From e5a84d1abf976c493412cc6d236b3d582fad84c3 Mon Sep 17 00:00:00 2001 From: "3321822538@qq.com" <3321822538@qq.com> Date: Mon, 9 Dec 2024 16:29:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- page_components/eletj.vue | 196 +++++++++++---------- page_fenbao/hehuoren/index.vue | 8 +- page_fenbao/statulist/taocanlist/index.vue | 6 +- page_user/sbdetail.vue | 2 +- 4 files changed, 112 insertions(+), 100 deletions(-) diff --git a/page_components/eletj.vue b/page_components/eletj.vue index 0e77ee8..dc4d027 100644 --- a/page_components/eletj.vue +++ b/page_components/eletj.vue @@ -41,7 +41,6 @@ 临时开关:{{tdtxt}} - @@ -515,7 +514,7 @@ // 开启和关闭 btnkq() { - if (this.onlineStatus == 0) { + if (this.onlineStatus == 1) { if (this.tdtxt == '开启') { this.$u.put(`/app/bill/switchDevice?billId=${this.billId}&open=false`).then((res) => { if (res.code == 200) { @@ -558,96 +557,109 @@ }) } } else { - if (this.ver_data == null) { - this.jieshufalg = true - uni.showLoading({ - title: '切换中' - }) - xBlufi.initXBlufi(1) - xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent) - xBlufi.notifyStartDiscoverBle({ - 'isStart': true - }) - // 停止蓝牙搜索 - setTimeout(() => { - xBlufi.notifyStartDiscoverBle({ - 'isStart': false - }) - xBlufi.notifyConnectBle({ - isStart: true, - deviceId: this.deviceId, - name: this.name - }) - xBlufi.notifyInitBleEsp32({ - deviceId: this.deviceId - }) - let name = '' - let index = this.name.indexOf('-') - if (index !== -1) { - name = this.name.slice(index + 1) - } - if (this.sbobj.powerStatus == 0) { - this.imgflag = false - } else { - this.imgflag = true - } - }, 1000) - } else { - // console.log(this.tdtxt,'020202'); - if (this.tdtxt == '开启') { - let that = this - uni.getNetworkType({ - success(res) { - if (res.networkType !== 'none') { - uni.getConnectedBluetoothDevices({ - success(res) { - setTimeout(() => { - // console.log('close关闭'); - that.tdtxt = '关闭' - that.imgflag = false - xBlufi.notifySendCustomData({ - customData: 'close' - }) - xBlufi.notifySendCustomData({ - customData: '11close' - }) - }, 1000) - }, - fail(err) { - console.error('获取已连接蓝牙设备信息失败:', err) - } - }) - } - } - }) - } else { - let that = this - uni.getNetworkType({ - success(res) { - if (res.networkType !== 'none') { - uni.getConnectedBluetoothDevices({ - success(res) { - setTimeout(() => { - // console.log('open开启'); - that.tdtxt = '开启' - that.imgflag = true - xBlufi.notifySendCustomData({ - customData: 'open' - }) - xBlufi.notifySendCustomData({ - customData: '11open' - }) - }, 1000) - }, - fail(err) { - console.error('获取已连接蓝牙设备信息失败:', err) - } - }) - } - } - }) - } - } + let currentTime = new Date(); + let endTimeString = this.detaobj.suitEndTime + let endTimeParts = endTimeString.split(/[- :]/) + let endTime = new Date(endTimeParts[0], endTimeParts[1] - 1, endTimeParts[2], endTimeParts[3], endTimeParts[4], endTimeParts[5]); + // 比较当前时间和结束时间 + if (currentTime > endTime) { + uni.showToast({ + title: '该订单已结束,不能进行操作', + icon: 'none', + duration: 2000 + }) + } else { + if (this.ver_data == null) { + this.jieshufalg = true + uni.showLoading({ + title: '切换中' + }) + xBlufi.initXBlufi(1) + xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent) + xBlufi.notifyStartDiscoverBle({ + 'isStart': true + }) + // 停止蓝牙搜索 + setTimeout(() => { + xBlufi.notifyStartDiscoverBle({ + 'isStart': false + }) + xBlufi.notifyConnectBle({ + isStart: true, + deviceId: this.deviceId, + name: this.name + }) + xBlufi.notifyInitBleEsp32({ + deviceId: this.deviceId + }) + let name = '' + let index = this.name.indexOf('-') + if (index !== -1) { + name = this.name.slice(index + 1) + } + if (this.sbobj.powerStatus == 0) { + this.imgflag = false + } else { + this.imgflag = true + } + }, 1000) + } else { + // console.log(this.tdtxt,'020202'); + if (this.tdtxt == '开启') { + let that = this + uni.getNetworkType({ + success(res) { + if (res.networkType !== 'none') { + uni.getConnectedBluetoothDevices({ + success(res) { + setTimeout(() => { + // console.log('close关闭'); + that.tdtxt = '关闭' + that.imgflag = false + xBlufi.notifySendCustomData({ + customData: 'close' + }) + xBlufi.notifySendCustomData({ + customData: '11close' + }) + }, 1000) + }, + fail(err) { + console.error('获取已连接蓝牙设备信息失败:', err) + } + }) + } + } + }) + } else { + let that = this + uni.getNetworkType({ + success(res) { + if (res.networkType !== 'none') { + uni.getConnectedBluetoothDevices({ + success(res) { + setTimeout(() => { + // console.log('open开启'); + that.tdtxt = '开启' + that.imgflag = true + xBlufi.notifySendCustomData({ + customData: 'open' + }) + xBlufi.notifySendCustomData({ + customData: '11open' + }) + }, 1000) + }, + fail(err) { + console.error('获取已连接蓝牙设备信息失败:', err) + } + }) + } + } + }) + } + } + } } }, diff --git a/page_fenbao/hehuoren/index.vue b/page_fenbao/hehuoren/index.vue index 8421cd7..1c06c7c 100644 --- a/page_fenbao/hehuoren/index.vue +++ b/page_fenbao/hehuoren/index.vue @@ -7,15 +7,15 @@ - + {{item.userName}}-合伙人 - 点击扫码绑定 + 点击扫码绑定 - + @@ -240,7 +240,7 @@ width: 750rpx; height: 100vh; background: #fff; - opacity: .8; + // opacity: .8; border-radius: 0rpx 0rpx 0rpx 0rpx; z-index: 1; position: fixed; diff --git a/page_fenbao/statulist/taocanlist/index.vue b/page_fenbao/statulist/taocanlist/index.vue index d0b2e48..7093182 100644 --- a/page_fenbao/statulist/taocanlist/index.vue +++ b/page_fenbao/statulist/taocanlist/index.vue @@ -36,9 +36,9 @@ 暂无可用套餐 - + 确定 @@ -277,7 +277,7 @@ }, btnadd() { uni.navigateTo({ - url: '/page_fenbao/statulist/taocanlist/addtaocan/index?id=' + '' + url: '/page_fenbao/statulist/taocanlist/addtaocan/index' }) } } diff --git a/page_user/sbdetail.vue b/page_user/sbdetail.vue index 42ea510..5afcbb2 100644 --- a/page_user/sbdetail.vue +++ b/page_user/sbdetail.vue @@ -189,7 +189,7 @@ - 分享 + 设备二维码