|
|
|
@ -28,7 +28,6 @@ Page({ |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
*/ |
|
|
|
onLoad: function (options) { |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
from: options.from, |
|
|
|
kjId: app.globalData.kjId, |
|
|
|
@ -269,38 +268,38 @@ Page({ |
|
|
|
coupon: app.globalData.couponInfo |
|
|
|
}) |
|
|
|
// 获取补贴
|
|
|
|
if (this.data.product.length == 1) { |
|
|
|
commonApi.user_post("product/getProductAllowancePrice", { |
|
|
|
product_code: this.data.product[0].product.product_code |
|
|
|
}).then(resTwo => { |
|
|
|
console.log(resTwo) |
|
|
|
if (resTwo && resTwo.code == 1) { |
|
|
|
this.setData({ |
|
|
|
allowance_data: resTwo.data |
|
|
|
}) |
|
|
|
let spread_price = Number(this.data.allowance_data.discount_limit_price - this.data.allowance_data.user_used_price) |
|
|
|
let sInfo = this.data.product[0].sku |
|
|
|
console.log(9999, this.data.allowance_data.discount_rate / 100 * sInfo.price) |
|
|
|
console.log(9999, spread_price) |
|
|
|
if (spread_price > 0) { |
|
|
|
if (spread_price < this.data.allowance_data.discount_rate / 100 * sInfo.price) { |
|
|
|
this.setData({ |
|
|
|
allowance_price: spread_price |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.setData({ |
|
|
|
allowance_price: this.data.allowance_data.discount_rate / 100 * sInfo.price |
|
|
|
}) |
|
|
|
} |
|
|
|
this.changePrice() |
|
|
|
} else { |
|
|
|
this.setData({ |
|
|
|
allowance_price: 0 |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
// if (this.data.product.length == 1) {
|
|
|
|
// commonApi.user_post("product/getProductAllowancePrice", {
|
|
|
|
// product_code: this.data.product[0].product.product_code
|
|
|
|
// }).then(resTwo => {
|
|
|
|
// console.log(resTwo)
|
|
|
|
// if (resTwo && resTwo.code == 1) {
|
|
|
|
// this.setData({
|
|
|
|
// allowance_data: resTwo.data
|
|
|
|
// })
|
|
|
|
// let spread_price = Number(this.data.allowance_data.discount_limit_price - this.data.allowance_data.user_used_price)
|
|
|
|
// let sInfo = this.data.product[0].sku
|
|
|
|
// console.log(9999, this.data.allowance_data.discount_rate / 100 * sInfo.price)
|
|
|
|
// console.log(9999, spread_price)
|
|
|
|
// if (spread_price > 0) {
|
|
|
|
// if (spread_price < this.data.allowance_data.discount_rate / 100 * sInfo.price) {
|
|
|
|
// this.setData({
|
|
|
|
// allowance_price: spread_price
|
|
|
|
// })
|
|
|
|
// } else {
|
|
|
|
// this.setData({
|
|
|
|
// allowance_price: this.data.allowance_data.discount_rate / 100 * sInfo.price
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// this.changePrice()
|
|
|
|
// } else {
|
|
|
|
// this.setData({
|
|
|
|
// allowance_price: 0
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
|