feat: 新增多个页面及功能,优化用户体验

在项目中新增了多个页面,包括押金页面、设备详情页面、反馈页面和帮助页面。同时,更新了订单支付和归还成功页面的逻辑,确保用户在支付和归还设备时能够获得清晰的反馈。优化了扫码和订单状态处理逻辑,提升了整体用户体验。
This commit is contained in:
8vd8
2025-04-21 14:54:00 +08:00
parent 41b409c327
commit 8431cdf2d6
12 changed files with 337 additions and 111 deletions
+1 -1
View File
@@ -6876,7 +6876,7 @@ function initOnError() {
function initRuntimeSocketService() {
const hosts = "10.8.0.5,192.168.1.15,127.0.0.1";
const port = "8090";
const id = "mp-weixin_V-Usyu";
const id = "mp-weixin_WlfuId";
const lazy = typeof swan !== "undefined";
let restoreError = lazy ? () => {
} : initOnError();
+11 -2
View File
@@ -47,6 +47,7 @@ const getDeviceInfo = (deviceNo) => {
});
};
const queryById = (id) => {
common_vendor.index.__f__("log", "at config/user.js:80", `查询订单详情, orderId: ${id}`);
return config_http.request({
url: `/app/order/${id}`,
method: "get",
@@ -61,20 +62,27 @@ const rentPowerBank = (deviceNo, phone) => {
});
};
const confirmPaymentAndRent = (orderId) => {
common_vendor.index.__f__("log", "at config/user.js:118", `确认支付并弹出充电宝, orderId: ${orderId}`);
common_vendor.index.__f__("log", "at config/user.js:119", `确认支付并弹出充电宝, orderId: ${orderId}`);
return config_http.request({
url: `/app/device/confirmPaymentAndRent?orderId=${orderId}`,
method: "post"
});
};
const updateOrderPackage = (data) => {
common_vendor.index.__f__("log", "at config/user.js:157", "更新订单套餐信息:", data);
common_vendor.index.__f__("log", "at config/user.js:158", "更新订单套餐信息:", data);
return config_http.request({
url: "/app/device/updateOrderPackage",
method: "post",
data
});
};
const updateUserBalance = (orderId) => {
return config_http.request({
url: `/app/user/updateBalance/${orderId}`,
method: "post",
hideLoading: true
});
};
exports.checkOrdersByStatus = checkOrdersByStatus;
exports.confirmPaymentAndRent = confirmPaymentAndRent;
exports.getDeviceInfo = getDeviceInfo;
@@ -84,5 +92,6 @@ exports.login = login;
exports.queryById = queryById;
exports.rentPowerBank = rentPowerBank;
exports.updateOrderPackage = updateOrderPackage;
exports.updateUserBalance = updateUserBalance;
exports.withdrawDeposit = withdrawDeposit;
//# sourceMappingURL=../../.sourcemap/mp-weixin/config/user.js.map
+13 -6
View File
@@ -76,6 +76,7 @@ const _sfc_main = {
formattedTime = this.formatTime(/* @__PURE__ */ new Date());
}
} catch (e) {
common_vendor.index.__f__("error", "at pages/order/payment.vue:158", "时间格式化错误:", e);
formattedTime = this.formatTime(/* @__PURE__ */ new Date());
}
this.orderInfo = {
@@ -84,12 +85,12 @@ const _sfc_main = {
createTime: formattedTime,
phone: orderData.phone,
deposit: this.passedDepositAmount || orderData.depositAmount || "99.00",
amount: orderData.packagePrice || this.packageInfo.price || "0.00"
// 优先使用传递的押金,然后是订单中的押金,最后默认99元
amount: orderData.amount || this.packageInfo.price || "0.00"
};
if (orderData.packageTime) {
this.packageInfo.time = `${orderData.packageTime / 60}小时`;
this.packageInfo.price = orderData.packagePrice || "0.00";
} else if (this.packageInfo.time) {
if (!orderData.packageTime && this.packageInfo.time) {
this.orderInfo.packageTime = this.packageInfo.time;
this.orderInfo.packagePrice = this.packageInfo.price;
}
} else {
throw new Error("获取订单信息失败");
@@ -126,6 +127,11 @@ const _sfc_main = {
title: "支付成功",
icon: "success"
});
try {
await config_user.updateUserBalance(this.orderId);
} catch (error) {
common_vendor.index.__f__("warn", "at pages/order/payment.vue:223", "更新用户余额失败:", error);
}
setTimeout(() => {
common_vendor.index.redirectTo({
url: `/pages/order/index?orderId=${this.orderId}`
@@ -133,6 +139,7 @@ const _sfc_main = {
}, 1500);
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/order/payment.vue:234", "支付失败:", err);
throw new Error("支付失败,请重试");
}
});
@@ -229,7 +236,7 @@ const _sfc_main = {
throw new Error("查询订单状态失败");
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/order/payment.vue:332", "查询订单状态错误:", error);
common_vendor.index.__f__("error", "at pages/order/payment.vue:342", "查询订单状态错误:", error);
return null;
}
}
+84 -37
View File
@@ -21,15 +21,18 @@ const _sfc_main = {
maxStatusChecks: 30,
// 最多检查30次
currentStatusChecks: 0,
statusCheckInterval: 5e3
statusCheckInterval: 5e3,
// 5秒检查一次
isPageActive: false
// 跟踪页面是否活跃
};
},
onLoad(options) {
common_vendor.index.__f__("log", "at pages/return/index.vue:96", "Return page loaded with options:", JSON.stringify(options));
common_vendor.index.__f__("log", "at pages/return/index.vue:97", "Return page loaded with options:", JSON.stringify(options));
this.isPageActive = true;
this.orderInfo.orderId = options.orderId || "";
this.deviceId = options.deviceNo || options.deviceId || "";
common_vendor.index.__f__("log", "at pages/return/index.vue:102", `初始化参数: orderId=${this.orderInfo.orderId}, deviceId=${this.deviceId}`);
common_vendor.index.__f__("log", "at pages/return/index.vue:106", `初始化参数: orderId=${this.orderInfo.orderId}, deviceId=${this.deviceId}`);
if (!this.orderInfo.orderId && this.deviceId) {
this.getOrderByDevice();
} else if (this.orderInfo.orderId) {
@@ -39,13 +42,14 @@ const _sfc_main = {
common_vendor.index.setStorageSync("activeOrderId", this.orderInfo.orderId);
try {
if (this.$orderMonitor) {
this.$orderMonitor.addOrder({ orderId: this.orderInfo.orderId });
common_vendor.index.__f__("log", "at pages/return/index.vue:122", "订单已添加到监控队列:", this.orderInfo.orderId);
this.$orderMonitor.removeOrder({ orderId: this.orderInfo.orderId });
this.$orderMonitor.addOrder({ orderId: this.orderInfo.orderId }, "return");
common_vendor.index.__f__("log", "at pages/return/index.vue:129", "订单已添加到监控队列:", this.orderInfo.orderId);
} else {
common_vendor.index.__f__("warn", "at pages/return/index.vue:124", "$orderMonitor 未定义,无法添加订单到监控队列");
common_vendor.index.__f__("warn", "at pages/return/index.vue:131", "$orderMonitor 未定义,无法添加订单到监控队列");
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/return/index.vue:127", "添加订单到监控队列失败:", error);
common_vendor.index.__f__("error", "at pages/return/index.vue:134", "添加订单到监控队列失败:", error);
}
} else {
common_vendor.index.showToast({
@@ -58,15 +62,37 @@ const _sfc_main = {
}
common_vendor.index.$on("orderCompleted", this.handleOrderCompleted);
},
onUnload() {
// 添加onHide生命周期,处理页面隐藏时的清理工作
onHide() {
common_vendor.index.__f__("log", "at pages/return/index.vue:154", "归还页面隐藏,清理计时器资源和监控服务");
this.isPageActive = false;
this.clearTimer();
this.clearStatusCheckTimer();
this.removeFromOrderMonitor();
},
onUnload() {
common_vendor.index.__f__("log", "at pages/return/index.vue:166", "归还页面卸载,清理所有资源");
this.isPageActive = false;
this.clearTimer();
this.clearStatusCheckTimer();
this.removeFromOrderMonitor();
common_vendor.index.$off("orderCompleted", this.handleOrderCompleted);
},
methods: {
// 从订单监控服务中移除当前订单
removeFromOrderMonitor() {
if (this.orderInfo.orderId && this.$orderMonitor) {
try {
this.$orderMonitor.removeOrder({ orderId: this.orderInfo.orderId });
common_vendor.index.__f__("log", "at pages/return/index.vue:186", "订单已从监控队列移除:", this.orderInfo.orderId);
} catch (error) {
common_vendor.index.__f__("error", "at pages/return/index.vue:188", "从监控队列移除订单失败:", error);
}
}
},
// 处理订单完成事件(可由任何地方触发)
handleOrderCompleted(orderData) {
common_vendor.index.__f__("log", "at pages/return/index.vue:155", "收到订单完成事件:", orderData);
common_vendor.index.__f__("log", "at pages/return/index.vue:194", "收到订单完成事件:", orderData);
if (orderData.orderId === this.orderInfo.orderId || orderData.orderNo === this.orderInfo.orderNo) {
this.showReturnSuccessModal(orderData);
}
@@ -108,18 +134,21 @@ const _sfc_main = {
},
// 获取订单详情
async getOrderDetails() {
if (!this.isPageActive) {
common_vendor.index.__f__("log", "at pages/return/index.vue:250", "页面已不活跃,跳过订单详情请求");
return;
}
try {
common_vendor.index.showLoading({ title: "加载中" });
if (!this.orderInfo.orderId) {
throw new Error("订单ID不能为空");
}
common_vendor.index.__f__("log", "at pages/return/index.vue:216", "请求订单详情, orderId:", this.orderInfo.orderId);
common_vendor.index.__f__("log", "at pages/return/index.vue:261", "请求订单详情, orderId:", this.orderInfo.orderId);
const result = await config_user.queryById(this.orderInfo.orderId);
common_vendor.index.__f__("log", "at pages/return/index.vue:218", "订单详情结果:", JSON.stringify(result));
common_vendor.index.__f__("log", "at pages/return/index.vue:263", "订单详情结果:", JSON.stringify(result));
if (result.code === 200 && result.data) {
const orderData = result.data;
common_vendor.index.__f__("log", "at pages/return/index.vue:222", "订单原始数据:", orderData);
common_vendor.index.__f__("log", "at pages/return/index.vue:223", "开始时间字段:", orderData.startTime, typeof orderData.startTime);
common_vendor.index.__f__("log", "at pages/return/index.vue:267", "订单原始数据:", orderData);
common_vendor.index.__f__("log", "at pages/return/index.vue:268", "开始时间字段:", orderData.startTime, typeof orderData.startTime);
if (orderData.orderStatus) {
this.orderInfo.orderStatus = orderData.orderStatus;
}
@@ -129,12 +158,12 @@ const _sfc_main = {
return;
}
this.updateOrderInfo(orderData);
common_vendor.index.__f__("log", "at pages/return/index.vue:245", "更新后的开始时间:", this.orderInfo.startTime);
common_vendor.index.__f__("log", "at pages/return/index.vue:290", "更新后的开始时间:", this.orderInfo.startTime);
} else {
throw new Error(result.msg || "获取订单详情失败");
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/return/index.vue:250", "获取订单详情错误:", error);
common_vendor.index.__f__("error", "at pages/return/index.vue:295", "获取订单详情错误:", error);
common_vendor.index.showToast({
title: error.message || "获取订单信息失败",
icon: "none"
@@ -157,7 +186,7 @@ const _sfc_main = {
},
// 使用后端返回的使用时长和费用数据
updateOrderInfo(orderData) {
common_vendor.index.__f__("log", "at pages/return/index.vue:278", "更新订单信息:", JSON.stringify(orderData));
common_vendor.index.__f__("log", "at pages/return/index.vue:323", "更新订单信息:", JSON.stringify(orderData));
this.orderInfo.usedTime = orderData.usedTime || "0分钟";
this.orderInfo.currentFee = orderData.currentFee || orderData.actualDeviceAmount || orderData.payAmount || "0.00";
if (orderData.orderStatus) {
@@ -166,16 +195,16 @@ const _sfc_main = {
this.orderInfo._rawStartTime = orderData.startTime;
if (orderData.startTime) {
try {
common_vendor.index.__f__("log", "at pages/return/index.vue:297", "API返回的开始时间:", orderData.startTime);
common_vendor.index.__f__("log", "at pages/return/index.vue:342", "API返回的开始时间:", orderData.startTime);
this.orderInfo.startTime = orderData.startTime;
} catch (e) {
common_vendor.index.__f__("error", "at pages/return/index.vue:301", "更新开始时间错误:", e);
common_vendor.index.__f__("error", "at pages/return/index.vue:346", "更新开始时间错误:", e);
this.orderInfo.startTime = "未知";
}
} else {
common_vendor.index.__f__("warn", "at pages/return/index.vue:305", "API返回的订单数据中没有startTime字段");
common_vendor.index.__f__("warn", "at pages/return/index.vue:350", "API返回的订单数据中没有startTime字段");
if (orderData.createTime) {
common_vendor.index.__f__("log", "at pages/return/index.vue:308", "使用createTime作为备选:", orderData.createTime);
common_vendor.index.__f__("log", "at pages/return/index.vue:353", "使用createTime作为备选:", orderData.createTime);
this.orderInfo.startTime = orderData.createTime;
} else {
this.orderInfo.startTime = "未知";
@@ -187,15 +216,24 @@ const _sfc_main = {
},
// 更新使用时长的定时器
startTimer() {
this.clearTimer();
this.timer = setInterval(() => {
this.getOrderDetails();
if (this.isPageActive) {
common_vendor.index.__f__("log", "at pages/return/index.vue:375", "执行定时更新订单信息");
this.getOrderDetails();
} else {
common_vendor.index.__f__("log", "at pages/return/index.vue:378", "页面已不活跃,停止计时器");
this.clearTimer();
}
}, 6e4);
common_vendor.index.__f__("log", "at pages/return/index.vue:383", "已启动使用时长更新计时器");
},
// 清除定时器
clearTimer() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
common_vendor.index.__f__("log", "at pages/return/index.vue:391", "已清除使用时长更新计时器");
}
},
// 清除状态检查定时器
@@ -203,6 +241,7 @@ const _sfc_main = {
if (this.statusCheckTimer) {
clearInterval(this.statusCheckTimer);
this.statusCheckTimer = null;
common_vendor.index.__f__("log", "at pages/return/index.vue:400", "已清除归还状态检查计时器");
}
},
// 开始状态检查定时器
@@ -210,22 +249,28 @@ const _sfc_main = {
this.currentStatusChecks = 0;
this.clearStatusCheckTimer();
this.statusCheckTimer = setInterval(() => {
this.currentStatusChecks++;
this.checkReturnStatus();
if (this.currentStatusChecks >= this.maxStatusChecks) {
if (this.isPageActive) {
this.currentStatusChecks++;
common_vendor.index.__f__("log", "at pages/return/index.vue:414", `执行归还状态检查 (${this.currentStatusChecks}/${this.maxStatusChecks})`);
this.checkReturnStatus();
if (this.currentStatusChecks >= this.maxStatusChecks) {
this.clearStatusCheckTimer();
common_vendor.index.showToast({
title: "请手动刷新查看归还状态",
icon: "none",
duration: 3e3
});
}
} else {
common_vendor.index.__f__("log", "at pages/return/index.vue:429", "页面已不活跃,停止状态检查计时器");
this.clearStatusCheckTimer();
common_vendor.index.showToast({
title: "请手动刷新查看归还状态",
icon: "none",
duration: 3e3
});
}
}, this.statusCheckInterval);
common_vendor.index.__f__("log", "at pages/return/index.vue:434", "已启动归还状态检查计时器");
},
// 通过设备号查询使用中的订单
async getOrderByDevice() {
try {
common_vendor.index.showLoading({ title: "加载中" });
if (!this.deviceId) {
throw new Error("设备号不能为空");
}
@@ -237,16 +282,16 @@ const _sfc_main = {
"Clientid": common_vendor.index.getStorageSync("client_id")
}
});
common_vendor.index.__f__("log", "at pages/return/index.vue:387", "通过设备号查询订单结果:", JSON.stringify(inUseRes));
common_vendor.index.__f__("log", "at pages/return/index.vue:456", "通过设备号查询订单结果:", JSON.stringify(inUseRes));
if (inUseRes.statusCode === 200 && inUseRes.data.code === 200 && inUseRes.data.data) {
const inUseOrder = inUseRes.data.data;
common_vendor.index.__f__("log", "at pages/return/index.vue:391", "使用中的订单:", inUseOrder);
common_vendor.index.__f__("log", "at pages/return/index.vue:460", "使用中的订单:", inUseOrder);
this.orderInfo.orderId = inUseOrder.orderId;
if (inUseOrder.orderStatus) {
this.orderInfo.orderStatus = inUseOrder.orderStatus;
}
if (inUseOrder.startTime) {
common_vendor.index.__f__("log", "at pages/return/index.vue:403", "inUse API返回的开始时间:", inUseOrder.startTime);
common_vendor.index.__f__("log", "at pages/return/index.vue:472", "inUse API返回的开始时间:", inUseOrder.startTime);
this.orderInfo.startTime = inUseOrder.startTime;
}
this.getOrderDetails();
@@ -256,7 +301,7 @@ const _sfc_main = {
throw new Error("未找到使用中的订单");
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/return/index.vue:417", "通过设备号查询订单失败:", error);
common_vendor.index.__f__("error", "at pages/return/index.vue:486", "通过设备号查询订单失败:", error);
common_vendor.index.showToast({
title: error.message || "获取订单信息失败",
icon: "none"
@@ -271,9 +316,11 @@ const _sfc_main = {
// 检查归还状态
async checkReturnStatus() {
try {
await this.getOrderDetails();
if (this.isPageActive) {
await this.getOrderDetails();
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/return/index.vue:437", "检查归还状态失败:", error);
common_vendor.index.__f__("error", "at pages/return/index.vue:509", "检查归还状态失败:", error);
}
},
// 返回首页
+63 -23
View File
@@ -7,34 +7,56 @@ class OrderMonitor {
this.timer = null;
this.checkInterval = 1e4;
this.isRunning = false;
this.currentPage = null;
}
/**
* 添加订单到监控队列
* @param {Object} orderData 订单数据对象,必须包含orderId字段
* @param {String} pageName 关联的页面名称,默认为'return'
*/
addOrder(orderData) {
addOrder(orderData, pageName = "return") {
if (!orderData || !orderData.orderId) {
common_vendor.index.__f__("error", "at utils/orderMonitor.js:21", "添加订单监控失败:无效的订单数据");
common_vendor.index.__f__("error", "at utils/orderMonitor.js:23", "添加订单监控失败:无效的订单数据");
return;
}
common_vendor.index.__f__("log", "at utils/orderMonitor.js:25", "添加订单到监控队列:", orderData.orderId);
this.activeOrders.set(orderData.orderId, orderData);
common_vendor.index.__f__("log", "at utils/orderMonitor.js:27", `添加订单到监控队列: ${orderData.orderId}, 页面: ${pageName}`);
this.activeOrders.set(orderData.orderId, {
...orderData,
pageName
});
if (!this.isRunning) {
this.start();
}
}
/**
* 移除订单的监控
* @param {String} orderId 订单ID
* @param {Object} params 包含orderId或pageName的对象
*/
removeOrder(orderId) {
if (this.activeOrders.has(orderId)) {
common_vendor.index.__f__("log", "at utils/orderMonitor.js:40", "从监控队列移除订单:", orderId);
this.activeOrders.delete(orderId);
if (this.activeOrders.size === 0) {
this.stop();
removeOrder(params) {
if (!params)
return;
if (params.orderId && this.activeOrders.has(params.orderId)) {
common_vendor.index.__f__("log", "at utils/orderMonitor.js:48", "从监控队列移除订单:", params.orderId);
this.activeOrders.delete(params.orderId);
} else if (params.pageName) {
common_vendor.index.__f__("log", "at utils/orderMonitor.js:53", "从监控队列移除页面相关订单:", params.pageName);
for (const [orderId, data] of this.activeOrders.entries()) {
if (data.pageName === params.pageName) {
this.activeOrders.delete(orderId);
}
}
}
if (this.activeOrders.size === 0) {
this.stop();
}
}
/**
* 设置当前活跃页面
* @param {String} pageName 页面名称
*/
setActivePage(pageName) {
this.currentPage = pageName;
common_vendor.index.__f__("log", "at utils/orderMonitor.js:73", "设置当前活跃页面:", pageName);
}
/**
* 启动监控服务
@@ -42,7 +64,7 @@ class OrderMonitor {
start() {
if (this.isRunning)
return;
common_vendor.index.__f__("log", "at utils/orderMonitor.js:56", "启动订单监控服务");
common_vendor.index.__f__("log", "at utils/orderMonitor.js:82", "启动订单监控服务");
this.isRunning = true;
this.checkOrders();
this.timer = setInterval(() => {
@@ -55,7 +77,7 @@ class OrderMonitor {
stop() {
if (!this.isRunning)
return;
common_vendor.index.__f__("log", "at utils/orderMonitor.js:71", "停止订单监控服务");
common_vendor.index.__f__("log", "at utils/orderMonitor.js:97", "停止订单监控服务");
this.isRunning = false;
if (this.timer) {
clearInterval(this.timer);
@@ -68,12 +90,18 @@ class OrderMonitor {
async checkOrders() {
if (this.activeOrders.size === 0)
return;
common_vendor.index.__f__("log", "at utils/orderMonitor.js:86", `检查 ${this.activeOrders.size} 个活跃订单状态`);
for (const [orderId, orderData] of this.activeOrders.entries()) {
common_vendor.index.__f__("log", "at utils/orderMonitor.js:112", `检查 ${this.activeOrders.size} 个活跃订单状态, 当前页面: ${this.currentPage}`);
for (const [orderId, data] of this.activeOrders.entries()) {
try {
await this.checkOrderStatus(orderId);
if (!data.pageName || data.pageName === "return") {
if (this.currentPage === "return" || this.currentPage === null) {
await this.checkOrderStatus(orderId);
} else {
common_vendor.index.__f__("log", "at utils/orderMonitor.js:122", `跳过订单状态检查: ${orderId}, 当前不在归还页面`);
}
}
} catch (error) {
common_vendor.index.__f__("error", "at utils/orderMonitor.js:92", `检查订单状态失败: ${orderId}`, error);
common_vendor.index.__f__("error", "at utils/orderMonitor.js:126", `检查订单状态失败: ${orderId}`, error);
}
}
}
@@ -83,13 +111,18 @@ class OrderMonitor {
*/
async checkOrderStatus(orderId) {
try {
common_vendor.index.__f__("log", "at utils/orderMonitor.js:103", `检查订单 ${orderId} 的状态`);
common_vendor.index.__f__("log", "at utils/orderMonitor.js:137", `检查订单 ${orderId} 的状态`);
const result = await config_user.queryById(orderId);
if (result.code === 200 && result.data) {
const orderData = result.data;
this.activeOrders.set(orderId, orderData);
const existingData = this.activeOrders.get(orderId);
const pageName = existingData ? existingData.pageName : null;
this.activeOrders.set(orderId, {
...orderData,
pageName
});
if (orderData.orderStatus === "used_done" || orderData.orderStatus === "used_down") {
common_vendor.index.__f__("log", "at utils/orderMonitor.js:114", `订单 ${orderId} 已完成!`);
common_vendor.index.__f__("log", "at utils/orderMonitor.js:153", `订单 ${orderId} 已完成!`);
common_vendor.index.$emit("orderCompleted", orderData);
common_vendor.index.showToast({
title: "充电宝归还成功",
@@ -99,7 +132,7 @@ class OrderMonitor {
const innerAudioContext = common_vendor.index.createInnerAudioContext();
innerAudioContext.src = "/static/audio/return_success.mp3";
innerAudioContext.play();
this.removeOrder(orderId);
this.removeOrder({ orderId });
setTimeout(() => {
common_vendor.index.showModal({
title: "归还成功",
@@ -117,16 +150,23 @@ class OrderMonitor {
}
}
} catch (error) {
common_vendor.index.__f__("error", "at utils/orderMonitor.js:153", `检查订单 ${orderId} 状态出错:`, error);
common_vendor.index.__f__("error", "at utils/orderMonitor.js:192", `检查订单 ${orderId} 状态出错:`, error);
}
}
}
const orderMonitor = new OrderMonitor();
common_vendor.index.onAppRoute((route) => {
const pagePath = route.path || "";
const pageSegments = pagePath.split("/");
const pageName = pageSegments[pageSegments.length - 1];
orderMonitor.setActivePage(pageName || null);
common_vendor.index.__f__("log", "at utils/orderMonitor.js:209", "页面切换:", pagePath, "当前活跃页面:", pageName);
});
const initOrderMonitor = () => {
const lastActiveOrderId = common_vendor.index.getStorageSync("activeOrderId");
if (lastActiveOrderId) {
const lastOrderData = { orderId: lastActiveOrderId };
orderMonitor.addOrder(lastOrderData);
orderMonitor.addOrder(lastOrderData, "return");
}
};
initOrderMonitor();