bug修复
This commit is contained in:
parent
f8675832cc
commit
f1eee059b6
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user