From 8172e79a769cbcd995b421109e67514355c7b8dc Mon Sep 17 00:00:00 2001 From: "3321822538@qq.com" <3321822538@qq.com> Date: Mon, 23 Jun 2025 11:26:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E9=B9=BF=E9=AA=91=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/http.interceptor.js | 2 +- page_fenbao/storedlist/trueorder.vue | 11 ++ page_shanghu/admin_index.vue | 2 +- page_shanghu/gongzuotai/sysSet.vue | 27 +++ page_shanghu/guanli/device_detail.vue | 28 +--- page_user/hcshenhe.vue | 23 --- pages/myorder/returned/index.vue | 230 +++++++++++++++++--------- 7 files changed, 190 insertions(+), 133 deletions(-) diff --git a/common/http.interceptor.js b/common/http.interceptor.js index b74d440..ee2efcb 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.89:4101', //键辉本地 + // baseUrl: 'http://192.168.2.19: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/page_fenbao/storedlist/trueorder.vue b/page_fenbao/storedlist/trueorder.vue index 7b4751e..1f09e9a 100644 --- a/page_fenbao/storedlist/trueorder.vue +++ b/page_fenbao/storedlist/trueorder.vue @@ -507,6 +507,17 @@ }, onLoad(option) { xBlufi.initXBlufi(1) + this.$u.get("/app/orderDevice/mineUsing").then((res) => { + if (res.code == 200) { + if (res.data) { + uni.switchTab({ + url:'/pages/myorder/returned/index' + }) + } else { + + } + } + }) this.getQiniuToken() console.log(option) if (option.modelId) { diff --git a/page_shanghu/admin_index.vue b/page_shanghu/admin_index.vue index cc35f48..fa068a2 100644 --- a/page_shanghu/admin_index.vue +++ b/page_shanghu/admin_index.vue @@ -493,7 +493,7 @@ this.status4 = [] this.status8 = [] this.status9 = [] - this.status6 = [] + this.status6 = [] // 重新分类设备 this.listData.forEach(item => { if (item.status == 0) { diff --git a/page_shanghu/gongzuotai/sysSet.vue b/page_shanghu/gongzuotai/sysSet.vue index 61a9890..5936090 100644 --- a/page_shanghu/gongzuotai/sysSet.vue +++ b/page_shanghu/gongzuotai/sysSet.vue @@ -45,6 +45,33 @@ 开启后用户必须先进行实名认证才可使用 + + + + 最低用车年龄 + + + + + + + 用户年龄不满足最低年龄不可使用 + + + + + + 换车校验位置 + + + + + + + 开启后用户换车是否需要校验位置 + + diff --git a/page_shanghu/guanli/device_detail.vue b/page_shanghu/guanli/device_detail.vue index d91ccb2..e7c7b12 100644 --- a/page_shanghu/guanli/device_detail.vue +++ b/page_shanghu/guanli/device_detail.vue @@ -977,7 +977,6 @@ import { showLoading } from "../../components/blufi/util" setTimeout(()=>{ this.jieliuflag = true },2000) - }else { uni.hideLoading() uni.showToast({ @@ -1030,19 +1029,6 @@ import { showLoading } from "../../components/blufi/util" setTimeout(()=>{ this.jieliuflag = true },2000) - // let that = this - // uni.showModal({ - // title: '提示', - // content: '正在尝试使用蓝牙控制,蓝牙连接需尽可能靠近车辆!', - // showCancel: true, - // success: function(res) { - // if (res.confirm) { - // that.lanya(0) - // } else if (res.cancel) { - - // } - // } - // }) }else{ uni.hideLoading() uni.showToast({ @@ -1334,7 +1320,7 @@ import { showLoading } from "../../components/blufi/util" // iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u6jBvj7S50FPgsHaHXai', iconPath: this.deviceInfos.onlineStatus == 0 ? 'https://lxnapi.ccttiot.com/bike/img/static/uQRng4QNKA38Amk8Wgt5' : - 'https://lxnapi.ccttiot.com/bike/img/static/uocjFo8Ar2BJVpzC2G2f', + 'https://lxnapi.ccttiot.com/bike/img/static/uocjFo8Ar2BJVpzC2G2f', callout: { content: this.deviceInfos.remainingPower + '%', // 修改为你想要显示的文字内容 color: '#ffffff', // 修改为文字颜色 @@ -1854,18 +1840,6 @@ import { showLoading } from "../../components/blufi/util" transform: scale(0.95); filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.3)); /* 减弱发光 */ } - // .lypic{ - // display: flex; - // align-items: center; - // font-size: 24rpx; - // color: #3D3D3D; - // margin-right: 22rpx; - // image{ - // width: 36rpx; - // height: 36rpx; - // margin-right: 8rpx; - // } - // } } .bikexx{ margin-top: 26rpx; diff --git a/page_user/hcshenhe.vue b/page_user/hcshenhe.vue index 121d156..eff8cb0 100644 --- a/page_user/hcshenhe.vue +++ b/page_user/hcshenhe.vue @@ -201,29 +201,6 @@ duration: 2000 }) } - // if(res.code == 200){ - // uni.showToast({ - // title: '还车成功', - // icon: 'success', - // duration: 2000 - // }) - // setTimeout(()=>{ - // uni.hideLoading() - // // uni.switchTab({ - // // url:'/pages/myorder/returned/index' - // // }) - // uni.redirectTo({ - // url:'/page_user/yongche/orderxq?id=' + this.orderId - // }) - // },2000) - // }else{ - // uni.hideLoading() - // uni.showToast({ - // title: res.msg, - // icon: 'none', - // duration: 2000 - // }) - // } }) }, diff --git a/pages/myorder/returned/index.vue b/pages/myorder/returned/index.vue index 6658185..5007be3 100644 --- a/pages/myorder/returned/index.vue +++ b/pages/myorder/returned/index.vue @@ -26,7 +26,7 @@ 连接中... - + 点击连接 @@ -87,7 +87,7 @@ - 您已骑行{{Number(remainingTime) < 0 ? '0' : remainingTime}} + 您已骑行{{getRemainingTimeText}} 预计金额¥{{qixingobj.rideFee}} @@ -242,9 +242,15 @@ isUploading: false,// 上传状态锁 isRefreshing: false, orderid:'', - qixingobj:{} + qixingobj:{}, + shibainum:0 }; }, + computed: { + getRemainingTimeText() { + return Number(this.remainingTime) < 0 ? '0' : this.remainingTime; + } + }, onLoad(option) { if (option.id) { this.orderid = option.id @@ -261,7 +267,7 @@ onShow() { setTimeout(()=>{ if(this.ver_dataflag == 3){ - console.log('11') + // console.log('11') }else{ xBlufi.initXBlufi(1) xBlufi.notifyStartDiscoverBle({ @@ -287,7 +293,7 @@ if (this.findDeviceTimer) { clearTimeout(this.findDeviceTimer) this.findDeviceTimer = null - console.log('清除定时器1') + // console.log('清除定时器1') } }, onUnload() { @@ -296,7 +302,7 @@ if (this.findDeviceTimer) { clearTimeout(this.findDeviceTimer) this.findDeviceTimer = null - console.log('清除定时器2') + // console.log('清除定时器2') } }, // 组件销毁时清除定时器 @@ -304,18 +310,26 @@ clearTimeout(this.uploadTimer) }, methods: { - // 点击连接 - btnlj(){ - this.findDevice() - }, // 点击断开 btndk(){ - xBlufi.notifyConnectBle({ - isStart: false, - deviceId: this.deviceid, - name: this.name + let that = this + uni.showModal({ + title: '提示', + content: '您确定要断开蓝牙连接吗?', + showCancel: true, + success: function(res) { + if (res.confirm) { + xBlufi.notifyConnectBle({ + isStart: false, + deviceId: that.deviceid, + name: that.name + }) + that.ver_dataflag = 1 + } else if (res.cancel) { + + } + } }) - this.ver_dataflag = 1 }, // 开坐垫锁 btnkzds(){ @@ -324,7 +338,7 @@ isHighAccuracy: true, accuracy:'best', success: (res) => { - console.log('精确坐标:', res) + // console.log('精确坐标:', res) this.lslat = res.latitude this.lslon = res.longitude }, @@ -358,7 +372,7 @@ title: '加载中...', mask: true }) - console.log(that.lslat,that.lslon,'开坐垫锁'); + // console.log(that.lslat,that.lslon,'开坐垫锁'); if (that.ver_dataflag == 3) { xBlufi.notifySendCustomData({ customData: "11hpen@" @@ -384,17 +398,7 @@ showCancel: true, success: function(res) { if (res.confirm) { - if(that.ver_dataflag != 3){ - // if(that.ljflag == true){ - // uni.showLoading({ - // title: '连接中...', - // mask: true - // }) - // that.ljflag = false - // that.findDevice() - // that.getchaoshi() - // } - } + } else if (res.cancel) { } @@ -447,7 +451,7 @@ } }) } else if (res.cancel) { - console.log('取消') // 用户点击取消 + // console.log('取消') // 用户点击取消 } } }) @@ -533,7 +537,7 @@ this.ver_dataflag = 2 // 使用 find 方法查找匹配的设备 const matchedDevice = this.devicesarr.find(device => { - console.log(device.name, this.mac, '111') + // console.log(device.name, this.mac, '111') return device.name.slice(-12) == this.mac.slice(-12) }) if (matchedDevice) { @@ -548,9 +552,27 @@ }) this.deviceid = matchedDevice.deviceId this.devicename = matchedDevice.name - console.log(this.deviceid, '11221') } else { - this.findDeviceTimer = setTimeout(this.findDevice.bind(this), 1000) // 使用 bind 保持 this 上下文 + console.log(this.shibainum,'000000000000000000000000000000000000000000000000000'); + if(this.shibainum < 3){ + this.shibainum++ + this.findDeviceTimer = setTimeout(this.findDevice.bind(this), 1000) // 使用 bind 保持 this 上下文 + }else{ + this.ver_dataflag = 1 + this.shibainum = 0 + uni.showModal({ + title: '提示', + content: '设备连接失败,请重新点击连接', + showCancel: false, + success: function(res) { + if (res.confirm) { + + } else if (res.cancel) { + + } + } + }) + } } }, // 获取附近蓝牙设备列表 @@ -606,37 +628,84 @@ const dataStr = data.toString(); // console.log('原始数据:', dataStr); const dataObj = {}; - dataStr.split(',').forEach(part => { - const [key, value] = part.split(':').map(item => item.trim()); - if (!key || value === undefined) return; - switch (key) { - case 'status': dataObj.status = value; break; - case 'bat': dataObj.bat = parseFloat(value); break; - case 'csq': dataObj.csq = parseInt(value); break; - case 'lat': dataObj.lat = parseFloat(value); break; - case 'lon': dataObj.lon = parseFloat(value); break; - case 'q': dataObj.q = parseInt(value); break; - case 's': dataObj.s = parseInt(value); break; - } - }) + + // 判断数据格式:检查是否包含@或,分隔符 + let separator = ','; + if (dataStr.includes('@')) { + separator = '@'; + } + + // console.log('使用分隔符:', separator); + + dataStr.split(separator).forEach(part => { + if (!part) return; // 忽略空字符串 + + let key, value; + + // 如果使用@分隔符,数据格式为 key-value 对,例如: status0@csq0@bat125@... + if (separator === '@') { + // 使用正则表达式分离键(字母)和值(数字) + const match = part.match(/^([a-zA-Z]+)(.*)$/); + if (!match) return; + + key = match[1]; + value = match[2]; + } else { + // 如果使用,分隔符,数据格式为 key:value 对,例如: status:0,csq:0,bat:125,... + const [keyPart, valuePart] = part.split(':').map(item => item.trim()); + if (!keyPart || valuePart === undefined) return; + + key = keyPart; + value = valuePart; + } + + if (key && value !== undefined) { + switch (key) { + case 'status': + dataObj.status = value; + break; + case 'bat': + dataObj.bat = parseFloat(value); + break; + case 'csq': + dataObj.csq = parseInt(value, 10); + break; + case 'lat': + dataObj.lat = parseFloat(value); + break; + case 'lon': + dataObj.lon = parseFloat(value); + break; + case 'q': + dataObj.q = parseInt(value, 10); + break; + case 's': + dataObj.s = parseInt(value, 10); + break; + } + } + }); + + // console.log('解析后的数据对象:', dataObj); + // 2. 获取定位 uni.getLocation({ - type: 'gcj02', - isHighAccuracy: true, - success: (res) => { - this.submitData({ - ...dataObj, - lon: res.longitude, - lat: res.latitude - }) - }, - fail: () => { - this.submitData({ - ...dataObj, - lon: 0, - lat: 0 - }) - } + type: 'gcj02', + isHighAccuracy: true, + success: (res) => { + this.submitData({ + ...dataObj, + lon: res.longitude, + lat: res.latitude + }) + }, + fail: () => { + this.submitData({ + ...dataObj, + lon: dataObj.lon || 0, + lat: dataObj.lat || 0 + }) + } }) }, @@ -645,13 +714,13 @@ const payload = { mac: this.mac, sys: { - bat: Number(data.bat) || 0, - csq: Number(data.csq) || 0, - s: Number(data.s) ?? null, - q: Number(data.q) ?? null, + bat: data.bat !== undefined && data.bat !== null ? Number(data.bat) : 0, + csq: data.csq !== undefined && data.csq !== null ? Number(data.csq) : 0, + s: data.s !== undefined && data.s !== null ? Number(data.s) : null, + q: data.q !== undefined && data.q !== null ? Number(data.q) : null, status: String(data.status || '0'), - lon: Number(data.lon) || 0, - lat: Number(data.lat) || 0 + lon: data.lon !== undefined && data.lon !== null ? Number(data.lon) : 0, + lat: data.lat !== undefined && data.lat !== null ? Number(data.lat) : 0 } } this.bluetoothData = payload @@ -680,7 +749,7 @@ if (!this.bluetoothData || this.isUploading) return this.isUploading = true this.lastUploadTime = Date.now() - console.log(this.bluetoothData,'this.bluetoothDatathis.bluetoothData') + // console.log(this.bluetoothData,'this.bluetoothDatathis.bluetoothData') this.$u.put(`/app/device/iot/bltUpload`, this.bluetoothData).then(res => { if(res.code == 200) { console.log('上传蓝牙数据成功',this.bluetoothData, new Date().toLocaleTimeString()) @@ -1055,7 +1124,7 @@ } else if (res.cancel) { } - } + } }) } }else{ @@ -1193,17 +1262,7 @@ showCancel: true, success: function(res) { if (res.confirm) { - // if(that.ver_dataflag != 3){ - // if(that.ljflag == true){ - // uni.showLoading({ - // title: '连接中...', - // mask: true - // }) - // that.ljflag = false - // that.findDevice() - // that.getchaoshi() - // } - // } + } else if (res.cancel) { } @@ -1246,7 +1305,6 @@ duration: 2000 }) setTimeout(()=>{ - // that.getorderdevice() uni.navigateTo({ url:'/page_user/yongche/orderxq?id=' + that.deivceobj.orderId }) @@ -1277,6 +1335,11 @@ name: that.name }) that.getorderdevice() + setTimeout(()=>{ + uni.navigateTo({ + url:'/page_user/yongche/orderxq?id=' + that.deivceobj.orderId + }) + },1000) },1000) } }else if(res.msg == null) { @@ -1351,6 +1414,11 @@ }) uni.hideLoading() that.getorderdevice() + setTimeout(()=>{ + uni.navigateTo({ + url:'/page_user/yongche/orderxq?id=' + that.deivceobj.orderId + }) + },1000) },1000) } }else if(res.msg == null) {