From 01e23be6118d68d38a71d186296d440eadcaa197 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 07 六月 2021 18:23:41 +0800 Subject: [PATCH] 特价bug修复 --- app/src/main/java/com/tejia/lijin/app/ui/recommend/GoodsDetailActivity.java | 392 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 330 insertions(+), 62 deletions(-) diff --git a/app/src/main/java/com/tejia/lijin/app/ui/recommend/GoodsDetailActivity.java b/app/src/main/java/com/tejia/lijin/app/ui/recommend/GoodsDetailActivity.java index 7bb20d8..9e4fb63 100644 --- a/app/src/main/java/com/tejia/lijin/app/ui/recommend/GoodsDetailActivity.java +++ b/app/src/main/java/com/tejia/lijin/app/ui/recommend/GoodsDetailActivity.java @@ -1,5 +1,6 @@ package com.tejia.lijin.app.ui.recommend; +import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -42,12 +43,18 @@ import com.tejia.lijin.app.BasicTextHttpResponseHandler; import com.tejia.lijin.app.R; import com.tejia.lijin.app.ShoppingApi; +import com.tejia.lijin.app.entity.CouponInfo; import com.tejia.lijin.app.entity.CouponUser; +import com.tejia.lijin.app.entity.GoodsDetail; import com.tejia.lijin.app.entity.PushEventData; import com.tejia.lijin.app.entity.TaoBaoGoodsBrief; import com.tejia.lijin.app.entity.common.ImageShowEntity; import com.tejia.lijin.app.entity.goods.GoodsDetailVO; +import com.tejia.lijin.app.entity.user.UserLijinLevelInfoVO; import com.tejia.lijin.app.ui.BaseActivity; +import com.tejia.lijin.app.ui.dialog.GoodsDetailHongBaoAndCouponSelectDialog; +import com.tejia.lijin.app.ui.dialog.GoodsDetailJumpLoaingDialog; +import com.tejia.lijin.app.ui.dialog.GoodsDetailNotifyDialog; import com.tejia.lijin.app.ui.dialog.JumpTaoBaoDialog; import com.tejia.lijin.app.ui.goods.GoodsDetailHongBaoListAdapter; import com.tejia.lijin.app.ui.goods.GoodsDetailPreEventManager; @@ -55,14 +62,19 @@ import com.tejia.lijin.app.ui.mine.LoginSelectActivity; import com.tejia.lijin.app.ui.mine.MyFootmarkActivity; import com.tejia.lijin.app.ui.trends.BigImageActivity; +import com.tejia.lijin.app.util.Constant; import com.tejia.lijin.app.util.FlowLayout; import com.tejia.lijin.app.util.GlideCircleTransform; import com.tejia.lijin.app.util.GlideRoundTransform; +import com.tejia.lijin.app.util.GoodsBuyJumpUtil; import com.tejia.lijin.app.util.ImageUtil; import com.tejia.lijin.app.util.SetLabels; import com.tejia.lijin.app.util.Toast_Dialog; import com.tejia.lijin.app.util.TopStatusSettings; import com.tejia.lijin.app.util.clipboard.ClipboardUtil; +import com.tejia.lijin.app.util.goods.GoodsBuyUtil; +import com.tejia.lijin.app.util.ui.GoodsDetailUtil; +import com.tejia.lijin.app.util.ui.dialog.DialogUtil; import com.tejia.lijin.app.util.umengCustomEvent.GoodsCustomEvent; import com.tejia.lijin.app.util.user.LoginAndInviteStatusUtil; import com.tejia.lijin.app.util.user.UserUtil; @@ -94,8 +106,9 @@ public class GoodsDetailActivity extends BaseActivity implements View.OnClickListener { + private static final String TAG = "GoodsDetailActivity"; /**************************鎺т欢瀹氫箟寮�濮�**************************/ - private MyScrollView lv_goods_pic; + private MyScrollView sv_goods; private LinearLayout ll_content; @@ -124,7 +137,8 @@ //鍟嗗搧搴楅摵淇℃伅 private LinearLayout ll_shop; - private ImageView iv_shop_img, iv_shop_type; + private ImageView iv_shop_img; + private TextView tv_shop_type; private TextView tv_shop_name; private TextView tv_shop_des, tv_shop_service, tv_shop_logistics, tv_shop_des_grade, tv_shop_logistics_grade, tv_shop_service_grade; @@ -138,11 +152,13 @@ private RecyclerView rv_price_info; //鍥炬枃璇︽儏 + private FrameLayout fl_goods_detail; private ImageView iv_imgtext_status; private WebView webView; private LinearLayout ll_loading; private ImageView iv_loading; private TextView tv_loading; + private View view_goods_imgs_tag;//鐢ㄦ潵鏍囪瘑瀵艰埅鏍忛�変腑 //鐚滀綘鍠滄 private LinearLayout ll_guess_like; @@ -175,7 +191,7 @@ private void initView() { ll_content = findViewById(R.id.ll_content); - lv_goods_pic = findViewById(R.id.lv_goods_pic); + sv_goods = findViewById(R.id.lv_goods_pic); tv_top_title1 = findViewById(R.id.tv_top_title1); tv_top_title2 = findViewById(R.id.tv_top_title2); tv_top_title3 = findViewById(R.id.tv_top_title3); @@ -187,7 +203,7 @@ tv_buy = findViewById(R.id.tv_buy); ll_top_title = findViewById(R.id.ll_top_title); iv_shop_img = findViewById(R.id.iv_shop_img); - iv_shop_type = findViewById(R.id.iv_shop_type); + tv_shop_type = findViewById(R.id.tv_shop_type); tv_shop_name = findViewById(R.id.tv_shop_name); tv_shop_des = findViewById(R.id.tv_shop_des); tv_shop_service = findViewById(R.id.tv_shop_service); @@ -202,14 +218,18 @@ v_3 = findViewById(R.id.v_3); v_4 = findViewById(R.id.v_4); + fl_face = findViewById(R.id.fl_face); + avLoadingIndicatorView = findViewById(R.id.avi); ll_guess_like = findViewById(R.id.ll_guess_like); iv_imgtext_status = findViewById(R.id.iv_imgtext_status); + fl_goods_detail = findViewById(R.id.fl_goods_detail); ll_loading = findViewById(R.id.ll_loading); tv_loading = findViewById(R.id.tv_loading); iv_loading = findViewById(R.id.iv_loading); webView = findViewById(R.id.webView); + view_goods_imgs_tag = findViewById(R.id.view_goods_imgs_tag); vp_goods_detail = findViewById(R.id.vp_goods_img); @@ -258,8 +278,29 @@ //umeng缁熻 GoodsCustomEvent.goodsDetail(this, from); inputTime = System.currentTimeMillis(); - final String goodsId = getIntent().getExtras().getString("goodsId"); - final int goodsType = Integer.parseInt(getIntent().getExtras().getString("goodsType")); + + String tempGoodsType = ""; + String tempGoodsId = ""; + + + //鑾峰彇鍟嗗搧ID + tempGoodsId = getIntent().getExtras().getString("goodsId"); + if (StringUtils.isNullOrEmpty(tempGoodsId)) + tempGoodsId = getIntent().getExtras().getString("id"); + final String goodsId = tempGoodsId; + + + //鑾峰彇鍟嗗搧绫诲瀷 + tempGoodsType = getIntent().getExtras().getString("goodsType"); + if (StringUtils.isNullOrEmpty(tempGoodsType)) + tempGoodsType = getIntent().getExtras().getInt("goodsType", 0) + ""; + if (tempGoodsType.equalsIgnoreCase("0")) + tempGoodsType = Constant.GOODS_TYPE_TB + ""; + + + final int goodsType = Integer.parseInt(tempGoodsType); + + from = getIntent().getExtras().getString("from"); tv_loading.setText("瀹濊礉璇︽儏椤靛姞杞戒腑..."); @@ -276,7 +317,7 @@ avLoadingIndicatorView.setVisibility(View.VISIBLE); Animation ani = AnimationUtils.loadAnimation(this, R.anim.touming); //鐢虫槑涓�涓姩鐢� avLoadingIndicatorView.setAnimation(ani);//涓哄浘鐗囩粦瀹氬姩鐢� - findViewById(R.id.fl_face).setVisibility(View.VISIBLE); + fl_face.setVisibility(View.VISIBLE); bannerAdapter = new ImageAdapter(mBanners, this); vp_goods_detail.setAdapter(bannerAdapter); vp_goods_detail.setCurrentItem(0, true); @@ -362,25 +403,16 @@ } }); - lv_goods_pic.setOnScrollListener(new MyScrollView.OnScrollListener() { + sv_goods.setOnScrollListener(new MyScrollView.OnScrollListener() { @Override public void onScroll(int scrollY) { int titleHeight = DimenUtils.dip2px(GoodsDetailActivity.this, 48); int marginTopHeight = DimenUtils.dip2px(GoodsDetailActivity.this, 8); - if (scrollY < (vp_goods_detail.getHeight() - titleHeight * 2)) {//澶撮儴 + if (scrollY < fl_goods_detail.getTop()) {//澶撮儴 setPosition(1); - } else if (scrollY >= vp_goods_detail.getHeight() - titleHeight * 2 - && scrollY < (vp_goods_detail.getHeight() + webView.getHeight() - titleHeight) - && webView.getVisibility() != View.GONE) {//璇︽儏鍥剧墖 + } else if (scrollY >= (fl_goods_detail.getTop() - titleHeight) + && scrollY < view_goods_imgs_tag.getTop()) {//璇︽儏鍥剧墖 setPosition(2); - } else if (scrollY >= (vp_goods_detail.getHeight() - + webView.getHeight() - titleHeight + marginTopHeight) && scrollY < (vp_goods_detail.getHeight() - + webView.getHeight() + ll_guess_like.getHeight() - titleHeight + marginTopHeight) - && webView.getVisibility() != View.GONE) {//鐚滀綘鍠滄 - setPosition(3); - } else if (scrollY >= (vp_goods_detail.getHeight() + webView.getHeight() - + ll_guess_like.getHeight() - titleHeight + marginTopHeight)) {//鎺ㄨ崘 - setPosition(4); } else { setPosition(4); } @@ -529,6 +561,8 @@ } + GoodsDetailNotifyDialog notifyDialog; + @Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); @@ -539,7 +573,32 @@ from = ""; initView(); initData(); -// getAppPageNotification(); + getAppPageNotification(); + +// new GoodsDetailJumpLoaingDialog.Builder(this).setHasAd(true).setAdPid("").setNotify("閾傞噾浼氬憳鍏嶅箍鍛婏紝绀奸噾鎻愰珮100%", "http://www.baidu.com").setPlatform(Constant.GOODS_TYPE_TB).setOnCloseListener(new GoodsDetailJumpLoaingDialog.Builder.IDialogClose() { +// @Override +// public void onClose(boolean auto) { +// } +// }).create().show(); + + } + + public void showNotifyDialog(String btnName, String link) { + DialogUtil.dismiss(notifyDialog); + + notifyDialog = new GoodsDetailNotifyDialog.Builder(this).setLeftBtnInfo(btnName, link).setOnButtonClickListener(new GoodsDetailNotifyDialog.Builder.IDialogButtonClick() { + @Override + public void onLeftClick() { + DialogUtil.dismiss(notifyDialog); + } + + @Override + public void onRightClick() { + DialogUtil.dismiss(notifyDialog); + goFanli(); + } + }).create(); + DialogUtil.show(notifyDialog); } @@ -555,7 +614,7 @@ inAnima.setInterpolator(new DecelerateInterpolator()); ll_notification.setAnimation(inAnima); ll_notification.startAnimation(inAnima); -// inAnima.start(); + inAnima.start(); } else if (msg.what == 3) {//鍏抽棴寮圭獥 if (dialog != null && dialog.isShowing()) dialog.dismiss(); @@ -685,8 +744,10 @@ tv_name.setText(mInfo.getGoods().getTitle()); webView.loadUrl(mInfo.getExtra().getDetailUrl()); - - tv_sales_num.setText("鏈堥攢 " + mInfo.getGoods().getSalesCount()); + if (StringUtils.isNullOrEmpty(mInfo.getGoods().getSalesCount())) { + tv_sales_num.setText(""); + } else + tv_sales_num.setText(GoodsDetailUtil.getSalesTypeDesc(mInfo.getGoods().getSalesType()) + " " + mInfo.getGoods().getSalesCount()); if (mInfo.getGoods().getShopInfo() != null) { ll_shop.setVisibility(View.VISIBLE); @@ -698,19 +759,26 @@ tv_shop_name.setText(mInfo.getGoods().getShopInfo().getShopName()); try { + GoodsDetailUtil.fillShopType(tv_shop_type, mInfo.getGoods().getShopType()); - iv_shop_type.setImageDrawable(mInfo.getGoods().getShopInfo().getUserType() == 0 ? - getResources().getDrawable(R.drawable.ic_shop_type_taobao) : - getResources().getDrawable(R.drawable.ic_shop_type_tmall)); - tv_shop_des.setText("瀹濊礉鎻忚堪: " + mInfo.getGoods().getShopInfo().getScoreGoods()); - tv_shop_service.setText("鍗栧鏈嶅姟: " + mInfo.getGoods().getShopInfo().getScoreSeller()); - tv_shop_logistics.setText("鐗╂祦鏈嶅姟: " + mInfo.getGoods().getShopInfo().getScoreLogistics()); - tv_shop_des_grade.setText(mInfo.getGoods().getShopInfo().getScoreGoodsD() == 0 ? "骞�" : - mInfo.getGoods().getShopInfo().getScoreGoodsD() == 1 ? "楂�" : "浣�"); - tv_shop_service_grade.setText(mInfo.getGoods().getShopInfo().getScoreSellerD() == 0 ? "骞�" : - mInfo.getGoods().getShopInfo().getScoreSellerD() == 1 ? "楂�" : "浣�"); - tv_shop_logistics_grade.setText(mInfo.getGoods().getShopInfo().getScoreLogisticsD() == 0 ? "骞�" : - mInfo.getGoods().getShopInfo().getScoreLogisticsD() == 1 ? "楂�" : "浣�"); + if (!StringUtils.isNullOrEmpty(mInfo.getGoods().getShopInfo().getScoreGoods())) { + tv_shop_des.setText("瀹濊礉鎻忚堪: " + mInfo.getGoods().getShopInfo().getScoreGoods()); + tv_shop_service.setText("鍗栧鏈嶅姟: " + mInfo.getGoods().getShopInfo().getScoreSeller()); + tv_shop_logistics.setText("鐗╂祦鏈嶅姟: " + mInfo.getGoods().getShopInfo().getScoreLogistics()); + tv_shop_des_grade.setText(mInfo.getGoods().getShopInfo().getScoreGoodsD() == 0 ? "骞�" : + mInfo.getGoods().getShopInfo().getScoreGoodsD() == 1 ? "楂�" : "浣�"); + tv_shop_service_grade.setText(mInfo.getGoods().getShopInfo().getScoreSellerD() == 0 ? "骞�" : + mInfo.getGoods().getShopInfo().getScoreSellerD() == 1 ? "楂�" : "浣�"); + tv_shop_logistics_grade.setText(mInfo.getGoods().getShopInfo().getScoreLogisticsD() == 0 ? "骞�" : + mInfo.getGoods().getShopInfo().getScoreLogisticsD() == 1 ? "楂�" : "浣�"); + } else { + tv_shop_des.setVisibility(View.INVISIBLE); + tv_shop_service.setVisibility(View.INVISIBLE); + tv_shop_logistics.setVisibility(View.INVISIBLE); + tv_shop_des_grade.setVisibility(View.INVISIBLE); + tv_shop_service_grade.setVisibility(View.INVISIBLE); + tv_shop_logistics_grade.setVisibility(View.INVISIBLE); + } } catch (Exception e) { } @@ -749,10 +817,10 @@ vp_goods_detail.setCurrentItem(0); initFanliAndBuyBtn(mInfo.getExtra().isBuyValid(), mInfo.getExtra().isFanliValid()); requestState(0); + sv_goods.scrollTo(0, 0); } else if (jsonObject.optString("code").equalsIgnoreCase("2")) { - ll_content.setVisibility(View.GONE); findViewById(R.id.ll_goods_nothing).setVisibility(View.VISIBLE); - findViewById(R.id.fl_face).setVisibility(View.VISIBLE); + fl_face.setVisibility(View.VISIBLE); } } @@ -775,10 +843,8 @@ public void onFinish() { super.onFinish(); Log.e("mResult", "goodsdetail---onFinish()"); - lv_goods_pic.scrollTo(0, 0); + sv_goods.scrollTo(0, 0); avLoadingIndicatorView.hide(); - findViewById(R.id.fl_face).setVisibility(View.GONE); - ll_content.setVisibility(View.VISIBLE); } }); } @@ -827,19 +893,20 @@ finish(); break; case R.id.tv_top_title1: - lv_goods_pic.scrollTo(0, 0); + sv_goods.scrollTo(0, 0); setPosition(1); break; - case R.id.tv_top_title2: - lv_goods_pic.scrollTo(0, vp_goods_detail.getHeight() - titleHeight * 2); + case R.id.tv_top_title2://璇︽儏 + sv_goods.scrollTo(0, fl_goods_detail.getTop()); setPosition(2); break; - case R.id.tv_top_title3: - lv_goods_pic.scrollTo(0, vp_goods_detail.getHeight() + webView.getHeight() - titleHeight + marginTopHeight); + case R.id.tv_top_title3://鐚滀綘鍠滄 + sv_goods.scrollTo(0, (int) ll_guess_like.getTop()); setPosition(3); break; - case R.id.tv_top_title4: - lv_goods_pic.scrollTo(0, vp_goods_detail.getHeight() + webView.getHeight() + ll_guess_like.getHeight() - titleHeight + marginTopHeight); + case R.id.tv_top_title4://鎺ㄨ崘 + Log.i(TAG, (int) ll_guess_like.getTop() + ""); + sv_goods.scrollTo(0, (int) ll_guess_like.getTop()); setPosition(4); break; @@ -1068,10 +1135,15 @@ * @param state */ private void requestState(int state) { - ll_content.setVisibility(state == 0 ? View.VISIBLE : View.GONE); +// fl_face.setVisibility(state != 0 ? View.VISIBLE : View.GONE); ll_no_data.setVisibility(state == 1 ? View.VISIBLE : View.GONE); ll_request_failture.setVisibility(state == 2 ? View.VISIBLE : View.GONE); ll_no_net.setVisibility(state == 3 ? View.VISIBLE : View.GONE); + if (mInfo == null) { + fl_face.setVisibility(View.VISIBLE); + } else { + fl_face.setVisibility(View.GONE); + } } @Override @@ -1092,22 +1164,54 @@ private void goFanli() { - goodsDetailPreEventManager.startClick(0, new GoodsDetailPreEventManager.IPreEventListener() { - @Override - public void onPreSuccess() { - - //TODO 杩斿埄 - } - }); + if (mInfo.getGoods().getCouponInfoList() != null && mInfo.getGoods().getCouponInfoList().size() > 1) { + new GoodsDetailHongBaoAndCouponSelectDialog.Builder(this).setCouponList(mInfo.getGoods().getCouponInfoList()).setItemClickListener(new GoodsDetailHongBaoAndCouponSelectDialog.OnItemClickListener() { + @Override + public void onClick(int p) { + goFanli(mInfo.getGoods().getCouponInfoList().get(p)); + } + }).create().show(); + } else { + goFanli(null); + } //鍒ゆ柇鏄惁鏈夊寮犲埜鎯呭喌 } - private void goBuy() { - goodsDetailPreEventManager.startClick(1, new GoodsDetailPreEventManager.IPreEventListener() { - + private void goFanli(final CouponInfo couponInfo) { + goodsDetailPreEventManager.startClick(0, new GoodsDetailPreEventManager.IPreEventListener() { @Override public void onPreSuccess() { - //TODO 璐拱 + fanliRequest(couponInfo); + } + }); + } + + private void goBuy() { + final List<GoodsDetailVO.GoodsHongBaoListVO> hongBaoList = new ArrayList<>(); + hongBaoList.addAll(mInfo.getGoods().getPriceList()); + for (int i = 0; i < hongBaoList.size(); i++) { + if (hongBaoList.get(i).getType() != 2) { + hongBaoList.remove(i--); + } + } + if (hongBaoList.size() > 1) { + new GoodsDetailHongBaoAndCouponSelectDialog.Builder(this).setHongBaoList(hongBaoList).setItemClickListener(new GoodsDetailHongBaoAndCouponSelectDialog.OnItemClickListener() { + @Override + public void onClick(int p) { + goBuy(hongBaoList.get(p)); + } + }).create().show(); + } else { + if (hongBaoList.size() > 0) + goBuy(hongBaoList.get(0)); + } + } + + private void goBuy(final GoodsDetailVO.GoodsHongBaoListVO lijinVO) { + goodsDetailPreEventManager.startClick(1, new GoodsDetailPreEventManager.IPreEventListener() { + @Override + public void onPreSuccess() { + buyRequest(lijinVO); } }); } @@ -1116,6 +1220,7 @@ private void setRightsData(List<GoodsDetailVO.GoodsRightsVO> rightsList) { if (rightsList == null || rightsList.size() == 0) { ll_rights_type.setVisibility(View.GONE); + return; } else { ll_rights_type.setVisibility(View.VISIBLE); } @@ -1179,11 +1284,26 @@ } rv_price_info.setLayoutManager(new LinearLayoutManager(rv_price_info.getContext())); - rv_price_info.setNestedScrollingEnabled(false); DividerItemDecoration decoration = new DividerItemDecoration(); decoration.setSize(DimenUtils.dip2px(getApplicationContext(), 5)); rv_price_info.addItemDecoration(decoration); - rv_price_info.setAdapter(new GoodsDetailHongBaoListAdapter(getApplicationContext(), goodsInfoVO.getPriceList(), false)); + rv_price_info.setAdapter(new GoodsDetailHongBaoListAdapter(getApplicationContext(), goodsInfoVO.getPriceList(), new GoodsDetailHongBaoListAdapter.ListClickListener() { + + @Override + public void onHongBaoClick(int p, GoodsDetailVO.GoodsHongBaoListVO info) { + if (info.getType() == 4) { + goFanli(null); + } else { + goBuy(info); + } + } + + @Override + public void onCouponClick(int p) { + + } + }, + false, true)); tv_fanli_money_num.setText(goodsInfoVO.getMoneyInfo().getFanliMoney()); tv_buy.setText(goodsInfoVO.getMoneyInfo().getHongBaoMoney()); @@ -1228,4 +1348,152 @@ }); } + + private void buyRequest(GoodsDetailVO.GoodsHongBaoListVO goodsHongBaoListVO) { + + ShoppingApi.buyWithLijin(getApplicationContext(), mInfo.getGoods().getGoodsId(), mInfo.getGoods().getGoodsType(), goodsHongBaoListVO.getId(), UserUtil.getUid(getApplicationContext()), from, new BasicTextHttpResponseHandler() { + + @Override + public void onStart() { + super.onStart(); + DialogUtil.show(loadingDialog); + } + + @Override + public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { + super.onSuccessPerfect(statusCode, headers, jsonObject); + int code = jsonObject.optInt("code"); + if (code == 0) { + JSONObject data = jsonObject.optJSONObject("data"); + JSONObject link = data.optJSONObject("link"); + UserLijinLevelInfoVO userLevel = null; + if (data.optJSONObject("userLevel") != null) { + userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); + } + + if (link != null) { + final String linkUrl = link.optString("clickUrl"); + GoodsBuyJumpUtil.jumpTB(GoodsDetailActivity.this, null, linkUrl, linkUrl, userLevel, null); + } + + } else { + if (code == 2001) { + //鐢ㄦ埛鏈轰細宸茬粡鐢ㄥ畬浜� + getBuyChanceInfoRequest(); + } else + Toast.makeText(GoodsDetailActivity.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); + } + } + + @Override + public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) { + super.onFailure(statusCode, headers, jsonObject, e); + } + + @Override + public void onFinish() { + super.onFinish(); + DialogUtil.dismiss(loadingDialog); + } + }); + + } + + private void fanliRequest(CouponInfo couponInfo) { + GoodsBuyUtil.GoodsBuyRequestInfo requestInfo = new GoodsBuyUtil.GoodsBuyRequestInfo(); + requestInfo.setGoodsId(mInfo.getGoods().getGoodsId()); + requestInfo.setGoodsType(mInfo.getGoods().getGoodsType()); + if (couponInfo != null) + requestInfo.setCouponLink(couponInfo.getLink()); + requestInfo.setUid(UserUtil.getUid(getApplicationContext())); + requestInfo.setFrom(from); + + //杩斿埄 + GoodsBuyUtil.fanli(this, getApplicationContext(), requestInfo, new GoodsBuyUtil.IBuyGoodsResultListener() { + @Override + public void onConvertLinkStart() { + DialogUtil.show(loadingDialog); + } + + @Override + public void onConvertLinkSuccess() { + DialogUtil.dismiss(loadingDialog); + } + + @Override + public void onConvertLinkFail(String msg) { + DialogUtil.dismiss(loadingDialog); + } + + @Override + public void onConvertLinkComplete() { + DialogUtil.dismiss(loadingDialog); + } + + @Override + public void onJumpThirdAppStart() { + + } + + @Override + public void onJumpThirdAppSuccess() { + + } + + @Override + public void onJumpThirdAppFail() { + + } + }); + + } + + + /** + * 鑾峰彇璐拱鏈轰細淇℃伅 + */ + private void getBuyChanceInfoRequest() { + ShoppingApi.getUserLijinCreatedInfo(getApplicationContext(), mInfo.getGoods().getGoodsId(), mInfo.getGoods().getGoodsType(), UserUtil.getUid(getApplicationContext()), new BasicTextHttpResponseHandler() { + @Override + public void onStart() { + super.onStart(); + } + + @Override + public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { + super.onSuccessPerfect(statusCode, headers, jsonObject); + if (jsonObject.optInt("code") == 0) { + JSONObject data = jsonObject.optJSONObject("data"); + int leftCount = data.optInt("leftCount"); +// if (leftCount <= 0) { + JSONObject openInfo = data.optJSONObject("openInfo"); + if (openInfo != null) { + showNotifyDialog(openInfo.optString("btnName"), openInfo.optString("vipLink")); + } else { + showNotifyDialog(null, null); + } +// } + + + } else { + Toast.makeText(GoodsDetailActivity.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); + } + } + + @Override + public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) { + super.onFailure(statusCode, headers, jsonObject, e); + Toast.makeText(GoodsDetailActivity.this, "缃戠粶璇锋眰鍑洪敊", Toast.LENGTH_SHORT).show(); + } + + @Override + public void onFinish() { + super.onFinish(); + DialogUtil.dismiss(loadingDialog); + } + }); + + + } + } -- Gitblit v1.8.0