diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index b592643..77d4065 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -146,6 +146,9 @@ Page({ all_collocation_list: [], appoint_pick_keyid: '', is_pre_cut:0, //是否可以使用预存 0是不可以1的可以 + + coll_prom:{} //搭配活动存储 + }, onLoad: function (t) { wx.setNavigationBarTitle({ title: "填写订单", }) @@ -621,6 +624,7 @@ Page({ distr_t = gd.distr_type || pick.distr_type; } + var prom=null; await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew/" + os.stoid + "/" + gd.goods_id + "/0/" + user_id, { }).then(res => { @@ -628,6 +632,7 @@ Page({ var r_data = res.data.data; if (r_data.collocationList) { collocation_list = r_data.collocationList; + prom= r_data.collocationPromList; } } }) @@ -645,9 +650,15 @@ Page({ // } if (!new_arr.length) return null; + + this.data.coll_prom[prom.id]=prom; + + for (let i = 0; i < new_arr.length; i++) { + new_arr[i].is_coupon=prom.is_coupon; + } + if (arr) { arr[index].collocationList = new_arr; - } else th.setData({ all_collocation_list: new_arr @@ -5203,6 +5214,9 @@ Page({ continue; } + if(gd.prom_type==5 && !th.data.coll_prom[gd.prom_id].is_coupon){ + continue; + } //--如果是团购,要判断有没有限制使用优惠券 if (gd.prom_type == 2) { var prom1 = null; @@ -6472,6 +6486,9 @@ Page({ item.is_collocation = 1; item.prom_type = 5; + + th.setData({is_coupon:item.is_coupon}) + var coll_arr = []; if (this.data.collocation_goods && this.data.collocation_goods.length) { coll_arr = this.data.collocation_goods; @@ -6495,6 +6512,9 @@ Page({ th.get_cart_quan(); } else { + + th.setData({is_coupon:item.is_coupon}) + var item = this.data.all_collocation_list[e.index]; var coll_arr = this.data.collocation_goods; var find = coll_arr.findIndex(function (e) { diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index af15820..1dddd55 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -1874,15 +1874,24 @@ Page({ //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d); if ("add" == t.currentTarget.dataset.action) { - // if (newd.prom_type==0 && th.data.prom_goods && !th.data.sele_g.whsle_id) { - // newd.prom_type = 3; - // newd.prom_id = th.data.prom_goods[0].prom_id; - // } + if( [3,5,10].indexOf(newd.prom_type)>-1){ newd.prom_type=0; newd.prom_id=0; } + //如果有搭配购的时候的时候 + if(th.data.collocationGoods && newd.prom_type==0){ + newd.prom_type = 5; + newd.prom_id = th.data.collocationGoods.id; + } + + //如果有搭配购的时候的时候 + if(th.data.zh_act && newd.prom_type==0){ + newd.prom_type = 7; + newd.prom_id = th.data.zh_act.id; + } + //----先看会员在购物车中是否加入了该商品----- i.get("/api/weshop/cart/page", { data: { @@ -2159,6 +2168,12 @@ Page({ newd.prom_id = th.data.zh_act.id; } + //如果有搭配购的时候的时候 + if(th.data.jt && newd.prom_type==0){ + newd.prom_type = 7; + newd.prom_id = th.data.zh_act.id; + } + newd['pick_name'] = th.data.sto_sele_name; newd['pick_dis'] = th.data.sto_sele_distr; @@ -2617,9 +2632,36 @@ Page({ callback(); } else { //-- 判断有没有优惠活动 -- - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0" + "/" + usr.user_id, {}).then(res => { + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0" + "/" + usr.user_id, {}).then(async res => { if (res.data.code == 0) { + var r_data = res.data.data; + + if(r_data.collocationList){ + th.data.ladderLists =null; + th.data.prom_goods =null; + r_data.promGoodsLists=null; + r_data.ladderLists=null; + } + + if (r_data.ladderLists) { + var act_id = r_data.ladderLists[0].form_id; + //-- 判断会员能不能参与阶梯促销 -- + await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + usr.user_id + "/" + act_id, {}).then(res => { + if (res.data.code == 0 && res.data.data) { + var prom_content = ""; + //暂定优惠促销还不能重叠 + if (res.data.data.good_object == 0 && (r_data.promGoodsLists || th.data.zh_act)) { + return false; + } + if (res.data.data.good_object == 1) { + r_data.promGoodsLists = null; + } + th.data.ladderLists = r_data.ladderLists; + } + }) + } + th.data.prom_goods = r_data.promGoodsLists; if (!th.data.prom_goods) { callback(); @@ -7142,7 +7184,7 @@ Page({ //暂时积分够 不和 优惠,阶梯重叠 - if(th.data.has_jf || th.data.zh_act){ + if(th.data.zh_act){ r_data.collocationList=null; r_data.ladderLists=null; r_data.promGoodsLists=null;