|
|
|
@ -74,8 +74,8 @@ Page({ |
|
|
|
// 如果带有指定skuid的话 那么取指定的sku展示
|
|
|
|
if (options.skuid) { |
|
|
|
let pItem = null; |
|
|
|
for (let i = 0; i < res.data.product.length; i++) { |
|
|
|
for (let j = 0; j < res.data.product[i].sku.length; j++) { |
|
|
|
for (let i = 0; i < res.data.product.length; i++) {//3
|
|
|
|
for (let j = 0; j < res.data.product[i].sku.length; j++) {//4
|
|
|
|
if (res.data.product[i].sku[j].id == options.skuid) { |
|
|
|
res.data.product[i].sku = [res.data.product[i].sku[j]]; |
|
|
|
pItem = res.data.product[i]; |
|
|
|
@ -274,7 +274,6 @@ Page({ |
|
|
|
}) |
|
|
|
return; |
|
|
|
} else { |
|
|
|
|
|
|
|
app.globalData.postProduct = [] |
|
|
|
app.globalData.list = [] |
|
|
|
if (this.data.skuFlag == 'order') { |
|
|
|
@ -302,9 +301,10 @@ Page({ |
|
|
|
...sku, |
|
|
|
...product |
|
|
|
} |
|
|
|
wx.navigateTo({ |
|
|
|
url: '/pages/order/scene/index', |
|
|
|
}) |
|
|
|
|
|
|
|
wx.navigateTo({ |
|
|
|
url: '/pages/order/scene/index', |
|
|
|
}) |
|
|
|
} else { |
|
|
|
commonApi.user_post("cart/add_sku", { |
|
|
|
sku_id: this.data.skuList[this.data.skuIndex].id, |
|
|
|
@ -313,7 +313,7 @@ Page({ |
|
|
|
if (res.code == 1) { |
|
|
|
commonApi.user_post('cart/get_list', {}).then(res => { |
|
|
|
this.setData({ |
|
|
|
cartCount: res.data.length |
|
|
|
cartCount: res.data.length//5
|
|
|
|
}) |
|
|
|
}) |
|
|
|
// 加动效
|
|
|
|
@ -661,6 +661,12 @@ Page({ |
|
|
|
}) |
|
|
|
return; |
|
|
|
} |
|
|
|
if (this.data.info.product[0].type=='line') { |
|
|
|
wx.navigateTo({ |
|
|
|
url: '/pages/order/road/index?id=' + this.data.info.product[0].id |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
this.setData({ |
|
|
|
skuFlag: 'order' |
|
|
|
}) |
|
|
|
@ -687,7 +693,7 @@ Page({ |
|
|
|
onShow: function () { |
|
|
|
commonApi.user_post('cart/get_list', {}).then(res => { |
|
|
|
this.setData({ |
|
|
|
cartCount: res.data.length |
|
|
|
cartCount: res.data.length//1
|
|
|
|
}) |
|
|
|
}) |
|
|
|
if (!wx.getStorageSync('jstrip_token')) { |
|
|
|
@ -695,36 +701,38 @@ Page({ |
|
|
|
} |
|
|
|
if (this.data.info && this.data.info.id) { |
|
|
|
this.drawImg() |
|
|
|
// 获取补贴
|
|
|
|
if (this.data.product.length == 1) { |
|
|
|
commonApi.user_post("product/getProductAllowancePrice", { |
|
|
|
product_code: this.data.product[0].product.product_code |
|
|
|
}).then(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 |
|
|
|
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 => {
|
|
|
|
// 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
|
|
|
|
// 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
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
//// 获取补贴结束
|
|
|
|
|
|
|
|
} else { |
|
|
|
setTimeout(() => { |
|
|
|
this.onShow() |
|
|
|
|