bug修复
This commit is contained in:
parent
f8675832cc
commit
f1eee059b6
|
@ -312,13 +312,22 @@
|
|||
|
||||
},
|
||||
watch: {
|
||||
sncode(newValue, oldValue) {
|
||||
sncode: {
|
||||
handler(newValue) {
|
||||
if (newValue && newValue.length === 7) {
|
||||
// 等待 orderinfo 加载完成后再获取设备信息
|
||||
if (this.orderinfo && this.orderinfo.areaId) {
|
||||
this.getdevice();
|
||||
} else {
|
||||
// 如果 orderinfo 还未加载完成,等待后再调用
|
||||
setTimeout(() => {
|
||||
this.getdevice();
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
immediate: false
|
||||
}
|
||||
},
|
||||
|
||||
onHide() {
|
||||
|
@ -772,26 +781,46 @@
|
|||
});
|
||||
},
|
||||
getdevice() {
|
||||
this.deviceinfo={}
|
||||
if (!this.sncode) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 清空当前设备信息
|
||||
this.deviceinfo = {};
|
||||
|
||||
this.$u.get('/app/device/info?sn=' + this.sncode).then((res) => {
|
||||
if (res.code == 200) {
|
||||
if(this.orderinfo.areaId==res.data.areaId){
|
||||
this.deviceinfo = res.data
|
||||
// this.deviceinfo.onlineStatus=0
|
||||
if (res.code === 200 && res.data) {
|
||||
console.log('当前区域ID:', this.orderinfo.areaId);
|
||||
console.log('设备区域ID:', res.data.areaId);
|
||||
|
||||
// 确保两个值都存在且为数字类型进行比较
|
||||
const currentAreaId = Number(this.orderinfo.areaId);
|
||||
const deviceAreaId = Number(res.data.areaId);
|
||||
|
||||
if (!isNaN(currentAreaId) && !isNaN(deviceAreaId) && currentAreaId === deviceAreaId) {
|
||||
this.deviceinfo = res.data;
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '换车设备和当前运营区不同,请使用其他车辆换车',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
this.sncode = ''; // 清空输入的 sn
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
// 处理接口返回错误的情况
|
||||
uni.showToast({
|
||||
title: res.msg || '获取设备信息失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
}).catch(error => {
|
||||
// 处理接口请求失败的情况
|
||||
console.error('获取设备信息错误:', error);
|
||||
uni.showToast({
|
||||
title: '获取设备信息失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
qrcode() {
|
||||
|
@ -799,7 +828,7 @@
|
|||
onlyFromCamera: true,
|
||||
scanType: ['qrCode'],
|
||||
success: res => {
|
||||
|
||||
try {
|
||||
let sn = null;
|
||||
let queryParams = res.result.split('?')[1];
|
||||
if (queryParams) {
|
||||
|
@ -812,23 +841,47 @@
|
|||
});
|
||||
}
|
||||
|
||||
this.sncode = sn
|
||||
console.log(res.result);
|
||||
if (this.sncode != '') {
|
||||
|
||||
this.getdevice()
|
||||
if (!sn) {
|
||||
uni.showToast({
|
||||
title: '无效的二维码',
|
||||
icon: 'none',
|
||||
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 => {
|
||||
console.error('扫描失败:', err);
|
||||
uni.showToast({
|
||||
title: '扫描失败',
|
||||
icon: 'none'
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Binddevice() {
|
||||
uni.getBluetoothAdapterState({
|
||||
success: function (res) {
|
||||
|
|
|
@ -1501,6 +1501,7 @@ export default {
|
|||
|
||||
},
|
||||
deviceInfo(num) {
|
||||
setTimeout(() => {
|
||||
if (!this.sn) return;
|
||||
|
||||
// 检查是否有进行中的订单
|
||||
|
@ -1513,7 +1514,7 @@ export default {
|
|||
});
|
||||
return;
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
this.$u.get('/app/device/info?sn=' + this.sn).then((res) => {
|
||||
|
@ -1577,6 +1578,10 @@ export default {
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}, 700);
|
||||
|
||||
},
|
||||
// 新增辅助方法处理状态消息
|
||||
getStatusMessage(status) {
|
||||
|
@ -2082,8 +2087,6 @@ export default {
|
|||
console.error("Error fetching parking data:", error);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
totxtpage() {
|
||||
this.seeDetail = true
|
||||
uni.navigateTo({
|
||||
|
@ -4577,7 +4580,7 @@ export default {
|
|||
},
|
||||
convertBoundaryToPolylines(boundaries, num) {
|
||||
if (num == 1) {
|
||||
console.log('判断1');
|
||||
|
||||
return boundaries.map(boundary => {
|
||||
if (!boundary) return null;
|
||||
let coords;
|
||||
|
|
Loading…
Reference in New Issue
Block a user