diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js
index a6bedcb..00566c4 100644
--- a/pages/goods/goodsInfo/goodsInfo.js
+++ b/pages/goods/goodsInfo/goodsInfo.js
@@ -268,6 +268,8 @@ Page({
base_nor_prom_id:0,
base_nor_goods_id:0,
user_pre_buynum:0, //用户优惠促销参与次数
+
+ cx_prom_group:[], //促销活动,用于显示和判断默认要用什么促销活动
},
//------初始化加载----------
@@ -2768,26 +2770,11 @@ Page({
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;
}
})
@@ -3294,7 +3281,7 @@ Page({
//普通商品多规格的时候,商品切换
- if([1,2,4,8,9].indexOf(this.data.base_nor_prom_type)==-1){
+ if([1,2,4,6,8,9].indexOf(this.data.base_nor_prom_type)==-1){
this.setData({
prom_goods:null,
jieti_prom:null,
@@ -3337,7 +3324,7 @@ Page({
if (nor) that.get_sto(1);
else that.get_sto();
- if (!item.whsle_id) that.check_is_youhui(gid, that.data.is_normal);
+
//默认门店要拿下门店库存
if (that.data.sales_rules >= 2 && that.data.def_pick_store && !that.data.sele_g.whsle_id) {
@@ -3356,7 +3343,7 @@ Page({
this.sele_spec_chech_activity(nor);
//如果是秒杀,拼团等互动,就不重新算界面
- if([1,2,4,8,9].indexOf(this.data.base_nor_prom_type)>0){ return false; }
+ if([1,2,4,6,8,9].indexOf(this.data.base_nor_prom_type)>0){ return false; }
this.check_has_flash(gid);
var url = '/api/weshop/activitylist/listGoodActInfo2New';
@@ -3376,6 +3363,8 @@ Page({
var arr3 = arr.filter(function (e) {
return e.s_time < ut.gettimestamp() && e.prom_type==7;
})
+
+ //-- 组合购要在面前计算 --,计算完之后,再来计算check_is_youhui --
if(arr3 && arr3.length>0){
//获取活动信息
var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" +
@@ -3393,10 +3382,12 @@ Page({
});
th.getUserBuyPromNum(e.data.data.id)
}
-
}
+ if (!item.whsle_id) that.check_is_youhui(gid, that.data.is_normal);
}
});
+ }else{
+ if (!item.whsle_id) that.check_is_youhui(gid, that.data.is_normal);
}
}
@@ -7378,6 +7369,17 @@ Page({
}
}
+ //-- 如果有组合购的时候 --
+ if(th.data.zh_act){
+ //-- 开始组装数据 --
+ th.add_cx_prom_group({
+ id: fir_act.prom_id,
+ condition: fir_act.condition + (item.prom_type == 1 ? '件' : '元'),
+ limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'),
+ more: more_arr,
+ prom_type:7
+ });
+ }
//调用接口判断订单优惠,
await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + gid + "/0" + "/" + user_id, {
@@ -7385,13 +7387,8 @@ Page({
if (res.data.code == 0 && res.data.data) {
var r_data = res.data.data;
var max = 0, min = 0;
- //暂时积分够 不和 优惠,阶梯重叠
- if(th.data.zh_act){
- r_data.collocationList=null;
- r_data.ladderLists=null;
- r_data.promGoodsLists=null;
- }
+ //如果是搭配购的时候
if (r_data.collocationList) {
for (var i in r_data.collocationList) {
if (max == 0) max = r_data.collocationList[i].price;
@@ -7402,13 +7399,20 @@ Page({
}
r_data.collocationPromList.max = (max + th.data.data.shop_price).toFixed(2);
r_data.collocationPromList.min = (min + th.data.data.shop_price).toFixed(2);
-
- //如果有搭配促销先不和 阶梯促销和优惠测序重合,做到后台可以重合
- r_data.ladderLists=null;
- r_data.promGoodsLists=null;
+ var show_price= '¥'+r_data.collocationPromList.max+'-'+ r_data.collocationPromList.min;
+ var show_time=ut.formatTime(r_data.collocationPromList.start_time)+"至"+ ut.formatTime(r_data.collocationPromList.end_time);
+
+ //-- 开始组装数据 --
+ th.add_cx_prom_group({
+ id: r_data.collocationPromList.id,
+ title: r_data.collocationPromList.title,
+ show_price: show_price,
+ show_time: show_time,
+ prom_type:5
+ });
}
-
+ //-- 如果是阶梯促销的时候 --
if (r_data.ladderLists) {
var act_id = r_data.ladderLists[0].form_id;
//-- 判断会员能不能参与阶梯促销 --
@@ -7416,15 +7420,6 @@ Page({
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;
- }
-
for (let jj in r_data.ladderLists) {
if (r_data.ladderLists[jj].discount == 10) {
prom_content += "第" + (parseInt(jj) + 1) + "件原价,";
@@ -7433,16 +7428,58 @@ Page({
}
}
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.data.prom_type = 10;
+ // th.data.prom_id = act_id;
+ // th.setData({
+ // jieti_prom: prom_content,
+ // ladder_act_id: act_id
+ // })
+
+ var s_time=res.data.data.start_time;
+ var e_time=res.data.data.end_time;
+ th.add_cx_prom_group({
+ id: act_id,
+ title: prom_content,
+ show_time: ut.formatTime(s_time) + "至" + ut.formatTime(e_time),
+ prom_type:10
+ });
+
}
})
}
+ //优惠促销的时候
+ if (r_data.promGoodsLists) {
+ var fir_act = r_data.promGoodsLists[0];
+ var more_arr = [];
+ //减价
+ if (fir_act.money > 0) more_arr.push('减价'+fir_act.money+'元');
+ if (fir_act.sale > 0) more_arr.push('打'+fir_act.sale+'折');
+ if (fir_act.past ==1) more_arr.push('包邮');
+ if (fir_act.intValue > 0) more_arr.push('送'+fir_act.intValue+'积分');
+ if (fir_act.couponId > 0) more_arr.push('送'+fir_act.couponMoney+'元优惠券');
+ if (fir_act.gift_id) {
+ var is_more_gf=fir_act.gift_id.split(',')
+ if(is_more_gf.length>1){
+ more_arr.push('送赠品');
+ }else{
+ more_arr.push('送'+fir_act.goods_name+' x'+fir_act.zp_num);
+ }
+ }
+ if (fir_act.lb_id) more_arr.push('送'+fir_act.lbtitle);
+ if (fir_act.zxlb_id) more_arr.push('送'+fir_act.zxlbtitle);
+
+ //-- 开始组装数据 --
+ th.add_cx_prom_group( {
+ id: fir_act.prom_id,
+ condition: fir_act.condition + (item.prom_type == 1 ? '件' : '元'),
+ limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'),
+ more: more_arr,
+ prom_type:3
+
+ });
+ }
//普通购买不在界面显示
if(is_nor){
@@ -7456,6 +7493,7 @@ Page({
})
}
th.is_show_more_buy();
+
}
})
@@ -7464,6 +7502,52 @@ Page({
},
+ //获取促销活动的组合
+ add_cx_prom_group(data){
+ var th=this;
+ getApp().getConfig2(function (e) {
+ //需要读者系统顺序
+ var json_d = JSON.parse(e.switch_list);
+ var auto_promote_sale=json_d.auto_promote_sale;
+ if(auto_promote_sale){
+ var auto_promote_sale=auto_promote_sale.split(',');
+ var fd=auto_promote_sale.indexOf(data.prom_type);
+ data.sort=fd;
+ }else{
+ data.sort=data.prom_type;
+ }
+
+ var fdix=th.data.cx_prom_group.findIndex(function (em){
+ return em.prom_type==data.prom_type
+ })
+
+ if(fdix>-1){
+ th.data.cx_prom_group.splice(fdix,1);
+ }
+
+ th.data.cx_prom_group.push(data);
+
+ //-- 排序一下 --
+ function comp(a, b) {
+ return a.sort-b.sort; //升序
+ }
+ var ppdata = this.data.cx_prom_group;
+ //使用sort排序
+ ppdata.sort(comp);
+
+ th.setData({
+ cx_prom_group:ppdata
+ })
+
+ })
+ },
+
+ //-- 获取默认的促销活动的默认活动 --
+ check_prom_custom() {
+ if (!this.data.cx_prom_group.length) return 3;
+ return data[0].prom_type;
+ },
+
closePoster() {
this.setData({
showPoster: false,
@@ -7483,6 +7567,11 @@ Page({
is_show_more_buy: async function () {
var prom_goods = this.data.prom_goods;
+ if(!prom_goods) return false;
+ //如果系统默认的顺序不是以优惠促销为默认第一位的时候
+ if(th.check_prom_custom()!==3){
+ return false;
+ }
var per_price = this.data.sele_g.shop_price
if (this.data.card_field && this.data.sele_g[this.data.card_field] > 0) {
per_price = this.data.sele_g[this.data.card_field];
@@ -7633,7 +7722,7 @@ Page({
});
},
- //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动
+ //-- 积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动,普通购买的时候一定要注意 --
check_nor_promgood(goods_id, back) {
var th=this;
var user_id=getApp().globalData.user_id;
diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml
index 06e2a66..77b20f0 100644
--- a/pages/goods/goodsInfo/goodsInfo.wxml
+++ b/pages/goods/goodsInfo/goodsInfo.wxml
@@ -501,65 +501,65 @@
-
-
-
-
- 促销
-
-
-
-
- 消费满{{item.condition}}{{item.prom_type==1 ? '件':'元'}}享优惠(每人{{item.limit_num ? '限参与'+item.limit_num+'次' : '参与不限次' }})
-
-
-
-
- 减价{{item.money}}元
- 打{{item.sale}}折
- 包邮
- 送{{item.intValue}}积分
- 送{{item.couponMoney}}元优惠券
-
-
- 送赠品
-
-
- 送{{item.goods_name}}
- x{{item.zp_num}}
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- 送{{item.lbtitle}}
- 送{{item.zxlbtitle}}
-
-
-
-
-
-
-
-
-
-
- 阶梯促
-
-
- 阶
- {{jieti_prom}}
-
-
-
-
-
-
-
-
-
订单优惠
@@ -575,27 +575,29 @@
-
-
-
- 组合购
-
-
-
-
-
- {{zh_act.name}}
-
- (活动时间:{{tool.format_tt(zh_act.start_time)}} - {{tool.format_tt(zh_act.end_time)}})
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -617,7 +619,7 @@
团
积
拼
- 预
+ 预
@@ -636,6 +638,29 @@
+
+
+
+ 促销
+
+
+
+
+ 优惠促销
+ 搭配促销
+ 组合购
+ 阶梯促销
+
+
+
+
+
+
+
+
+
+
+
@@ -654,6 +679,9 @@
+
+
+
@@ -704,29 +732,30 @@
-
-
- 优惠热配
-
- 查看全部
-
-
-
-
-
-
-
- {{collocationGoods.title}}
-
- 搭配价¥{{collocationGoods.min}}-{{collocationGoods.max}}
-
- 搭配价¥{{collocationGoods.min}}
-
- 活动至{{filters.format_time(collocationGoods.end_time,1)}}
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/goods/goodsList/goodsList.wxml b/pages/goods/goodsList/goodsList.wxml
index a43abc3..a19238b 100644
--- a/pages/goods/goodsList/goodsList.wxml
+++ b/pages/goods/goodsList/goodsList.wxml
@@ -1,12 +1,13 @@
-
+
+ 每人限参与{{limit_num}}次;
- 每人限参与{{limit_num}}次;
满{{item.condition}}元 件
减{{item.content.money}}元
+ 包邮
打{{item.content.sale}}折
送{{item.content.int}}积分
送{{item.content.coupon}}元优惠券