From 798a7ba909755f505c976ddfa4ca9edb32132297 Mon Sep 17 00:00:00 2001 From: "3321822538@qq.com" <3321822538@qq.com> Date: Sat, 15 Feb 2025 14:15:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B1=E4=BA=AB=E8=8C=B6=E5=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/http.interceptor.js | 4 +- page_fenbaotwo/zhangdan.vue | 2 +- page_moban/baojieorder.vue | 2 +- page_moban/datingxq.vue | 28 ++- page_shanghu/dianpuroomadd.vue | 100 ++++++----- page_shanghu/erwm.vue | 38 ++-- page_shanghu/index.vue | 96 +++++++++-- page_shanghu/roomxq.vue | 8 +- page_shanghu/shebei.vue | 16 +- page_shanghu/yunying.vue | 1 - page_user/dingdanxq.vue | 133 +++++++++----- page_user/xudan.vue | 20 ++- pages/index/index.vue | 307 ++++++++++++++++++++++++++------- pages/my.vue | 32 ++-- pages/myorder/index.vue | 53 ++++-- pages/nearbystores/index.vue | 233 ++++++++++++++++++++++--- pages/tj.vue | 40 +++-- 17 files changed, 825 insertions(+), 288 deletions(-) diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 5c749eb..1bb4916 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -20,8 +20,8 @@ const install = (Vue, vm) => { // }, // https://yxd.ccttiot.com/prod-api}); Vue.prototype.$u.http.setConfig({ - baseUrl: 'http://192.168.2.56:8089', - // baseUrl: 'https://testcha.chuangtewl.com/prod-api', + // baseUrl: 'http://192.168.2.56:8089', + baseUrl: 'https://testcha.chuangtewl.com/prod-api', loadingText: '努力加载中~', loadingTime: 800, // 设置自定义头部content-type diff --git a/page_fenbaotwo/zhangdan.vue b/page_fenbaotwo/zhangdan.vue index fb89d60..7e8c92e 100644 --- a/page_fenbaotwo/zhangdan.vue +++ b/page_fenbaotwo/zhangdan.vue @@ -158,7 +158,7 @@ background-color: #fff; border-radius: 20rpx; // overflow: scroll; - padding-bottom: 70rpx; + padding-bottom: 20rpx; box-sizing: border-box; padding-top: 8rpx; padding-left: 36rpx; diff --git a/page_moban/baojieorder.vue b/page_moban/baojieorder.vue index 03739f9..1d44ffa 100644 --- a/page_moban/baojieorder.vue +++ b/page_moban/baojieorder.vue @@ -48,7 +48,7 @@ 包厢名称:竹韵 - 预计结束时间:{{item.endTime}} + 预计结束时间:{{item.endTime == null ? '--' : item.endTime}} 完成时间:-- diff --git a/page_moban/datingxq.vue b/page_moban/datingxq.vue index b01bc56..5ec9333 100644 --- a/page_moban/datingxq.vue +++ b/page_moban/datingxq.vue @@ -21,6 +21,14 @@ {{leixing}} + + + 生成二维码 + + + + + 设备绑定 @@ -194,6 +202,12 @@ uni.removeStorageSync('ruleIdlist') }, methods: { + // 点击生成二维码 + btnewm(){ + uni.navigateTo({ + url:'/page_shanghu/erwm?roomId=' + this.roomId + }) + }, // 点击未投列表放选择 btntouf(){ this.dtflags = false @@ -209,7 +223,7 @@ success: res => { function getQueryParam(url, paramName) { let regex = new RegExp(`[?&]${paramName}=([^&]*)`) - let results = regex.exec(url); + let results = regex.exec(url) return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null } console.log(res); @@ -285,15 +299,15 @@ }, // 点击选择标签 btnbq(dictValue,index) { - const indexExists = this.selectedIndices.includes(dictValue); + const indexExists = this.selectedIndices.includes(dictValue) if (indexExists) { - this.selectedIndices = this.selectedIndices.filter(i => i !== dictValue); + this.selectedIndices = this.selectedIndices.filter(i => i !== dictValue) } else { - this.selectedIndices.push(dictValue); + this.selectedIndices.push(dictValue) } }, isSelected(dictValue) { - return this.selectedIndices.includes(dictValue); + return this.selectedIndices.includes(dictValue) }, // 获取标签 getbiaoqian(){ @@ -439,7 +453,7 @@ } }) } else if (res.cancel) { - + } } }) @@ -670,7 +684,7 @@ } .box{ width: 680rpx; - max-height: 408rpx; + max-height: 470rpx; background: #FFFFFF; margin: auto; margin-top: 22rpx; diff --git a/page_shanghu/dianpuroomadd.vue b/page_shanghu/dianpuroomadd.vue index 73b47c8..a78250c 100644 --- a/page_shanghu/dianpuroomadd.vue +++ b/page_shanghu/dianpuroomadd.vue @@ -51,12 +51,12 @@ 未绑定 - + @@ -119,16 +119,16 @@ 未绑定 - + - @@ -201,9 +201,9 @@ - + @@ -221,7 +221,7 @@ - @@ -413,7 +413,7 @@ }, // 点击控制大厅设施 btndtkg(num, index, item) { - console.log(item); + console.log(item) let equipmentId = item.equipmentList[0].equipmentId if (num == 0) { //关闭 this.$u.put(`/app/device/adminMch/${equipmentId}/switch?open=false`).then(res => { @@ -461,6 +461,7 @@ }, // 点击控制房间设施 btnroomkg(num, index, item) { + console.log(item,'1000'); let equipmentId = item.equipmentList[index].equipmentId if (num == 0) { //关闭 this.$u.put(`/app/device/adminMch/${equipmentId}/switch?open=false`).then(res => { @@ -512,41 +513,50 @@ }, // 点击控制大门 btndmkg(num) { - if (num == 0) { //关闭 - this.$u.put(`/app/device/admin/${this.gateSnobj.deviceId}/switch?open=false`).then(res => { - if (res.code == 200) { - uni.showToast({ - title: '关闭成功', - icon: 'success', - duration: 2000 - }) - this.gateSnobj.powerStatus = 0 - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - } - }) - } else { //开启 - this.$u.put(`/app/device/admin/${this.gateSnobj.deviceId}/switch?open=true`).then(res => { - if (res.code == 200) { - uni.showToast({ - title: '开启成功', - icon: 'success', - duration: 2000 - }) - this.gateSnobj.powerStatus = 1 - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - } - }) - } + this.$u.get(`app/store/openGate/${this.storeId}`).then(res => { + if(res.code == 200){ + uni.showToast({ + title: '开启成功', + icon: 'success', + duration: 2000 + }) + } + }) + // if (num == 0) { //关闭 + // this.$u.put(`/app/device/admin/${this.gateSnobj.deviceId}/switch?open=false`).then(res => { + // if (res.code == 200) { + // uni.showToast({ + // title: '关闭成功', + // icon: 'success', + // duration: 2000 + // }) + // this.gateSnobj.powerStatus = 0 + // } else { + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }) + // } + // }) + // } else { //开启 + // this.$u.put(`/app/device/admin/${this.gateSnobj.deviceId}/switch?open=true`).then(res => { + // if (res.code == 200) { + // uni.showToast({ + // title: '开启成功', + // icon: 'success', + // duration: 2000 + // }) + // this.gateSnobj.powerStatus = 1 + // } else { + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }) + // } + // }) + // } }, // 点击添加大厅and厕所设施 @@ -807,7 +817,7 @@ image { width: 50rpx; height: 50rpx; - margin-top: 30rpx; + margin-top: 50rpx; } .rt { diff --git a/page_shanghu/erwm.vue b/page_shanghu/erwm.vue index 87d106e..31a7acc 100644 --- a/page_shanghu/erwm.vue +++ b/page_shanghu/erwm.vue @@ -33,27 +33,19 @@ }, sn:'', roomId:'', - viewType:'', - equipmentId:'', https:'' } }, onLoad(option) { - if(option.equipmentId){ //设施 - this.equipmentId = option.equipmentId - if(option.viewType){ //判断是否为卫生间 - this.viewType = option.viewType - }else{ - this.viewType = '' - } - this.https = 'https://testcha.chuangtewl.com?equipmentId=' + this.equipmentId + '&viewType=' + this.viewType - }else if(option.roomId){ //房间 + if(option.roomId){ //房间and大厅 this.roomId = option.roomId - this.viewType = option.viewType - this.https = 'https://testcha.chuangtewl.com?roomId=' + this.roomId + '&viewType=' + this.viewType - }else if(option.storeId){ //大门 + this.https = 'https://testcha.chuangtewl.com?roomId=' + this.roomId + }else if(option.storeId){ //大门-店铺 this.storeId = option.storeId this.https = 'https://testcha.chuangtewl.com?storeId=' + this.storeId + }else if(option.toiletId){ //厕所 + this.toiletId = option.toiletId + this.https = 'https://testcha.chuangtewl.com?toiletId=' + this.toiletId } console.log(option) this.qrFun() @@ -63,31 +55,31 @@ }, methods: { drawCanvas() { - const ctx = uni.createCanvasContext('qrcode', this); - ctx.setFillStyle('#fff'); - ctx.fillRect(10, 10, 250, 250); - ctx.draw(); + const ctx = uni.createCanvasContext('qrcode', this) + ctx.setFillStyle('#fff') + ctx.fillRect(10, 10, 250, 250) + ctx.draw() }, // 保存二维码 saveCanvas() { uni.canvasToTempFilePath({ canvasId: 'qrcode', success: (res) => { - console.log(res.tempFilePath); // 打印图片路径 + console.log(res.tempFilePath) // 打印图片路径 uni.saveImageToPhotosAlbum({ filePath: res.tempFilePath, success: function() { uni.showToast({ title: '保存成功', icon: 'success' - }); + }) } - }); + }) }, fail: (err) => { - console.error(err); + console.error(err) } - }); + }) }, //**生成二维码**// qrFun: function() { diff --git a/page_shanghu/index.vue b/page_shanghu/index.vue index d8b68d2..7159a92 100644 --- a/page_shanghu/index.vue +++ b/page_shanghu/index.vue @@ -5,7 +5,7 @@ - + + 充值记录 @@ -70,8 +70,8 @@ 销售统计 - - + --> + + + + {{item.menuName}} + + + + + {{val.menuName}} + + - @@ -127,21 +137,64 @@ bgc: { backgroundColor: "", }, + userobj:[], + menuobj:[], + yiyouobj:[], + list:[] } }, onLoad() { - // 一进来请求个人信息 判断有无登录 - this.$u.get(`/getAppInfo`).then(res => { - if (res.code == 200) { - - }else if(res.code == 401){ - uni.reLaunch({ - url:'/pages/login/index' - }) - } - }) + this.getinfo() }, methods: { + // 点击进行页面跳转 + btnurl(url){ + console.log(url); + if(url == null){ + uni.showToast({ + title: '此功能暂未开放', + icon: 'none', + duration:2000 + }) + }else{ + uni.navigateTo({ + url:url + }) + } + }, + + // 查询菜单列表 + getmenu(){ + this.$u.get('/app/appMenu/allList').then(res => { + if (res.code === 200) { + this.menuobj = res.data + let topLevelMenus = this.menuobj.filter(item => item.parentId == 0) + let menuMap = new Map(topLevelMenus.map(item => [item.menuId, { ...item, children: [] }])) + this.yiyouobj = this.menuobj.filter(item => + this.userobj.appMenus.includes(item.menuId) + ) + this.yiyouobj.forEach(item => { + if (menuMap.has(item.parentId)) { + menuMap.get(item.parentId).children.push(item) + } + }) + this.list = Array.from(menuMap.values()) + } + }) + }, + // 查询个人信息 + getinfo(){ + this.$u.get(`/getAppInfo`).then(res => { + if (res.code == 200) { + this.userobj = res.user + this.getmenu() + }else if(res.code == 401){ + uni.reLaunch({ + url:'/pages/login/index' + }) + } + }) + }, // 点击这些提示未开放 btnwei(){ uni.showToast({ @@ -187,9 +240,14 @@ url:'/page_moban/baojieorder' }) }else if(num == 8){ //跳转到对账单页面 - uni.navigateTo({ - url:'/page_fenbaotwo/duizhangdan' - }) + uni.showToast({ + title: '此功能暂未开放', + icon: 'none', + duration:2000 + }) + // uni.navigateTo({ + // url:'/page_fenbaotwo/duizhangdan' + // }) }else if(num == 9){ //跳转到配置WIFI页面 uni.navigateTo({ url:'/page_fenbaotwo/wifipz' diff --git a/page_shanghu/roomxq.vue b/page_shanghu/roomxq.vue index 785f955..fff8fad 100644 --- a/page_shanghu/roomxq.vue +++ b/page_shanghu/roomxq.vue @@ -89,20 +89,20 @@ 未绑定 - + SN:{{item.device.sn}} - - + + diff --git a/page_shanghu/shebei.vue b/page_shanghu/shebei.vue index 5864afb..768b3b2 100644 --- a/page_shanghu/shebei.vue +++ b/page_shanghu/shebei.vue @@ -53,12 +53,12 @@ - + 没有更多设备啦... @@ -148,11 +148,11 @@ }) }, // 点击跳转到二维码 - btnewm(sn){ - uni.navigateTo({ - url:'/page_shanghu/erwm?deviceId=' + deviceId - }) - }, + // btnewm(deviceId){ + // uni.navigateTo({ + // url:'/page_shanghu/erwm?deviceId=' + deviceId + // }) + // }, // 点击进行搜索 btnsousuo(){ this.pagesum = 1 @@ -306,7 +306,7 @@ box-sizing: border-box; .list_item{ width: 750rpx; - height: 422rpx; + height: 340rpx; background: #FFFFFF; margin-top: 20rpx; .sbm{ diff --git a/page_shanghu/yunying.vue b/page_shanghu/yunying.vue index 1f07c9c..b6002fd 100644 --- a/page_shanghu/yunying.vue +++ b/page_shanghu/yunying.vue @@ -137,7 +137,6 @@ - diff --git a/page_user/dingdanxq.vue b/page_user/dingdanxq.vue index b41e8b5..d78878e 100644 --- a/page_user/dingdanxq.vue +++ b/page_user/dingdanxq.vue @@ -34,7 +34,7 @@ - 【{{orderobj.storeName == null ? '--' : orderobj.storeName}}】 + 【{{orderobj.storeName == null ? '--' : orderobj.storeName}}】 房间 大厅 @@ -67,6 +67,10 @@ 微信支付 门店余额 + + 套餐名称: + {{orderobj.explain == null ? '--' : orderobj.explain}} + 付款金额: ¥{{orderobj.price == null ? '--' : orderobj.price}}({{orderobj.hours == null ? '--' : orderobj.hours}}小时套餐) @@ -89,7 +93,8 @@ - + + @@ -113,16 +118,16 @@ 温馨提示 - 1、订单转发好友后,好友也可直接自助开门进入 门店、包厢; + 1、订单转发好友后,好友也可直接自助开门进入门店、包厢; - 2、订单续单可能碰到后续时间段被人预定而无法 续单的情况,请提前规划好预约时间段; + 2、订单续单可能碰到后续时间段被人预定而无法续单的情况,请提前规划好预约时间段; - 3、如果临时有事无法到店消费,请在订单开始前 进行取消订单操作,开始后,不支持退款,请合 理规划您的时间; + 3、如果临时有事无法到店消费,请在订单开始前进行取消订单操作,开始后,不支持退款,请合理规划您的时间; - 4、若您迟到,订单仍按预定开始时间计费,迟到 部分时长不进行退款,不进行延期,请合理规划 预定时间段; + 4、若您迟到,订单仍按预定开始时间计费,迟到部分时长不进行退款,不进行延期,请合理规划预定时间段; 5、请勿大声喧哗,订单结束离店请爱护财务。 @@ -201,7 +206,24 @@ } }) }, - + // 如果是大厅设施则点击开启 + btnkai(){ + this.$u.get(`/app/room/openRoomGate/${this.orderobj.roomId}`).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '开启成功', + icon: 'success', + duration: 2000 + }) + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + }, // 自定义导航栏返回 btns(){ uni.reLaunch({ @@ -210,39 +232,65 @@ }, // 点击开店门 btnkdm(){ - this.$u.get(`app/store/openGate/${this.orderobj.storeId}`).then(res => { - if (res.code == 200) { - uni.showToast({ - title: '开启店门成功', - icon: 'success', - duration: 2000 - }) - }else{ - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - } - }) + if(this.orderobj.userId != this.user.userId){ + this.$u.get(`app/store/openGate/${this.orderobj.storeId}`).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '开启店门成功', + icon: 'success', + duration: 2000 + }) + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + }else{ + this.$u.get(`app/store/openGate/${this.orderobj.storeId}&isVerify=false`).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '开启店门成功', + icon: 'success', + duration: 2000 + }) + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + } }, // 点击开包厢门 btnkbxm(){ - this.$u.get(`app/room/openRoomGate/${this.orderobj.roomId}`).then(res => { - if (res.code == 200) { - uni.showToast({ - title: '开启包厢门成功', - icon: 'success', - duration: 2000 - }) - }else{ - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - } - }) + if(this.orderobj.roomType2 == 1){ + this.$u.get(`app/room/openRoomGate/${this.orderobj.roomId}`).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '开启包厢门成功', + icon: 'success', + duration: 2000 + }) + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + }else{ + uni.showToast({ + title: '大厅无需开包厢门', + icon: 'none', + duration: 2000 + }) + } }, // 请求订单详情(被分享人) getxqs(){ @@ -478,7 +526,7 @@ width: 288rpx; height: 78rpx; margin-top: 20rpx; - margin-left: 34rpx; + margin-left: 40rpx; position: relative; border-radius: 50rpx; image{ @@ -535,7 +583,7 @@ } .dianpu{ width: 674rpx; - max-height: 526rpx; + max-height: 600rpx; background: #FFFFFF; box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(0,0,0,0.15); border-radius: 18rpx 18rpx 18rpx 18rpx; @@ -580,6 +628,13 @@ color: #3D3D3D; border-left: 8rpx solid #48893B; border-radius: 4rpx; + text{ + padding: 4rpx; + border: 1px solid #48893B; + font-size: 24rpx; + font-weight: 400; + color: #48893B; + } } .rt{ image{ diff --git a/page_user/xudan.vue b/page_user/xudan.vue index 375b61d..782e40d 100644 --- a/page_user/xudan.vue +++ b/page_user/xudan.vue @@ -11,7 +11,7 @@ - + @@ -38,19 +38,19 @@ --> - + 套餐选择: - {{item.explain == null ? '--' : item.explain}} + {{item.explain.length > 5 ? item.explain.slice(0,4) + '...' : item.explain}} ¥{{item.price == null ? '--' : item.price}} - + 时长选择: @@ -247,7 +247,8 @@ timeshijian:'', orderNo:'', biaoqianlist:[], - viewType:'' + viewType:'', + ruleId:'' } }, onLoad(option) { @@ -509,9 +510,9 @@ // let formattedDateString = time.replace(/\//g, "-") let data = { payType: this.zfssid, - ruleId:this.tclist[0].mode == 2 ? this.tcobj.ruleId : this.tclist[0].mode, - viewType:this.viewType, - type: 2, + ruleId:this.ruleId, + type2:this.viewType, + // type: 2, mode: this.tclist[0].mode, hours: this.hourstime, price: this.price, @@ -817,6 +818,7 @@ // 选择套餐 btntc(index, item) { this.tcobj = item + this.ruleId = item.ruleId this.price = item.price //订单金额 this.hourstime = item.hours //订单时间 this.indextwo = index diff --git a/pages/index/index.vue b/pages/index/index.vue index e33f3c6..2176345 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,6 +1,6 @@ @@ -222,7 +228,7 @@ backgroundColor: "", }, list: [{ - image: 'https://api.ccttiot.com/smartmeter/img/static/uqYdRLVlB5b61Qdnbirn' + image: 'https://api.ccttiot.com/smartmeter/img/static/uuoqWaq7HnXBteQayaz4' }], imgflag: true, storeId: '', @@ -235,7 +241,7 @@ jinxinglist: [], jinxinflag: false, jinxintxt: '开包厢', - tabindex: 0, + tabindex: 1, biaoqianlist: [], biaostoreqianlist: [], mdindex:-1, @@ -243,32 +249,129 @@ tit:'', tabarr:[], type:'', - distance:'' + distance:'', + roomId:'', + sceneValue:'', + cesuolist:[], + cesuoflag:false, + csindex:-1, } }, onLoad(option) { - this.tit = option.tit - this.distance = option.distance - if (option.storeId) { + console.log(option); + if (option.q) { + // 解码扫码结果 + this.sceneValue = option.q; + let decodedValue = decodeURIComponent(this.sceneValue); + // 解析 URL 参数的函数 + function getQueryParam(url, paramName) { + let regex = new RegExp(`[?&]${paramName}=([^&]*)`); + let results = regex.exec(url); + return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null; + } + // 判断是 storeId 还是 roomId + let storeId = getQueryParam(decodedValue, 'storeId'); + let roomId = getQueryParam(decodedValue, 'roomId'); + if (storeId) { + console.log('这是 storeId:', storeId); + // 执行 storeId 相关的逻辑 + this.storeId = storeId + uni.setStorageSync('storeId', this.storeId) + this.tabindex = 1 + this.getroombq() + this.jinxinflag = false //如果进行了tab切换 则隐藏 + this.getbiaoqian() + this.getstorebiaoqian() + this.getorder() + this.hourPointsArray = this.getCurrentHourPoints() //计算从当前时间往后推24小时 + } else if (roomId) { + console.log('这是 roomId:', roomId); + // 执行 roomId 相关的逻辑 + this.roomId = roomId + this.$u.get(`/app/order/getInProgressOrderList`).then(res => { + if (res.code == 200) { + if(res.data == null || res.data.length == 0){ + uni.navigateTo({ + url: '/pages/myorder/index?roomId=' + this.roomId + }) + }else{ + uni.navigateTo({ + url:'/page_user/dingdanxq?orderNo=' + res.data[0].orderNo + '&viewType=' + res.data[0].roomType2 + }) + } + }else if(res.code == 401){ + uni.navigateTo({ + url:'/pages/login/index' + }) + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + } else { + console.log('URL 中未找到 storeId 或 roomId'); + } + }else if(option.storeId) { this.storeId = option.storeId uni.setStorageSync('storeId', this.storeId) + this.tabindex = 1 + this.getroombq() + this.jinxinflag = false //如果进行了tab切换 则隐藏 + this.getbiaoqian() + this.getstorebiaoqian() + this.getorder() + this.hourPointsArray = this.getCurrentHourPoints() //计算从当前时间往后推24小时 } else { this.storeId = uni.getStorageSync('storeId') + this.tabindex = 1 + this.getroombq() + this.jinxinflag = false //如果进行了tab切换 则隐藏 + this.getbiaoqian() + this.getstorebiaoqian() + this.getorder() + this.hourPointsArray = this.getCurrentHourPoints() //计算从当前时间往后推24小时 + } + if(option.distance){ + this.distance = option.distance } }, onShow() { - this.tabindex = 0 - this.getroombq() - this.jinxinflag = false //如果进行了tab切换 则隐藏 - this.getbiaoqian() - this.getstorebiaoqian() - this.getorder() - this.hourPointsArray = this.getCurrentHourPoints() //计算从当前时间往后推24小时 + }, mounted() { }, methods: { + // 点击打开厕所门 + btncs(item){ + if(item.deviceId == null){ + uni.showToast({ + title: '该厕所未安装设备', + icon: 'none', + duration: 2000 + }) + }else{ + this.$u.get(`/app/room/openToilet/${item.toiletId}`).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '打开成功', + icon: 'success', + duration: 2000 + }) + this.cesuoflag = false + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + } + }, // 点击存取球杆进行跳转 btncungan(){ uni.navigateTo({ @@ -278,7 +381,7 @@ // 点击包厢切换高亮 btnmd(index,item){ - this.viewType = item.viewType + this.viewType = item.reType this.mdindex = index }, // 点击隐藏进行中订单 @@ -353,12 +456,13 @@ // 点击切换tab类型 btngundong(type, index) { - this.tabindex = index + console.log(type) + this.shopobj.roomList = [] + this.tabindex = type this.type = type this.getstoredetail() }, - // 拿到当前时间后24小时格式成两位数 initializeData() { // 获取当前时间 @@ -387,12 +491,12 @@ // 更新房间的预订状态且与initializeData进行匹对 updateRoomReservationStatus() { this.roomList.forEach(room => { - if (room.reservationStatus == null) { - room.reservationStatus = {} // 为每个房间创建一个新的预订状态对象 - this.hours.forEach(hour => { - room.reservationStatus[hour] = false // 初始化为未预订状态 - }) - } else { + // if (room.reservationStatus == null) { + // room.reservationStatus = {} // 为每个房间创建一个新的预订状态对象 + // this.hours.forEach(hour => { + // room.reservationStatus[hour] = false // 初始化为未预订状态 + // }) + // } else { room.reservationStatus = {} // 为每个房间创建一个新的预订状态对象 this.hours.forEach(hour => { room.reservationStatus[hour] = false // 初始化为未预订状态 @@ -434,12 +538,11 @@ } } }) - } + // } }) console.log(this.roomList, '00') }, - //计算从当前时间往后推24小时 getCurrentHourPoints() { let now = new Date() @@ -553,11 +656,21 @@ } }) }else{ - uni.showToast({ - title: '您当前没有订单', - icon: 'none', - duration: 2000 - }) + this.$u.get(`app/store/openGate/${this.storeId}`).then(res => { + if(res.code == 200){ + uni.showToast({ + title: '开启店门成功', + icon: 'success', + duration: 2000 + }) + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) } }else if(num == 2){ if(this.jinxinglist.length > 1){ @@ -619,12 +732,43 @@ }) } }) + }else if(num == 6){ + this.$u.get(`/app/toilet/list?storeId=${this.storeId}`).then(res =>{ + if(res.code == 200){ + if(res.rows == null || res.rows.length == 0){ + uni.showToast({ + title: '暂无卫生间', + icon: 'none', + duration:2000 + }) + }else{ + this.cesuolist = res.rows + if(this.cesuolist.length == 1){ + this.$u.get(`/app/room/openToilet/${this.cesuolist[0].toiletId}`).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '打开成功', + icon: 'success', + duration: 2000 + }) + this.cesuoflag = false + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + }else{ + this.cesuoflag = true + } + } + } + }) } }, - - - // 点击进行导航 btndaohang() { uni.openLocation({ @@ -649,7 +793,7 @@ // 点击跳转包厢详情页 btndetail(item) { uni.navigateTo({ - url: '/pages/myorder/index?roomId=' + item.roomId + '&viewType=' + item.viewType + url: '/pages/myorder/index?roomId=' + item.roomId + '&viewType=' + item.type2 }) }, // 点击自定义导航栏返回首页 @@ -674,7 +818,6 @@ } }) } - } } @@ -699,7 +842,53 @@ background-color: #226914 !important; color: #fff !important; } - + .cesuoul{ + width: 260rpx; + max-height: 500rpx; + background-color: #fff; + border-radius: 30rpx; + position: fixed; + top: 50%; + left: 50%; + transform: translateX(-50%); + z-index: 99; + padding: 30rpx; + box-sizing: border-box; + .anniuqx{ + width: 100%; + height: 80rpx; + border: 1px solid #226914; + text-align: center; + line-height: 80rpx; + color: #226914; + margin-top: 30rpx; + border-radius: 20rpx; + font-size: 32rpx; + font-weight: 600; + } + .cesuoli{ + width: 100%; + .caocuo{ + .name{ + width: 100%; + text-align: center; + margin-top: 20rpx; + font-size: 32rpx; + } + .kaiguan{ + padding: 10rpx; + background-color: #226914; + color: #fff; + border-radius: 10rpx; + margin: auto; + margin-top: 20rpx; + width: 100rpx; + text-align: center; + } + } + + } + } .taiqiubox { max-height: 710rpx; overflow: scroll; @@ -959,7 +1148,7 @@ .xuanfu { position: fixed; - top: 62%; + top: 58%; right: 30rpx; animation: fadeInDowns .5s ease-out forwards; @@ -997,7 +1186,7 @@ .xuanfus { position: fixed; - top: 62%; + top: 58%; right: -80rpx; animation: fadeInDown .5s ease-out forwards; diff --git a/pages/my.vue b/pages/my.vue index 7f7a9d8..7c10344 100644 --- a/pages/my.vue +++ b/pages/my.vue @@ -224,23 +224,23 @@ url:'/pages/nearbystores/index' }) }else if(num == 2){ - uni.navigateTo({ - url:'/page_user/huogui' - }) - // uni.scanCode({ - // onlyFromCamera: true, - // scanType: ['qrCode'], - // success: res => { - // console.log(res); - // }, - // fail: err => { - // console.error('扫描失败:', err) - // uni.showToast({ - // title: '扫描失败', - // icon: 'none' - // }) - // } + // uni.navigateTo({ + // url:'/page_user/huogui' // }) + uni.scanCode({ + onlyFromCamera: true, + scanType: ['qrCode'], + success: res => { + console.log(res); + }, + fail: err => { + console.error('扫描失败:', err) + uni.showToast({ + title: '扫描失败', + icon: 'none' + }) + } + }) }else if(num == 7){ uni.showModal({ title: '温馨提示', diff --git a/pages/myorder/index.vue b/pages/myorder/index.vue index b4abb8b..d35a64c 100644 --- a/pages/myorder/index.vue +++ b/pages/myorder/index.vue @@ -1,7 +1,7 @@ @@ -151,7 +173,11 @@ jinxinflag:false, sousuovalue:'', tabindex:1, - type:1 + type:1, + userType:'00', + cesuolist:[], + cesuoflag:false, + csindex:-1, } }, onLoad(option) { @@ -184,7 +210,7 @@ }, // 点击选择开包厢 btnmd(index,item){ - this.viewType = item.viewType + this.viewType = item.reType this.mdindex = index }, // 请求正在进行中的订单 @@ -352,16 +378,129 @@ onlyFromCamera: true, scanType: ['qrCode'], success: res => { - console.log(res) - uni.navigateTo({ - url:'/pages/myorder/orderxd?roomId=' + 65 - }) - }, - fail: err => { - console.error('扫描失败:', err) + function getQueryParam(url, paramName) { + let regex = new RegExp(`[?&]${paramName}=([^&]*)`) + let results = regex.exec(url); + return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null + } + console.log(res); + let sceneValue = res.result + let decodedValue = decodeURIComponent(sceneValue) + let id = getQueryParam(decodedValue, 'sn') + if(id){ + let that = this + let data = { + sn: id, + } + that.$u.get(`/app/device/isBind?deviceNo=${id}`).then(res => { + if (res.data == 2) { + uni.showToast({ + title: '该设备已被绑定', + icon: 'none', + duration: 2000 + }) + } else if (res.data == 1) { + uni.showModal({ + title: '提示', + content: '该设备未绑定,你需进行绑定吗?', + success: function(res) { + if (res.confirm) { + that.$u.put("/app/device/bind", data).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '绑定成功', + icon: 'success', + duration: 2000 + }) + that.userType = '01' + } + }) + } + } + }) + }else if(res.data == 0){ + uni.showToast({ + title: '该设备为录入,请先录入', + icon: 'none', + duration: 2000 + }) + } + }) + } + } + }) + }else if(num == 5){ + uni.switchTab({ + url:'/pages/tj' + }) + }else if(num == 6){ + if(this.jinxinglist.length > 0){ + let storeId = this.jinxinglist[0].storeId + this.$u.get(`/app/toilet/list?storeId=${storeId}`).then(res =>{ + if(res.code == 200){ + if(res.rows == null || res.rows.length == 0){ + uni.showToast({ + title: '暂无卫生间', + icon: 'none', + duration:2000 + }) + }else{ + this.cesuolist = res.rows + if(this.cesuolist.length == 1){ + this.$u.get(`/app/room/openToilet/${this.cesuolist[0].toiletId}`).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '打开成功', + icon: 'success', + duration: 2000 + }) + this.cesuoflag = false + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + }else{ + this.cesuoflag = true + } + } + } + }) + }else{ + uni.showToast({ + title: '当前没有订单,请先下单', + icon: 'none', + duration: 2000 + }) + } + } + }, + // 点击打开厕所门 + btncs(item){ + console.log(item); + if(item.deviceId == null){ + uni.showToast({ + title: '该厕所未安装设备', + icon: 'none', + duration: 2000 + }) + }else{ + this.$u.get(`/app/room/openToilet/${item.toiletId}`).then(res => { + if (res.code == 200) { uni.showToast({ - title: '扫描失败', - icon: 'none' + title: '打开成功', + icon: 'success', + duration: 2000 + }) + this.cesuoflag = false + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 }) } }) @@ -401,6 +540,7 @@ getinfo(){ this.$u.get(`/getAppInfo`).then(res => { if(res.code == 200){ + this.userType = res.user.userType uni.setStorageSync('user', res.data) }else if(res.code == 401){ this.jingmo() @@ -420,6 +560,7 @@ that.$u.post(`/loginByopenid?jsCode=${res.code}`,data).then(res=>{ if (res.code == 200) { console.log("老用户登录",res) + that.getinfo() wx.setStorageSync('token', res.token) } }) @@ -459,7 +600,7 @@ onTouchEnd(e) { this.imgflag = true let deltaX = e.changedTouches[0].clientX - this.touchStartX - let deltaY = e.changedTouches[0].clientY - this.touchStartY; + let deltaY = e.changedTouches[0].clientY - this.touchStartY if (Math.abs(deltaX) > 50 && Math.abs(deltaX) > Math.abs(deltaY)) { if (deltaX >= 0) { // console.log("左滑") @@ -522,6 +663,53 @@ font-size: 40rpx !important; color: #3D3D3D !important; } + .cesuoul{ + width: 260rpx; + max-height: 500rpx; + background-color: #fff; + border-radius: 30rpx; + position: fixed; + top: 50%; + left: 50%; + transform: translateX(-50%); + z-index: 99; + padding: 30rpx; + box-sizing: border-box; + .anniuqx{ + width: 100%; + height: 80rpx; + border: 1px solid #226914; + text-align: center; + line-height: 80rpx; + color: #226914; + margin-top: 30rpx; + border-radius: 20rpx; + font-size: 32rpx; + font-weight: 600; + } + .cesuoli{ + width: 100%; + .caocuo{ + .name{ + width: 100%; + text-align: center; + margin-top: 20rpx; + font-size: 32rpx; + } + .kaiguan{ + padding: 10rpx; + background-color: #226914; + color: #fff; + border-radius: 10rpx; + margin: auto; + margin-top: 20rpx; + width: 100rpx; + text-align: center; + } + } + + } + } .tabqh{ display: flex; width: 100%; @@ -707,10 +895,10 @@ .shop_item{ margin: auto; display: flex; - margin-top: 40rpx; + margin-top: 30rpx; box-sizing: border-box; width: 674rpx; - height: 350rpx; + height: 330rpx; background: #FFFFFF; padding: 20rpx 18rpx; box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(0,0,0,0.15); @@ -781,7 +969,7 @@ margin-right: 38rpx; image{ width: 186rpx; - height: 236rpx; + height: 220rpx; border-radius: 10rpx; } .hour{ @@ -841,6 +1029,7 @@ font-size: 36rpx; color: #226914; line-height: 50rpx; + height: 50rpx; padding-left: 34rpx; box-sizing: border-box; } diff --git a/pages/tj.vue b/pages/tj.vue index c18824d..32bcfd0 100644 --- a/pages/tj.vue +++ b/pages/tj.vue @@ -15,17 +15,17 @@ - - 订单状态 待支付 - 订单状态 支付中 - 订单状态 待使用 - 订单状态 使用中 - 订单状态 已完成 - 订单状态 超时自动取消 - 订单状态 用户取消订单 - 订单状态 退款中 - 订单状态 已退款 - 用户结束订单 + + 订单状态 预订单 续单 待支付 + 订单状态 预订单 续单 支付中 + 订单状态 预订单 续单 待使用 + 订单状态 预订单 续单 使用中 + 订单状态 预订单 续单 已完成 + 订单状态 预订单 续单 超时自动取消 + 订单状态 预订单 续单 用户取消订单 + 订单状态 预订单 续单 退款中 + 订单状态 预订单 续单 已退款 + 用户结束订单 @@ -43,7 +43,7 @@ - + 预定包厢 @@ -218,9 +218,9 @@ this.getlist() }, // 点击跳转到详情页 - btnxq(orderNo){ + btnxq(orderNo,roomType2){ uni.navigateTo({ - url:'/page_user/dingdanxq?orderNo=' + orderNo + url:'/page_user/dingdanxq?orderNo=' + orderNo + '&viewType=' + roomType2 }) }, // 点击结束订单 @@ -247,7 +247,7 @@ }else{ uni.showToast({ title: res.msg, - icon: 'success', + icon: 'none', duration:2000 }) } @@ -303,7 +303,7 @@ fail: function(err) { console.error('拨打电话失败', err) uni.showToast({ - title: '取消拨打电话', + title: '暂无店长电话', icon: 'none' }) } @@ -459,6 +459,14 @@ display: flex; justify-content: space-between; font-weight: 600; + .ydd{ + padding: 4rpx; + box-sizing: border-box; + border: 1px solid #48893B; + color: #48893B; + font-size: 24rpx; + margin-left: 10rpx; + } .ones{ font-weight: 600; font-size: 28rpx;