From b2abe69e377e84aa63aac509bcef150242b5525b Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Tue, 29 Oct 2024 18:27:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AE=9D=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 29 ++++++++++++++++-- pages/chooseasong/index.vue | 12 ++++++-- pages/member/index.vue | 38 +++++++++++++----------- pages/order_food/order_food.vue | 30 +++++++++++++------ pages/pay_code/pay_code.vue | 2 +- pagesOrder/components/orderInfoAfter.vue | 2 +- pagesOrder/components/paymentMethod.vue | 3 +- pagesOrder/confirm_order/index.vue | 4 +-- pagesOrder/order_detail/index.vue | 4 +-- pagesQueueUp/index/index.vue | 7 ++++- 10 files changed, 89 insertions(+), 42 deletions(-) diff --git a/App.vue b/App.vue index 8434f37..d0dc6c7 100644 --- a/App.vue +++ b/App.vue @@ -4,9 +4,25 @@ import Api from '@/common/js/api.js' export default { globalData: { - systemInfo: null + systemInfo: null, + tableCode: null, + shopId: null, + queueId: null, }, - onLaunch: function() { + onLaunch: function(options) { + console.log(3333) + console.log(options) + if ( options.query.qrCode ) { + if (this.getQueryString(options.query.qrCode, 'code')) { + this.globalData.tableCode = this.getQueryString(options.query.qrCode, 'code') + } + if (this.getQueryString(options.query.qrCode, 'shopId')) { + this.globalData.shopId = this.getQueryString(options.query.qrCode, 'shopId') + } + if (this.getQueryString(options.query.qrCode, 'queueId')) { + this.globalData.queueId = this.getQueryString(options.query.qrCode, 'queueId') + } + } if ( uni.getStorageSync("NAME") && !uni.getStorageSync("NAME").data) { uni.cache.clear(); } @@ -68,7 +84,14 @@ // console.log('App Hide'); }, methods: { - + getQueryString(url, name) { //解码 + var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i') + var r = url.substr(1).match(reg) + if (r != null) { + return r[2] + } + return null; + }, } }; diff --git a/pages/chooseasong/index.vue b/pages/chooseasong/index.vue index 8531df7..2521395 100644 --- a/pages/chooseasong/index.vue +++ b/pages/chooseasong/index.vue @@ -134,11 +134,17 @@ timer: null //定时器 }; }, - onLoad(e) { + onLoad(options) { // 隐藏首页按钮 - if (e.q) { - this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId') + + // #ifdef MP-WEIXIN + if (options.q) { + this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId') } + // #endif + // #ifdef MP-ALIPAY + if (getApp().globalData.shopId) { this.shopId = getApp().globalData.shopId } + // #endif }, computed: {}, diff --git a/pages/member/index.vue b/pages/member/index.vue index b8d29b8..695940e 100644 --- a/pages/member/index.vue +++ b/pages/member/index.vue @@ -121,33 +121,35 @@ type: "", } }, - async onLoad(e) { + async onLoad(options) { // if ( e.type == 'list' || e.type == 'index') { // this.shopId = e.shopId; // this.init(); // } - console.log(e) uni.cache.set('forceUpdate',1) - if (e.q) { - this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId') + // #ifdef MP-WEIXIN + if (options.q) { + this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId') uni.cache.set('shopId',this.shopId) this.tokenShow = false; - // 等待登录结果返回 - // if (!uni.cache.get('token')) { - // await this.$onLaunched; - // } - this.shopInfo(); - this.paygetActive() - } else{ - this.shopId = e.shopId; - this.type = e.type; - if ( e.amount ) { this.amount = e.amount; } - uni.cache.set('shopId',this.shopId) - this.shopInfo(); - this.paygetActive() - } + // #endif + // #ifdef MP-ALIPAY + if (getApp().globalData.shopId) { this.shopId = getApp().globalData.shopId } + uni.cache.set('shopId',this.shopId) + // #endif + + if (options.shopId) { + this.shopId = options.shopId + uni.cache.set('shopId',this.shopId) + } + if (options.type) { + this.type = options.type + } + if ( options.amount ) { this.amount = options.amount; } + this.shopInfo(); + this.paygetActive() }, methods: { /** diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index 4a776ca..ecfef4b 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -374,6 +374,7 @@ shopExtend: null, shopId: "", tableCode: "", + orderAMeal: true, } }, onPageScroll(e) { @@ -402,16 +403,24 @@ this.$store.getters.is_BarHeight.customBar) } }, - onLoad(e) { - if (e.q) { - this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code') + onLoad(options) { + // #ifdef MP-WEIXIN + if (options.q) { + this.tableCode = this.getQueryString(decodeURIComponent(options.q), 'code') uni.cache.set('tableCode', this.tableCode) } - if ( e.shopId ) { - this.shopId = e.shopId + // #endif + // #ifdef MP-ALIPAY + if (getApp().globalData.tableCode) { + this.tableCode = getApp().globalData.tableCode + uni.cache.set('tableCode', this.tableCode) } - if ( e.tableCode ) { - this.tableCode = e.tableCode + // #endif + if ( options.shopId ) { + this.shopId = options.shopId + } + if ( options.tableCode ) { + this.tableCode = options.tableCode } }, @@ -431,7 +440,9 @@ }, async onShow() { let _this = this; - + if (!this.orderAMeal){ + uni.pro.switchTab('index/index') + } this.$nextTick(() => { uni.pageScrollTo({ scrollTop: 0, @@ -539,7 +550,8 @@ if (this.shopId) {params.shopId = this.shopId} let res = await this.api.productqueryShop(params) if (res.code == 0) { - if ( res.data.shopTableInfo && !res.data.shopTableInfo.choseCount) { + if ( res.data.shopTableInfo && !res.data.shopTableInfo.choseCount&&this.orderAMeal) { + this.orderAMeal = false; uni.pro.navigateTo('/pagesOrder/orderAMeal/index', { tableCode: this.tableCode, shopId: res.data.storeInfo.id, diff --git a/pages/pay_code/pay_code.vue b/pages/pay_code/pay_code.vue index de8cde8..82bfda0 100644 --- a/pages/pay_code/pay_code.vue +++ b/pages/pay_code/pay_code.vue @@ -40,7 +40,7 @@ textMargin: 14 }, qrcodeSize: 400, - createcardNo: '4637700074809642', + createcardNo: '', shopInfo: null }; }, diff --git a/pagesOrder/components/orderInfoAfter.vue b/pagesOrder/components/orderInfoAfter.vue index c656ffe..bae1e76 100644 --- a/pagesOrder/components/orderInfoAfter.vue +++ b/pagesOrder/components/orderInfoAfter.vue @@ -81,7 +81,7 @@ 备注: - {{ listinfo.orderInfo.remark}} + {{ listinfo.orderInfo.remark||""}} 就餐人数: diff --git a/pagesOrder/components/paymentMethod.vue b/pagesOrder/components/paymentMethod.vue index 5f36dce..d69cd2d 100644 --- a/pagesOrder/components/paymentMethod.vue +++ b/pagesOrder/components/paymentMethod.vue @@ -92,9 +92,8 @@ .paymentMethod{ box-sizing: border-box; margin-top: 30rpx; - padding: 0 20rpx; + padding: 0 20rpx 220rpx 20rpx; border-radius: 18rpx; - margin-bottom: 220rpx; .paymentMethod_content{ background-color: #fff; border-radius: 22rpx; diff --git a/pagesOrder/confirm_order/index.vue b/pagesOrder/confirm_order/index.vue index ab447e0..0d802f6 100644 --- a/pagesOrder/confirm_order/index.vue +++ b/pagesOrder/confirm_order/index.vue @@ -109,7 +109,7 @@ - + @@ -180,7 +180,7 @@ 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: "points", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png"}, ], isPointsChecked: false, rechargeFreeChecked: false, diff --git a/pagesOrder/order_detail/index.vue b/pagesOrder/order_detail/index.vue index 406383c..41ee60e 100644 --- a/pagesOrder/order_detail/index.vue +++ b/pagesOrder/order_detail/index.vue @@ -3,10 +3,10 @@ - 下单成功 + {{listinfo.registerType == 'munchies'?'待支付':'下单成功'}} 已完成 - 下单时间:{{listinfo.createdAt}} + 下单时间:{{ listinfo.createdAt }} 付款时间:{{listinfo.paidTime}} diff --git a/pagesQueueUp/index/index.vue b/pagesQueueUp/index/index.vue index d8b5068..9eb5b8b 100644 --- a/pagesQueueUp/index/index.vue +++ b/pagesQueueUp/index/index.vue @@ -137,11 +137,16 @@ }; }, onLoad(options) { + // #ifdef MP-WEIXIN if (options.q) { this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId') this.queueId = this.getQueryString(decodeURIComponent(options.q), 'queueId') } - + // #endif + // #ifdef MP-ALIPAY + if (getApp().globalData.shopId) { this.shopId = getApp().globalData.shopId } + if (getApp().globalData.queueId) { this.queueId = getApp().globalData.queueId } + // #endif }, onShow() { this.getQueueUpState();