diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index 66038a6..36990e8 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -1305,7 +1305,6 @@ Page({ //-- 判断是不是可以收藏 -- if (gd.prom_type == 5 && !th.data.all_collocation_list.length) { - await th.set_collection(gd); } @@ -1488,7 +1487,7 @@ Page({ //--搭配促销也是按照购物车的方式来计算优惠券-- - if (gg.prom_type == 5) { + if (gg.prom_type == 5 && th.data.collocation_goods && th.data.collocation_goods.length>0 ) { var frozenQuan = null; var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; app.request.promiseGet(url0, { 1: 1 }).then(res => { diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index f9e5bc6..6990202 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -1469,6 +1469,7 @@ Page({ }) // return userbuynum }, + //-- 加入购物的函数 -- add_cart_func: function (t) { var i = getApp().request; @@ -1731,7 +1732,10 @@ Page({ } }) - } else if (th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 5 || th.data.prom_type == 10) { + } + + //要包含积分购的普通购买 + else if (th.data.prom_type == 0 || th.data.prom_type == 3 || newd.is_integral_normal || th.data.prom_type == 5 || th.data.prom_type == 10) { newd.prom_type = 0; newd.prom_id = 0; @@ -2184,6 +2188,8 @@ Page({ if(th.data.collocationGoods && newd.prom_type==0){ newd.prom_type = 5; newd.prom_id = th.data.collocationGoods.id; + newd.is_coupon= th.data.collocationGoods.is_coupon; + } //如果有搭配购的时候的时候 @@ -5075,6 +5081,12 @@ Page({ if (e && e.act_id) { newd['prom_type'] = e.prom_type; newd['prom_id'] = e.act_id; + + //搭配购要把是否使用券带入 + if( newd['prom_type']==5 ){ + newd['is_coupon']=e.is_coupon; + } + } if(e.prom_type==10){ @@ -7149,57 +7161,7 @@ Page({ var th = this; var user_id = getApp().globalData.user_id; if (!user_id) user_id = 0; - //如果是普通购买的时候,要进行调用 - if (is_nor) { - getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + gid, { - success: function (res) { - if (res.data.code == 0) { - var r_data = res.data.data; - - //如果有 - if (r_data.ladderLists) { - var act_id = r_data.ladderLists[0].form_id; - //-- 判断会员能不能参与阶梯促销 -- - getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + act_id, {}).then(res => { - if (res.data.code == 0 && res.data.data) { - var prom_content = ""; - for (let jj in r_data.ladderLists) { - if (r_data.ladderLists[jj].discount == 10) { - prom_content += "第" + (parseInt(jj) + 1) + "件原价,"; - } else { - prom_content += "第" + (parseInt(jj) + 1) + "件" + r_data.ladderLists[jj].discount + "折,"; - } - } - - //暂定优惠促销还不能重叠 - 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; - } - - prom_content = ut.sub_last(prom_content); - th.data.prom_type = 10; - th.data.prom_id = act_id; - th.setData({ - jieti_prom: prom_content, - ladder_act_id: act_id - }) - } - }) - } - - th.setData({ - prom_goods: r_data.promGoodsLists, - }) - th.is_show_more_buy(); - } - }, - }) - } else { //调用接口判断订单优惠, getApp().request.get("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + gid + "/0" + "/" + user_id, { success: async function (res) { @@ -7277,7 +7239,7 @@ Page({ } } }) - } + }, closePoster() { @@ -7443,6 +7405,74 @@ Page({ //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动 check_nor_promgood(goods_id, back) { + var th=this; + var user_id=getApp().globalData.user_id; + //调用接口判断订单优惠, + getApp().request.get("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + goods_id + "/0" + "/" + user_id, { + success: async function (res) { + if (res.data.code == 0 && res.data.data) { + + var obj = {}; + var r_data = res.data.data; + //暂时积分够 不和 优惠,阶梯重叠 + if(th.data.zh_act){ + obj = { + act_id: th.data.zh_act.id, + prom_type:3 + } + back(obj); + return false; + } + + if (r_data.collocationList) { + obj = { + act_id: r_data.collocationList[0].prom_id, + prom_type:5 + } + obj.is_coupon=r_data.collocationPromList.is_coupon; + back(obj); + return false; + } + + if (r_data.ladderLists) { + var act_id = r_data.ladderLists[0].form_id; + //-- 判断会员能不能参与阶梯促销 -- + await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + 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; + } + obj = { + act_id: act_id, + prom_type:10 + } + back(obj); + return false; + } + }) + } + + if(r_data.promGoodsLists){ + obj = { + act_id: r_data.promGoodsLists[0].prom_id, + prom_type:3 + } + back(obj); + return false; + } + + } + } + }) + + + getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, { success: function (res) { if (res.data.code == 0 && res.data.data) {