fix: 设备扫码检测到订单为in_used状态,跳转不成功的问题
This commit is contained in:
+13
-2
@@ -62,6 +62,7 @@
|
||||
|
||||
let deviceNo = getQueryString(scanResult.path, 'deviceNo')
|
||||
console.log('扫码路径:', scanResult.path)
|
||||
console.log('解析到的设备号:', deviceNo)
|
||||
|
||||
// 检查是否有使用中的订单
|
||||
const inUseRes = await uni.request({
|
||||
@@ -73,12 +74,18 @@
|
||||
}
|
||||
})
|
||||
|
||||
console.log('使用中订单检查结果:', JSON.stringify(inUseRes))
|
||||
|
||||
if (inUseRes.statusCode === 200 && inUseRes.data.code === 200 && inUseRes.data.data) {
|
||||
// 存在使用中的订单,跳转到归还页面
|
||||
const inUseOrder = inUseRes.data.data
|
||||
uni.navigateTo({
|
||||
url: `/pages/return/index?orderId=${inUseOrder.orderId}&deviceId=${deviceNo}`
|
||||
console.log('检测到使用中订单,准备跳转:', inUseOrder)
|
||||
|
||||
// 直接使用reLaunch而不是navigateTo以确保页面跳转
|
||||
uni.reLaunch({
|
||||
url: `/pages/return/index?orderId=${inUseOrder.orderId}&deviceId=${deviceNo || inUseOrder.deviceNo}`
|
||||
})
|
||||
console.log('已发起页面跳转')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -92,14 +99,18 @@
|
||||
}
|
||||
})
|
||||
|
||||
console.log('待支付订单检查结果:', JSON.stringify(orderRes))
|
||||
|
||||
if (orderRes.statusCode === 200 && orderRes.data.code === 200 && orderRes.data.data) {
|
||||
// 存在待支付订单,跳转到支付页面
|
||||
const unpaidOrder = orderRes.data.data
|
||||
console.log('检测到待支付订单,准备跳转:', unpaidOrder)
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/payment?orderId=${unpaidOrder.orderId}`
|
||||
})
|
||||
} else {
|
||||
// 无待支付订单,正常跳转到设备检查页面
|
||||
console.log('无待支付订单,跳转到设备检查页面, deviceNo:', deviceNo)
|
||||
uni.navigateTo({
|
||||
url: `/pages/serve/bagCheck/index?deviceNo=${deviceNo}`
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user