Commit 541aee9afd46762292647ec82dde650ae957a203
1 parent
0551117b
购物车使用优惠券
Showing
2 changed files
with
19 additions
and
6 deletions
pages/cart/cart2/cart2.js
@@ -332,17 +332,30 @@ Page({ | @@ -332,17 +332,30 @@ Page({ | ||
332 | 332 | ||
333 | break; | 333 | break; |
334 | case 1: //---秒杀----- | 334 | case 1: //---秒杀----- |
335 | + var quanlist=null; | ||
335 | getApp().request.get("/api/weshop/activitylist/getSJGoodsPrice/"+gd.store_id | 336 | getApp().request.get("/api/weshop/activitylist/getSJGoodsPrice/"+gd.store_id |
336 | + "/" + gd.goods_id + "/1/" + gd.prom_id,{ | 337 | + "/" + gd.goods_id + "/1/" + gd.prom_id,{ |
337 | - success: function (tt) { | 338 | + success: async function (tt) { |
338 | if(tt.data.code==0){ | 339 | if(tt.data.code==0){ |
339 | - t.data.data.shop_price=tt.data.data.prom_price; | 340 | + t.data.data.shop_price=tt.data.data.prom_price; |
340 | }else{ | 341 | }else{ |
341 | - t.data.data.prom_id = 0; t.data.data.prom_type = 0; | 342 | + t.data.data.prom_id = 0; t.data.data.prom_type = 0; |
343 | + | ||
344 | + th.data.ckeck_quan_price=t.data.data.shop_price*gg.goods_num; | ||
345 | + th.data.check_quan_price_list=t.data.data.shop_price*gg.goods_num+""; | ||
346 | + th.data.check_quan_ware_list=t.data.data.erpwareid+""; | ||
347 | + | ||
348 | + var url="/api/weshop/couponList/getUseCouponList"; | ||
349 | + await app.request.promiseGet(url,{ | ||
350 | + data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:th.data.ckeck_quan_price,WareIds:th.data.check_quan_ware_list,pageSize:100} | ||
351 | + }).then(res=>{ | ||
352 | + if(res.data.code==0) | ||
353 | + quanlist=res.data.data.pageData; | ||
354 | + }) | ||
342 | } | 355 | } |
343 | th.setData({ | 356 | th.setData({ |
344 | bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, | 357 | bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, |
345 | - bn_pick: gg.pick_id, bn_t_exp_t: distr_t | 358 | + bn_pick: gg.pick_id, bn_t_exp_t: distr_t,selected_quan_list:quanlist |
346 | }); | 359 | }); |
347 | //计算价格 | 360 | //计算价格 |
348 | th.calculatePrice2(); | 361 | th.calculatePrice2(); |
pages/cart/cart2/cart2.wxml
@@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
54 | 54 | ||
55 | <!-----使用优惠券------> | 55 | <!-----使用优惠券------> |
56 | <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" | 56 | <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" |
57 | - wx:if="{{item.quan_list}}" data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}"> | 57 | + wx:if="{{item.quan_list && item.quan_list.length>0 }}" data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}"> |
58 | <view class="work-frame flex-space-between"> | 58 | <view class="work-frame flex-space-between"> |
59 | <view class="work">使用优惠券</view> | 59 | <view class="work">使用优惠券</view> |
60 | <view class="xc-right-frame"> | 60 | <view class="xc-right-frame"> |
@@ -127,7 +127,7 @@ | @@ -127,7 +127,7 @@ | ||
127 | </view> | 127 | </view> |
128 | 128 | ||
129 | <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" | 129 | <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" |
130 | - wx:if="{{selected_quan_list}}"> | 130 | + wx:if="{{selected_quan_list && selected_quan_list.length>0}}"> |
131 | <view class="work-frame flex-space-between"> | 131 | <view class="work-frame flex-space-between"> |
132 | <view class="work"> | 132 | <view class="work"> |
133 | 使用优惠券 | 133 | 使用优惠券 |