Commit 657118ac by 高淑倩

实付款

parent a566706a
......@@ -60,10 +60,24 @@ Component({
})
couponList[index].checked = true
let params = {
type,
faceAmount: ''
}
if(type == 1){
params.faceAmount = couponList[index].couponSettingDTO.faceAmount
} else if(type == 2){
params.faceAmount = couponList[index].couponSettingDTO.faceAmount
}
wxService.nextTick(() => {
this.triggerEvent('updateCoupon', couponList[index].couponDiscount)
this.triggerEvent('updateCoupon', params)
})
// wxService.nextTick(() => {
// this.triggerEvent('updateCoupon', couponList[index].couponDiscount)
// })
this.setData({
couponList
},()=>{
......
......@@ -20,7 +20,8 @@ wxService.page({
cityView: '',
multiIndex: [0, 0, 0],
selectCityName: ['', ''],
currentCoupon: '无可用优惠券'
currentCoupon: '',
orderPrice: null, // 订单金额
},
/**
......@@ -63,14 +64,34 @@ wxService.page({
// 地址列表
this.getAddressList()
},
updateCoupon(e){
updateCoupon(e) {
console.log('e', e.detail)
if(e.detail){
// faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券
const { faceAmount, type } = e.detail
const { orderPrice } = this.data
if (type == 1) {
this.setData({
haveCoupon: true,
currentCoupon: `- ${e.detail}`
currentCoupon: `${faceAmount / 100}`
})
} else if (type == 2) {
let discounPrice = (faceAmount / 100) * (orderPrice)
let spread = Math.round(orderPrice - discounPrice)
this.setData({
haveCoupon: true,
currentCoupon: `${spread}`
})
}
// 实付款
this.setPayPrice()
},
setPayPrice() {
const { currentCoupon, orderPrice } = this.data
let orderCoupon = parseFloat(currentCoupon)
this.setData({
orderPrice: Math.round(orderPrice - currentCoupon)
})
},
formSubmit(e) {
const { goodsAddress } = this.data
......@@ -230,7 +251,10 @@ wxService.page({
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
this.setData({ currentOrderList: data })
this.setData({
currentOrderList: data,
orderPrice: data.amount
})
}
}
})
......
<!--pages/confirmOrder/confirmOrder.wxml-->
<wxs src="../..//wxs/utils.wxs" module="utils" />
<view class="page-confirm-order">
<form bindsubmit="formSubmit">
<view class="address-wrap">
......@@ -122,7 +124,7 @@
<view>
<text class="price-label">优惠券</text>
<view class="select-coupon" bindtap="selectCoupon">
<text class="{{haveCoupon ? 'coupon-price' : 'no-coupon'}}">{{currentCoupon}}</text>
<text class="{{haveCoupon ? 'coupon-price' : 'no-coupon'}}"> {{currentCoupon ? '-' : '无可用优惠券'}} {{currentCoupon}}</text>
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />
</view>
</view>
......@@ -147,7 +149,7 @@
<view class="pro-footer">
<view class="cost">
<text class="cost-label">实付款:</text>
<text class="cost-price">¥{{currentOrderList.amount}}</text>
<text class="cost-price">¥{{utils.numberFormat(orderPrice)}}</text>
</view>
<!-- <button form-type="submit" class="theme-color buy-btn">立即购买</button>-->
<!-- <view class="theme-color buy-btn" bindtap="handelGobuy">立即购买</view> -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment