...
|
...
|
@@ -14,6 +14,7 @@ Page({ |
|
|
area: '',
|
|
|
address: '',
|
|
|
cover_type: false,
|
|
|
total:''
|
|
|
},
|
|
|
//加减商品数量
|
|
|
num_change(e) {
|
...
|
...
|
@@ -36,7 +37,7 @@ Page({ |
|
|
that.setData({
|
|
|
[`info.coudanProduct[${index}].num`]: num
|
|
|
})
|
|
|
if (check){
|
|
|
if (check) {
|
|
|
coudan.forEach((item, index) => {
|
|
|
if (item.id == id) {
|
|
|
item.num = num
|
...
|
...
|
@@ -49,12 +50,28 @@ Page({ |
|
|
// 计算凑单费用
|
|
|
get_choudan() {
|
|
|
let coudan_arr = this.data.coudan_arr
|
|
|
let choudan_money = 0
|
|
|
for (let obj of coudan_arr){
|
|
|
let choudan_money = 0;
|
|
|
|
|
|
|
|
|
for (let obj of coudan_arr) {
|
|
|
console.log(obj)
|
|
|
console.log(obj.price2)
|
|
|
if (obj.price2!= null) {
|
|
|
console.log(111)
|
|
|
choudan_money = (obj.price2 * 100 * obj.num) / 100 + choudan_money
|
|
|
} else {
|
|
|
console.log(222)
|
|
|
choudan_money = (obj.price * 100 * obj.num) / 100 + choudan_money
|
|
|
}
|
|
|
}
|
|
|
|
|
|
console.log(typeof (choudan_money))
|
|
|
console.log(choudan_money)
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
choudan_money: choudan_money
|
|
|
choudan_money: choudan_money*100
|
|
|
// choudan_money: Math.floor(choudan_money* 100) / 100
|
|
|
})
|
|
|
},
|
|
|
show_cover() {
|
...
|
...
|
@@ -98,13 +115,14 @@ Page({ |
|
|
let num = e.currentTarget.dataset.num
|
|
|
let index = e.currentTarget.dataset.index
|
|
|
let id = e.currentTarget.dataset.id
|
|
|
let price = e.currentTarget.dataset.price
|
|
|
let price = e.currentTarget.dataset.price;
|
|
|
let price2 = e.currentTarget.dataset.price2;
|
|
|
if (check) {
|
|
|
check = 0
|
|
|
coudan.forEach((item, index) => {
|
|
|
if (item.id == id) {
|
|
|
coudan.splice(index, 1)
|
|
|
coudan_arr.splice(index,1)
|
|
|
coudan_arr.splice(index, 1)
|
|
|
}
|
|
|
})
|
|
|
} else {
|
...
|
...
|
@@ -117,7 +135,8 @@ Page({ |
|
|
coudan_arr.push({
|
|
|
id: id,
|
|
|
num: num,
|
|
|
price: Number(price)
|
|
|
price: Number(price),
|
|
|
price2:Number(price2)
|
|
|
})
|
|
|
}
|
|
|
that.setData({
|
...
|
...
|
@@ -136,9 +155,21 @@ Page({ |
|
|
info: info
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log('99999', res, Number(res.msg.total))
|
|
|
|
|
|
res.msg.total = Number(res.msg.total * 100)
|
|
|
res.msg.yunfei = Number(res.msg.yunfei * 100)
|
|
|
let total = (res.msg.total + res.msg.yunfei).toFixed("1");
|
|
|
console.log(total)
|
|
|
|
|
|
that.setData({
|
|
|
info: res.msg
|
|
|
info: res.msg,
|
|
|
total:total
|
|
|
|
|
|
})
|
|
|
|
|
|
console.log('9988756', that.data.info)
|
|
|
|
|
|
})
|
|
|
},
|
|
|
|
...
|
...
|
@@ -153,7 +184,7 @@ Page({ |
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
that.setData({
|
|
|
"info.yunfei": res.msg.yunfei
|
|
|
"info.yunfei": Number(res.msg.yunfei)
|
|
|
})
|
|
|
})
|
|
|
},
|
...
|
...
|
|