Commit aedf9e9aeb2fc0c35548ea444cb0e8d93057d743

Authored by yvan.ni
1 parent 3137e206

在切换标签的时候,和点击参与不参与的时候,不再调用buy_pro_group来获取多活动

packageE/pages/cart/cart2/cart2.js
... ... @@ -1027,39 +1027,43 @@ Page({
1027 1027 //-- 判断组合购是总数量是不是存在 --
1028 1028 var no_zh_num={};
1029 1029 //-- 多促销活动调用接口需要的参数,和商品的购买数量和活动的购买数量的请求参数 --
1030   - var dug_cx_arr = [];
1031   - //获取 限购 和 多活动的促销---2024-2-1
1032   - for (var i = 0; i < carr.length; i++) {
1033 1030  
1034   - let item1 = carr[i];
1035   - //如果不是活动的时候,不是代发商品的时候,不是赠品的时候,不是阶梯商品拆分的,不是组合购拆分的
1036   - if([1, 2, 4, 6, 8, 9].indexOf(item1.prom_type)== -1 && !item1.whsle_id
1037   - && !item1.is_gift && !item1.is_ld_split && !item1.is_zh_split ){
1038   - //-- 快速查找,组装查询多活动的列表 --
1039   - let f_idx=dug_cx_arr.findIndex(function (ele) {
1040   - return ele.goods_id == item1.goods_id
1041   - });
1042   - if(f_idx==-1) {
1043   - let gd_ite={
1044   - goods_id:carr[i].goods_id,
1045   - goods_num:1,
1046   - is_limit_show:1,
1047   - is_state:0
  1031 + if(!is_change){
  1032 + var dug_cx_arr = [];
  1033 + //获取 限购 和 多活动的促销---2024-2-1
  1034 + for (var i = 0; i < carr.length; i++) {
  1035 +
  1036 + let item1 = carr[i];
  1037 + //如果不是活动的时候,不是代发商品的时候,不是赠品的时候,不是阶梯商品拆分的,不是组合购拆分的
  1038 + if([1, 2, 4, 6, 8, 9].indexOf(item1.prom_type)== -1 && !item1.whsle_id
  1039 + && !item1.is_gift && !item1.is_ld_split && !item1.is_zh_split ){
  1040 + //-- 快速查找,组装查询多活动的列表 --
  1041 + let f_idx=dug_cx_arr.findIndex(function (ele) {
  1042 + return ele.goods_id == item1.goods_id
  1043 + });
  1044 + if(f_idx==-1) {
  1045 + let gd_ite={
  1046 + goods_id:carr[i].goods_id,
  1047 + goods_num:1,
  1048 + is_limit_show:1,
  1049 + is_state:0
  1050 + }
  1051 + dug_cx_arr.push(gd_ite);
1048 1052 }
1049   - dug_cx_arr.push(gd_ite);
  1053 +
1050 1054 }
1051 1055  
  1056 + if(is_change){
  1057 + carr[i].collocationList=null;
  1058 + }
1052 1059 }
1053   -
1054   - if(is_change){
1055   - carr[i].collocationList=null;
  1060 + //-- 对商品的多促销进行判断 ---2024-2-1--
  1061 + if(dug_cx_arr.length){
  1062 + await th.buy_pro_group(dug_cx_arr,carr);
1056 1063 }
1057 1064 }
1058 1065  
1059   - //-- 对商品的多促销进行判断 ---2024-2-1--
1060   - if(dug_cx_arr.length){
1061   - await th.buy_pro_group(dug_cx_arr,carr);
1062   - }
  1066 +
1063 1067 //在分组的时候,就不要再调用接口,await
1064 1068 for (var i = 0; i < carr.length; i++) {
1065 1069 var item = carr[i];
... ... @@ -2477,9 +2481,9 @@ Page({
2477 2481  
2478 2482 ord_goods.splice(pos+1,0,newd);
2479 2483 th.data.old_cartlist[i].goods.splice(pos2+1,0,newd);
2480   -
2481   - var txt9 = "cartlist[" + i + "].goods["+(pos+1)+"]";
2482   - th.setData({ [txt9]: newd })
  2484 + var txt9 = "cartlist[" + i + "].goods";
  2485 + th.setData({ [txt9]: ord_goods })
  2486 +
2483 2487  
2484 2488 }
2485 2489  
... ... @@ -8610,6 +8614,11 @@ Page({
8610 8614 //--- 不参与优惠促销的开关 ---
8611 8615 no_cj_prom: function (e) {
8612 8616  
  8617 + //重新调用cart_next,进行下一步计算
  8618 + wx.showLoading({
  8619 + title: "处理中.",
  8620 + })
  8621 +
8613 8622 this.setData({
8614 8623 send_lb:{},
8615 8624 month_lb:{},
... ... @@ -8693,10 +8702,7 @@ Page({
8693 8702 th.data.cartlist_y = JSON.parse(JSON.stringify(n_goods))
8694 8703  
8695 8704  
8696   - //重新调用cart_next,进行下一步计算
8697   - wx.showLoading({
8698   - title: "处理中.",
8699   - })
  8705 +
8700 8706 this.get_cart_next(null, 1, {prom_type: 0, prom_id: 0});
8701 8707  
8702 8708  
... ...
packageE/pages/cart/cart2/cart2.wxml
... ... @@ -122,7 +122,7 @@
122 122  
123 123  
124 124 <!-- 多个活动的时候 -->
125   - <block wx:if="{{item.show_can_cx[items.goods_id].act_arr.length>1}}">
  125 + <block wx:if="{{item.show_can_cx[items.goods_id].act_arr.length>1 && !items.is_gift}}">
126 126 <!-- 组合购和阶梯促销要特殊出来 -->
127 127 <block wx:if="{{item.show_can_cx[items.goods_id].sele_prom_type==7 || item.show_can_cx[items.goods_id].sele_prom_type==10 }}">
128 128  
... ... @@ -210,7 +210,7 @@
210 210 </view>
211 211 </block>
212 212 <block wx:else>
213   - <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1 && util.check_is_last(index,items.goods_id) }}" >
  213 + <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1 && util.check_is_last(index,items.goods_id) && !items.is_gift }}" >
214 214 <view bindtap="switch_cx_group"
215 215 data-index="{{pidx}}"
216 216 data-gd_key="{{index}}"
... ... @@ -563,7 +563,6 @@
563 563 </view>
564 564 </block>
565 565  
566   -
567 566 <block wx:if="{{collocation_goods}}">
568 567 <!-- 搭配购买的功能实现 -->
569 568 <view class="order-detail" wx:for="{{collocation_goods}}">
... ...