diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 711e537..098b315 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -1,7 +1,7 @@ const install = (Vue, vm) => { uni.setStorageSync('deptId', 100); Vue.prototype.$u.http.setConfig({ - // baseUrl: 'http://192.168.2.124:4101', //键辉本地 + // baseUrl: 'http://192.168.2.10:4101', //键辉本地 // baseUrl: 'http://192.168.0.102:4101', //景森本地 baseUrl: 'https://ele.ccttiot.com/prod-api', //线上 // baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上 diff --git a/components/blufi/xBlufi-wx-impl.js b/components/blufi/xBlufi-wx-impl.js index 94f5a30..02b9b25 100644 --- a/components/blufi/xBlufi-wx-impl.js +++ b/components/blufi/xBlufi-wx-impl.js @@ -1246,7 +1246,7 @@ function init() { // && devices.devices[0].name != 'SMART_R2XS' // && devices.devices[0].name != 'SMART_R2XS' // ) - if (devices.devices[0].name.indexOf("CTPO") != -1 || devices.devices[0].name.indexOf("BBLE") != -1){ + if (devices.devices[0].name.indexOf("BBLE") != -1){ // if ( devices.devices[0].name.indexOf("gjkg") != -1 ){ // console.log("跳过",devices.devices[0].name) // isnotexist = false; diff --git a/page_fenbao/jiameng/addjiam.vue b/page_fenbao/jiameng/addjiam.vue index 251a4f7..c5a6464 100644 --- a/page_fenbao/jiameng/addjiam.vue +++ b/page_fenbao/jiameng/addjiam.vue @@ -40,7 +40,11 @@ {{item.tit}} - + + + + @@ -105,7 +109,7 @@ list: [{ name: '查看运营区', tit: '是否允许', - checked: false, + checked: true, txt: 1 }, { diff --git a/page_fenbao/storedlist/trueorder.vue b/page_fenbao/storedlist/trueorder.vue index 9b71cc5..effeb64 100644 --- a/page_fenbao/storedlist/trueorder.vue +++ b/page_fenbao/storedlist/trueorder.vue @@ -579,6 +579,7 @@ ljsbflag:false, kefuflag: false, kefulist: [], + respData:{} } }, onLoad(option) { @@ -764,7 +765,6 @@ this.getgg() this.gethuiyuan() },1500) - console.log(this.sn,'03333333303333333'); }, onShow() { @@ -1260,6 +1260,104 @@ } }, + // 开锁方法 + openDevice() { + let xllat = null + let xllng = null + uni.getLocation({ + type: 'wgs84', + success: (res) => { + xllat = res.latitude + xllng = res.longitude + }, + fail: (err) => { + console.error('获取位置失败:', err) + } + }) + this.$u.put(`/app/order/openDevice?orderId=${this.bstId}&requiredIot=true&lon=${xllng}&lat=${xllat}`).then(res =>{ + if(res.code == 200){ + this.$u.put(`/app/pay/refreshPayResult?no=${this.respData.pay.no}`).then((res) => { + setTimeout(() => { + uni.switchTab({ + url: '/pages/index/index?orderid=' + this.bstId + }) + }, 2000) + }) //刷新支付结果 + }else if(res.code == 20001){ + this.wenbentxtflag = true + this.wenbentxt = '蓝牙开锁中...' + let that = this + const findDevice = () =>{ + that.ver_dataflag = 2 + const matchedDevice = that.devicesarr.find(device => { + return device.name.slice(-12) == that.mac.slice(-12) + }) + if (matchedDevice) { + xBlufi.notifyStartDiscoverBle({ + 'isStart': false + }) + xBlufi.notifyConnectBle({ + isStart: true, + deviceId: matchedDevice.deviceId, + name: matchedDevice.name + }) + that.deviceid = matchedDevice.deviceId + that.devicename = matchedDevice.name + setTimeout(()=>{ + if(that.ver_dataflag == 3){ + xBlufi.notifySendCustomData({ + customData: "11opensub5@" + }) + that.wenbentxt = '' + that.wenbentxtflag = false + let flag = false + that.zhezhaoflag = true + that.$u.put(`/app/order/openDevice?orderId=${that.bstId}&requiredIot=false&lon=${xllng}&lat=${xllat}`).then(res =>{}) + setTimeout(() => { + uni.switchTab({ + url: '/pages/index/index?orderid=' + that.respData.pay.bstId + }) + }, 2000) + }else{ + that.ver_dataflag = 1 + that.shibainum = 0 + that.wenbentxt = '' + that.wenbentxtflag = false + that.ljsbflag = true + } + },4000) + } else { + if(that.shibainum < 3){ + that.shibainum++ + that.findDeviceTimer = setTimeout(findDevice.bind(that), 1000) // 使用 bind 保持 this 上下文 + }else{ + that.ver_dataflag = 1 + that.shibainum = 0 + that.wenbentxt = '' + that.wenbentxtflag = false + that.ljsbflag = true + } + } + } + findDevice() + }else if(res.code == 40001){ + // 当返回40001时,重新执行当前这一步 + console.log('开锁返回40001,重新执行开锁请求...') + setTimeout(() => { + this.openDevice() + }, 1000) // 延迟1秒后重新执行 + } else{ + this.wenbentxt = '' + this.wenbentxtflag = false + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 3000 + }) + } + }) + }, + // 下单 getzf() { let data = { @@ -1288,98 +1386,13 @@ success: (respc) => { console.log(respc, '支付成功') this.bstId = resp.data.pay.bstId + this.respData = resp.data // 保存响应数据供开锁方法使用 this.wenbentxtflag = true this.wenbentxt = '开锁中...' - let xllat = null - let xllng = null - uni.getLocation({ - type: 'wgs84', - success: (res) => { - xllat = res.latitude - xllng = res.longitude - }, - fail: (err) => { - console.error('获取位置失败:', err) - } - }) - this.$u.put(`/app/order/openDevice?orderId=${this.bstId}&requiredIot=true&lon=${xllng}&lat=${xllat}`).then(res =>{ - if(res.code == 200){ - this.$u.put(`/app/pay/refreshPayResult?no=${resp.data.pay.no}`).then((res) => { - setTimeout(() => { - uni.switchTab({ - url: '/pages/index/index?orderid=' + this.bstId - }) - }, 2000) - }) //刷新支付结果 - }else if(res.code == 20001){ - this.wenbentxtflag = true - this.wenbentxt = '蓝牙开锁中...' - let that = this - const findDevice = () =>{ - that.ver_dataflag = 2 - const matchedDevice = that.devicesarr.find(device => { - return device.name.slice(-12) == that.mac.slice(-12) - }) - if (matchedDevice) { - xBlufi.notifyStartDiscoverBle({ - 'isStart': false - }) - xBlufi.notifyConnectBle({ - isStart: true, - deviceId: matchedDevice.deviceId, - name: matchedDevice.name - }) - that.deviceid = matchedDevice.deviceId - that.devicename = matchedDevice.name - setTimeout(()=>{ - if(that.ver_dataflag == 3){ - xBlufi.notifySendCustomData({ - customData: "11opensub5@" - }) - that.wenbentxt = '' - that.wenbentxtflag = false - let flag = false - that.zhezhaoflag = true - that.$u.put(`/app/order/openDevice?orderId=${that.bstId}&requiredIot=false&lon=${xllng}&lat=${xllat}`).then(res =>{}) - that.$u.put(`/app/pay/refreshPayResult?no=${resp.data.pay.bstId}`).then((res) => { - setTimeout(() => { - uni.switchTab({ - url: '/pages/index/index?orderid=' + resp.data.pay.bstId - }) - }, 2000) - }) //刷新支付结果 - }else{ - that.ver_dataflag = 1 - that.shibainum = 0 - that.wenbentxt = '' - that.wenbentxtflag = false - that.ljsbflag = true - } - },4000) - } else { - if(that.shibainum < 3){ - that.shibainum++ - that.findDeviceTimer = setTimeout(findDevice.bind(that), 1000) // 使用 bind 保持 this 上下文 - }else{ - that.ver_dataflag = 1 - that.shibainum = 0 - that.wenbentxt = '' - that.wenbentxtflag = false - that.ljsbflag = true - } - } - } - findDevice() - }else{ - this.wenbentxt = '' - this.wenbentxtflag = false - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 3000 - }) - } - }) + // 调用开锁方法 + this.$u.put(`/app/pay/refreshPayResult?no=${this.respData.pay.no}`).then((res) => { + this.openDevice() + }) //刷新支付结果 }, fail(err) { setTimeout(() => { diff --git a/page_fenbao/yunwei/addyunwei.vue b/page_fenbao/yunwei/addyunwei.vue index 21f9a41..62d0b58 100644 --- a/page_fenbao/yunwei/addyunwei.vue +++ b/page_fenbao/yunwei/addyunwei.vue @@ -37,7 +37,11 @@ {{item.tit}} - + + + + @@ -102,7 +106,7 @@ list: [{ name: '查看运营区', tit: '是否允许', - checked: false, + checked: true, txt: 1 }, { diff --git a/page_shanghu/admin_index.vue b/page_shanghu/admin_index.vue index fa068a2..b574090 100644 --- a/page_shanghu/admin_index.vue +++ b/page_shanghu/admin_index.vue @@ -160,9 +160,10 @@