bug修复

This commit is contained in:
tx 2024-12-30 14:31:59 +08:00
parent f8675832cc
commit f1eee059b6
2 changed files with 1695 additions and 1639 deletions

View File

@ -312,13 +312,22 @@
}, },
watch: { watch: {
sncode(newValue, oldValue) { sncode: {
handler(newValue) {
if (newValue && newValue.length === 7) { if (newValue && newValue.length === 7) {
// orderinfo
if (this.orderinfo && this.orderinfo.areaId) {
this.getdevice(); this.getdevice();
} else {
// orderinfo
setTimeout(() => {
this.getdevice();
}, 500);
} }
} }
},
immediate: false
}
}, },
onHide() { onHide() {
@ -772,26 +781,46 @@
}); });
}, },
getdevice() { getdevice() {
this.deviceinfo={} if (!this.sncode) {
return;
}
//
this.deviceinfo = {};
this.$u.get('/app/device/info?sn=' + this.sncode).then((res) => { this.$u.get('/app/device/info?sn=' + this.sncode).then((res) => {
if (res.code == 200) { if (res.code === 200 && res.data) {
if(this.orderinfo.areaId==res.data.areaId){ console.log('当前区域ID:', this.orderinfo.areaId);
this.deviceinfo = res.data console.log('设备区域ID:', res.data.areaId);
// this.deviceinfo.onlineStatus=0
//
const currentAreaId = Number(this.orderinfo.areaId);
const deviceAreaId = Number(res.data.areaId);
if (!isNaN(currentAreaId) && !isNaN(deviceAreaId) && currentAreaId === deviceAreaId) {
this.deviceinfo = res.data;
} else { } else {
uni.showToast({ uni.showToast({
title: '换车设备和当前运营区不同,请使用其他车辆换车', title: '换车设备和当前运营区不同,请使用其他车辆换车',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
this.sncode = ''; // sn
} }
} else { } else {
// uni.showToast({
title: res.msg || '获取设备信息失败',
icon: 'none',
duration: 2000
});
} }
}).catch(error => { }).catch(error => {
// console.error('获取设备信息错误:', error);
uni.showToast({
title: '获取设备信息失败',
icon: 'none',
duration: 2000
});
}); });
}, },
qrcode() { qrcode() {
@ -799,7 +828,7 @@
onlyFromCamera: true, onlyFromCamera: true,
scanType: ['qrCode'], scanType: ['qrCode'],
success: res => { success: res => {
try {
let sn = null; let sn = null;
let queryParams = res.result.split('?')[1]; let queryParams = res.result.split('?')[1];
if (queryParams) { if (queryParams) {
@ -812,23 +841,47 @@
}); });
} }
this.sncode = sn if (!sn) {
console.log(res.result); uni.showToast({
if (this.sncode != '') { title: '无效的二维码',
icon: 'none',
this.getdevice() duration: 2000
});
return;
} }
this.sncode = sn;
if (this.sncode) {
// orderinfo
if (this.orderinfo && this.orderinfo.areaId) {
this.getdevice();
} else {
// orderinfo
setTimeout(() => {
this.getdevice();
}, 500);
}
}
} catch (error) {
console.error('二维码解析错误:', error);
uni.showToast({
title: '二维码格式错误',
icon: 'none',
duration: 2000
});
}
}, },
fail: err => { fail: err => {
console.error('扫描失败:', err); console.error('扫描失败:', err);
uni.showToast({ uni.showToast({
title: '扫描失败', title: '扫描失败',
icon: 'none' icon: 'none',
duration: 2000
}); });
} }
}); });
}, },
Binddevice() { Binddevice() {
uni.getBluetoothAdapterState({ uni.getBluetoothAdapterState({
success: function (res) { success: function (res) {

View File

@ -1501,6 +1501,7 @@ export default {
}, },
deviceInfo(num) { deviceInfo(num) {
setTimeout(() => {
if (!this.sn) return; if (!this.sn) return;
// //
@ -1513,7 +1514,7 @@ export default {
}); });
return; return;
} }
return
} }
this.$u.get('/app/device/info?sn=' + this.sn).then((res) => { this.$u.get('/app/device/info?sn=' + this.sn).then((res) => {
@ -1577,6 +1578,10 @@ export default {
}); });
} }
}); });
}, 700);
}, },
// //
getStatusMessage(status) { getStatusMessage(status) {
@ -2082,8 +2087,6 @@ export default {
console.error("Error fetching parking data:", error); console.error("Error fetching parking data:", error);
}); });
}, },
totxtpage() { totxtpage() {
this.seeDetail = true this.seeDetail = true
uni.navigateTo({ uni.navigateTo({
@ -4577,7 +4580,7 @@ export default {
}, },
convertBoundaryToPolylines(boundaries, num) { convertBoundaryToPolylines(boundaries, num) {
if (num == 1) { if (num == 1) {
console.log('判断1');
return boundaries.map(boundary => { return boundaries.map(boundary => {
if (!boundary) return null; if (!boundary) return null;
let coords; let coords;