From 06468f03a09cd228a2e7109ae3e0b1bbbf72ea96 Mon Sep 17 00:00:00 2001 From: shaojing <2901156235@qq.com> Date: Mon, 15 Jan 2024 10:33:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=99=AF=E7=82=B9=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E5=92=8C=E9=9A=90=E8=97=8F=E7=94=B5=E5=BD=B1=E6=9D=BF?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.wxml | 8 ++--- pages/list/activitynew/index.wxml | 4 +-- pages/order/components/date/index.js | 4 +++ pages/order/scene/index.js | 49 +++++++++++++++++++++++++--- pages/order/scene/index.wxml | 4 +-- 5 files changed, 57 insertions(+), 12 deletions(-) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 824434e..e323560 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -291,13 +291,13 @@ 廉洁地图 --> - + - - + 文化惠民 diff --git a/pages/order/components/date/index.js b/pages/order/components/date/index.js index 7f8b37f..919747e 100644 --- a/pages/order/components/date/index.js +++ b/pages/order/components/date/index.js @@ -168,6 +168,7 @@ Component({ showMoreDateFlag: false, moreFlag: flag }) + app.globalData.product.price = this.data.activeDate.price this.triggerEvent("onChangeDate", this.data.activeDate) this.getTimeStock() }, @@ -199,6 +200,9 @@ Component({ }) this.triggerEvent("onChangeTime", this.data.timelist[this.data.timeIndex]) }) + app.globalData.product.price = this.data.activeDate.price + console.log('price',this.data.activeDate.price); + console.log(app.globalData.product); }, selectTime: function (e) { if (this.data.timelist[e.currentTarget.dataset.index].stock_number >0) { diff --git a/pages/order/scene/index.js b/pages/order/scene/index.js index c8e79f7..18096dd 100644 --- a/pages/order/scene/index.js +++ b/pages/order/scene/index.js @@ -30,7 +30,8 @@ Page({ flag:null, ticket_type:1, isCar:'single', - showMask: false + showMask: false, + price:0, }, /** @@ -63,12 +64,13 @@ Page({ this.setData({ productNum: app.globalData.product.num < 1 ? 1 : app.globalData.product.num }) - } + } this.setData({ product: app.globalData.product, singlePrice: this.data.gp_id ? app.globalData.product.sku.event_price : app.globalData.product.sku.price }) - console.log(this.data.product); + this.showAllPrice() + // console.log('********',this.data.product); if (!this.data.kjId && !this.data.gp_id && this.data.product.isGroup != 1 && this.data.type!='museum') { this.couponCom = this.selectAllComponents("#coupon")[0]; } @@ -78,6 +80,37 @@ Page({ // showMask:true // }) // }, + showAllPrice:function () { + // console.log('detail',app.globalData.product); + // console.log('singlePrice',this.data.singlePrice); + // console.log('productNum',this.data.productNum); + if (app.globalData.product.price) { + this.setData({ + singlePrice:app.globalData.product.price + }) + let price = this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0) + if (price >0) { + this.setData({ + price:price/100 + }) + }else { + this.setData({ + price:0 + }) + } + // console.log(this.data.singlePrice); + } + let price = this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0) + if (price >0) { + this.setData({ + price:price/100 + }) + }else { + this.setData({ + price:0 + }) + } + }, cancel: function () { this.setData({ showMask:false @@ -133,6 +166,7 @@ Page({ }) this.data.product.num = this.data.productNum this.changePrice() + this.showAllPrice() }, minus: function () { if (this.data.productNum==undefined) { @@ -160,15 +194,19 @@ Page({ }) this.data.product.num = this.data.productNum this.changePrice() + this.showAllPrice() }, changeDate: function (e) { + // console.log('打印',e); + this.showAllPrice() if (e.detail.price != this.data.singlePrice && this.data.coupon) { wx.showToast({ title: '订单价格发生变化,请重新选择优惠券', icon: 'none' }) this.setData({ - coupon: null + coupon: null, + singlePrice:e.detail.price }) if (!this.data.kjId && !this.data.gp_id && this.data.product.isGroup != 1 && this.data.type!='museum') { this.couponCom.setNullCoupon() @@ -541,6 +579,9 @@ Page({ // } // }) // } + // console.log('-----',app.globalData.product.sku.price); + // app.globalData.product = delete(app.globalData.product.detail) + // this.showAllPrice() }, /** diff --git a/pages/order/scene/index.wxml b/pages/order/scene/index.wxml index 0094b6e..a6d3748 100644 --- a/pages/order/scene/index.wxml +++ b/pages/order/scene/index.wxml @@ -49,8 +49,8 @@ 合计:¥0 - 合计:¥{{((singlePrice * productNum - (coupon?coupon.activity.money:0))>0?(singlePrice * productNum - (coupon?coupon.activity.money:0)):0)/ 100}} + 合计: + ¥{{price}} 下一步