Commit 6dc3a2d5 by 高淑倩

coupon

parent 657118ac
......@@ -54,7 +54,7 @@ Component({
// 1 抵用券 2 折扣券
const { id,index,type } = e.currentTarget.dataset
const { couponList } = this.data
console.log('type---1 抵用券 2 折扣券 ', id,index, type)
couponList.forEach(item=>{
item.checked = false
})
......@@ -62,6 +62,7 @@ Component({
let params = {
type,
id,
faceAmount: ''
}
if(type == 1){
......
......@@ -65,22 +65,23 @@ wxService.page({
this.getAddressList()
},
updateCoupon(e) {
console.log('e', e.detail)
// faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券
const { faceAmount, type } = e.detail
const { faceAmount, type, id } = e.detail
const { orderPrice } = this.data
console.log('id', id)
if (type == 1) {
this.setData({
couponId: id,
haveCoupon: true,
currentCoupon: `${faceAmount / 100}`
currentCoupon: `${faceAmount / 100}`
})
} else if (type == 2) {
let discounPrice = (faceAmount / 100) * (orderPrice)
let spread = Math.round(orderPrice - discounPrice)
this.setData({
couponId: id,
haveCoupon: true,
currentCoupon: `${spread}`
currentCoupon: `${spread}`
})
}
// 实付款
......@@ -89,8 +90,9 @@ wxService.page({
setPayPrice() {
const { currentCoupon, orderPrice } = this.data
let orderCoupon = parseFloat(currentCoupon)
console.log('orderPrice - orderCoupon', orderPrice - orderCoupon)
this.setData({
orderPrice: Math.round(orderPrice - currentCoupon)
orderPrice: Math.round(orderPrice - orderCoupon)
})
},
formSubmit(e) {
......
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