From 5f03e447014a996c24882b09b0daafca02ede41d Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Tue, 24 Sep 2024 15:22:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AE=9D=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=EF=BC=8C=E6=8E=92=E9=98=9F=E9=A2=84=E7=BA=A6=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E8=AE=A2=E5=8D=95=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 9 +- common/js/api.js | 18 +- common/js/websocket.js | 3 - components/popupad.vue | 1 + components/tki-barcode/tki-barcode.vue | 3 - components/tki-qrcode/tki-qrcode.vue | 9 + framework/1-utils.js | 51 +-- framework/11-api.js | 33 +- pages.json | 38 +- pages/index/components/diamond.vue | 4 +- pages/index/index.vue | 22 +- pages/index/indexs.vue | 99 ++---- pages/login/login.vue | 3 +- pages/login/loginw.vue | 4 +- pages/member/components/registermember.vue | 94 ++++- pages/member/index.vue | 15 +- pages/member/list.vue | 38 +- pages/member/memberdetails.vue | 26 +- pages/order/order.vue | 18 +- pages/order/orders.vue | 336 ------------------ pages/order/successful.vue | 2 +- pages/order_food/order_food.vue | 116 ++++-- pages/order_food/order_food_search.vue | 69 ++-- pages/pay_code/pay_code.vue | 18 +- pages/user/my_info.vue | 75 ++-- pages/user/user.vue | 27 +- .../confirm_order/index.vue | 182 ++++++++-- pagesOrder/orderAMeal/index.vue | 143 ++++++++ .../order_detail/index.vue | 0 pagesQueueUp/index/index.vue | 103 ++++-- store/index.js | 1 - 31 files changed, 823 insertions(+), 737 deletions(-) delete mode 100644 pages/order/orders.vue rename pages/order_food/confirm_order.vue => pagesOrder/confirm_order/index.vue (87%) create mode 100644 pagesOrder/orderAMeal/index.vue rename pages/order/order_detail.vue => pagesOrder/order_detail/index.vue (100%) diff --git a/App.vue b/App.vue index b3b9869..3026991 100644 --- a/App.vue +++ b/App.vue @@ -86,10 +86,15 @@ // #endif success: async (infoRes) => { console.log(infoRes) - uni.cache.set('weixincode', data.code); let res = await Api.userwxlogin({ - code: uni.cache.get('weixincode'), //临时登录凭证 + code: data.code, //临时登录凭证 rawData: infoRes.rawData, + // #ifdef MP-WEIXIN + source: 'wechat', + // #endif + // #ifdef MP-ALIPAY + source: 'alipay', + // #endif }) if (res.code == 0) { uni.cache.set('token', res.data.token); diff --git a/common/js/api.js b/common/js/api.js index 1d2008b..2ec864c 100644 --- a/common/js/api.js +++ b/common/js/api.js @@ -1,9 +1,9 @@ export default { userwxlogin(data) { //登录 - return uni.api.post("/login/wx/custom/login", data); + return uni.api.post("/login/auth/custom/login", data); }, loginwxuserInfo(data) { //获取用户详情 - return uni.api.get("/login/userInfo", data); + return uni.api.get("/login/userInfo", data,false); }, userwxlogins(data) { // 获取手机号 return uni.api.post("/login/getPhoneNumber", data); @@ -13,7 +13,7 @@ export default { }, // 获取弹窗广告列表 getPopUpAd(data) { - return uni.api.get("/tbShopAd/list", data); + return uni.api.get("/tbShopAd/list", data,false); }, productqueryShop(data) { //通过桌码获取店铺信息 @@ -87,7 +87,7 @@ export default { // 获取店铺会员信息 shopUserInfo(data) { - return uni.api.get("/user/shopUserInfo", data); + return uni.api.get("/user/shopUserInfo", data,false); }, // 注册会员 openMember(data) { @@ -236,12 +236,20 @@ export default { }, /** - * 获取排好状态 + * 获取排号状态 * @param {Object} param */ getQueueUpState(param) { return uni.api.get("/callTable/state", param); }, + + /** + * 获取订阅 + * @param {Object} data + */ + setSubMsg(data) { + return uni.api.post("/callTable/subMsg", data,false); + }, /** * 取号 diff --git a/common/js/websocket.js b/common/js/websocket.js index d9d8490..de6ffd8 100644 --- a/common/js/websocket.js +++ b/common/js/websocket.js @@ -27,7 +27,6 @@ class webSocketUtils { connectSocketInit(data) { let _this = this; this.data = data; - console.log(this.url) // #ifdef MP-WEIXIN this.socketTask = uni.connectSocket({ // #endif @@ -42,7 +41,6 @@ class webSocketUtils { return this.socketTask; }, fail: (res) => { - console.log(res) } }); @@ -221,7 +219,6 @@ class webSocketUtils { //停止发送心跳 clearInterval(this.heartbeatInterval); //如果不是人为关闭的话,进行重连 - console.log(!this.is_open_socket) if (!this.is_open_socket) { console.log('进行重连'); this.canReconnect = true; diff --git a/components/popupad.vue b/components/popupad.vue index 742e3be..8216d61 100644 --- a/components/popupad.vue +++ b/components/popupad.vue @@ -54,6 +54,7 @@ watch: { forceUpdate(val,oldval) { // 在 forceUpdate 改变时执行更新操作 + console.log(val,oldval) let time = uni.cache.get('popUpTime') ? new Date().getTime() - uni.cache.get('popUpTime') : 1000; if ( time >= 1000 ) { uni.cache.set('popUpTime', new Date().getTime()) diff --git a/components/tki-barcode/tki-barcode.vue b/components/tki-barcode/tki-barcode.vue index 04222d0..a47925a 100644 --- a/components/tki-barcode/tki-barcode.vue +++ b/components/tki-barcode/tki-barcode.vue @@ -83,7 +83,6 @@ onUnload: function() {}, methods: { setval(n) { - console.log(n) this.val = n if (!this._empty(n)) { setTimeout(() => { @@ -167,8 +166,6 @@ }, watch: { val(n, o) { - console.log(n,0) - console.log(this.onval) if (this.onval) { console.log(!this._empty(n)) if (n != o && !this._empty(n)) { diff --git a/components/tki-qrcode/tki-qrcode.vue b/components/tki-qrcode/tki-qrcode.vue index f1bb6de..d9f6476 100644 --- a/components/tki-qrcode/tki-qrcode.vue +++ b/components/tki-qrcode/tki-qrcode.vue @@ -87,6 +87,15 @@ export default { } }, methods: { + setval(n) { + console.log("setval==",n) + this.val = n + if (!this._empty(n)) { + setTimeout(() => { + this._makeCode() + }, 0); + } + }, _makeCode() { let that = this if (!this._empty(this.val)) { diff --git a/framework/1-utils.js b/framework/1-utils.js index 5f9d5db..14deaf2 100644 --- a/framework/1-utils.js +++ b/framework/1-utils.js @@ -244,6 +244,7 @@ const getUserInfo = function (successCallback, failCallback) { uni.login({ provider: 'weixin', success: (data) => { + console.log(data) // 微信小程序环境 uni.getUserInfo({ provider: 'weixin', @@ -251,23 +252,14 @@ const getUserInfo = function (successCallback, failCallback) { let res = await Api.userwxlogin({ code: data.code, //临时登录凭证 rawData: infoRes.rawData, + source: 'wechat' }) if (res.code == 0) { resolve(res) - // uni.cache.set('token', res.data.token); - // uni.cache.set('miniAppOpenId', res.data.userInfo - // .miniAppOpenId) - // uni.cache.set('userInfo', res.data.userInfo); - // let pages = getCurrentPages() - // let curPage = pages[pages.length -1 ] - // curPage.onLoad(curPage.options) - // curPage.onShow() - // // curPage.mounted() - // curPage.onReady() } }, fail: (err) => {} - }); + }); } }); @@ -279,30 +271,21 @@ const getUserInfo = function (successCallback, failCallback) { my.getAuthCode({ scopes: 'auth_user', success: (data) => { + console.log(data) // 支付宝小程序环境 - my.getAuthUserInfo({ - success: async (infoRes) => { - uni.cache.set('weixincode', data.authCode); - let res = await Api.userwxlogin({ - code: uni.cache.get('weixincode'), //临时登录凭证 - rawData: JSON.stringify(infoRes), - }) - if (res.code == 0) { - resolve(res) - // uni.cache.set('token', res.data.token); - // uni.cache.set('miniAppOpenId', res.data.userInfo - // .miniAppOpenId) - // uni.cache.set('userInfo', res.data.userInfo); - // let pages = getCurrentPages() - // let curPage = pages[pages.length -1 ] - // curPage.onLoad(curPage.options) - // curPage.onShow() - // // curPage.mounted() - // curPage.onReady() - } - }, - fail: (err) => {} - }); + // my.getAuthUserInfo({ + // success: async (infoRes) => { + // let res = await Api.userwxlogin({ + // code: data.authCode, //临时登录凭证 + // rawData: JSON.stringify(infoRes), + // source: 'alipay' + // }) + // if (res.code == 0) { + // resolve(res) + // } + // }, + // fail: (err) => {} + // }); } }); }) diff --git a/framework/11-api.js b/framework/11-api.js index 43aee2a..4c4c7d8 100644 --- a/framework/11-api.js +++ b/framework/11-api.js @@ -80,13 +80,13 @@ async function request(options) { environment: 'app', // #endif // #ifdef H5 - environment: 'wx', + environment: 'h5', // #endif // #ifdef MP-WEIXIN environment: 'wx', // #endif // #ifdef MP-ALIPAY - environment: 'wx', + environment: 'alipay', // environment: 'alipay', // #endif token: uni.cache.get('token'), @@ -125,21 +125,20 @@ async function request(options) { uni.cache.set('storage:offset-time', offset, -1) return await request(options) } else { - if (options.toast) { - uni.showToast({ - title: res.message || res.msg || res.error, - icon: "none", - success: () => { - setTimeout(res => { - if (options.toast) { - // #ifndef MP-WEIXIN || MP-ALIPAY - uni.pro.hideLoading() - // #endif - } - }, 2000) - } - }) - } + console.log(options) + uni.showToast({ + title: res.message || res.msg || res.error, + icon: "none", + success: () => { + setTimeout(res => { + if (options.toast) { + // #ifndef MP-WEIXIN || MP-ALIPAY + uni.pro.hideLoading() + // #endif + } + }, 2000) + } + }) return res } } else { diff --git a/pages.json b/pages.json index f8e1719..3c7140b 100644 --- a/pages.json +++ b/pages.json @@ -127,13 +127,6 @@ "navigationBarTitleText": "订单列表" } }, - - { - "path": "pages/order/order_detail", - "style": { - "navigationBarTitleText": "订单详情" - } - }, { "path": "pages/order/successful", @@ -227,13 +220,6 @@ } } }, - { - "path": "pages/order_food/confirm_order", - "style": { - "navigationBarTitleText": "确认订单", - "navigationBarBackgroundColor": "#E8AD7B" - } - }, { "path": "pages/make/list", "style": { @@ -363,6 +349,30 @@ } } ] + }, + { + "root": "pagesOrder", + "pages": [ + { + "path": "orderAMeal/index", + "style": { + "navigationBarTitleText": "点单" + } + }, + { + "path": "confirm_order/index", + "style": { + "navigationBarTitleText": "确认订单", + "navigationBarBackgroundColor": "#E8AD7B" + } + }, + { + "path": "order_detail/index", + "style": { + "navigationBarTitleText": "订单详情" + } + } + ] } ], "globalStyle": { diff --git a/pages/index/components/diamond.vue b/pages/index/components/diamond.vue index afc4310..e925770 100644 --- a/pages/index/components/diamond.vue +++ b/pages/index/components/diamond.vue @@ -58,7 +58,9 @@ let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code') uni.cache.set('tableCode', tableCode) if (tableCode) { - uni.pro.navigateTo('order_food/order_food') + uni.pro.navigateTo('order_food/order_food', { + tableCode: tableCode, + }) } }, fail:( res) =>{ diff --git a/pages/index/index.vue b/pages/index/index.vue index 5b6df69..62f365a 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -236,7 +236,7 @@ - + @@ -265,7 +265,6 @@ data() { return { showindex: "", - userInfo: {},//个人信息 NAME: uni.cache.get('NAME'), timersetInterval: '0', //定时器 isFixedTop: false, //吸顶是否显示 @@ -305,7 +304,7 @@ categoryList: [], subCategoryList: [], //二级菜单数据 // 登录后店铺信息 - usershopUserinfo:{}, + shopUserInfo:{}, popupadList: [], //广告数据 forceUpdate: false, shopExtend: null, @@ -368,10 +367,9 @@ "userId": uni.cache.get('userInfo').id, }) if (res.code == 0) { - this.usershopUserinfo = res.data - uni.cache.set('shopUserInfo',this.usershopUserinfo) + this.shopUserInfo = res.data + uni.cache.set('shopUserInfo',this.shopUserInfo) } - this.loginwxuserInfo() //个人信息接口 if ( uni.cache.get('forceUpdate') == 1) { this.forceUpdate = !this.forceUpdate; } @@ -442,17 +440,7 @@ this.shopExtend = res.data; } }, - // 个人信息 - async loginwxuserInfo() { - let res = await this.api.loginwxuserInfo({ - userId: uni.cache.get('userInfo').id - }) - if (res.code == 0) { - uni.cache.set('userInfo', res.data); - this.userInfo = uni.cache.get('userInfo') - } - }, - + closeproductlist() { this.showproductlist = false // console.log('close'); diff --git a/pages/index/indexs.vue b/pages/index/indexs.vue index 22c9229..b99b2e7 100644 --- a/pages/index/indexs.vue +++ b/pages/index/indexs.vue @@ -9,7 +9,7 @@ 在线点不排队 - + @@ -17,7 +17,7 @@ 入会享权益 - + @@ -34,10 +34,12 @@ - - \ No newline at end of file diff --git a/pages/order/successful.vue b/pages/order/successful.vue index 554028d..24a5e74 100644 --- a/pages/order/successful.vue +++ b/pages/order/successful.vue @@ -170,7 +170,7 @@ }, wantEvent() { uni.redirectTo({ - url: '/pages/order/order_detail?orderId=' + this.orderId + url: '/pagesOrder/order_detail/index?orderId=' + this.orderId }); }, async DoublingEvent() { diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index fc1c31f..07e1642 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -226,6 +226,8 @@ + + 已下单菜品 - - - - - {{ item.name }} - {{ item.skuName }} - - - - - {{ item.salePrice }} - - - - - + + + + + + {{ item.name }} + {{ item.skuName }} + + + + + {{ item.salePrice }} - {{ item.number }} - - - + + + + + + {{ item.number }} + + + + + + 备注 + + @@ -378,6 +390,7 @@ + @@ -427,6 +440,7 @@ forceUpdate: false, shopExtend: null, shopId: null, + tableCode: null, } }, onPageScroll(e) { @@ -456,10 +470,14 @@ } }, onLoad(e) { + console.log(e) if (e.q) { this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code') uni.cache.set('tableCode', this.tableCode) } + if ( e.tableCode ) { + this.tableCode = e.tableCode + } }, onUnload() { if (this.socketTicket) { @@ -581,6 +599,7 @@ this.shopId = res.data.storeInfo.id; this.shopInfo = res.data; this.productqueryProduct() //list 数据 + this.getShopUserInfo() //list 数据 this.handlemessage() //监听websocket返回 this.getShopExtend(); } else { @@ -590,7 +609,21 @@ } }, - + + /** + * 获取门店会员信息 + */ + async getShopUserInfo() { + let res = await this.api.shopUserInfo({ + "shopId": this.shopId, + "userId": uni.cache.get('userInfo').id, + }) + if (res.code == 0) { + this.shopUserInfo = res.data; + uni.cache.set('shopUserInfo', res.data) + } + }, + /** * 图片加载 */ @@ -1022,8 +1055,9 @@ }) return false } + console.log(JSON.stringify(this.shopInfo.storeInfo)) uni.navigateTo({ - url: `/pages/order_food/confirm_order?storeInfo=${JSON.stringify(this.shopInfo.storeInfo)}&cartList=${JSON.stringify(this.cartLists)}` + url: `/pagesOrder/confirm_order/index?storeInfo=${encodeURIComponent(JSON.stringify(this.shopInfo.storeInfo))}&cartLists=${JSON.stringify(this.cartLists)}&tableCode=${this.tableCode}` }); }, @@ -1822,8 +1856,23 @@ .shop-item { display: flex; + flex-direction: column; padding-bottom: $paddingSize; - + .shop-item-content{ + display: flex; + } + .shop-item-remark{ + display: flex; + align-items: center; + padding-right: 180rpx; + margin-top: 10rpx; + .label{ + font-size: 28rpx; + color: #666; + margin-right: 20rpx; + } + + } .langcover { position: relative; } @@ -1951,7 +2000,25 @@ } } - + .placedOrderTip{ + width: 200rpx; + height: 60rpx; + display: flex; + align-items: center; + position: fixed; + justify-content: center; + right: 0; + top: 0; + bottom: 0; + margin: auto; + z-index: 99; + background-color: #fff; + font-weight: 400; + font-size: 24rpx; + color: #333333; + border-radius: 40rpx 0rpx 0rpx 40rpx; + box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0,0,0,0.16); + } } @@ -2250,5 +2317,6 @@ } } + } \ No newline at end of file diff --git a/pages/order_food/order_food_search.vue b/pages/order_food/order_food_search.vue index 03e9cef..24ea30b 100644 --- a/pages/order_food/order_food_search.vue +++ b/pages/order_food/order_food_search.vue @@ -125,31 +125,41 @@ - - - - - {{ item.name }} - {{ item.skuName }} - - - - - {{ item.salePrice }} - - - - - + + + + + + {{ item.name }} + {{ item.skuName }} + + + + + {{ item.salePrice }} - {{ item.number }} - - - + + + + + + {{ item.number }} + + + + + + 备注 + + @@ -792,7 +802,7 @@ return false } uni.redirectTo({ - url: `/pages/order_food/confirm_order?storeInfo=${JSON.stringify(this.shopInfo.storeInfo)}&cartList=${JSON.stringify(this.cartLists)}` + url: `/pagesOrder/confirm_order/index?storeInfo=${JSON.stringify(this.shopInfo.storeInfo)}&cartList=${JSON.stringify(this.cartLists)}` }); }, @@ -1399,8 +1409,23 @@ .shop-item { display: flex; + flex-direction: column; padding-bottom: $paddingSize; - + .shop-item-content{ + display: flex; + } + .shop-item-remark{ + display: flex; + align-items: center; + padding-right: 180rpx; + margin-top: 10rpx; + .label{ + font-size: 28rpx; + color: #666; + margin-right: 20rpx; + } + + } .langcover { position: relative; } diff --git a/pages/pay_code/pay_code.vue b/pages/pay_code/pay_code.vue index b928c8b..4f3025e 100644 --- a/pages/pay_code/pay_code.vue +++ b/pages/pay_code/pay_code.vue @@ -12,7 +12,8 @@ - + + 使用门店:{{shopInfo.shopName || '--'}} @@ -23,10 +24,13 @@ + + \ No newline at end of file diff --git a/pages/order/order_detail.vue b/pagesOrder/order_detail/index.vue similarity index 100% rename from pages/order/order_detail.vue rename to pagesOrder/order_detail/index.vue diff --git a/pagesQueueUp/index/index.vue b/pagesQueueUp/index/index.vue index 822ef1e..3adaaf0 100644 --- a/pagesQueueUp/index/index.vue +++ b/pagesQueueUp/index/index.vue @@ -5,7 +5,7 @@ - + {{shopInfo.shopName}} {{shopInfo.status == 1 ? '营业中' : '休息中'}} @@ -20,8 +20,8 @@ - {{item.tableName}} - {{item.tableNote}} + {{item.tableName||''}} + {{item.tableNote||''}} {{item.waitingCount}} @@ -49,7 +49,7 @@ 当前门店 {{queueInfo.callNum}} - {{queueInfo.tableName}}{{queueInfo.tableNote}} + {{queueInfo.tableName}}{{queueInfo.tableNote||''}} @@ -57,14 +57,20 @@ 前方等待桌数 - ≥{{queueInfo.waitTime}}分钟 + ≥{{queueInfo.waitTime||''}}分钟 预计等待时长 - - 取消排队 + + + + 取消排队 + + @@ -88,8 +94,8 @@ v-for="(item,index) in tableList" :key="index" @click="tableCut(item)" > - {{item.name}} - {{item.note}} + {{item.name||''}} + {{item.note||''}} @@ -123,15 +129,17 @@ phone: "", queueUpList: [], tableList: [], - callTableId: null, + callTableId: "", shopInfo: null, queueInfo: null, - shopId: null, + shopId: "", + queueId: "", }; }, onLoad(options) { if (options.q) { this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId') + this.queueId = this.getQueryString(decodeURIComponent(options.q), 'queueId') } }, @@ -140,9 +148,7 @@ this.getQueueUpList(); this.getQueueUpTablList(); }, - onReachBottom() { - - }, + methods: { /** @@ -163,10 +169,15 @@ * 获取排号状态 */ async getQueueUpState () { - let res = await this.api.getQueueUpState({ + let params = { openId: uni.cache.get('miniAppOpenId'), shopId: this.shopId, - }) + } + if (this.queueId) { + params.queueId = this.queueId; + } + let res = await this.api.getQueueUpState(params) + if ( res.code == 0) { this.shopInfo = res.data.shopInfo; this.queueInfo = res.data.queueInfo; @@ -199,6 +210,26 @@ } }, + /** + * 订阅通知 + */ + async subscribe () { + + let res = await this.api.setSubMsg({ + openId: uni.cache.get('miniAppOpenId'), + shopId: this.shopId, + queueId: this.queueId, + }) + if ( res.code == 0) { + uni.requestSubscribeMessage({ + tmplIds:["qUhvEfvCtIcBA3DOn3QMqsGOolrEpyr0YBh99i-AUqw","yxOjWK-KjMEZ_BaHWqDJJpHiUPXN6JWqr7u9y65RIWM","3BgFazRpVlvreh5z9u4cNP_VeclXKSQfh-r3x2_bYx4"], + complete() { + + }, + }) + } + + }, /** * 取号 @@ -218,6 +249,8 @@ callTableId: this.callTableId, }) if ( res.code == 0) { + this.phone = ""; + this.queueId = res.data.id; this.getQueueUpState(); this.show = false; uni.requestSubscribeMessage({ @@ -568,18 +601,32 @@ border-right: 1rpx solid #E5E5E5; } } - .cancelBtn{ - width: 336rpx; - height: 80rpx; - line-height: 80rpx; - text-align: center; - border-radius: 56rpx; - border: 2rpx solid #333333; - font-family: Source Han Sans CN, Source Han Sans CN; - font-weight: bold; - font-size: 32rpx; - color: #333333; - margin: 64rpx auto; + .result_btn{ + display: flex; + align-items: center; + view{ + height: 80rpx; + line-height: 80rpx; + text-align: center; + border-radius: 56rpx; + border: 2rpx solid #333333; + font-family: Source Han Sans CN, Source Han Sans CN; + font-weight: bold; + font-size: 32rpx; + color: #333333; + } + .subscribe{ + width: 336rpx; + margin: 64rpx auto; + } + .cancelBtn{ + width: 336rpx; + + + + margin: 64rpx auto; + } } + } \ No newline at end of file diff --git a/store/index.js b/store/index.js index 3804969..7f88442 100644 --- a/store/index.js +++ b/store/index.js @@ -71,7 +71,6 @@ const store = new Vuex.Store({ let curPage = pages[pages.length -1 ] curPage.onLoad(curPage.options) curPage.onShow() - // curPage.mounted() curPage.onReady()