优惠券列表显示,使用优惠券价格计算
This commit is contained in:
parent
51823edb12
commit
390bda7c0e
@ -309,17 +309,7 @@ export default {
|
||||
},
|
||||
setTotalPrice() {
|
||||
const goods = this.orderInfo.store_goods_total;
|
||||
// console.log(this.freight);
|
||||
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);
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
let freight = 0, price = 0, minPrice;
|
||||
// 运费
|
||||
for (const key in this.freight) {
|
||||
if (this.freight.hasOwnProperty(key)) {
|
||||
@ -327,27 +317,35 @@ export default {
|
||||
freight += Number(element);
|
||||
}
|
||||
}
|
||||
// 商品价格
|
||||
for (const key in goods) {
|
||||
if (goods.hasOwnProperty(key)) {
|
||||
const element = goods[key];
|
||||
price += Number(element);
|
||||
// 商品价格减去优惠券
|
||||
// 店铺
|
||||
for (const gid in goods) {
|
||||
if (goods.hasOwnProperty(gid)) {
|
||||
// 计算最小价格
|
||||
minPrice += 0.01;
|
||||
// 每个店铺所有商品的价格
|
||||
let sprice = Number(goods[gid]);
|
||||
if(JSON.stringify(this.storeCoupon) != '{}') {
|
||||
for (const cid in this.storeCoupon) {
|
||||
if (this.storeCoupon.hasOwnProperty(cid)) {
|
||||
const cprice = this.storeCoupon[cid];
|
||||
// 商品减去优惠券价格
|
||||
if(gid == cid) {
|
||||
sprice -= cprice.voucher_price;
|
||||
// 每个店铺最低付款 0.01
|
||||
if(sprice <= 0) sprice = 0.01;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 所有商品总价
|
||||
price += sprice;
|
||||
}
|
||||
}
|
||||
// 减去优惠券
|
||||
// 平台
|
||||
if(JSON.stringify(this.choiceCoupon) != '{}') price -= Number(this.choiceCoupon.voucher_price);
|
||||
// 店铺
|
||||
if(JSON.stringify(this.storeCoupon) != '{}') {
|
||||
for (const key in this.storeCoupon) {
|
||||
if (this.storeCoupon.hasOwnProperty(key)) {
|
||||
const element = this.storeCoupon[key];
|
||||
price -= element.voucher_price;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 最低付款 0.01
|
||||
if(price <= 0) price = 0.01;
|
||||
// 每个店铺最低付款 0.01
|
||||
if(price <= minPrice) price = minPrice;
|
||||
// console.log(price);
|
||||
this.totalPrice = (price + freight).toFixed(2);
|
||||
},
|
||||
|
@ -61,6 +61,7 @@ export default {
|
||||
})
|
||||
},
|
||||
async getMemberCouponList({ load = 'reload' }) {
|
||||
if(load == 'reload') this.page = 0;
|
||||
const res = await this.$u.api.getMemberCouponList({
|
||||
status: this.current + 1, // 代金券状态 1:未用 2:已用 3:过期 4:收回
|
||||
page: this.page,
|
||||
|
@ -209,7 +209,7 @@ export default {
|
||||
this.getOrderNumber();
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
console.log(e);
|
||||
// console.log(e);
|
||||
if(e.index == 0) this.$u.route('/pageE/setting/Index');
|
||||
},
|
||||
methods: {
|
||||
@ -237,7 +237,7 @@ export default {
|
||||
})
|
||||
},
|
||||
toOtherPage(url) {
|
||||
console.log(url);
|
||||
// console.log(url);
|
||||
uni.navigateTo({
|
||||
url: '/pageE' + url
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user