Commit 31fea55a31d472f0ff31917e66dae78faf73e24e

Authored by 前端开发-罗建龙
1 parent e76dc5d7

oa优惠

packageE/pages/cart/cart2/cart2.js
@@ -147,7 +147,8 @@ Page({ @@ -147,7 +147,8 @@ Page({
147 appoint_pick_keyid: '', 147 appoint_pick_keyid: '',
148 is_pre_cut:0, //是否可以使用预存 0是不可以1的可以 148 is_pre_cut:0, //是否可以使用预存 0是不可以1的可以
149 149
150 - coll_prom:{} //搭配活动存储 150 + coll_prom:{}, //搭配活动存储
  151 + yh_is_xz_yh:{},//优惠促销优惠券使用开关
151 152
152 }, 153 },
153 onLoad: function (t) { 154 onLoad: function (t) {
@@ -754,23 +755,23 @@ Page({ @@ -754,23 +755,23 @@ Page({
754 } 755 }
755 }) 756 })
756 } 757 }
757 - 758 +
758 //要把优惠活动加入,prom_goods_map中,赠品不要运算,代发商品不算优惠 759 //要把优惠活动加入,prom_goods_map中,赠品不要运算,代发商品不算优惠
759 if (item1.prom_type == 3 && item1.is_gift != 1 && !item1.whsle_id) { 760 if (item1.prom_type == 3 && item1.is_gift != 1 && !item1.whsle_id) {
760 // th.check_is_youhui(item1.goods_id, item1.pick_id); 761 // th.check_is_youhui(item1.goods_id, item1.pick_id);
761 //增加优惠活动次数限制 762 //增加优惠活动次数限制
762 - let limit_num= await th.getprom(item1.prom_id) //活动限制次数 763 + let limit_num= await th.getprom(item1) //活动限制次数
763 764
764 if(!limit_num){ 765 if(!limit_num){
765 await th.add_prom_goods_map(item1); 766 await th.add_prom_goods_map(item1);
766 - item1.prom_id=''  
767 - item1.prom_type='' 767 + // item1.prom_id=''
  768 + // item1.prom_type=''
768 }else{ 769 }else{
769 - let user_pre_buynum = await th.getUserBuyPromNum_pre(item1.prom_id) //用户已经参与次数  
770 - 770 + let user_pre_buynum = await th.getUserBuyPromNum_pre(item1.prom_id) //用户已经参与次数
771 if(user_pre_buynum<limit_num){ 771 if(user_pre_buynum<limit_num){
772 await th.add_prom_goods_map(item1); 772 await th.add_prom_goods_map(item1);
773 }else{ 773 }else{
  774 + // await th.add_prom_goods_map(item1);
774 item1.prom_id='' 775 item1.prom_id=''
775 item1.prom_type='' 776 item1.prom_type=''
776 } 777 }
@@ -5560,6 +5561,9 @@ Page({ @@ -5560,6 +5561,9 @@ Page({
5560 arr.prom_price=null; 5561 arr.prom_price=null;
5561 arr.prom_id=""; 5562 arr.prom_id="";
5562 arr.prom_type=""; 5563 arr.prom_type="";
  5564 + if(prom.is_xz_yh){
  5565 + arr.is_xz_yh=prom.is_xz_yh
  5566 + }
5563 func(arr); 5567 func(arr);
5564 }else{ 5568 }else{
5565 let min_value = 0 5569 let min_value = 0
@@ -5717,12 +5721,20 @@ Page({ @@ -5717,12 +5721,20 @@ Page({
5717 return user_pre_buynum 5721 return user_pre_buynum
5718 }, 5722 },
5719 //获取优惠活动 5723 //获取优惠活动
5720 - async getprom(prom_id){ 5724 + async getprom(item){
  5725 +
  5726 + let prom_id=item.prom_id
  5727 + let pickup_id=item.pick_id
5721 let limit_num=0 5728 let limit_num=0
5722 await getApp().request.promiseGet("/api/weshop/promgoods/get/" + oo.stoid + "/" + prom_id, {}).then(res => { 5729 await getApp().request.promiseGet("/api/weshop/promgoods/get/" + oo.stoid + "/" + prom_id, {}).then(res => {
5723 if (res.data.code == 0) { 5730 if (res.data.code == 0) {
5724 let prom = res.data.data; 5731 let prom = res.data.data;
5725 limit_num =prom.limit_num 5732 limit_num =prom.limit_num
  5733 + let yh_is_xz_yh=this.data.yh_is_xz_yh
  5734 + yh_is_xz_yh[pickup_id]=prom.is_xz_yh
  5735 + this.setData({
  5736 + ['yh_is_xz_yh']:yh_is_xz_yh
  5737 + })
5726 } 5738 }
5727 }) 5739 })
5728 return limit_num 5740 return limit_num
packageE/pages/cart/cart2/cart2.wxml
@@ -241,7 +241,7 @@ @@ -241,7 +241,7 @@
241 </view> 241 </view>
242 242
243 <!-----使用优惠券------> 243 <!-----使用优惠券------>
244 - <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" wx:if="{{(item.quan_list && item.quan_list.length>0) || get_by_quan_list_cart[item.pickup_id]!=null && item.can_num>0}}" data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}"> 244 + <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" wx:if="{{!(yh_is_xz_yh[item.pickup_id]) && ((item.quan_list && item.quan_list.length>0 ) || get_by_quan_list_cart[item.pickup_id]!=null && item.can_num>0)}}" data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}">
245 <view class="work-frame flex-space-between"> 245 <view class="work-frame flex-space-between">
246 <view class="work">优惠券<text class="quan_num_show fs20">{{item.can_num}}张可用</text></view> 246 <view class="work">优惠券<text class="quan_num_show fs20">{{item.can_num}}张可用</text></view>
247 <view class="xc-right-frame"> 247 <view class="xc-right-frame">