Browse Source

购物车优惠券

master
nige 3 years ago
parent
commit
476787cbff
  1. 30
      pages/order/orderList/index.js
  2. 4
      pages/order/orderList/index.wxml

30
pages/order/orderList/index.js

@ -17,7 +17,7 @@ Page({
gp_id: null,
showPrice: 0,
postFee: 0,
coupon:null,
coupon:app.globalData.couponInfo,
select_allowance: false,
allowance_data: null,
allowance_price: 0,
@ -35,8 +35,6 @@ Page({
gp_id: app.globalData.gp_id || app.globalData.team_id,
flag:options.flag
})
console.log(this.data.flag);
console.log(app.globalData);
let price = 0, sku_id = [] ,postFee= 0;
app.globalData.postProduct.map(item => {
if (!app.globalData.kjId && !this.data.gp_id) {
@ -107,14 +105,32 @@ Page({
item.remark = e.detail.value;
}
})
},
},
//获取最高优惠券
getNewCoupon(e){
this.setData({
coupon:e.detail
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
coupon: app.globalData.couponInfo
})
try {
if (Object.keys(app.globalData.couponInfo).length!=0) {
this.setData({
coupon: app.globalData.couponInfo
})
}else{
this.setData({
coupon:null
})
}
} catch (error) {
this.setData({
coupon:null
})
}
},
/**

4
pages/order/orderList/index.wxml

@ -52,11 +52,11 @@
<view style="flex-shrink:0">订单备注:</view>
<input type="text" bindinput="inputRemark" data-index="{{index}}" placeholder="选填"></input>
</view>
<coupon id="coupon" wx:if="{{!kjId && !gp_id}}" money="{{showPrice + postFee}}" sku="{{sku_id}}"></coupon>
<coupon bind:getNewCoupon = 'getNewCoupon' id="coupon" wx:if="{{!kjId && !gp_id}}" money="{{showPrice + postFee}}" sku="{{sku_id}}"></coupon>
<view class="fixed-bottom">
<view class="fixed-price-box">
<text>合计</text>
<text>合计:</text>
<text class="price">¥{{((showPrice + postFee - (coupon?coupon.activity.money:0))>0?(showPrice + postFee - (coupon?coupon.activity.money:0)):0)/100}}</text>
</view>
<view class="fixed-btn" bindtap="order">下一步</view>

Loading…
Cancel
Save