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}}
+
+
+
+
+ 参与订单促销
+
+
+
+
diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js
index d26912b..06e0f86 100644
--- a/packageE/pages/cart/cart2/cart2.js
+++ b/packageE/pages/cart/cart2/cart2.js
@@ -178,7 +178,15 @@ Page({
yhcx_act_map: {},
//优惠促销购买次数
- yhcx_buy_map:{}
+ yhcx_buy_map:{},
+
+ //-- 订单促销判断积累 ---2024-2-20
+ order_prom_map_ck: {},
+ //能不能使用订单促销
+ can_use_ord_prom:{},
+ //存储订单促销的取价,按照门店进行索引
+ show_ord_prom:{},
+
},
@@ -944,7 +952,8 @@ Page({
// }
// })
- th.data.cartlist_y =JSON.parse(JSON.stringify(carr)); //存储原始购物车列表
+ th.data.cartlist_y =JSON.parse(JSON.stringify(carr)); //存储原始购物车列表,这个数据还会收到污染
+ th.data.cartlist_old =JSON.parse(JSON.stringify(carr)); //存储原始购物车列表
wx.showLoading();
th.get_cart_next(carr);
@@ -1028,33 +1037,35 @@ Page({
var no_zh_num={};
//-- 多促销活动调用接口需要的参数,和商品的购买数量和活动的购买数量的请求参数 --
- if(!is_change){
+ if(!is_change) {
+ //-- 多促销活动调用接口需要的参数,和商品的购买数量和活动的购买数量的请求参数 --
var dug_cx_arr = [];
//获取 限购 和 多活动的促销---2024-2-1
- for (var i = 0; i < carr.length; i++) {
+ for (var iv = 0; iv < carr.length; iv++) {
- let item1 = carr[i];
+ let item1 = carr[iv];
//如果不是活动的时候,不是代发商品的时候,不是赠品的时候,不是阶梯商品拆分的,不是组合购拆分的
- if([1, 2, 4, 6, 8, 9].indexOf(item1.prom_type)== -1 && !item1.whsle_id
- && !item1.is_gift && !item1.is_ld_split && !item1.is_zh_split ){
+ if ([1, 2, 4, 6, 8, 9].indexOf(item1.prom_type) == -1 && !item1.whsle_id
+ && !item1.is_gift && !item1.is_ld_split && !item1.is_zh_split) {
//-- 快速查找,组装查询多活动的列表 --
- let f_idx=dug_cx_arr.findIndex(function (ele) {
+ let f_idx = dug_cx_arr.findIndex(function (ele) {
return ele.goods_id == item1.goods_id
});
- if(f_idx==-1) {
- let gd_ite={
- goods_id:carr[i].goods_id,
- goods_num:1,
- is_limit_show:1,
- is_state:0
+ if (f_idx == -1) {
+ let gd_ite = {
+ goods_id: carr[iv].goods_id,
+ goods_num: 1,
+ is_limit_show: 1,
+ is_state: 0
}
dug_cx_arr.push(gd_ite);
}
}
- if(is_change){
- carr[i].collocationList=null;
+
+ if (is_change) {
+ carr[iv].collocationList = null;
}
}
//-- 对商品的多促销进行判断 ---2024-2-1--
@@ -1062,11 +1073,45 @@ Page({
await th.buy_pro_group(dug_cx_arr,carr);
}
}
-
-
//在分组的时候,就不要再调用接口,await
for (var i = 0; i < carr.length; i++) {
var item = carr[i];
+
+ //如果有户有点击参与订单促销的话,那么可以参与订单促销的商品的活动都要清理成0,订单促销在使用过程中的重要方法
+ if (this.data.can_use_ord_prom[item.pick_id]) {
+ //从订单促销的order_prom_map_ck数据结构中获取到可以参与的商品列表
+ let gdlist = this.data.order_prom_map_ck[item.pick_id] ? this.data.order_prom_map_ck[item.pick_id].goodsList : null;
+ if (gdlist && gdlist.length) {
+ //查找商品item1有没有在gdlist中,就要把商品的prom_type清理0
+ let f_idx = gdlist.findIndex(function (ele) {
+ return ele.id == item.id
+ });
+ if (f_idx != -1) {
+ //开始变换商品的价格显示
+ switch (th.data.show_ord_prom[item.pick_id]) {
+ case 1:
+ carr[i].goods_price = item.shop_price;
+ break;
+ case 2:
+ carr[i].goods_price = item.goods_market_price;
+ break;
+ }
+
+ if(!carr[i].prom_type) carr[i].prom_type=0;
+ switch (parseInt(carr[i].prom_type)){
+ case 4:
+ carr[i].is_integral_normal = 1;
+ break;
+ default:
+ carr[i].is_pd_normal = 1;
+ break;
+ }
+ carr[i].prom_type = 0;
+ carr[i].discount_field = th.data.show_ord_prom[item.pick_id];
+ }
+ }
+ }
+
//-- 如果是等级会员注册返回 --
if (is_card_back) {
th.data.card_name = th.data.userinfo.card_field;
@@ -1290,11 +1335,8 @@ Page({
if (ie.exp_type == 0 || ie.exp_type == 2) is_a_zt= 0;
}
th.setData({ is_all_zt: is_a_zt});
-
}
-
-
var cart_commission = 0;
//-- 循环计算一下线下取价 --
for (var k = 0; k < arr.length; k++) {
@@ -1344,6 +1386,26 @@ Page({
//-- 如果初始活动在计算的时候,是不满足的时候,就要把活动清理掉 --
var is_no_ok=arr[k].show_can_cx[key_o].cur_act.is_no_ok;
if(is_no_ok==1){
+
+ let temp_id=arr[k].show_can_cx[key_o].cur_act.prom_id;
+ switch (parseInt(arr[k].show_can_cx[key_o].cur_act.prom_type+'')){
+ case 3:
+ var yhcx_act_map=th.data.yhcx_act_map?th.data.yhcx_act_map[temp_id]:null;
+ if(yhcx_act_map && !yhcx_act_map.is_order_yh){
+ item1.is_no_order_yh=1;
+ }
+ break;
+ case 7:
+ var zhhe_act=th.data.zhhe_act_map?th.data.zhhe_act_map[temp_id]:null;
+ if(zhhe_act && !zhhe_act.is_orderyh){
+ item1.is_no_order_yh=1;
+ }
+ break;
+ }
+
+ debugger;
+
+
item1.prom_id = 0;
item1.prom_type = 0;
@@ -1352,6 +1414,16 @@ Page({
item1.is_act_last=1; //这个是要在前端显示按钮切换的
}
+ }else{
+
+ let obj=arr[k].show_can_cx[key_o];
+ //不是优惠促销的不参与 不是订单促销参与(订单促销不是实收价的时候)
+ let ck1=obj.no_cj_prom && obj.cur_act.prom_type==3;
+ let ck2=th.data.can_use_ord_prom[arr[k].pickup_id];
+ if( !ck1 && !ck2){
+ item1.prom_id = arr[k].show_can_cx[key_o].cur_act.prom_id;
+ item1.prom_type = arr[k].show_can_cx[key_o].cur_act.prom_type;
+ }
}
}
}
@@ -1463,8 +1535,6 @@ Page({
} else {
-
-
item1.act = th.data.zhhe_act_map[item1.prom_id];
}
}
@@ -1609,7 +1679,6 @@ Page({
prom_type: item[c].prom_type,
prom_id: item[c].prom_id,
}
- //单个就不调用了
// let req_d1 = {
// user_id: getApp().globalData.user_id, goods_ids: [hr], store_id: os.stoid
// }
@@ -2094,6 +2163,8 @@ Page({
success: async function (tt) {
if (tt.data.code == 0) {
//t.data.data.shop_price = tt.data.data.prom_price;
+
+ gd.shop_price_y=gd.shop_price;
gd.shop_price=t.data.data.shop_price = tt.data.data.prom_user_price;
th.data.ckeck_quan_price = 0;
@@ -2142,6 +2213,9 @@ Page({
}
+ //用深拷贝把商品缓存起来,方便后面使用
+ th.data.old_bn_goods=ut.deep_cp(gd);
+
th.setData({
bn_goods: gd,
bn_pickname: gg.pick_name,
@@ -2170,6 +2244,7 @@ Page({
ut.get_active_info(2,gd.prom_id,os.stoid,function(e){
//t.data.data.shop_price = tt.data.data.prom_price;
+ gd.shop_price_y=gd.shop_price;
gd.shop_price=t.data.data.shop_price = tt.data.data.price;
t.data.data.fir_rate = tt.data.data.fir_rate;
@@ -2209,6 +2284,10 @@ Page({
gd.is_xz_yh = 1;
}
+
+ //用深拷贝把商品缓存起来,方便后面使用
+ th.data.old_bn_goods=ut.deep_cp(gd);
+
th.setData({
bn_goods: gd,
bn_pickname: gg.pick_name,
@@ -2980,6 +3059,9 @@ Page({
}
}
+ //重置订单促销判断累计
+ this.re_set_order_prom_map_ck();
+
for (var i in c_arr) {
var cart_item = c_arr[i];
cart_item.prom_pt_json=[];
@@ -2996,6 +3078,7 @@ Page({
}
+
//调用函数计算每件商品的单价
await th.calc_per(c_arr);
@@ -3009,7 +3092,7 @@ Page({
//-- 经纬度不循环调用接口 --
var lon = 0; var lat = 0;
- //---循环购物车---
+ //---循环购物车,按照门店订单进行循环---
for (var i in c_arr) {
//因为搭配购买也是再这里计算,搭配购的is_b_now==1
if (th.data.is_b_now == 0) {
@@ -3047,15 +3130,15 @@ Page({
var no_order_yh = 0; //-- 有些活动不能和订单优惠叠加的金额 --
var no_post_temp = 0; //-- 有些活动不能和包邮模板的金额 --
+ var no_post_temp_shop_price = 0; //-- 有些活动不能和包邮模板的金额 --因为订单促销有手店价取价
+ var no_post_temp_market_price = 0; //-- 有些活动不能和包邮模板的金额 --因为订单促销有市场价取价
if (th.data.using_quan[pickid] != null && th.data.using_quan[pickid] != undefined)
quan_no = th.data.using_quan[pickid].coupon_no;
//普通券的时候
if (quan_no && th.data.using_quan[pickid].isby != 1) {
-
var IsUserWare=1;
-
//---获取优惠券优惠---
await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", {
data: {
@@ -3076,13 +3159,10 @@ Page({
quan_price=0;
break;
}
-
}
-
}
})
-
if(!IsUserWare){
wx.showToast({
@@ -3112,6 +3192,11 @@ Page({
//--------循环计算总价-----------
for (var jc = 0; jc < item.length; jc++) {
+ //如果item的prom_type==0,没有如果活动的时候,如果是优惠促销和组合促销不满足的时候
+ //或者是组合购和阶梯购多出来的商品
+ if (item[jc].prom_type == 0 && !item[jc].whsle_id && !item[jc].is_no_order_yh) {
+ th.get_order_prom_map_ck(item[jc],pickid);
+ }
if (item[jc].whsle_id > 0) {
whsle_goods_price += item[jc].goods_price * item[jc].goods_num;
@@ -3124,11 +3209,13 @@ Page({
if (item[jc].prom_type == 7 && th.data.zhhe_act_map && th.data.zhhe_act_map[item[jc].prom_id]
&& th.data.zhhe_act_map[item[jc].prom_id].is_orderyh) {
is_no_zh = 1;
+ th.get_order_prom_map_ck(item[jc],pickid); //有订单优惠叠加的时候,就要构建数据解救
}
//阶梯购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加,就要累积阶梯促销的金额
if (item[jc].prom_type == 10 && ladder_prom_goods && ladder_prom_goods[item[jc].prom_id]
&& th.data.ladder_map[item[jc].prom_id].is_useorderyh) {
is_no_zh = 1;
+ th.get_order_prom_map_ck(item[jc],pickid); //有订单优惠叠加的时候,就要构建数据解救
}
if (is_no_zh) {
@@ -3144,20 +3231,28 @@ Page({
var gd_price=item[jc].goods_price;
if(item[jc].account_fir) gd_price=item[jc].account_fir;
-
- //组合购和阶梯购是订单优惠是另外算的
+ //组合购和阶梯购是订单优惠是另外算的,不参与订单促销的时候
if(!item[jc].is_order_yh && !item[jc].whsle_id && item[jc].prom_type!=7 && item[jc].prom_type!=10){
no_order_yh+=gd_price * item[jc].goods_num;
if(item[jc].quan_num) no_order_yh-=item[jc].quan_num; //券要把他补回去
-
}
+ //参与订单促销的时候
+ if(item[jc].is_order_yh && !item[jc].whsle_id && item[jc].prom_type!=7 && item[jc].prom_type!=10){
+ th.get_order_prom_map_ck(item[jc],pickid); //有订单优惠叠加的时候,就要构建数据解救
+ }
+
if(!item[jc].is_post_temp){
no_post_temp+=gd_price * item[jc].goods_num;
+ no_post_temp_shop_price+=item[jc].shop_price * item[jc].goods_num;
+ no_post_temp_market_price+=item[jc].goods_market_price * item[jc].goods_num;
if(item[jc].quan_num) no_post_temp-=item[jc].quan_num; //券要把他补回去
}
}
+
}
+
+
//判断是不是有组合购的金额
var f_o_price = o_price;
//如果又优惠的钱,就要减价
@@ -3236,21 +3331,33 @@ Page({
ord_prom_condition=o_price - quan_price - whsle_goods_price - no_order_yh;
}
- //---判断是不是有订单优惠---
- await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
- data: { store_id: os.stoid, orderAmount: parseFloat(ord_prom_condition).toFixed(2), user_id: getApp().globalData.user_id }
- }).then(res => {
- if (res.data.code == 0) {
- ord_prom = res.data.data;
+ //判断订单促销的实收价的累计
+ if(!this.data.order_prom_map_ck[pickid]){
+ this.data.order_prom_map_ck[pickid]={
+ shop_price_all:0, //手店价的累计
+ market_price_all:0, //市场价的累计
+ goods_price_all:0, //实收价的累计
+ no_ord_price:0, //要累计上不参与订单促销的金额
+ goodsList:[],
}
- })
+ }
+ this.data.order_prom_map_ck[pickid].goods_price_all=ord_prom_condition;
+ //---判断是不是有订单优惠---
+ // await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
+ // data: { store_id: os.stoid, orderAmount: parseFloat(ord_prom_condition).toFixed(2), user_id: getApp().globalData.user_id }
+ // }).then(res => {
+ // if (res.data.code == 0) {
+ // ord_prom = res.data.data;
+ // }
+ // })
+ //获取当前时间段的进行中的订单促销
+ ord_prom=await th.get_cur_ord_prom(pickid);
//如果有使用优惠券,如何订单促销有控制使用优惠券不参与此活动的话
if(quan_price>0 && ord_prom && ord_prom.is_xz_yh ){
ord_prom=null;
}
-
//--如果是物流,且选择了地址,就要开始显示包邮券,且包邮券也已经优惠了优惠活动的金额--
if (cart_item.exp_type == 0 && th.data.user_addr != null && !cart_item.is_xz_yh) {
@@ -3300,10 +3407,23 @@ Page({
//-- 如果没有订单优惠,或者订单优惠中有勾选包邮模板 --
if (!ord_prom || ord_prom.is_post_temp) {
- var user_addr = th.data.user_addr;
+
+ let user_addr = th.data.user_addr;
+ let c_wuliu=parseFloat(o_price - quan_price - whsle_goods_price - no_post_temp).toFixed(2);
+
+ //-- 因为订单促销的取价规则,所以要判断一下各种情况 --
+ switch (ord_prom && ord_prom.discount_field){
+ case 1:
+ c_wuliu=parseFloat(ord_prom.real_condition_price - whsle_shop_price - no_post_temp_shop_price).toFixed(2);
+ break;
+ case 2:
+ c_wuliu=parseFloat(ord_prom.real_condition_price - whsle_market_price - no_post_temp_market_price).toFixed(2);
+ break;
+ }
+
var req_d = {
province: user_addr.province, city: user_addr.city, district: user_addr.district,
- wuliu: parseFloat(o_price - quan_price - whsle_goods_price - no_post_temp).toFixed(2), store_id: os.stoid
+ wuliu: c_wuliu, store_id: os.stoid
}
await getApp().request.promisePost("/api/weshop/order/areaFreight", {
is_json: 1, data: req_d
@@ -3313,7 +3433,6 @@ Page({
}
}
-
//如果是包邮券的时候,要看看券的情况
if (quan_no && th.data.using_quan[pickid].isby == 1) {
var quan = th.data.using_quan[pickid];
@@ -3504,24 +3623,25 @@ Page({
}
var order_m = 0;
-
//么有使用券,或者活动没有限制使用优惠券
if (ord_prom && (quan_price <= 0 || !ord_prom.is_xz_yh)) {
- order_prom_id = ord_prom['id'];
- switch (ord_prom['type']) {
- case 0:
- order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
- order_prom_amount = (o_condition - order_m).toFixed(2);
- break;
- case 1:
- //order_m = o_condition - ord_prom['expression'];//满额优惠金额
- var bs = 1;
- if (ord_prom.is_bz) {
- bs = Math.floor(o_condition / ord_prom.money);
- }
- order_prom_amount = ord_prom['expression'];
- break;
- }
+ order_prom_id = ord_prom['id'];
+ //-- 订单促销是按照实收价格进行计算的时候 --
+ switch (ord_prom['type']) {
+ case 0:
+ order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
+ order_prom_amount = (o_condition - order_m).toFixed(2);
+ break;
+ case 1:
+ //order_m = o_condition - ord_prom['expression'];//满额优惠金额
+ var bs = 1;
+ if (ord_prom.is_bz) {
+ bs = Math.floor(o_condition / ord_prom.money);
+ }
+ order_prom_amount = ord_prom['expression'];
+ break;
+ }
+
}
cart_item.order_prom_amount = 0;
@@ -3930,7 +4050,7 @@ Page({
//---如果有选择优惠券的情况下---
var quan_price = 0, bn_pick = th.data.bn_pick;
var quan_no = null;
- if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined)
+ if (th.data.using_quan && th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined)
quan_no = th.data.using_quan[bn_pick].coupon_no;
if (quan_no) {
@@ -3964,15 +4084,22 @@ Page({
var ord_prom = null;
var is_ord_prom_post = 0;
- if (condition > 0 && th.data.bn_is_order_yh && !th.data.bn_goods.whsle_id) {
- await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
- data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id }
- }).then(res => {
- if (res.data.code == 0) {
- var data = res.data.data;
- ord_prom = data;
- }
- })
+ //一件代发商品不参与订单优惠, 本身商品的活动也有要不要参与优惠促销的设置bn_is_order_yh
+ if (th.data.bn_is_order_yh && !th.data.bn_goods.whsle_id) {
+
+ th.set_by_now_ord_prom(th.data.bn_goods);
+ th.data.order_prom_map_ck[bn_pick].goods_price_all=condition;
+
+ // await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
+ // data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id }
+ // }).then(res => {
+ // if (res.data.code == 0) {
+ // var data = res.data.data;
+ // ord_prom = data;
+ // }
+ // })
+ ord_prom=await th.get_cur_ord_prom(bn_pick);
+
if (ord_prom && ord_prom.is_post_temp) {
is_ord_prom_post = 1;
}
@@ -4717,6 +4844,9 @@ Page({
if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
getApp().my_warnning("读取物流失败", 0, th);
th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
return false;
}
@@ -4853,6 +4983,29 @@ Page({
'prom_id': th.data.bn_goods.prom_id, //促销活动id
};
+ //如果有参与非实收的订单促销,那么就相当于是普通购买
+ if (th.data.can_use_ord_prom[th.data.bn_pick]) {
+ goods.is_pd_normal = 1;
+ goods.discount_field = th.data.show_ord_prom[th.data.bn_pick];
+
+ //如果是指定门店,就要判断
+ 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 (th.data.bn_goods.whsle_id) {
item.is_whsle = 1;
item.whsle_id = th.data.bn_goods.whsle_id;
@@ -4903,11 +5056,17 @@ Page({
if(mo_num>goods.goods_num){
getApp().confirmBox(goods.goods_name + "的未达到起订数量");
th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
return false;
}
if(steep>1 && (goods.goods_num-mo_num)%steep!=0 ){
getApp().confirmBox(goods.goods_name + "的购买的数量不是起订量的倍数");
th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
return false;
}
}
@@ -4922,6 +5081,9 @@ Page({
if (!isok) {
getApp().confirmBox("商品的门店库存不足");
th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
return false;
}
}
@@ -5040,6 +5202,9 @@ Page({
if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
th.data.is_summit_ing = 0;
getApp().confirmBox("读取物流失败");
+ th.setData({
+ submit: 0
+ })
return false;
}
}
@@ -5246,6 +5411,26 @@ Page({
'store_id': oo.stoid,
};
+ //订单促销取价规则使用
+ if (g_item.discount_field) {
+ goods.discount_field =g_item.discount_field;
+ //此时要判断商品的门店是不是匹配
+ if(g_item.prom_type==0 && g_item.pick_group_ids){
+ var idx0 = g_item.pick_up_lists.findIndex(function (e) {
+ return e.pickup_id == item.pickup_id;
+ })
+ if (idx0 < 0) {
+ getApp().my_warnning(g_item.goods_name + "的门店不可售", 0, th);
+ th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
+ return false;
+ }
+ }
+
+ }
+
if (g_item.is_pd_normal) {
goods.is_pd_normal = 1;
}
@@ -6531,6 +6716,7 @@ Page({
get_cart_quan: async function (order_prom_list_cart) {
var th = this;
var user_id = getApp().globalData.user_id;
+
//等待值的出现
//getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () {
//var arr=th.data.order_prom_list_cart;
@@ -6542,6 +6728,12 @@ Page({
//------------开始计算使用优惠券相关------------
for (var ind in arr) {
var ep = arr[ind];
+
+ //如果门店订单使用订单促销(此订单促销取价规则不是实收价的时候)
+ if(th.data.can_use_ord_prom[ep.pickup_id]){
+ continue;
+ }
+
var goodlist = ep.goods;
var pickup_id = ep.pickup_id;
//--更优惠券抵用有关,立即购买的,如果是购物车,如果有等级价还有考虑等级价的东西
@@ -8423,10 +8615,13 @@ Page({
var cx_prom_group=this.data.cartlist[idx].show_can_cx[gd_key].act_arr;
+ //-- 切换活动的时候,让订单促销参与不选中 --
+ let tt_wd="can_use_ord_prom["+pk+"]";
th.setData({
send_lb:{},
month_lb:{},
- send_gf:{}
+ send_gf:{},
+ [tt_wd]:0
})
th.data.prom_goods_map={};
@@ -8635,6 +8830,9 @@ Page({
//--- 不参与优惠促销的开关 ---
no_cj_prom: function (e) {
+ //避免重复点击
+ if(this.data.submit) return false;
+ this.setData({ submit: 1,same_ok:1 });
//重新调用cart_next,进行下一步计算
wx.showLoading({
@@ -8719,16 +8917,245 @@ Page({
if(!goods[ig].is_gift){
n_goods.push(goods[ig]);
}
- }
+ }
+
//原始数据要有深拷贝不能有地址的牵连
th.data.cartlist_y = JSON.parse(JSON.stringify(n_goods))
+ //重新调用cart_next,进行下一步计算
+ wx.showLoading({
+ title: "处理中.",
+ })
+ this.get_cart_next(null, 1, {prom_type: 0, prom_id: 0});
+
+ },
+
+ //---订单促销累计的数据结构的构建,购物车计算流程的那一部分
+ get_order_prom_map_ck(item,pickid) {
+ //赠品不计算
+ if(item.is_gift) return false;
+ var order_prom_map_ck= this.data.order_prom_map_ck;
+ if(!order_prom_map_ck[pickid]){
+ 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 * item.goods_num;
+ pk_ord_map.market_price_all += item.goods_market_price * item.goods_num;
+
+ let ite = {
+ id: item.id,
+ goods_id: item.goods_id,
+ goods_num: item.goods_num,
+ prom_type: item.prom_type
+ }
+ pk_ord_map.goodsList.push(ite);
+ },
+
+
+ //-- 秒杀和团购使用 --
+ 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;
+
+ },
+
+ //重置订单促销判断累计
+ re_set_order_prom_map_ck() {
+ this.data.order_prom_map_ck = {}
+ },
+
+ //获取当前进行中订单促销,同时带入相应的金额判断订单促销是不是运行,同时订单促销的条件不是实收价判断的话,默认的时候,订单促销是不参与运算的
+ 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: function (e) {
+
+ if(this.data.submit) return false;
+ this.setData({ submit: 1,same_ok:1 });
+
+ let pickid = e.currentTarget.dataset.pd;
+ 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
+ })
+
+ //购物车进行还原,一下数据的清理的必须的
+ this.setData({
+ send_lb: {},
+ month_lb: {},
+ send_gf: {}
+ })
+ //清空优惠促销的内容
+ this.data.prom_goods_map = {};
+
+ //处理一下商品
+ let goods0 = JSON.parse(JSON.stringify(this.data.cartlist_y));
+ let goods = [];
+ for (var ik = 0; ik < goods0.length; ik++) {
+ var item_c = goods0[ik];
+ if(item_c.pick_id == pickid && item_c.is_collocation) continue;
+ if(item_c.is_gift) continue
+ goods.push(item_c);
+ }
+
+ //原始数据要有深拷贝不能有地址的牵连
+ this.data.cartlist_y = JSON.parse(JSON.stringify(goods))
+ //重新调用cart_next,进行下一步计算
+ wx.showLoading({
+ title: "处理中.",
+ mark:true
+ })
+ //-- 重新计算一下价格 --
+>>>>>>> dev_oa_fuordercx
this.get_cart_next(null, 1, {prom_type: 0, prom_id: 0});
+ },
+
+ //立即购买的时候,点击订单促销的参与
+ 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;
+
+ 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/cart2.wxml b/packageE/pages/cart/cart2/cart2.wxml
index 0952a49..9be0c7f 100644
--- a/packageE/pages/cart/cart2/cart2.wxml
+++ b/packageE/pages/cart/cart2/cart2.wxml
@@ -104,9 +104,9 @@
{{filters.show_gui_ge(items.goods_spec,items.goods_color)}}
-
+
¥{{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}}
+
+
+
+
+ 参与订单促销
+
+
+
@@ -1096,7 +1117,7 @@
一
-
+
+
diff --git a/packageE/pages/cart/cart2/filter.wxs b/packageE/pages/cart/cart2/filter.wxs
index d32491d..dbd7d77 100644
--- a/packageE/pages/cart/cart2/filter.wxs
+++ b/packageE/pages/cart/cart2/filter.wxs
@@ -49,14 +49,11 @@ function check_is_last(index,goods_id){
return true;
}
return false;
-
}
-
-
module.exports = {
format: format,
is_more_act:is_more_act,
check_show:check_show,
- check_is_last:check_is_last
+ check_is_last:check_is_last,
}
diff --git a/packageE/pages/cart/cart2/ladder_calculate.js b/packageE/pages/cart/cart2/ladder_calculate.js
index 6beb282..d0a066c 100644
--- a/packageE/pages/cart/cart2/ladder_calculate.js
+++ b/packageE/pages/cart/cart2/ladder_calculate.js
@@ -115,6 +115,11 @@ module.exports = {
})
//goods[idx].goods_num -= num;
let new_g = JSON.parse(JSON.stringify(goods[idx]));
+
+ //多余的商品如果活动不参与订单促销,那么变成普通商品的也不能参与订单促销,2024-2-26
+ if(!ladder_map.is_useorderyh){
+ new_g.is_no_order_yh=1;
+ }
new_g.goods_num = num;
new_g.prom_type = 0;
new_g.prom_id = 0;
diff --git a/packageE/pages/cart/cart2/zh_calculate.js b/packageE/pages/cart/cart2/zh_calculate.js
index 3b89844..f240e6f 100644
--- a/packageE/pages/cart/cart2/zh_calculate.js
+++ b/packageE/pages/cart/cart2/zh_calculate.js
@@ -270,6 +270,11 @@ module.exports = {
let new_g = JSON.parse(JSON.stringify(goods[idx]));
if(new_g.more_cx) delete new_g.more_cx;
+
+ //多余的商品如果活动不参与订单促销,那么变成普通商品的也不能参与订单促销,2024-2-26
+ if(!act.is_orderyh){
+ new_g.is_no_order_yh=1;
+ }
new_g.goods_num = num;
new_g.prom_type = 0;
new_g.prom_id = 0;
@@ -331,6 +336,11 @@ module.exports = {
offline_price += item.goods_price - item.offline_price;
offline_num += 1;
}
+
+ //多余的商品如果活动不参与订单促销,那么变成普通商品的也不能参与订单促销,2024-2-26
+ if(!act.is_orderyh){
+ item.is_no_order_yh=1;
+ }
item.prom_type = 0;
item.prom_id = 0;
}
diff --git a/packageE/pages/cart/cart2_inte/cart2_inte.js b/packageE/pages/cart/cart2_inte/cart2_inte.js
index 2503b41..7dad782 100644
--- a/packageE/pages/cart/cart2_inte/cart2_inte.js
+++ b/packageE/pages/cart/cart2_inte/cart2_inte.js
@@ -85,7 +85,14 @@ Page({
same_ok:1, //同城配送的控制,默认ok
bconfig: null,
showFold:true,
- template_id:[]
+ template_id:[],
+
+ //-- 订单促销判断积累 ---2024-2-20
+ order_prom_map_ck: {},
+ //能不能使用订单促销
+ can_use_ord_prom:{},
+ //存储订单促销的取价,按照门店进行索引
+ show_ord_prom:{},
},
@@ -632,6 +639,8 @@ Page({
success: async function (tt) {
if (tt.data.code == 0 && tt.data.data && tt.data.data.pageData) {
var inte_data = tt.data.data.pageData[0];
+
+ gd.shop_price_y=gd.shop_price;
t.data.data.shop_price = inte_data.addmoney;
t.data.data.integral = inte_data.integral;
@@ -658,6 +667,9 @@ Page({
+ //用深拷贝把商品缓存起来,方便后面使用
+ th.data.old_bn_goods=ut.deep_cp(t.data.data);
+
th.setData({
bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, index: m_wind,
bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et,inv_is_post:inte_data.is_post
@@ -742,16 +754,23 @@ Page({
var condition = parseFloat(allpice-cut_price).toFixed(2);
var ord_prom = null;
var is_ord_prom_post = 0;
+ //---如果有选择优惠券的情况下---
+ var quan_price = 0, bn_pick = th.data.bn_pick;
+
+ if (th.data.bn_is_order_yh && !th.data.bn_goods.whsle_id) {
+ // await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
+ // data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id }
+ // }).then(res => {
+ // if (res.data.code == 0) {
+ // var data = res.data.data;
+ // ord_prom = data;
+ // }
+ // })
+
+ th.set_by_now_ord_prom(th.data.bn_goods);
+ th.data.order_prom_map_ck[bn_pick].goods_price_all=condition;
+ ord_prom=await th.get_cur_ord_prom(bn_pick);
- if (condition > 0 && th.data.bn_is_order_yh && !th.data.bn_goods.whsle_id) {
- await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
- data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id }
- }).then(res => {
- if (res.data.code == 0) {
- var data = res.data.data;
- ord_prom = data;
- }
- })
if (ord_prom && ord_prom.is_post_temp) {
is_ord_prom_post = 1;
}
@@ -894,8 +913,7 @@ Page({
var wl_txt = "formData.shipping_price";
th.setData({ [wl_txt]: 0, })
}
- //---如果有选择优惠券的情况下---
- var quan_price = 0, bn_pick = th.data.bn_pick;
+
//-----------------支付价,优惠券不减物流-----------------
var total_m = (parseFloat(allpice)).toFixed(2);
@@ -1281,7 +1299,6 @@ Page({
item.samecity_order_amount=th.data.bn_samecity_order_amount;
}
-
//获取立即购买的商品的信息
var gg = to.get_b_now();
//--商品的房间号--
@@ -1319,6 +1336,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;
}
@@ -1757,7 +1799,146 @@ Page({
var th = this;
th.setData({bn_use_commission: !th.data.bn_use_commission});
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.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.integral=0;
+ good.discount_field=discount_field;
+
+ }else{
+ good=ut.deep_cp(th.data.old_bn_goods);
+ }
+
+ th.setData({
+ bn_goods:good
+ })
+ wx.showLoading({
+ title: "处理中.",
+ mark:true
+ })
+ th.calculatePrice2()
}
+
});
diff --git a/packageE/pages/cart/cart2_inte/cart2_inte.wxml b/packageE/pages/cart/cart2_inte/cart2_inte.wxml
index dd18640..b3bce8a 100644
--- a/packageE/pages/cart/cart2_inte/cart2_inte.wxml
+++ b/packageE/pages/cart/cart2_inte/cart2_inte.wxml
@@ -94,6 +94,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}}
+
+
+
+
+ 参与订单促销
+
+
diff --git a/packageE/pages/cart/cart_wk/cart_wk.js b/packageE/pages/cart/cart_wk/cart_wk.js
index d4363e5..e55b4b3 100644
--- a/packageE/pages/cart/cart_wk/cart_wk.js
+++ b/packageE/pages/cart/cart_wk/cart_wk.js
@@ -539,6 +539,9 @@ Page({
}).then(res => {
if (res.data.code == 0) {
ord_prom = res.data.data;
+
+ //如果订单促销的取价不是实收,清空订单促销
+ if(ord_prom && ord_prom.discount_field>0) ord_prom=null;
}
})
}
diff --git a/packageG/pages/user/order_detail/order_detail.js b/packageG/pages/user/order_detail/order_detail.js
index 7616b41..0a174bf 100644
--- a/packageG/pages/user/order_detail/order_detail.js
+++ b/packageG/pages/user/order_detail/order_detail.js
@@ -1157,13 +1157,39 @@ Page({
//-- 优惠促销的时候控制取价规则 --
// gg.prom_type!=3 && gg.prom_type!=10 同时商品不是普通购买的时候,又参与优惠促销,阶梯促销
if((gg.prom_type!=3 && gg.prom_type!=10) || gg.discount_field==undefined || gg.discount_field==0 ) {
- if (card_field && gg[card_field] > 0) {
- if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
- if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
- } else {
- if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
- if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+
+ //判断一下活动是不是有参与订单促销,并且订单促销的活动是不是实收取价,2024-2-23
+ let ordprom_price_type=0;
+ if(order.order_prom_id && good.prom_type==0){
+ let p_rs= await getApp().request.promiseGet("/api/weshop/promorder/get/"+os.stoid+"/"+order.order_prom_id, {});
+ if(p_rs && p_rs.data.code==0 && p_rs.data.data){
+ let ord_p=p_rs.data.data;
+ if(ord_p && ord_p.discount_field>0){
+ ordprom_price_type=ord_p.discount_field
+ }
+ }
+ }
+ if(ordprom_price_type>0){
+ //-- 看一下订单促销的取价规则 --
+ switch (ordprom_price_type){
+ case 1:
+ if (good.goods_price != gg.shop_price) isok = 0;
+ break;
+ case 2:
+ if (good.goods_price != gg.market_price) isok = 0;
+ break;
+ }
+
+ }else {
+ if (card_field && gg[card_field] > 0) {
+ if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
+ if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+
+ } else {
+ if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
+ if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+ }
}
}else{
if(good.prom_type==3 && good.prom_type==10){
diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js
index 6495c93..ff117d6 100644
--- a/pages/cart/cart/cart.js
+++ b/pages/cart/cart/cart.js
@@ -1192,10 +1192,10 @@ Page({
// if (this.data.btn_click) {
// return false;
// }
+
setTimeout(() => {
if (this.data.up_dating == 1) return false;
this.data.up_dating=1
-
this.data.btn_click = 1;
var a = t.currentTarget.dataset.item;
var b = t.currentTarget.dataset.pitems;
diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js
index 58b871f..f36e3ed 100644
--- a/pages/user/order_list/order_list.js
+++ b/pages/user/order_list/order_list.js
@@ -1446,14 +1446,43 @@ Page({
//-- 优惠促销的时候控制取价规则 --
// gg.prom_type!=3 && gg.prom_type!=10 同时商品不是普通购买的时候,又参与优惠促销,阶梯促销
if((gg.prom_type!=3 && gg.prom_type!=10) || gg.discount_field==undefined || gg.discount_field==0 ){
- if (card_field && gg[card_field] > 0) {
- if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
- if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
- } else {
- if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
- if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+ //判断一下活动是不是有参与订单促销,并且订单促销的活动是不是实收取价,2024-2-23
+ let ordprom_price_type=0;
+ if(order.order_prom_id && good.prom_type==0){
+ let p_rs= await getApp().request.promiseGet("/api/weshop/promorder/get/"+os.stoid+"/"+order.order_prom_id, {});
+ if(p_rs && p_rs.data.code==0 && p_rs.data.data){
+ let ord_p=p_rs.data.data;
+ if(ord_p && ord_p.discount_field>0){
+ ordprom_price_type=ord_p.discount_field
+ }
+ }
+ }
+ if(ordprom_price_type>0){
+ //-- 看一下订单促销的取价规则 --
+ switch (ordprom_price_type){
+ case 1:
+ if (good.goods_price != gg.shop_price) isok = 0;
+ break;
+ case 2:
+ if (good.goods_price != gg.market_price) isok = 0;
+ break;
+ }
+
+ }else{
+ if (card_field && gg[card_field] > 0) {
+ if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
+ if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+
+ } else {
+ if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
+ if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+ }
}
+
+
+
+
}else{
if(good.prom_type==3 || good.prom_type==10 ){
diff --git a/utils/more_cx.js b/utils/more_cx.js
index 05b3afe..e1f2e3c 100644
--- a/utils/more_cx.js
+++ b/utils/more_cx.js
@@ -36,6 +36,7 @@ module.exports = {
}
return 0;
}
+
var goods =gdlist;
var all_num=0;
var need_to_buy=0;