From ba106d1f96a5624675f95fe64bef5ae444c4765e Mon Sep 17 00:00:00 2001 From: duan <1004387497@qq.com> Date: Wed, 5 Jun 2024 15:47:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- framework/0-conf.js | 4 ++-- pages/index/components/todaylist.vue | 4 ++-- pages/index/index.vue | 2 +- pages/order_detail/index.vue | 8 ++++---- pages/order_detail/order_detail.vue | 11 ++++++----- pages/order_food/order_food.vue | 20 ++++++++++++++------ pages/product/placeOrder.vue | 3 ++- store/index.js | 21 +++++++++++++++++---- 8 files changed, 48 insertions(+), 25 deletions(-) diff --git a/framework/0-conf.js b/framework/0-conf.js index 409f63a..71ffc4b 100644 --- a/framework/0-conf.js +++ b/framework/0-conf.js @@ -19,9 +19,9 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService' // const baseUrl = 'https://cashier.sxczgkj.cn/cashierService'// 线上 // const baseUrlwws = 'wss://cashier.sxczgkj.cn/cashierService' // 线上 // const baseUrl = 'http://192.168.2.42:9888/cashierService'// 测试-w -// const baseUrlwws ='ws://192.168.2.42:9888/cashierService' // 测试-w +const baseUrlwws ='wss://192.168.2.42:9999/cashierService' // 测试-w const baseUrl = 'https://wxcashiertest.sxczgkj.cn/cashierService'// 测试 -const baseUrlwws ='wss://wxcashiertest.sxczgkj.cn/cashierService' // 测试 +// const baseUrlwws ='wss://wxcashiertest.sxczgkj.cn/cashierService' // 测试 // #endif diff --git a/pages/index/components/todaylist.vue b/pages/index/components/todaylist.vue index b80ecec..f5cf27a 100644 --- a/pages/index/components/todaylist.vue +++ b/pages/index/components/todaylist.vue @@ -15,7 +15,7 @@ - + - + diff --git a/pages/index/index.vue b/pages/index/index.vue index d4b4288..a89f4f8 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -93,7 +93,7 @@ - + diff --git a/pages/order_detail/index.vue b/pages/order_detail/index.vue index 9e8e885..20667bf 100644 --- a/pages/order_detail/index.vue +++ b/pages/order_detail/index.vue @@ -220,6 +220,7 @@ }, onLoad(e) { // console.log(e, 140) + this.$store.dispatch("set_shopid"); //获取shapid let res = JSON.parse(e.tableId) this.listinfo.detailList = res this.listinfo.amount = e.amount // 算完了的价格 @@ -266,10 +267,9 @@ } }, async getAount() { - console.log(uni.cache.get('userInfo'), '余额中userId不显示打印') let res = await this.api.shopUserInfo({ // shopId:店铺ID - "shopId": uni.cache.get('shopUser'), + "shopId": this.$store.state.shopId, "userId": uni.cache.get('userInfo').id, }) if (res.code == 0) { @@ -342,7 +342,7 @@ "isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1: 使用, 0: 不使用), "isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1: 购买, 0: 不够买) "productId": '', //商品id - "shopId": uni.cache.get('shopUser'), + "shopId": this.$store.state.shopId, "userId": uni.cache.get('userInfo').id, // tableId:uni.cache.get('tableCode') } @@ -365,7 +365,7 @@ "isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1: 使用, 0: 不使用), "isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1: 购买, 0: 不够买) "productId": '', //商品id - "shopId": uni.cache.get('shopUser'), + "shopId": this.$store.state.shopId, "userId": uni.cache.get('userInfo').id, // tableId:uni.cache.get('tableCode') } diff --git a/pages/order_detail/order_detail.vue b/pages/order_detail/order_detail.vue index 78cdbad..2664ccb 100644 --- a/pages/order_detail/order_detail.vue +++ b/pages/order_detail/order_detail.vue @@ -234,13 +234,15 @@ this.ispws = false }, onLoad(e) { + this.listinfo = JSON.parse(e.tablelist) // 获取余额 - this.getAount() + // this.getAount() // 获取用户信息,判断是否设置支付密码 this.getuserinfo() }, onShow() { + // this.$store.dispatch("set_shopid"); //获取shapid this.getAount() this.getuserinfo() }, @@ -267,10 +269,9 @@ } }, async getAount() { - console.log(uni.cache.get('userInfo'), '余额中userId不显示打印') let res = await this.api.shopUserInfo({ // shopId:店铺ID - "shopId": uni.cache.get('shopUser'), + "shopId": this.$store.state.shopId, "userId": uni.cache.get('userInfo').id, }) if (res.code == 0) { @@ -343,7 +344,7 @@ "isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1: 使用, 0: 不使用), "isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1: 购买, 0: 不够买) "productId": '', //商品id - "shopId": uni.cache.get('shopUser'), + "shopId": this.$store.state.shopId, "userId": uni.cache.get('userInfo').id, // tableId:uni.cache.get('tableCode') } @@ -366,7 +367,7 @@ "isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1: 使用, 0: 不使用), "isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1: 购买, 0: 不够买) "productId": '', //商品id - "shopId": uni.cache.get('shopUser'), + "shopId": this.$store.state.shopId, "userId": uni.cache.get('userInfo').id, // tableId:uni.cache.get('tableCode') } diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index 6b09492..0dc888a 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -60,7 +60,7 @@ - + @@ -272,7 +272,7 @@ } this.countScrollTitle(e.scrollTop); }, - onLoad(e) { + onLoad(e) { if (e.q) { let tableCode = this.getQueryString(decodeURIComponent(e.q), 'code') uni.cache.set('tableCode', tableCode) @@ -280,7 +280,7 @@ } if (!uni.cache.get('token') && uni.cache.get('tableCode')) { uni.reLaunch({ - url: '/pages/login/login?type=' + 0 + url: '/pages/login/login?types=' + 0 }); } uni.$on('message', this.getMessage) @@ -292,10 +292,16 @@ this.socketSendMsg({ //定义socket数据传参 "type": "close", //“addcart:添加购物车,create0rder:生成订单,clearCart:庆康购物车”, }) + console.log(this.socketTicket, '关闭长连接') this.socketTicket.Close() uni.$off('message') }, onShow() { + // console.log(this.socketTicket,'进入页面') + // if (this.socketTicket) { + // this.socketTicket.Close() + // uni.$off('message') + // } // uni.onNetworkStatusChange((res) => { //监听网络状态变化 // if (!res.isConnected) { // // 检查网络是否连接 @@ -305,6 +311,7 @@ // } // }); setTimeout(() => { + console.log('调试1') if (uni.cache.get('token') && uni.cache.get('tableCode')) { this.productqueryShopIdByTableCode() //获取shop User id } @@ -392,7 +399,7 @@ msg.data.forEach((item, index, arr) => { //初始化skuidname的数据 选择第一个 if (item.skuId == this.skuidsearch) { nums = item.number - } + } // else { // this.$set(this, 'amountcartNumber', 0) // } @@ -530,7 +537,7 @@ return res }) this.specifications.tagSnap.forEach((val, index, arr) => { //初始化skuidname的数据 选择第一个 - console.log(val.children[0],'skuidnam是否为空1') + console.log(val.children[0], 'skuidnam是否为空1') this.skuidname.push(val.children[0]) }) try { @@ -543,7 +550,7 @@ } }, async morloe(e, index, index1, item) { - console.log(index,'skuidnam是否为空2') + console.log(index, 'skuidnam是否为空2') this.specifications.tagSnap[index]['start'] = index1 this.skuidname.splice(index, 1, e) //替换skuidname的数据 this.hodgepodge(item, 2) @@ -607,6 +614,7 @@ "shopId": uni.cache.get('shopUser'), "userId": uni.cache.get('userInfo').id, } + this.$store.dispatch("set_shopid"); //获取shapid uni.$u.debounce(this.socketSendMsg(data), 500) }, orderfoodindex() { diff --git a/pages/product/placeOrder.vue b/pages/product/placeOrder.vue index fb43144..1bdc09c 100644 --- a/pages/product/placeOrder.vue +++ b/pages/product/placeOrder.vue @@ -109,6 +109,7 @@ payPassword }, onLoad(e) { + this.$store.dispatch("set_shopid"); //获取shapid this.getInfo(e.id) this.orderIds = e.id this.amount = uni.cache.get('userInfo').amount @@ -131,7 +132,7 @@ async getAount() { let res = await this.api.shopUserInfo({ // shopId:店铺ID - "shopId": this.info.shopId, + "shopId": this.$store.state.shopId, "userId": uni.cache.get('userInfo').id }) if (res.code == 0) { diff --git a/store/index.js b/store/index.js index fab0761..82c400c 100644 --- a/store/index.js +++ b/store/index.js @@ -18,7 +18,7 @@ const store = new Vuex.Store({ bottompadding: "", heightBar: '' }, - + shopId: null }, getters: { is_login(state) { @@ -35,8 +35,12 @@ const store = new Vuex.Store({ //二次修改后的值 或者过滤的 return state.info; }, + }, mutations: { + SET_SHOPID(state, data) { + state.shopId = data; + }, SET_STATUS_BAR(state, data) { state.BarHeight.statusBar = data; }, @@ -57,7 +61,16 @@ const store = new Vuex.Store({ }, }, actions: { - + set_shopid: async ({ + commit + }, data) => { + let res = await Api.productqueryShopIdByTableCode({ + code: uni.cache.get('tableCode') + }) + if (res.code == 0) { + commit('SET_SHOPID', res.data) + } + }, HeightActions({ commit }) { @@ -95,8 +108,8 @@ const store = new Vuex.Store({ // #ifdef APP-PLUS console.log('app-plus', e) statusBar = e.statusBarHeight - heightBar = e.statusBarHeight - customBar = e.statusBarHeight + heightBar = e.statusBarHeight + customBar = e.statusBarHeight bottomPadding = (e.screenHeight - e.safeArea.bottom) // customBar = 0 // #endif