diff --git a/pages/index/components/diamond.vue b/pages/index/components/diamond.vue index 3086644..3efb8a6 100644 --- a/pages/index/components/diamond.vue +++ b/pages/index/components/diamond.vue @@ -52,6 +52,7 @@ uni.scanCode({ success: (res) => { let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code') + uni.cache.set('tableCode', this.tableCode) if (tableCode) { uni.pro.navigateTo('order_food/order_food', { tableCode: tableCode, diff --git a/pages/login/login.vue b/pages/login/login.vue index 1f10dec..2835a7f 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -2,9 +2,9 @@ - + - + 手机号码 @@ -50,14 +50,14 @@ 登录 其他手机号登录/注册 - + {{ baseUrl || '切换' }} @@ -118,6 +118,7 @@ second: 60, showText: true, Recapture: '发送验证码', + types: '', //判断是否是微信扫码点餐进来 form: { //密码 loginName: '', @@ -131,7 +132,13 @@ this.computed_h(); }, - onLoad() { + onLoad(e) { + console.log(e) + try { + this.types = e.type + } catch (e) { + //TODO handle the exception + } // #ifdef APP-PLUS || H5 this.showbox = true // #endif @@ -280,8 +287,13 @@ uni.cache.set('miniAppOpenId', res.data.userInfo .miniAppOpenId) uni.cache.set('userInfo', res.data.userInfo); - // uni.cache.set('shopUser', res.data.shopUser); - uni.pro.switchTab('index/index') + if (this.types == 0) { + uni.pro.navigateTo('order_food/order_food') + } else { + // uni.cache.set('shopUser', res.data.shopUser); + uni.pro.switchTab('index/index') + } + } }, @@ -330,8 +342,13 @@ uni.cache.set('miniAppOpenId', res.data.userInfo .miniAppOpenId) uni.cache.set('userInfo', res.data.userInfo); - uni.cache.set('shopUser', res.data.shopUser); - uni.pro.switchTab('index/index') + // uni.cache.set('shopUser', res.data.shopUser); + if (this.types == 0) { + uni.pro.navigateTo('order_food/order_food') + } else { + // uni.cache.set('shopUser', res.data.shopUser); + uni.pro.switchTab('index/index') + } } }, fail: (err) => { diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index 72955d8..79b6e5e 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -276,11 +276,13 @@ if (e.q) { this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code') uni.cache.set('tableCode', this.tableCode) - this.scanCodehandle() + // this.scanCodehandle() + uni.pro.navigateTo('login/login', { + type: 0 + }) } else { - this.tableCode = e.tableCode - uni.cache.set('tableCode', this.tableCode) - this.productqueryShopIdByTableCode()//获取shop User id + this.tableCode = uni.cache.get('tableCode') + this.productqueryShopIdByTableCode() //获取shop User id } uni.$on('message', this.getMessage) @@ -293,6 +295,11 @@ this.socketTicket.Close() uni.$off('message') }, + onShow() { + if (uni.cache.get('token')) { + this.productqueryShopIdByTableCode() //获取shop User id + } + }, methods: { // 单独获取他的shopUserid async productqueryShopIdByTableCode() { @@ -399,7 +406,6 @@ } }, scanCodehandle(e) { - // #ifdef MP-WEIXIN || MP-ALIPAY uni.login({ //alipay weixin provider: 'weixin',