From 390bda7c0eb0cbbaf301f8f564622ea223c06710 Mon Sep 17 00:00:00 2001 From: ghusermoon <2673031505@qq.com> Date: Thu, 20 Aug 2020 11:28:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=EF=BC=8C=E4=BD=BF=E7=94=A8=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pageC/cart/ConfirmOrder.vue | 54 ++++++++++++++++++------------------- pageE/tool/MineCoupon.vue | 1 + pages/mine/index.vue | 4 +-- 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/pageC/cart/ConfirmOrder.vue b/pageC/cart/ConfirmOrder.vue index d143717..8e64769 100644 --- a/pageC/cart/ConfirmOrder.vue +++ b/pageC/cart/ConfirmOrder.vue @@ -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); }, diff --git a/pageE/tool/MineCoupon.vue b/pageE/tool/MineCoupon.vue index 103c1bc..1e3daf7 100644 --- a/pageE/tool/MineCoupon.vue +++ b/pageE/tool/MineCoupon.vue @@ -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, diff --git a/pages/mine/index.vue b/pages/mine/index.vue index 6185c91..15bfc0f 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -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 });