diff --git a/components/promate_pop/promate_pop.js b/components/promate_pop/promate_pop.js index 20b5f4b..65c7b26 100644 --- a/components/promate_pop/promate_pop.js +++ b/components/promate_pop/promate_pop.js @@ -1,3 +1,4 @@ +const ut = require("../../utils/util.js"); Component({ /*** 页面的初始数据***/ data: { @@ -8,7 +9,9 @@ Component({ }, methods: { //-- 初始化弹出框 -- - set_init(type,cx_prom_group,is_cart){ + set_init(type,cx_prom_group0,is_cart){ + + var cx_prom_group=JSON.parse(JSON.stringify(cx_prom_group0)); if(!type) type=0; if(!is_cart) is_cart=0; @@ -18,6 +21,33 @@ Component({ if(fd==-1){ cx_prom_group[0].sele=1; } + + //-- 优惠促销要重新组装 -- + var yh_index=cx_prom_group.findIndex(function (p_time){ + return p_time.prom_type==3; + }) + if(yh_index>-1){ + var prom_list=cx_prom_group[yh_index].promGoodsListsDtos; + //规格参数 + cx_prom_group[yh_index].more=ut.format_yh_act(prom_list[0]); + cx_prom_group[yh_index].yh_index=0; //优惠阶梯 + + + if(prom_list.length){ + for(var i=1;i{{bm.text}} {{bm.text}} {{bm.text}} + data-index="{{item.yh_index}}" data-prom="{{bm.prom_id}}" >{{bm.text}} {{bm.text}} @@ -54,7 +54,7 @@ - + Γ diff --git a/components/promate_pop/promate_pop.wxss b/components/promate_pop/promate_pop.wxss index d3d9088..26beebe 100644 --- a/components/promate_pop/promate_pop.wxss +++ b/components/promate_pop/promate_pop.wxss @@ -24,6 +24,8 @@ display: flex; justify-content: center; overflow: hidden; */ + max-height: 580rpx; + overflow-y: auto; } .xc-top-content { diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index fee3c64..cb88906 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -7749,10 +7749,11 @@ Page({ //--- 选择回来时候的选择 --- sure_cx_group:function(e){ var th=this; - var sele_idx=e.detail.sele_idx; + //选中的活动类型 + var sele_prom_type=e.detail.sele_prom_type; + //-- 获取到当前的show_can_cx-- var idx=this.data.sele_cx_group_cidx; var gd_key= this.data.cx_group_gd_key; - //-- 获取到-- var cx_prom_group=this.data.cartlist[idx].show_can_cx[gd_key].act_arr; var pk=this.data.cartlist[idx].pickup_id; @@ -7764,10 +7765,12 @@ Page({ th.data.prom_goods_map={}; + //-- 获取第一次选中的 -- var fir_sele=0; for(var dx=0;dx -1) { var cx_arr = await getApp().get_has_cx_act(a.goods_id); @@ -4066,7 +4066,7 @@ Page({ } var t_zp_num = parseInt(discount.zp_num) * parseInt(discount.bs); - if (th.data.duo_zp_num_arr[prom.id]) { + if (th.data.duo_zp_num_arr && th.data.duo_zp_num_arr[prom.id]) { t_zp_num += th.data.duo_zp_num_arr[prom.id]; } @@ -4075,6 +4075,7 @@ Page({ json.prom_id = prom.id; json.prom_name = prom.name; send_gift_arr.push(json); + if(!th.data.duo_zp_num_arr) th.data.duo_zp_num_arr={}; th.data.duo_zp_num_arr[prom.id] = t_zp_num; } @@ -4656,17 +4657,16 @@ Page({ //--- 选择回来时候的选择 --- sure_cx_group: function (e) { var th = this; - var sele_idx = e.detail.sele_idx; + var sele_prom_type=e.detail.sele_prom_type; + //-- 获取到当前的 show_can_cx-- var idx = this.data.sele_cx_group_cidx; var gd_key = this.data.cx_group_gd_key; - //-- 获取到-- var cx_prom_group = this.data.requestData[idx].show_can_cx[gd_key].act_arr; var fir_sele = 0; - for (var dx = 0; dx < cx_prom_group.length; dx++) { if (cx_prom_group[dx].sele) fir_sele = dx; - if (dx != sele_idx) cx_prom_group[dx].sele = 0; + if (cx_prom_group[dx].prom_type!= sele_prom_type) cx_prom_group[dx].sele = 0; else cx_prom_group[dx].sele = 1; } diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 517e477..a814552 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -7619,84 +7619,85 @@ Page({ await this.getUserBuyPromNum_pre(fir_act.prom_id); if (!fir_act.limit_num || th.data.user_pre_buynum < fir_act.limit_num) { - var more_arr = []; - //减价 - if (fir_act.money > 0){ - - more_arr.push({ - text:'减价' + fir_act.money + '元', - is_fir:1 - }); - } - if (fir_act.sale > 0) { - more_arr.push({ - text:'打' + fir_act.sale + '折', - is_fir:1 - }); - } - if (fir_act.past == 1) { - more_arr.push({ - text:'包邮', - is_fir:1 - }); - } - if (fir_act.intValue > 0){ - more_arr.push({ - text:'送' + fir_act.intValue + '积分', - is_fir:1 - }); - } - if (fir_act.couponId > 0) { - more_arr.push({ - text:'送' + fir_act.couponMoney + '元优惠券', - is_quan:1 - }); - } - - if (fir_act.gift_id) { - var is_more_gf = fir_act.gift_id.split(',') - if (is_more_gf.length > 1) { - more_arr.push({ - text:'送赠品', - is_gift:1, - prom_id:fir_act.prom_id - }); - } else { - more_arr.push({ - text:'送' + fir_act.goods_name + ' x' + fir_act.zp_num, - is_gift:1, - prom_id:fir_act.prom_id - }); - } - } - if (fir_act.lb_id){ - more_arr.push({ - text:'送' + fir_act.lbtitle, - lb_id:fir_act.lb_id - }); - } - if (fir_act.zxlb_id){ - more_arr.push({ - text:'送' + fir_act.zxlbtitle, - zxlb_id:fir_act.zxlb_id - }); - } - if (fir_act.monthgiftbag_id){ - more_arr.push({ - text:'送' + fir_act.monthgiftbag_title, - monthgiftbag_id:fir_act.monthgiftbag_id - }); - } - + // var more_arr = []; + // //减价 + // if (fir_act.money > 0){ + // + // more_arr.push({ + // text:'减价' + fir_act.money + '元', + // is_fir:1 + // }); + // } + // if (fir_act.sale > 0) { + // more_arr.push({ + // text:'打' + fir_act.sale + '折', + // is_fir:1 + // }); + // } + // if (fir_act.past == 1) { + // more_arr.push({ + // text:'包邮', + // is_fir:1 + // }); + // } + // if (fir_act.intValue > 0){ + // more_arr.push({ + // text:'送' + fir_act.intValue + '积分', + // is_fir:1 + // }); + // } + // if (fir_act.couponId > 0) { + // more_arr.push({ + // text:'送' + fir_act.couponMoney + '元优惠券', + // is_quan:1 + // }); + // } + // + // if (fir_act.gift_id) { + // var is_more_gf = fir_act.gift_id.split(',') + // if (is_more_gf.length > 1) { + // more_arr.push({ + // text:'送赠品', + // is_gift:1, + // prom_id:fir_act.prom_id + // }); + // } else { + // more_arr.push({ + // text:'送' + fir_act.goods_name + ' x' + fir_act.zp_num, + // is_gift:1, + // prom_id:fir_act.prom_id + // }); + // } + // } + // if (fir_act.lb_id){ + // more_arr.push({ + // text:'送' + fir_act.lbtitle, + // lb_id:fir_act.lb_id + // }); + // } + // if (fir_act.zxlb_id){ + // more_arr.push({ + // text:'送' + fir_act.zxlbtitle, + // zxlb_id:fir_act.zxlb_id + // }); + // } + // if (fir_act.monthgiftbag_id){ + // more_arr.push({ + // text:'送' + fir_act.monthgiftbag_title, + // monthgiftbag_id:fir_act.monthgiftbag_id + // }); + // } + var more_arr=ut.format_yh_act(fir_act); //-- 开始组装数据 -- th.add_cx_prom_group({ id: fir_act.prom_id, condition: fir_act.condition + (fir_act.prom_type == 1 ? '件' : '元'), limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'), more: more_arr, - prom_type: 3 - + prom_type: 3, + promGoodsListsDtos:r_data.promGoodsLists }); + } } diff --git a/utils/util.js b/utils/util.js index c2133f8..7f06b05 100644 --- a/utils/util.js +++ b/utils/util.js @@ -799,6 +799,80 @@ module.exports = { return false }, + //优惠促销的数据的格式话 + format_yh_act(fir_act){ + var more_arr = []; + if(fir_act){ + //减价 + if (fir_act.money > 0){ + + more_arr.push({ + text:'减价' + fir_act.money + '元', + is_fir:1 + }); + } + if (fir_act.sale > 0) { + more_arr.push({ + text:'打' + fir_act.sale + '折', + is_fir:1 + }); + } + if (fir_act.past == 1) { + more_arr.push({ + text:'包邮', + is_fir:1 + }); + } + if (fir_act.intValue > 0){ + more_arr.push({ + text:'送' + fir_act.intValue + '积分', + is_fir:1 + }); + } + if (fir_act.couponId > 0) { + more_arr.push({ + text:'送' + fir_act.couponMoney + '元优惠券', + is_quan:1 + }); + } + + if (fir_act.gift_id) { + var is_more_gf = fir_act.gift_id.split(',') + if (is_more_gf.length > 1) { + more_arr.push({ + text:'送赠品', + is_gift:1, + prom_id:fir_act.prom_id + }); + } else { + more_arr.push({ + text:'送' + fir_act.goods_name + ' x' + fir_act.zp_num, + is_gift:1, + prom_id:fir_act.prom_id + }); + } + } + if (fir_act.lb_id){ + more_arr.push({ + text:'送' + fir_act.lbtitle, + lb_id:fir_act.lb_id + }); + } + if (fir_act.zxlb_id){ + more_arr.push({ + text:'送' + fir_act.zxlbtitle, + zxlb_id:fir_act.zxlb_id + }); + } + if (fir_act.monthgiftbag_id){ + more_arr.push({ + text:'送' + fir_act.monthgiftbag_title, + monthgiftbag_id:fir_act.monthgiftbag_id + }); + } + } + return more_arr + }, unserialize: unserialize, _throttle:_throttle,