diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index 62f9d55..268f96c 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -43,9 +43,9 @@ {{ item.name }} - + 招牌 @@ -1547,7 +1547,7 @@ padding: 12rpx 28rpx; border-radius: 8rpx; font-size: 24upx; - margin-left: 56rpx; + margin-right: 56rpx; background: #EFEFEF; border: 2rpx solid #EFEFEF; position: relative; diff --git a/pages/order_food/order_food_search.vue b/pages/order_food/order_food_search.vue index 7a204b1..5ad8fc6 100644 --- a/pages/order_food/order_food_search.vue +++ b/pages/order_food/order_food_search.vue @@ -1069,7 +1069,7 @@ padding: 12rpx 28rpx; border-radius: 8rpx; font-size: 24upx; - margin-left: 56rpx; + margin-right: 56rpx; background: #EFEFEF; border: 2rpx solid #EFEFEF; position: relative; diff --git a/pages/user/coupon.vue b/pages/user/coupon.vue index 8ef77ee..6ca57b3 100644 --- a/pages/user/coupon.vue +++ b/pages/user/coupon.vue @@ -135,9 +135,15 @@ */ navigatorGo ( item ) { uni.cache.set('shopId',item.shopId) - uni.pro.navigateTo('/pages/order_food/order_food', { - shopId: item.shopId - }) + if ( this.type == 'confirm_order') { + uni.$emit('couponItem', JSON.stringify(item)) + uni.navigateBack(); + } else { + uni.pro.navigateTo('/pages/order_food/order_food', { + shopId: item.shopId + }) + } + }, } }; diff --git a/pagesInviteFriends/index/index.vue b/pagesInviteFriends/index/index.vue index 05b65bd..9eb382c 100644 --- a/pagesInviteFriends/index/index.vue +++ b/pagesInviteFriends/index/index.vue @@ -110,12 +110,11 @@ console.log(options) if ( options.shopId ) { this.shopId = options.shopId; } if ( options.is_type ) { this.is_type = options.is_type; } - if ( options.shareId ) { this.shareId = options.shareId; } - if ( options.invitedId ) { this.invitedId = options.invitedId; } - this.is_type = 'he' - this.invitedId = "113" - this.shareId = "1" - this.shopId = "11" + if ( options.shareId && options.invitedId != uni.cache.get('userInfo').id ) { this.shareId = options.shareId; } + if ( options.invitedId && options.invitedId != uni.cache.get('userInfo').id ) { this.invitedId = options.invitedId; } + if ( options.invitedId == uni.cache.get('userInfo').id ) { + this.is_type == 'me' + } if ( this.is_type == 'he') { this.shareHeOpen() } @@ -171,8 +170,7 @@ let params = { shareId : this.shareId, invitedId : this.invitedId, - // beInvitedId : uni.cache.get('userInfo').id, - beInvitedId : 119, + beInvitedId : uni.cache.get('userInfo').id, shopId : this.shopId, } let res = await this.api.shareHeOpen(params) diff --git a/pagesOrder/components/orderInfoBefore.vue b/pagesOrder/components/orderInfoBefore.vue index 92396aa..d26b100 100644 --- a/pagesOrder/components/orderInfoBefore.vue +++ b/pagesOrder/components/orderInfoBefore.vue @@ -91,6 +91,14 @@ {{listinfo.orderInfo.seatAmount}} + + 积分抵扣 + + + + {{listinfo.orderInfo.pointsDiscountAmount.toFixed(2)}} + + 合计: ¥{{listinfo.payAmount}} @@ -112,7 +120,25 @@ 下单时间: {{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}} - + + 下单门店: + {{listinfo.name}} + + + 订单类型: + 快递 + 外卖 + 自提 + 堂食 + + + 备注: + {{ listinfo.orderInfo.remark||""}} + + + 就餐人数: + {{ listinfo.orderInfo.seatCount}} + @@ -281,6 +307,7 @@ } .shop-info { margin-top: 32rpx; + margin-bottom: 32rpx; .item:nth-child(1) { margin-top: 0; } @@ -341,7 +368,7 @@ display: flex; align-items: center; justify-content: space-between; - padding: 32rpx 0; + padding: 0 0 32rpx 0; .label{ font-weight: bold; font-size: 28rpx; diff --git a/pagesOrder/confirm_order/index.vue b/pagesOrder/confirm_order/index.vue index bbeae4e..5fd0236 100644 --- a/pagesOrder/confirm_order/index.vue +++ b/pagesOrder/confirm_order/index.vue @@ -46,10 +46,13 @@ {{ listinfo.name }} - - 桌号: - {{ shopTableInfo.name }} - {{ shopTableInfo.seatNum }}人 + + + 桌号: + {{ shopTableInfo.name || '' }} + {{ shopTableInfo.seatNum }}人 + + @@ -64,10 +67,18 @@ {{item.name || item.productName || "" }} {{ item.skuName || item.productSkuName || ""}} - X{{ item.totalNumber || item.num}} + X{{ item.totalNumber || ""}} - ¥{{ item.totalAmount || item.priceAmount || 0}} + ¥{{ item.memberPrice*item.totalNumber || item.salePrice*item.totalNumber || 0}} + + + 打包费 + + + + {{packFee.toFixed(2)}} + 餐位费 @@ -83,7 +94,7 @@ {{ item.name }} - + {{item.value}} @@ -122,9 +133,9 @@ - + - + @@ -195,9 +206,9 @@ sendType: "table", eatModel: [], favorable: [ - { name: "优惠券", type: "coupon", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"}, - // { name: "团购优惠", type: "group", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"}, - { name: "积分抵扣", type: "points", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png" } + { name: "优惠券", type: "coupon",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"}, + // { name: "团购优惠", type: "group",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"}, + { name: "积分抵扣", type: "points",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png" } ], isPointsChecked: false, rechargeFreeChecked: false, @@ -205,6 +216,7 @@ order: { phone: "", }, + userCouponInfos: null, shopTableInfo: null, freeDingConfig: null, cartLists: [], @@ -226,10 +238,11 @@ paymentBtnText: "余额支付", isSocket: false, socketTicket: null, - + orderAMeal: true, shopId: null, storeInfo: {}, tableCode: null, + packFee: null, } }, computed: { @@ -270,6 +283,7 @@ this.getchoseEatModel(); }, onShow() { + let _this = this; if (this.listinfoid) { uni.$on('message', this.getMessage) this.orderorderInfo() @@ -277,11 +291,32 @@ this.handlemessage() } this.is_typeList.map((item)=>{ - console.log(this.storeInfo.eatModel.indexOf(item.val)) if ( this.storeInfo.eatModel.indexOf(item.val) != -1) { item.show = true; } }) + uni.$on('couponItem',function(data){ + let couponData = JSON.parse(data) + console.log('监听到事件来自返回的参数:' , couponData); + _this.userCouponInfos = { + userCouponId: couponData.id, + discountAmount: couponData.discountAmount, + num: 1, + } + console.log('监听到事件来自返回的参数:' , _this.favorable); + if ( couponData.discountAmount < _this.listinfo.payAmount) { + _this.listinfo.payAmount = _this.listinfo.payAmount - _this.userCouponInfos.discountAmount + _this.favorable[0].value = ('-¥'+couponData.discountAmount) + if ( _this.isPointsChecked) { + _this.pointsChange() + _this.getCalcUsablePoints() + } + + } else { + + } + // TODO 下面执行刷新的方法 + }) }, methods: { setPayAmount ( cartLists ) { @@ -291,6 +326,8 @@ } else { this.listinfo.payAmount = (cartLists.amount+(this.shopTableInfo?(this.shopTableInfo.seatNum*this.storeInfo.tableFee):0)).toFixed(2) } + this.isPointsChecked = false; + this.getCalcUsablePoints() }, /** * 免单状态监听 @@ -387,14 +424,13 @@ uni.pro.navigateTo('/pagesOrder/orderAMeal/index', { tableCode: this.tableCode, shopId: res.data.storeInfo.id, + type: 'confirm' }) return; } this.freeDingConfig = res.data.freeDingConfig; this.shopTableInfo = res.data.shopTableInfo; this.storeInfo = res.data.storeInfo; - this.setPayAmount(this.cartLists) - this.getCalcUsablePoints() }, /** @@ -446,26 +482,22 @@ return; } this.isSocket = true; - this.isPointsChecked = false; this.listinfoid = msg.data.id this.listinfo.details = msg.data.detailList; this.setPayAmount(msg.data) uni.$off('getMessage') this.orderorderInfo(1) - this.getCalcUsablePoints() } break; case 'addCart': this.isSocket = true; if ( this.eatModel == "dine-in" && this.tableCode ) { - this.isPointsChecked = false; if (this.listinfoid) { this.orderorderInfo() } else { this.listinfo.details = msg.data; this.setPayAmount(msg) } - this.getCalcUsablePoints() } break; @@ -478,14 +510,12 @@ }, 1000) break; case 'addcart': - this.isPointsChecked = false; if (this.listinfoid) { this.orderorderInfo() } else { this.listinfo.details = msg.data; this.setPayAmount(msg) } - this.getCalcUsablePoints() this.isSocket = true; break; } @@ -504,6 +534,7 @@ this.eatModel = []; this.eatModel.push(item.val); this.getchoseEatModel(); + }, /** @@ -518,6 +549,7 @@ if ( this.shopTableInfo && this.shopTableInfo.seatNum ) { params.num = this.shopTableInfo.seatNum; } let res = await this.api.choseEatModel(params) this.listinfo.details = res.data.info; + this.packFee = res.data.packFee; this.setPayAmount(res.data) }, @@ -634,6 +666,9 @@ } if ( this.isPointsChecked && this.calcUsablePointsData.pointsNum && this.calcUsablePointsData.pointsNum > 0) { params.pointsNum = this.calcUsablePointsData.pointsNum; + } + if ( this.userCouponInfos ) { + params.userCouponInfos = this.userCouponInfos } let res = await this.api.creatOrder(params) console.log(res) diff --git a/pagesOrder/orderAMeal/index.vue b/pagesOrder/orderAMeal/index.vue index f6c6a8e..3102186 100644 --- a/pagesOrder/orderAMeal/index.vue +++ b/pagesOrder/orderAMeal/index.vue @@ -36,11 +36,13 @@ numIndex: 0, otherNum: '其他', dinersNum: 1, + type: "" }; }, onLoad(options) { this.tableCode = options.tableCode; this.shopId = options.shopId; + if ( options.type ) { this.type = options.type} }, onShow() { }, @@ -90,10 +92,15 @@ shopId: this.shopId, }) //判断是否支付成功 if ( res.code == 0) { - uni.pro.redirectTo('order_food/order_food', { - // uni.pro.navigateTo('order_food/order_food', { - tableCode: this.tableCode, - }) + if( this.type == 'confirm') { + uni.pro,navigateBack() + } else { + uni.pro.redirectTo('order_food/order_food', { + // uni.pro.navigateTo('order_food/order_food', { + tableCode: this.tableCode, + }) + } + } }