新人优惠券显示问题,使用优惠券价格问题
This commit is contained in:
@@ -310,17 +310,30 @@ export default {
|
||||
setTotalPrice() {
|
||||
const goods = this.orderInfo.store_goods_total;
|
||||
// console.log(this.freight);
|
||||
const freight = this.freight;
|
||||
let price = 0;
|
||||
let freight = 0, price = 0;
|
||||
// 商品价格加上运费
|
||||
[goods, freight].forEach(object => {
|
||||
for (const key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
const element = object[key];
|
||||
price += Number(element);
|
||||
}
|
||||
// [goods, freight].forEach(object => {
|
||||
// for (const key in object) {
|
||||
// if (object.hasOwnProperty(key)) {
|
||||
// const element = object[key];
|
||||
// price += Number(element);
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// 运费
|
||||
for (const key in this.freight) {
|
||||
if (this.freight.hasOwnProperty(key)) {
|
||||
const element = this.freight[key];
|
||||
freight += Number(element);
|
||||
}
|
||||
})
|
||||
}
|
||||
// 商品价格
|
||||
for (const key in goods) {
|
||||
if (goods.hasOwnProperty(key)) {
|
||||
const element = goods[key];
|
||||
price += Number(element);
|
||||
}
|
||||
}
|
||||
// 减去优惠券
|
||||
// 平台
|
||||
if(JSON.stringify(this.choiceCoupon) != '{}') price -= Number(this.choiceCoupon.voucher_price);
|
||||
@@ -333,8 +346,10 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 最低付款 0.01
|
||||
if(price <= 0) price = 0.01;
|
||||
// console.log(price);
|
||||
this.totalPrice = price.toFixed(2);
|
||||
this.totalPrice = (price + freight).toFixed(2);
|
||||
},
|
||||
setDelivery(index) {
|
||||
if(index == 1) {
|
||||
|
||||
Reference in New Issue
Block a user