From 51823edb12867870979670d0e09dc89cb53ab94a Mon Sep 17 00:00:00 2001 From: ghusermoon <2673031505@qq.com> Date: Thu, 20 Aug 2020 10:25:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E4=BA=BA=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E4=BB=B7=E6=A0=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/store/index.js | 4 ++++ pageC/cart/ConfirmOrder.vue | 35 +++++++++++++++++++++++++---------- pageE/setting/Index.vue | 2 ++ pages/index/index.vue | 11 +++++------ pages/mine/index.vue | 6 ++++-- static/js/common.js | 2 +- 6 files changed, 41 insertions(+), 19 deletions(-) diff --git a/common/store/index.js b/common/store/index.js index 91a1a40..2ab536a 100644 --- a/common/store/index.js +++ b/common/store/index.js @@ -20,6 +20,7 @@ const store = new Vuex.Store({ token: "", // 储存token showLoginModel: false, // 登录框 question: {}, // 帮助与反馈 + showCoupons: true, // 是否显示新人领取优惠券 }, getters: { getOrderAddress(state) { @@ -79,6 +80,9 @@ const store = new Vuex.Store({ }, setQuestion(state, question) { state.question = question; + }, + updateShowCoupons(state, status) { + state.showCoupons = status; } } }) diff --git a/pageC/cart/ConfirmOrder.vue b/pageC/cart/ConfirmOrder.vue index 61ef2bb..d143717 100644 --- a/pageC/cart/ConfirmOrder.vue +++ b/pageC/cart/ConfirmOrder.vue @@ -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) { diff --git a/pageE/setting/Index.vue b/pageE/setting/Index.vue index 3a43596..59538b6 100644 --- a/pageE/setting/Index.vue +++ b/pageE/setting/Index.vue @@ -91,6 +91,8 @@ }); }, async loginOut() { + // 显示新人领取优惠券 + this.$store.commit('updateShowCoupons', true); let im = this.imService this.logout(); uni.redirectTo({ diff --git a/pages/index/index.vue b/pages/index/index.vue index 98390da..0b263e0 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -301,17 +301,15 @@ // that.imService.connectIM() // },2000) // } - - // if (this.hasLogin) { - // this.isNewmembervoucher(); - // } + // 新人优惠券 + if (this.$store.state.showCoupons) { + this.isNewmembervoucher(); + } }, async onLoad(){ this.articleList = []; this.getArticlelist(); this.getSwiper(); - this.isNewmembervoucher(); - // 优惠券 // if(this.$store.state.hasLogin){ // const user = uni.getStorageSync('user_info'); @@ -553,6 +551,7 @@ }, // 是否显示新人优惠券 isNewmembervoucher() { + this.$store.commit('updateShowCoupons', false); this.$u.api.isNewmembervoucher().then(res => { if(res.errCode == 0) { this.$u.route('/pageB/coupon/index'); diff --git a/pages/mine/index.vue b/pages/mine/index.vue index 6c4695e..6185c91 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -208,8 +208,9 @@ export default { this.getUserInfo(); this.getOrderNumber(); }, - onNavigationBarButtonTap() { - this.toOtherPage("/setting/Index"); + onNavigationBarButtonTap(e) { + console.log(e); + if(e.index == 0) this.$u.route('/pageE/setting/Index'); }, methods: { getUserInfo() { @@ -236,6 +237,7 @@ export default { }) }, toOtherPage(url) { + console.log(url); uni.navigateTo({ url: '/pageE' + url }); diff --git a/static/js/common.js b/static/js/common.js index 49a9f48..fb70bf6 100644 --- a/static/js/common.js +++ b/static/js/common.js @@ -83,7 +83,7 @@ const common = { url = '/pageC/merchant/index?id=' + id; break; case 3: - url = '/pageE/tool/MineCoupon' + url = '/pageE/mine/MemberServe?current=1' break; default: break;