From d2dbfd5163eed828cb172bd752ea341f5b58e161 Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Tue, 19 Nov 2024 13:52:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order_food/order_food.vue | 26 ++------ pages/user/coupon.vue | 4 +- pagesInviteFriends/index/index.vue | 5 +- pagesOrder/components/orderInfoAfter.vue | 81 +++++++++++++++++------- pagesOrder/confirm_order/index.vue | 3 +- pagesOrder/order_detail/index.vue | 27 ++++---- 6 files changed, 88 insertions(+), 58 deletions(-) diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index 33e0231..083607d 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -662,13 +662,7 @@ if (b == '单规格') { //没有规格为空 this.skuidname = [] } - if ( a == "+" && item.cartNumber >= item.limitNumber){ - uni.showToast({ - title: '当前商品已达到最大赠送数量', - icon: 'none' - }) - return; - } + let cartNumber = a == '+' ? item.cartNumber + 1 : item.cartNumber - 1; @@ -685,13 +679,7 @@ */ shopAdd(item, index, index1, a, b) { if (a == "+") { - if ( this.amountcartNumber >= item.limitNumber){ - uni.showToast({ - title: '当前商品已达到最大赠送数量', - icon: 'none' - }) - return; - } + if (this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) { this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit); } else { @@ -717,13 +705,7 @@ return; } let num = 0; - if (item.cartNumber >= item.limitNumber){ - uni.showToast({ - title: '当前商品已达到最大赠送数量', - icon: 'none' - }) - return; - } + if (item.typeEnum == "normal") { num = item.cartNumber + this.amountcartNumber; } else { @@ -984,6 +966,7 @@ let res = await this.api.productqueryProductSku({ code: this.tableCode, shopId: this.shopId, + "isVip": 0, productId: item.id, //商品id spec_tag: this.skuidname.join(","), }) @@ -996,6 +979,7 @@ "type": c == '+' ? 1 : 0, "productId": item.id, //商品id "note": item.note, + "isVip": 0, "shopId": this.shopId, "userId": uni.cache.get('userInfo').id, } diff --git a/pages/user/coupon.vue b/pages/user/coupon.vue index 25a733e..336982c 100644 --- a/pages/user/coupon.vue +++ b/pages/user/coupon.vue @@ -105,9 +105,10 @@ if (options.payAmount) { this.payAmount = options.payAmount } if (options.shoppingCart) { this.shoppingCart = JSON.parse(decodeURIComponent(options.shoppingCart)) } if (options.productList) { this.productList = JSON.parse(decodeURIComponent(options.productList)) } + }, + onShow() { this.getCouponList() }, - methods: { /** @@ -133,6 +134,7 @@ if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product' ) { params.orderId = -1; } + console.log("params",params) let res = await this.api.conponList(params) if (res.code == 0) { console.log(res) diff --git a/pagesInviteFriends/index/index.vue b/pagesInviteFriends/index/index.vue index 75056eb..904d2aa 100644 --- a/pagesInviteFriends/index/index.vue +++ b/pagesInviteFriends/index/index.vue @@ -119,9 +119,9 @@ if ( this.is_type == 'he') { this.shareHeOpen() } - this.getByShopId(); }, onShow() { + this.getByShopId(); }, @@ -162,7 +162,7 @@ shareId : this.InviteFriendsData.id, invitedId : uni.cache.get('userInfo').id, shopId : this.shopId, - isSuccess : this.isSuccess, + success : this.isSuccess, } let res = await this.api.shareRecord(params) if ( res.code == 0 ) { @@ -214,6 +214,7 @@ }, tabClick(item) { this.tabAcitve = item.type; + this.shareRecord(); }, diff --git a/pagesOrder/components/orderInfoAfter.vue b/pagesOrder/components/orderInfoAfter.vue index 4dbd630..64dd920 100644 --- a/pagesOrder/components/orderInfoAfter.vue +++ b/pagesOrder/components/orderInfoAfter.vue @@ -149,6 +149,9 @@ listinfo:{ type: Object }, + amountVIP:{ + type: Object + }, }, watch :{ listinfo:{ @@ -160,14 +163,13 @@ }, }, mounted() { - console.log(this.listinfo.shopId) - uni.$on('couponItem',this.changeCoupon) - this.getCalcUsablePoints() - }, - onShow() { - // uni.$on('couponItem',this.changeCoupon) }, methods: { + childOnShow() { + console.log(222) + uni.$on('couponItem',this.changeCoupon) + this.getCalcUsablePoints() + }, /** * 监听优惠券/商品券选择 * @param {Object} data @@ -180,7 +182,7 @@ if ( couponData.type == 1 ) { //满减优惠券 let couponList = _this.userCouponInfos.filter(v => v.type == 1); //不包含优惠券的金额 - let currentPayAmount = (couponList.length > 0 ? _this.listinfo.payAmount + couponList[0].discountAmount : _this.listinfo.payAmount) + let currentPayAmount = (couponList.length > 0 ? Number(_this.listinfo.payAmount) + couponList[0].discountAmount : _this.listinfo.payAmount) // 判断优惠金额不能大于支付金额 if ( couponData.discountAmount < currentPayAmount) { _this.listinfo.payAmount = ( currentPayAmount - couponData.discountAmount).toFixed(2) @@ -203,11 +205,12 @@ num: couponData.type == 1 ? 1 : couponData.num, }) } + console.log(currentPayAmount) console.log(_this.listinfo.payAmount) - // if ( _this.isPointsChecked ) { + if ( _this.isPointsChecked ) { _this.pointsChange() _this.getCalcUsablePoints() - // } + } this.$emit("setPayAmount",_this.listinfo.payAmount) } else { uni.showToast({ @@ -230,15 +233,23 @@ productTicketList.map((item,index) => { productTicketNum += item.num }) + console.log(productTicketList) console.log(minCouponList) minCouponList.map((item,index) => { - productNumber += item.number - if ( productNum > 0 && productNumber > productTicketNum) { - let num = productNum >= item.number ? item.number : productNum - productNum = (productNum - item.number) >= 0 ? (productNum - item.number) : 0; - console.log(num) - console.log(item.salePrice) - productPayAmount = productPayAmount + (num*(item.memberPrice > 0 ? item.memberPrice : item.salePrice)) + // productNumber += item.num + if ( productNum > 0) { + item.num = (item.num - productTicketNum) <= 0 ? 0 : (item.num - productTicketNum) + productTicketNum = (item.num - productTicketNum) <= 0 ? (productTicketNum - item.num) : item.num - productTicketNum + console.log(productTicketNum) + } + if ( productNum > 0 && item.num > 0) { + let num = productNum >= item.num ? item.num : productNum + productNum = (productNum - item.num) >= 0 ? (productNum - item.num) : 0; + productPayAmount = productPayAmount + (num*(item.memberPrice > 0 ? item.memberPrice : item.price)) + // let num = productNum >= item.num ? item.num : productNum + // productNum = (productNum - item.num) >= 0 ? (productNum - item.num) : 0; + + // productNum = num <= productNum ? num : productNum; } }) _this.userCouponInfos.push({ @@ -257,15 +268,39 @@ num: productNum == 0 ? couponData.num : (couponData.num - productNum), }) console.log(productNum) - console.log(_this.favorable) - // if ( _this.isPointsChecked) { + console.log(productNum == 0 ? couponData.num : productNum) + if ( _this.isPointsChecked) { _this.pointsChange() - _this.getCalcUsablePoints() - // } - this.$emit("setPayAmount",_this.listinfo.payAmount) + } + this.setPayAmount() } uni.$off('couponItem') }, + setPayAmount ( cartLists ) { + let tableFee; + // this.storeInfo.registerType == 'munchies' + + + if ( this.userCouponInfos.length > 0 ) { + console.log(this.userCouponInfos) + this.userCouponInfos.forEach(item => { + if ( item.type == 1 ) { + if ( item.discountAmount && item.discountAmount > 0 ) { + this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2) + } + } else { + if ( item.discountAmount && item.discountAmount > 0 ) { + this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2) + } + } + }) + } + + + this.isPointsChecked = false; + this.getCalcUsablePoints() + this.$emit("setPayAmount",this.listinfo.payAmount) + }, /** * 积分状态监听 */ @@ -282,7 +317,8 @@ this.freeDisabled = false this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2); } - this.$emit("setPayAmount",_this.listinfo.payAmount) + console.log(this.listinfo.payAmount) + this.$emit("setPayAmount",this.listinfo.payAmount) }, goUrl(item){ switch (item.type){ @@ -661,6 +697,7 @@ font-weight: bold; font-size: 28rpx; color: #333333; + flex-shrink: 0; } .info { diff --git a/pagesOrder/confirm_order/index.vue b/pagesOrder/confirm_order/index.vue index 873831d..b5f5f5d 100644 --- a/pagesOrder/confirm_order/index.vue +++ b/pagesOrder/confirm_order/index.vue @@ -403,7 +403,8 @@ }, setPayAmount ( cartLists ) { let tableFee; - if ( this.is_type == 0 ) { + // this.storeInfo.registerType == 'munchies' + if ( this.is_type == 0 && this.storeInfo.registerType == 'munchies') { tableFee = this.shopTableInfo?(this.shopTableInfo.seatNum*this.storeInfo.tableFee):0 } else{ tableFee = 0 diff --git a/pagesOrder/order_detail/index.vue b/pagesOrder/order_detail/index.vue index fc4f6f9..c31db5b 100644 --- a/pagesOrder/order_detail/index.vue +++ b/pagesOrder/order_detail/index.vue @@ -27,7 +27,7 @@ - + @@ -96,11 +96,16 @@ }; }, onLoad(e) { - console.log(e) this.orderId = e.orderId + this.orderorderInfo() }, onShow() { - this.orderorderInfo() + if ( this.listinfo.useType == "dine-in-after") { + this.$nextTick(()=>{ + this.$refs.orderInfoAfterRef.childOnShow(); + }) + } + }, onUnload() { this.ispws = false @@ -116,8 +121,10 @@ }, methods: { setPayAmount(payAmount) { + console.log("payAmount===",payAmount) this.listinfo.payAmount = payAmount - this.$forceUpdate() + // this.$set(this.listinfo,"payAmount",payAmount) + // this.$forceUpdate() }, saveImage (url) { uni.saveImage({ @@ -157,17 +164,19 @@ }) if (res.code == 0) { this.listinfo = res.data; - console.log(this.listinfo.orderInfo.couponInfoList) if ( this.listinfo.orderInfo.couponInfoList ) { this.listinfo.orderInfo.couponInfoList = JSON.parse(this.listinfo.orderInfo.couponInfoList) - // this.listinfo.orderInfo.couponInfoList = eval('(' + jsonString + ')') } this.listinfoid = res.data.orderId; this.shopId = res.data.shopId; if (this.listinfo.useType == " ") { //堂食先付费 } - console.log(this.listinfo) + if ( this.listinfo.useType == "dine-in-after") { + this.$nextTick(()=>{ + this.$refs.orderInfoAfterRef.childOnShow(); + }) + } this.getAount(); } }, @@ -181,10 +190,6 @@ }) }, - - - - /** * 去支付 */