From 640929ad4ff085bd2f8cf90818298dcfe8a22bf8 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Tue, 25 May 2021 09:59:50 +0800 Subject: [PATCH] 返回的bug优化 --- packageA/pages/cart2_ser/cart2_ser.js | 4 ++-- packageA/pages/goodsInfo/goodsInfo.js | 19 ++++++++++++++++++- pages/cart/cart/cart.js | 2 +- pages/cart/cart2/cart2.js | 5 ++++- pages/giftpack/buygiftpack/giftpackbuy.js | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- pages/giftpack/buygiftpack/giftpackbuy.wxml | 6 ++++++ pages/giftpack/giftpacklist/giftpacklist.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pages/giftpack/giftpacklist/giftpacklist.wxml | 12 +++++++++--- pages/goods/goodsInfo/goodsInfo.js | 19 +++++++++++++++---- pages/user/plus/plus.js | 9 +++++---- pages/user/plus/plus.wxml | 2 +- 11 files changed, 162 insertions(+), 25 deletions(-) diff --git a/packageA/pages/cart2_ser/cart2_ser.js b/packageA/pages/cart2_ser/cart2_ser.js index 87a733c..bc24789 100644 --- a/packageA/pages/cart2_ser/cart2_ser.js +++ b/packageA/pages/cart2_ser/cart2_ser.js @@ -137,7 +137,7 @@ Page({ good = res.data.data; }) - item.img_url = oo.imghost + good.img_url; + item.img_url = oo.imghost + good.imgUrl; item.erpItemID=good.erpItemID; /*----接口要弄出来的,先顶着-----*/ @@ -485,7 +485,7 @@ Page({ getApp().showWarning("购买成功"); setTimeout(function () { wx.reLaunch({ - url: "/packageA/pages/cardList/cardList", + url: "/pages/user/my_service/i_service", }) },1000) }, function () { diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index a1d77df..6d796be 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -751,9 +751,26 @@ Page({ for (var i = 0; i < e.data.data.pageData.length; i++) { num += e.data.data.pageData[i].goods_num; } + + /*-- t.setData({ cartGoodsNum: num - }); + });--*/ + + //-- 读取服务卡的数量 -- + getApp().promiseGet("/api/weshop/cartService/page",{ + data:{ + store_id: s.globalData.setting.stoid, + user_id: s.globalData.user_id, + } + }).then(res=>{ + for (var i = 0; i < res.data.data.pageData.length; i++) { + num += res.data.data.pageData[i].goods_num; + } + t.setData({cartGoodsNum:num}); + }) + + } }); }, diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 8520aa9..d4c1754 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -1799,7 +1799,7 @@ Page({ //---加载更多是靠这个函数---- onReachBottom: function() { - if(this.data.requestData.length==0) { + if(this.data.requestData && this.data.requestData.length==0) { var goods_list = this.selectComponent("#goods_list"); //组件的id if (goods_list) goods_list.get_list(); } diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 77d1772..deebde2 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -443,7 +443,10 @@ Page({ } var e_t=0 switch (arr[j].distr_t) { - case 0: e_t = 1; break; + case 0: + e_t = 1; + if(th.data.json_d.pickupway && th.data.json_d.pickupway==1) e_t=0; + break; case 1: e_t = 1; break; case 2: e_t = 0; break; } diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index adcd413..d55b7bd 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -158,7 +158,7 @@ Page({ var json = { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 - "buyType": '1', //1=积分兑换 2=余额购买 + "buyType": '1', //1=积分兑换 2=余额购买 3=免费领取 "giftBagId": id, //礼包Id "storeId": that.getStorageID, //商家Id "userId": that.getUserID, //用户ID @@ -169,8 +169,7 @@ Page({ if(getApp().globalData.guide_id){ json.guide_id=getApp().globalData.guide_id; } - - + var data = JSON.stringify(json); var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; getApp().request.json_post(url, json, @@ -181,15 +180,53 @@ Page({ getApp().my_warnning(res.data.msg, 0, th); } }, - function(res) { - - } - - ) + function(res) {}) }) }, + //免费领取 + GetFree:function (e){ + var that = this.data; + var th = this; + var id = e.currentTarget.dataset.id; //活动id + var my_confirm = th.selectComponent("#my_confirm"); //组件的id + my_confirm.open( + "是否确定领取该礼包", + "取消", + "确定", + function() { + my_confirm.open_cancel(0); + }, + function() { + my_confirm.open_cancel(0); + var json = { + "actId": '', //活动Id + "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 + "buyType": '3', //1=积分兑换 2=余额购买 3=免费领取 + "giftBagId": id, //礼包Id + "storeId": that.getStorageID, //商家Id + "userId": that.getUserID, //用户ID + "buyFrom": 2 + }; + //-- 分享导购要记录 -- + if(getApp().globalData.guide_id){ + json.guide_id=getApp().globalData.guide_id; + } + var data = JSON.stringify(json); + var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; + getApp().request.json_post(url, json, + function(res) { + if (res.data.code == 0) { + getApp().my_warnning("兑换成功!", 1, th); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + }, + function(res) {}) + }) + }, + getList: function(e) { var th = this; getApp().request.get('/api/weshop/marketing/giftbag/page', { diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxml b/pages/giftpack/buygiftpack/giftpackbuy.wxml index 6b36821..e711329 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.wxml +++ b/pages/giftpack/buygiftpack/giftpackbuy.wxml @@ -84,6 +84,12 @@ + + + + + + diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 9438489..45e12f2 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -202,6 +202,7 @@ Page({ }, + GetMyGiftList: function() { var _this = this; var th = this; @@ -419,6 +420,61 @@ Page({ } }, + //免费领取 + GetFree: function(e) { + var that = this.data; + var th = this; + + //如果还没有开始的话 + if(th.data.isStart!=1){ + getApp().my_warnning("活动还没有开始", 0, th); + return false; + } + // var id = e.currentTarget.dataset.id;//活动id + var my_confirm = th.selectComponent("#my_confirm"); //组件的id + my_confirm.open( + "是否确定领取该礼包", + "取消", + "确定", + function() { + my_confirm.open_cancel(0); + }, + function() { + my_confirm.open_cancel(0); + var json = { + "actId": '', //活动Id + "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 + "buyType": '3', //1=积分兑换 2=余额购买 + "giftBagId": that.getGiftID, //礼包Id + "storeId": a.stoid, //商家ID + "userId": d.user_id, //用户ID + "buyFrom":2 + }; + + //-- 分享导购要记录 -- + if(getApp().globalData.guide_id){ + json.guide_id=getApp().globalData.guide_id; + } + + + var data = JSON.stringify(json); + var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; + getApp().request.json_post(url, json, + function(res) { + if (res.data.code == 0) { + getApp().my_warnning("兑换成功!", 1, th); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + }, + function(res) {} + + ) + }) + + + }, + }); \ No newline at end of file diff --git a/pages/giftpack/giftpacklist/giftpacklist.wxml b/pages/giftpack/giftpacklist/giftpacklist.wxml index 2fb5f60..42fac24 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.wxml +++ b/pages/giftpack/giftpacklist/giftpacklist.wxml @@ -117,12 +117,10 @@ - + 立即购买 - - 立即兑换 @@ -137,6 +135,14 @@ 立即兑换 + + + + 免费领取 + + + + diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 9a9e311..412d9ec 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -1748,13 +1748,14 @@ Page({ callback(); return false; } + ///api/weshop/order/getWPayOrder?store_id=1&user_id=5682366&prom_id=1&goods_id=1 getApp().promiseGet("/api/weshop/order/getWPayOrder",{ data:{store_id:os.stoid,user_id:usr.user_id,goods_id:th.data.sele_g.goods_id,prom_id:th.data.prom_goods[0].prom_id} }).then(res=>{ if(res.data.code==0){ wx.showToast({ - title: "您还有该商品订单未支付", + title: "您已经购买了该商品待支付中", icon: 'none', duration: 2000 }) @@ -1926,9 +1927,19 @@ Page({ for (var i = 0; i < e.data.data.pageData.length; i++) { num += e.data.data.pageData[i].goods_num; } - t.setData({ - cartGoodsNum: num - }); + + //-- 读取服务卡的数量 -- + getApp().promiseGet("/api/weshop/cartService/page",{ + data:{ + store_id: s.globalData.setting.stoid, + user_id: s.globalData.user_id, + } + }).then(res=>{ + for (var i = 0; i < res.data.data.pageData.length; i++) { + num += res.data.data.pageData[i].goods_num; + } + t.setData({cartGoodsNum:num}); + }) } }); }, diff --git a/pages/user/plus/plus.js b/pages/user/plus/plus.js index c6e2b1d..92502be 100644 --- a/pages/user/plus/plus.js +++ b/pages/user/plus/plus.js @@ -170,13 +170,14 @@ Page({ var plusCard = res.data.data; var arr = [1219, 2089, 3031]; var new_arr = new Array(); + var parr=[]; for (var i = 0; i < plusCard.length; i++) { //plusCard[i].free=arr[i]; if(plusCard[i].IsStopBuy) { continue; } if (plusCard[i].CardImg == "") plusCard[i].CardImg = th.data.url + "/miniapp/images/plus/bg"+(i + 1)+ ".jpg?v=1"; var item = {"fee": plusCard[i].CardFee, 'index': i} new_arr.push(item); - + parr.push(plusCard[i]); } //看是不是还有卡项是可以购买的 @@ -200,17 +201,17 @@ Page({ } //---给数组添加立省多少钱--- - for (i = 0; i < plusCard.length; i++) { + for (i = 0; i < parr.length; i++) { //判断是否停用 for (var j = 0; j < new_arr.length; j++) { if (i == new_arr[j].index) { - plusCard[i].free = arr[j]; + parr[i].free = arr[j]; break; } } } th.setData({ - is_plusCard: plusCard, is_show: 1 + is_plusCard: parr, is_show: 1 }) }else{ diff --git a/pages/user/plus/plus.wxml b/pages/user/plus/plus.wxml index 89d65dd..8e71b06 100644 --- a/pages/user/plus/plus.wxml +++ b/pages/user/plus/plus.wxml @@ -17,7 +17,7 @@ - + {{item.CardName}} -- libgit2 0.21.4