fix:修复bug;新增订单列表页面订单监控

This commit is contained in:
2025-12-30 17:26:16 +08:00
parent 9d4e229312
commit be01fb211e
13 changed files with 400 additions and 125 deletions
+25 -1
View File
@@ -111,7 +111,8 @@
onMounted
} from 'vue'
import {
onLoad
onLoad,
onUnload
} from '@dcloudio/uni-app'
import {
getDeviceInfo,
@@ -170,6 +171,21 @@
await fetchDeviceInfo()
})
// 页面卸载时设置默认启动路径为首页(仅在非下单流程时生效)
onUnload(() => {
// 如果是下单流程跳转(在提交订单时设置了标记),则本次不设置启动路径
const skipSetLaunchPathOnce = uni.getStorageSync('skipSetLaunchPathOnce')
if (skipSetLaunchPathOnce) {
console.log('下单流程离开设备详情页,本次不设置启动路径')
uni.removeStorageSync('skipSetLaunchPathOnce')
return
}
// 正常离开设备详情页(比如返回、关闭小程序)时,记录启动路径为首页
uni.setStorageSync('launchPath', '/pages/index/index')
console.log('设备详情页卸载,已设置启动路径为首页')
})
const checkUserPhone = async () => {
try {
const userInfoRes = await getUserInfo()
@@ -278,6 +294,7 @@
// 检查登录状态和订单
const fetchDeviceInfo = async () => {
console.log(deviceId.value);
const res = await getDeviceInfo(deviceId.value)
if (res.code == 200) {
deviceInfo.value = res.data.device || {}
@@ -504,6 +521,13 @@
const order = rentResult.data
console.log('订单信息', order);
// 标记:本次是从设备详情页发起的下单流程,离开页面时不设置启动路径
try {
uni.setStorageSync('skipSetLaunchPathOnce', true)
} catch (e) {
console.warn('设置 skipSetLaunchPathOnce 失败:', e)
}
if (payWay == 'wx-pay') {
// 当支付方式为押金支付时
uni.hideLoading()