diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js index c9601f9..6b21bc1 100644 --- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js +++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js @@ -80,6 +80,13 @@ Page({ bconfig: null, showFold:true, template_id:[], + + //-- 订单促销判断积累 ---2024-2-20 + order_prom_map_ck: {}, + //能不能使用订单促销 + can_use_ord_prom:{}, + //存储订单促销的取价,按照门店进行索引 + show_ord_prom:{}, }, @@ -513,6 +520,7 @@ Page({ } + t.data.data.shop_price_y = t.data.data.shop_price; t.data.data.shop_price = gg.goods_price; //--如果是普通购买的时候-- if (gg.is_normal == 1) { @@ -569,7 +577,10 @@ Page({ } + t.data.data.goods_price=th.data.param.goods_price; + //用深拷贝把商品缓存起来,方便后面使用 + th.data.old_bn_goods=ut.deep_cp(t.data.data); th.setData({ bn_goods: t.data.data, @@ -642,6 +653,9 @@ Page({ } + t.data.data.goods_price=th.data.param.goods_price; + //用深拷贝把商品缓存起来,方便后面使用 + th.data.old_bn_goods=ut.deep_cp(t.data.data); th.setData({ bn_goods: t.data.data, @@ -651,7 +665,6 @@ Page({ bn_exp_type: et }); - //计算价格 th.calculatePrice2(); } @@ -842,7 +855,9 @@ Page({ //-----------计算商品总价-------------- //var allpice = th.data.param.goods_price; var allpice = (th.data.act.group_price/100).toFixed(2); - + if(th.data.can_use_ord_prom[th.data.bn_pick]){ + allpice=th.data.param.goods_price*th.data.bn_goods.buynum; + } allpice = parseFloat(allpice).toFixed(2); var txt = "formData.all_price"; @@ -868,14 +883,18 @@ Page({ var ord_prom=null; var o_condition=allpice; if(th.data.act.is_order_yh){ + // await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { + // data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id } + // }).then(res => { + // if (res.data.code == 0) { + // ord_prom = res.data.data; + // } + // }) + + th.set_by_now_ord_prom(th.data.bn_goods); + th.data.order_prom_map_ck[th.data.bn_pick].goods_price_all=o_condition; + ord_prom=await th.get_cur_ord_prom(th.data.bn_pick); - await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { - data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id } - }).then(res => { - if (res.data.code == 0) { - ord_prom = res.data.data; - } - }) } @@ -964,7 +983,7 @@ Page({ title: "物流配置未启用物流公司", icon: 'none', duration: 2000 }) //th.setData({ show_submit:0, }); - th.setData({show_submit:1, submit: 0,same_ok:0 }) + th.setData({show_submit:1, submit: 0,same_ok:0,sub:0 }) return false; } @@ -996,7 +1015,7 @@ Page({ wx.showToast({ title: "计算物流错误", icon: 'none', duration: 2000 }) - th.setData({show_submit:1, submit: 0,same_ok:0 }) + th.setData({show_submit:1, submit: 0,same_ok:0,sub:0 }) return false; } @@ -1289,7 +1308,7 @@ Page({ // 提交订单前弹出确认对话框 submitConfirm(e) { // is_show为0不显示温馨提示,为1显示温馨提示 - if (this.data.param.is_show == 1) { + if (this.data.param.is_show == 1 && !this.data.can_use_ord_prom[this.data.bn_pick]) { wx.showModal({ title: '温馨提示', content: this.data.param.alert, @@ -1451,6 +1470,34 @@ Page({ 'prom_id': th.data.param.group_id, //促销活动id }; + + if(th.data.bn_goods.discount_field){ + goods.discount_field=th.data.bn_goods.discount_field; + } + + //如果有参与非实收的订单促销,那么就相当于是普通购买 + if(th.data.can_use_ord_prom[th.data.bn_pick]){ + goods.is_integral_normal=1; + goods.prom_type=0; + goods.prom_id=0; + + //如果是指定门店,就要判断 + if (th.data.bn_goods.pick_group_ids) { + var idx0 = th.data.bn_goods.pick_up_lists.findIndex(function (e) { + return e.pickup_id == th.data.bn_pick; + }) + if (idx0 < 0) { + getApp().my_warnning(th.data.bn_goods.goods_name + "的门店不可售", 0, th); + th.data.is_summit_ing = 0; + th.setData({ + submit: 0 + }) + return false; + } + } + + } + if (getApp().globalData.skinface_id) { goods.skinface_id = getApp().globalData.skinface_id; } @@ -2085,9 +2132,149 @@ Page({ th.calculatePrice2(); }, + //-- 获取订单促销的判断结构 -- + set_by_now_ord_prom(item){ + let pickid=this.data.bn_pick; + let order_prom_map_ck= this.data.order_prom_map_ck; + order_prom_map_ck[pickid]={ + shop_price_all:0, //手店价的累计 + market_price_all:0, //市场价的累计 + goods_price_all:0, //实收价的累计 + no_ord_price:0, //要累计上不参与订单促销的金额 + goodsList:[], + } + + let pk_ord_map=order_prom_map_ck[pickid]; + pk_ord_map.shop_price_all += item.shop_price_y * item.buynum; + pk_ord_map.market_price_all += item.goods_market_price * item.buynum; + + }, + + //获取当前进行中订单促销,同时带入相应的金额判断订单促销是不是运行,同时订单促销的条件不是实收价判断的话,默认的时候,订单促销是不参与运算的 + async get_cur_ord_prom(pickid) { + let ord_prom = null; + let order_prom_map_ck = this.data.order_prom_map_ck[pickid]; + if(!order_prom_map_ck) return null; + + //获取当前进行中的优惠促销 + await getApp().request.promiseGet("/api/weshop/promorder/getPromOrder", { + data: { + store_id: os.stoid, + orderAmount: -1, //-1为不判断金额条件 + user_id: getApp().globalData.user_id + } + }).then(res => { + if (res.data.code == 0) { + ord_prom = res.data.data; + } + }) + if (!ord_prom) return null; + //用于计算订单促销的金额 + let calculate_price=0; + let txt1='show_ord_prom['+pickid+']'; + //-- 此时判断活动的金额满足与否 -- + switch (ord_prom.discount_field) { + //实收价的时候 + case 0: + //要先还原 + this.setData({ + [txt1]: 0 + }); + + if (ord_prom.money > order_prom_map_ck.goods_price_all){ + return null; + } + break; + //手店价的时候 + case 1: + if (ord_prom.money > order_prom_map_ck.shop_price_all){ + //要先还原 + this.setData({ + [txt1]: 0 + }); + return null; + } + //要显示订单促销使用的按钮 + this.setData({ + [txt1]: 1 + }); + break; + //市场价的时候 + case 2: + if (ord_prom.money > order_prom_map_ck.market_price_all){ + //要先还原 + this.setData({ + [txt1]: 0 + }); + return null; + } + //要显示订单促销使用的按钮 + this.setData({ + [txt1]: 2 + }); + break; + } + //如果订单促销是不参与订单促销的,那么就直接返回null(订单促销不是实收价的时候) + if(ord_prom.discount_field>0 && !this.data.can_use_ord_prom[pickid]){ + return null; + } + return ord_prom; + }, + + //立即购买的时候,点击订单促销的参与 + set_can_use_ord_prom_now:function (e){ + + if(this.data.sub) return false; + this.setData({ sub: 1,same_ok:1 }); + + let pickid=this.data.bn_pick; + let txt = 'can_use_ord_prom[' + pickid + ']'; + let can_use = this.data.can_use_ord_prom[pickid] ? this.data.can_use_ord_prom[pickid] : 0; + this.setData({ + [txt]: !can_use + }) + + let th=this; + let good=th.data.bn_goods; + let param=th.data.param; + + //如果有要参与订单促销的按钮点击后,要修改商品的价格 + if(th.data.can_use_ord_prom[pickid]){ + let discount_field=th.data.show_ord_prom[pickid]; + switch (discount_field){ + case 1: + good.shop_price=good.shop_price_y; + param.goods_price=good.shop_price_y; + break; + case 2: + good.shop_price=good.market_price; + param.goods_price=good.market_price; + break; + } + //-- 转成普通商品 --- + good.prom_type=0; + good.prom_id=0; + good.discount_field=discount_field; + + + }else{ + good=ut.deep_cp(th.data.old_bn_goods); + param.goods_price=good.goods_price; + } + + th.setData({ + bn_goods:good, + param + }) + wx.showLoading({ + title: "处理中.", + mark:true + }) + th.calculatePrice2() + } }); diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml index 71a9765..12ca5c8 100644 --- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml +++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml @@ -100,6 +100,14 @@ {{order.store_prom}} + + + + + 参与订单促销 + + + diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js index 6d9994d..6ec4ec6 100644 --- a/packageC/pages/presell/cart/cart.js +++ b/packageC/pages/presell/cart/cart.js @@ -2198,6 +2198,9 @@ Page({ }).then(res => { if (res.data.code == 0) { prom_ord = res.data.data; + + //如果订单促销的取价不是实收,清空订单促销 + if(prom_ord && prom_ord.discount_field>0) prom_ord=null; } }) diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js index ec9aed5..1bb61cb 100644 --- a/packageC/pages/presell/cart/cart2.js +++ b/packageC/pages/presell/cart/cart2.js @@ -134,7 +134,14 @@ Page({ bconfig:null, showFold:true, - is_fwk:0 //-- 判断是不是服务卡项订单 -- + is_fwk:0, //-- 判断是不是服务卡项订单 -- + + //-- 订单促销判断积累 ---2024-2-20 + order_prom_map_ck: {}, + //能不能使用订单促销 + can_use_ord_prom:{}, + //存储订单促销的取价,按照门店进行索引 + show_ord_prom:{}, }, @@ -595,7 +602,7 @@ Page({ }); }, - //-- 获取到服务卡项的详情 -- + //-- 获取到商品的详情 -- get_goods_detail(act, prelist,gg){ var th = this; //--------如果goods_id一样,就是要立即购买----- @@ -728,7 +735,10 @@ Page({ } //这个位置要拿活动的预售价 + t.data.data.shop_price_y = t.data.data.shop_price; t.data.data.shop_price = prelist.presell_money; + th.data.old_bn_goods=ut.deep_cp(t.data.data); + th.setData({ bn_goods: t.data.data, bn_pickname: gg.pick_name, @@ -832,6 +842,7 @@ Page({ // } th.setData({dis_btn:1}) + this.data.submit=0; wx.showLoading({ title: "处理中.",mask:true @@ -901,14 +912,18 @@ Page({ //-- 判断订单优惠的叠加 -- var ord_prom=null; var o_condition=allpice; - if (o_condition > 0 && th.data.act.is_useorderyh) { - await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { - data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id } - }).then(res => { - if (res.data.code == 0) { - ord_prom = res.data.data; - } - }) + if (th.data.act.is_useorderyh) { + // await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { + // data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id } + // }).then(res => { + // if (res.data.code == 0) { + // ord_prom = res.data.data; + // } + // }) + + th.set_by_now_ord_prom(th.data.bn_goods); + th.data.order_prom_map_ck[bn_pick].goods_price_all=o_condition; + ord_prom=await th.get_cur_ord_prom(bn_pick); } //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮,同时商品购买时候,服务卡项购买不计算运费---------- @@ -1568,6 +1583,33 @@ Page({ 'prom_id': th.data.bn_goods.prom_id, //促销活动id }; + if(th.data.bn_goods.discount_field){ + goods.discount_field=th.data.bn_goods.discount_field; + } + + //如果有参与非实收的订单促销,那么就相当于是普通购买 + if(th.data.can_use_ord_prom[th.data.bn_pick]){ + goods.is_integral_normal=1; + //如果是指定门店,就要判断 + if (th.data.bn_goods.pick_group_ids) { + var idx0 = th.data.bn_goods.pick_up_lists.findIndex(function (e) { + return e.pickup_id == th.data.bn_pick; + }) + if (idx0 < 0) { + getApp().my_warnning(th.data.bn_goods.goods_name + "的门店不可售", 0, th); + th.data.is_summit_ing = 0; + th.setData({ + submit: 0 + }) + return false; + } + } + + + } + + + if(getApp().globalData.skinface_id){ goods.skinface_id=getApp().globalData.skinface_id; } @@ -3179,8 +3221,158 @@ Page({ url= "/pages/goods/goodsInfo/goodsInfo?goods_id="+gid; } getApp().goto(url); + }, + + + //-- 获取订单促销的判断结构 -- + set_by_now_ord_prom(item){ + let pickid=this.data.bn_pick; + let order_prom_map_ck= this.data.order_prom_map_ck; + order_prom_map_ck[pickid]={ + shop_price_all:0, //手店价的累计 + market_price_all:0, //市场价的累计 + goods_price_all:0, //实收价的累计 + no_ord_price:0, //要累计上不参与订单促销的金额 + goodsList:[], + } + + let pk_ord_map=order_prom_map_ck[pickid]; + pk_ord_map.shop_price_all += item.shop_price_y * item.buynum; + pk_ord_map.market_price_all += item.goods_market_price * item.buynum; + + }, + + //获取当前进行中订单促销,同时带入相应的金额判断订单促销是不是运行,同时订单促销的条件不是实收价判断的话,默认的时候,订单促销是不参与运算的 + async get_cur_ord_prom(pickid) { + let ord_prom = null; + let order_prom_map_ck = this.data.order_prom_map_ck[pickid]; + if(!order_prom_map_ck) return null; + + //获取当前进行中的优惠促销 + await getApp().request.promiseGet("/api/weshop/promorder/getPromOrder", { + data: { + store_id: os.stoid, + orderAmount: -1, //-1为不判断金额条件 + user_id: getApp().globalData.user_id + } + }).then(res => { + if (res.data.code == 0) { + ord_prom = res.data.data; + } + }) + + if (!ord_prom) return null; + //用于计算订单促销的金额 + let calculate_price=0; + + let txt1='show_ord_prom['+pickid+']'; + //-- 此时判断活动的金额满足与否 -- + switch (ord_prom.discount_field) { + //实收价的时候 + case 0: + //要先还原 + this.setData({ + [txt1]: 0 + }); + + if (ord_prom.money > order_prom_map_ck.goods_price_all){ + return null; + } + break; + //手店价的时候 + case 1: + if (ord_prom.money > order_prom_map_ck.shop_price_all){ + //要先还原 + this.setData({ + [txt1]: 0 + }); + return null; + } + //要显示订单促销使用的按钮 + this.setData({ + [txt1]: 1 + }); + break; + //市场价的时候 + case 2: + if (ord_prom.money > order_prom_map_ck.market_price_all){ + //要先还原 + this.setData({ + [txt1]: 0 + }); + return null; + } + //要显示订单促销使用的按钮 + this.setData({ + [txt1]: 2 + }); + break; + } + //如果订单促销是不参与订单促销的,那么就直接返回null(订单促销不是实收价的时候) + if(ord_prom.discount_field>0 && !this.data.can_use_ord_prom[pickid]){ + return null; + } + return ord_prom; + }, + + //立即购买的时候,点击订单促销的参与 + set_can_use_ord_prom_now:function (e){ + + if(this.data.submit || this.data.dis_btn) return false; + this.data.submit=1; + + let pickid=this.data.bn_pick; + let txt = 'can_use_ord_prom[' + pickid + ']'; + let can_use = this.data.can_use_ord_prom[pickid] ? this.data.can_use_ord_prom[pickid] : 0; + this.setData({ + [txt]: !can_use + }) + + let th=this; + let good=th.data.bn_goods; + + //如果有要参与订单促销的按钮点击后,要修改商品的价格 + if(th.data.can_use_ord_prom[pickid]){ + let discount_field=th.data.show_ord_prom[pickid]; + switch (discount_field){ + case 1: + good.shop_price=good.shop_price_y; + break; + case 2: + good.shop_price=good.market_price; + break; + } + //-- 转成普通商品 --- + good.prom_type=0; + good.prom_id=0; + good.integral=0; + good.discount_field=discount_field; + + //把优惠券的使用还原 + th.setData({ + selected_quan_list: null, + using_quan: {} + }) + + }else{ + good=ut.deep_cp(th.data.old_bn_goods); + } + + th.setData({ + bn_goods:good + }) + wx.showLoading({ + title: "处理中.", + mark:true + }) + th.calculatePrice2() + + if(!th.data.can_use_ord_prom[pickid]){ + th.get_buy_now_quan(); + } } + }); diff --git a/packageC/pages/presell/cart/cart2.wxml b/packageC/pages/presell/cart/cart2.wxml index c7636bb..15374ba 100644 --- a/packageC/pages/presell/cart/cart2.wxml +++ b/packageC/pages/presell/cart/cart2.wxml @@ -150,6 +150,15 @@ {{order.store_prom}} + + + + + 参与订单促销 + + + + - + {{filters.toFix(items.goods_price,2)}}({{items.discount}}折) {{filters.toFix(items.goods_price,2)}} 佣金:{{filters.toFix(items.use_commission/items.goods_num,2)}}*{{items.goods_num}} @@ -171,8 +171,10 @@ - - + + + + 参与优惠活动 @@ -234,12 +236,15 @@ - - - - 参与优惠活动 + + + + + + 参与优惠活动 + - + @@ -348,6 +353,14 @@ + + + + + 参与订单促销 + + + @@ -679,6 +692,14 @@ {{order.store_prom}} + + + + + 参与订单促销 + + + + + + + + 参与订单促销 + + + diff --git a/packageE/pages/cart/cart2_pt/cart2_pt.js b/packageE/pages/cart/cart2_pt/cart2_pt.js index 394d22c..23d1d5c 100644 --- a/packageE/pages/cart/cart2_pt/cart2_pt.js +++ b/packageE/pages/cart/cart2_pt/cart2_pt.js @@ -90,6 +90,13 @@ Page({ is_no_by: {}, is_by: {}, is_quan_by: {}, + + //-- 订单促销判断积累 ---2024-2-20 + order_prom_map_ck: {}, + //能不能使用订单促销 + can_use_ord_prom:{}, + //存储订单促销的取价,按照门店进行索引 + show_ord_prom:{}, }, @@ -444,7 +451,9 @@ Page({ et = 2; } + t.data.data.shop_price_y=t.data.data.shop_price t.data.data.shop_price = gg.goods_price; + //--如果是普通购买的时候-- if (gg.is_normal == 1) { t.data.data.prom_id = 0; @@ -485,6 +494,8 @@ Page({ } + //用深拷贝把商品缓存起来,方便后面使用 + th.data.old_bn_goods=ut.deep_cp(t.data.data); th.setData({ bn_goods: t.data.data, bn_pickname: gg.pick_name, @@ -568,7 +579,6 @@ Page({ et = th.data.bn_exp_type; } - //-- 计算获得佣金的金额 -- if (getApp().globalData.userInfo.is_distribut && th.data.dis_config && th.data.dis_config.is_yongjin_dk) { @@ -591,6 +601,8 @@ Page({ } + //用深拷贝把商品缓存起来,方便后面使用 + th.data.old_bn_goods=ut.deep_cp(t.data.data); th.setData({ bn_goods: t.data.data, bn_pickname: gg.pick_name, @@ -834,13 +846,17 @@ Page({ if(th.data.bn_is_order_yh && th.data.kt_type != 3 ){ - await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { - data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id } - }).then(res => { - if (res.data.code == 0) { - ord_prom = res.data.data; - } - }) + // await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { + // data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id } + // }).then(res => { + // if (res.data.code == 0) { + // ord_prom = res.data.data; + // } + // }) + + th.set_by_now_ord_prom(th.data.bn_goods); + th.data.order_prom_map_ck[bn_pick].goods_price_all=o_condition; + ord_prom=await th.get_cur_ord_prom(bn_pick); } @@ -1468,6 +1484,31 @@ Page({ 'prom_id': th.data.bn_goods.prom_id, //促销活动id }; + if(th.data.bn_goods.discount_field){ + goods.discount_field=th.data.bn_goods.discount_field; + } + + //如果有参与非实收的订单促销,那么就相当于是普通购买 + if(th.data.can_use_ord_prom[th.data.bn_pick]){ + goods.is_integral_normal=1; + + //如果是指定门店,就要判断 + if (th.data.bn_goods.pick_group_ids) { + var idx0 = th.data.bn_goods.pick_up_lists.findIndex(function (e) { + return e.pickup_id == th.data.bn_pick; + }) + if (idx0 < 0) { + getApp().my_warnning(th.data.bn_goods.goods_name + "的门店不可售", 0, th); + th.data.is_summit_ing = 0; + th.setData({ + submit: 0 + }) + return false; + } + } + + } + if (getApp().globalData.skinface_id) { goods.skinface_id = getApp().globalData.skinface_id; } @@ -2260,6 +2301,152 @@ Page({ th.setData({ open_quan: 0 }); }, + //-- 获取订单促销的判断结构 -- + set_by_now_ord_prom(item){ + let pickid=this.data.bn_pick; + let order_prom_map_ck= this.data.order_prom_map_ck; + order_prom_map_ck[pickid]={ + shop_price_all:0, //手店价的累计 + market_price_all:0, //市场价的累计 + goods_price_all:0, //实收价的累计 + no_ord_price:0, //要累计上不参与订单促销的金额 + goodsList:[], + } + + let pk_ord_map=order_prom_map_ck[pickid]; + pk_ord_map.shop_price_all += item.shop_price_y * item.buynum; + pk_ord_map.market_price_all += item.goods_market_price * item.buynum; + + }, + + //获取当前进行中订单促销,同时带入相应的金额判断订单促销是不是运行,同时订单促销的条件不是实收价判断的话,默认的时候,订单促销是不参与运算的 + async get_cur_ord_prom(pickid) { + let ord_prom = null; + let order_prom_map_ck = this.data.order_prom_map_ck[pickid]; + if(!order_prom_map_ck) return null; + + //获取当前进行中的优惠促销 + await getApp().request.promiseGet("/api/weshop/promorder/getPromOrder", { + data: { + store_id: os.stoid, + orderAmount: -1, //-1为不判断金额条件 + user_id: getApp().globalData.user_id + } + }).then(res => { + if (res.data.code == 0) { + ord_prom = res.data.data; + } + }) + + if (!ord_prom) return null; + //用于计算订单促销的金额 + let calculate_price=0; + + let txt1='show_ord_prom['+pickid+']'; + //-- 此时判断活动的金额满足与否 -- + switch (ord_prom.discount_field) { + //实收价的时候 + case 0: + //要先还原 + this.setData({ + [txt1]: 0 + }); + + if (ord_prom.money > order_prom_map_ck.goods_price_all){ + return null; + } + break; + //手店价的时候 + case 1: + if (ord_prom.money > order_prom_map_ck.shop_price_all){ + //要先还原 + this.setData({ + [txt1]: 0 + }); + return null; + } + //要显示订单促销使用的按钮 + this.setData({ + [txt1]: 1 + }); + break; + //市场价的时候 + case 2: + if (ord_prom.money > order_prom_map_ck.market_price_all){ + //要先还原 + this.setData({ + [txt1]: 0 + }); + return null; + } + //要显示订单促销使用的按钮 + this.setData({ + [txt1]: 2 + }); + break; + } + //如果订单促销是不参与订单促销的,那么就直接返回null(订单促销不是实收价的时候) + if(ord_prom.discount_field>0 && !this.data.can_use_ord_prom[pickid]){ + return null; + } + return ord_prom; + }, + + //立即购买的时候,点击订单促销的参与 + set_can_use_ord_prom_now:function (e){ + + if(this.data.submit) return false; + this.setData({ submit: 1,same_ok:1 }); + + let pickid=this.data.bn_pick; + let txt = 'can_use_ord_prom[' + pickid + ']'; + let can_use = this.data.can_use_ord_prom[pickid] ? this.data.can_use_ord_prom[pickid] : 0; + this.setData({ + [txt]: !can_use + }) + + let th=this; + let good=th.data.bn_goods; + + //如果有要参与订单促销的按钮点击后,要修改商品的价格 + if(th.data.can_use_ord_prom[pickid]){ + let discount_field=th.data.show_ord_prom[pickid]; + switch (discount_field){ + case 1: + good.shop_price=good.shop_price_y; + break; + case 2: + good.shop_price=good.market_price; + break; + } + //-- 转成普通商品 --- + good.prom_type=0; + good.prom_id=0; + good.discount_field=discount_field; + + //把优惠券的使用还原 + th.setData({ + selected_quan_list: null, + using_quan: {} + }) + }else{ + good=ut.deep_cp(th.data.old_bn_goods); + } + + th.setData({ + bn_goods:good + }) + wx.showLoading({ + title: "处理中.", + mark:true + }) + th.calculatePrice2() + + if(!th.data.can_use_ord_prom[pickid]){ + th.get_buy_now_quan(); + } + } + diff --git a/packageE/pages/cart/cart2_pt/cart2_pt.wxml b/packageE/pages/cart/cart2_pt/cart2_pt.wxml index 2cd0b09..c0002b3 100644 --- a/packageE/pages/cart/cart2_pt/cart2_pt.wxml +++ b/packageE/pages/cart/cart2_pt/cart2_pt.wxml @@ -102,6 +102,13 @@ {{order.store_prom}} + + + + + 参与订单促销 + +