parseInt 是由于编辑器和真机不太一样;优惠券显示在总金额中

wechat_user_type
Ge Hao 8 years ago
parent 6da827ee3d
commit c682425318
  1. 10
      pages/cart/cart.js
  2. 7
      pages/cart/cart.wxml
  3. 2
      pages/mine/mine.js

@ -124,7 +124,7 @@ Page({
} }
order.postBilling(params, function(result){ order.postBilling(params, function(result){
if (result.statusCode === '403') { if (parseInt(result.statusCode) === 403) {
wx.showModal({ wx.showModal({
title: '出错', title: '出错',
content: result.data.msg, content: result.data.msg,
@ -144,7 +144,11 @@ Page({
showCancel: false, showCancel: false,
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
that.setData({cartItems: []}) that.setData({
cartItems: [],
coupon: null
})
that.changeCartAmount()
} }
} }
}) })
@ -179,7 +183,7 @@ Page({
amount += entry.quantity * entry.product['member-price'] amount += entry.quantity * entry.product['member-price']
}) })
} }
this.setData({amount: amount}) this.setData({amount: amount})
}, },

@ -65,6 +65,11 @@
<view class="billing-btn"> <view class="billing-btn">
<view>总计:¥{{amount}}元</view> <view wx:if="{{coupon}}">
<view>总计:¥{{amount}}元 {{'-' + coupon['coupon-value'] + '元优惠券' }}</view>
</view>
<view wx:else>
<view>总计:¥{{amount}}元</view>
</view>
<button class="button" type='warn' bindtap="bindBilling"> 去支付 </button> <button class="button" type='warn' bindtap="bindBilling"> 去支付 </button>
</view> </view>

@ -105,7 +105,7 @@ Page({
data: {code: app.globalData.code}, data: {code: app.globalData.code},
method: 'POST', method: 'POST',
success: function(res) { success: function(res) {
if (res.statusCode === '200') { if (parseInt(res.statusCode) === 200) {
wx.removeStorage({ key: 'token' }) wx.removeStorage({ key: 'token' })
app.globalData.currentCustomer = null app.globalData.currentCustomer = null
app.globalData.token = null app.globalData.token = null

Loading…
Cancel
Save