|
|
@ -57,12 +57,16 @@ Page({ |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
smoothlyTotal: e.detail.total |
|
|
smoothlyTotal: e.detail.total |
|
|
}); |
|
|
}); |
|
|
|
|
|
console.log(123456) |
|
|
// 重新计算总价
|
|
|
// 重新计算总价
|
|
|
this.changePrice(); |
|
|
this.changePrice(); |
|
|
}, |
|
|
}, |
|
|
// 调用子组件清除优惠券方法
|
|
|
// 调用子组件清除优惠券方法
|
|
|
callOtherCompMethod: function(e) { |
|
|
callOtherCompMethod: function(e) { |
|
|
this.couponCom.setNullCoupon() |
|
|
this.couponCom.setNullCoupon() |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
coupon: null |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
handleProduct () { |
|
|
handleProduct () { |
|
|
app.globalData.postProduct.forEach((item,index) => { |
|
|
app.globalData.postProduct.forEach((item,index) => { |
|
|
@ -212,6 +216,15 @@ Page({ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
minus: function (e) { |
|
|
minus: function (e) { |
|
|
|
|
|
if(this.data.coupon){ |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '订单价格发生变化,请重新选择优惠券', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
this.couponCom.setNullCoupon() |
|
|
|
|
|
app.globalData.couponInfo = null; |
|
|
|
|
|
|
|
|
let index = e.currentTarget.dataset.index, product = this.data.product; |
|
|
let index = e.currentTarget.dataset.index, product = this.data.product; |
|
|
let productNum = product[index].productNum; |
|
|
let productNum = product[index].productNum; |
|
|
if (productNum <= 1) return; |
|
|
if (productNum <= 1) return; |
|
|
@ -237,10 +250,6 @@ Page({ |
|
|
changePrice: function () { |
|
|
changePrice: function () { |
|
|
let product = this.data.product, price = 0, allPrice = 0; |
|
|
let product = this.data.product, price = 0, allPrice = 0; |
|
|
|
|
|
|
|
|
// 顺手购价格
|
|
|
|
|
|
price += this.data.smoothlyTotal || 0; |
|
|
|
|
|
allPrice = price |
|
|
|
|
|
|
|
|
|
|
|
product.map(item => { |
|
|
product.map(item => { |
|
|
price = price + item.sku.price * item.productNum; |
|
|
price = price + item.sku.price * item.productNum; |
|
|
if (this.data.allowance_data && this.data.select_allowance && this.data.allowance_price) { |
|
|
if (this.data.allowance_data && this.data.select_allowance && this.data.allowance_price) { |
|
|
@ -248,19 +257,27 @@ Page({ |
|
|
price -= this.data.allowance_price * item.productNum < spread_price ? this.data.allowance_price * item.productNum : spread_price |
|
|
price -= this.data.allowance_price * item.productNum < spread_price ? this.data.allowance_price * item.productNum : spread_price |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
if (this.data.coupon && this.data.showPrice != price) { |
|
|
|
|
|
wx.showToast({ |
|
|
allPrice = price |
|
|
title: '订单价格发生变化,请重新选择优惠券', |
|
|
|
|
|
icon: 'none' |
|
|
// 顺手购价格
|
|
|
}) |
|
|
if (!this.data.coupon) { |
|
|
app.globalData.couponInfo = null; |
|
|
price += this.data.smoothlyTotal || 0; |
|
|
if (!this.data.kjId && !this.data.gp_id) { |
|
|
|
|
|
this.couponCom.setNullCoupon() |
|
|
|
|
|
} |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
coupon: null |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if (this.data.coupon && this.data.showPrice != price) {
|
|
|
|
|
|
// wx.showToast({
|
|
|
|
|
|
// title: '订单价格发生变化,请重新选择优惠券',
|
|
|
|
|
|
// icon: 'none'
|
|
|
|
|
|
// })
|
|
|
|
|
|
// app.globalData.couponInfo = null;
|
|
|
|
|
|
// if (!this.data.kjId && !this.data.gp_id) {
|
|
|
|
|
|
// this.couponCom.setNullCoupon()
|
|
|
|
|
|
// }
|
|
|
|
|
|
// this.setData({
|
|
|
|
|
|
// coupon: null
|
|
|
|
|
|
// })
|
|
|
|
|
|
// }
|
|
|
this.setData({ |
|
|
this.setData({ |
|
|
showPrice: app.globalData.kjId ? 0 : price |
|
|
showPrice: app.globalData.kjId ? 0 : price |
|
|
}) |
|
|
}) |
|
|
@ -568,6 +585,8 @@ Page({ |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
coupon:e.detail |
|
|
coupon:e.detail |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.changePrice() |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|