style:根据支付分免押规范进行页面样式变更(整体)

This commit is contained in:
2025-06-30 09:09:08 +08:00
parent 8ac1666e6b
commit 7be1e97b7c
77 changed files with 2141 additions and 1420 deletions
+1 -1
View File
@@ -1 +1 @@
"use strict";const e=require("../common/vendor.js"),s=require("../config/user.js");const r=new class{constructor(){this.activeOrders=new Map,this.timer=null,this.checkInterval=1e4,this.isRunning=!1}addOrder(e){e&&e.orderId?(console.log("添加订单到监控队列:",e.orderId),this.activeOrders.set(e.orderId,e),this.isRunning||this.start()):console.error("添加订单监控失败:无效的订单数据")}removeOrder(e){this.activeOrders.has(e)&&(console.log("从监控队列移除订单:",e),this.activeOrders.delete(e),0===this.activeOrders.size&&this.stop())}start(){this.isRunning||(console.log("启动订单监控服务"),this.isRunning=!0,this.checkOrders(),this.timer=setInterval((()=>{this.checkOrders()}),this.checkInterval))}stop(){this.isRunning&&(console.log("停止订单监控服务"),this.isRunning=!1,this.timer&&(clearInterval(this.timer),this.timer=null))}async checkOrders(){if(0!==this.activeOrders.size){console.log(`检查 ${this.activeOrders.size} 个活跃订单状态`);for(const[s,r]of this.activeOrders.entries())try{await this.checkOrderStatus(s)}catch(e){console.error(`检查订单状态失败: ${s}`,e)}}}async checkOrderStatus(r){try{console.log(`检查订单 ${r} 的状态`);const t=await s.queryById(r);if(200===t.code&&t.data){const s=t.data;if(this.activeOrders.set(r,s),"used_done"===s.orderStatus||"used_down"===s.orderStatus){console.log(`订单 ${r} 已完成!`),e.index.$emit("orderCompleted",s),e.index.showToast({title:"充电宝归还成功",icon:"success",duration:2e3});const t=e.index.createInnerAudioContext();t.src="/static/audio/return_success.mp3",t.play(),this.removeOrder(r),setTimeout((()=>{e.index.showModal({title:"归还成功",content:"充电宝已归还成功,剩余押金将退还到您的账户",confirmText:"查看详情",success:s=>{s.confirm&&e.index.redirectTo({url:`/pages/order/return-success?orderId=${r}`})}})}),500)}}}catch(t){console.error(`检查订单 ${r} 状态出错:`,t)}}};(()=>{const s=e.index.getStorageSync("activeOrderId");if(s){const e={orderId:s};r.addOrder(e)}})(),exports.orderMonitor=r;
"use strict";const e=require("../common/vendor.js"),r=require("../config/user.js");const t=new class{constructor(){this.activeOrders=new Map,this.timer=null,this.checkInterval=1e4,this.isRunning=!1,this.currentPage=null}addOrder(e,r="return"){e&&e.orderId?(console.log(`添加订单到监控队列: ${e.orderId}, 页面: ${r}`),this.activeOrders.set(e.orderId,{...e,pageName:r}),this.isRunning||this.start()):console.error("添加订单监控失败:无效的订单数据")}removeOrder(e){if(e){if(e.orderId&&this.activeOrders.has(e.orderId))console.log("从监控队列移除订单:",e.orderId),this.activeOrders.delete(e.orderId);else if(e.pageName){console.log("从监控队列移除页面相关订单:",e.pageName);for(const[r,t]of this.activeOrders.entries())t.pageName===e.pageName&&this.activeOrders.delete(r)}0===this.activeOrders.size&&this.stop()}}setActivePage(e){this.currentPage=e,console.log("设置当前活跃页面:",e)}start(){this.isRunning||(console.log("启动订单监控服务"),this.isRunning=!0,this.checkOrders(),this.timer=setInterval((()=>{this.checkOrders()}),this.checkInterval))}stop(){this.isRunning&&(console.log("停止订单监控服务"),this.isRunning=!1,this.timer&&(clearInterval(this.timer),this.timer=null))}async checkOrders(){if(0!==this.activeOrders.size){console.log(`检查 ${this.activeOrders.size} 个活跃订单状态, 当前页面: ${this.currentPage}`);for(const[r,t]of this.activeOrders.entries())try{t.pageName&&"return"!==t.pageName||("return"===this.currentPage||null===this.currentPage?await this.checkOrderStatus(r):console.log(`跳过订单状态检查: ${r}, 当前不在归还页面`))}catch(e){console.error(`检查订单状态失败: ${r}`,e)}}}async checkOrderStatus(t){try{console.log(`检查订单 ${t} 的状态`);const s=await r.queryById(t);if(200===s.code&&s.data){const r=s.data,i=this.activeOrders.get(t),o=i?i.pageName:null;if(this.activeOrders.set(t,{...r,pageName:o}),"used_done"===r.orderStatus||"used_down"===r.orderStatus){console.log(`订单 ${t} 已完成!`),e.index.$emit("orderCompleted",r),e.index.showToast({title:"充电宝归还成功",icon:"success",duration:2e3});const s=e.index.createInnerAudioContext();s.src="/static/audio/return_success.mp3",s.play(),this.removeOrder({orderId:t}),setTimeout((()=>{e.index.showModal({title:"归还成功",content:"充电宝已归还成功,剩余押金将退还到您的账户",confirmText:"查看详情",success:r=>{r.confirm&&e.index.redirectTo({url:`/pages/order/return-success?orderId=${t}`})}})}),500)}}}catch(s){console.error(`检查订单 ${t} 状态出错:`,s)}}};e.index.onAppRoute((e=>{const r=e.path||"",s=r.split("/"),i=s[s.length-1];t.setActivePage(i||null),console.log("页面切换:",r,"当前活跃页面:",i)}));(()=>{const r=e.index.getStorageSync("activeOrderId");if(r){const e={orderId:r};t.addOrder(e,"return")}})(),exports.orderMonitor=t;