This commit is contained in:
XiaoMo 2025-05-06 08:28:03 +08:00
parent ffcfda1f4b
commit 8a8fb8c16d

View File

@ -17,8 +17,9 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const orderInfo = wx.getStorageSync('progressorder');
if (!orderInfo) {
var a = this;
e.request('/miniprogram/index/balance', {}, !0).then(function(res) {
if (!res.data || !res.data.progressorder) {
wx.showToast({
title: '没有进行中的订单',
icon: 'none',
@ -32,10 +33,11 @@ Page({
return;
}
const orderInfo = res.data.progressorder;
const currentTime = Math.floor(Date.now() / 1000);
const remainingTime = Math.max(0, orderInfo.timestamp + orderInfo.siteoccupationTime * 60 - currentTime);
this.setData({
a.setData({
agentname: orderInfo.agentname,
devicecode: orderInfo.devicecode,
remainingTime: remainingTime,
@ -43,8 +45,20 @@ Page({
});
if (remainingTime > 0) {
this.countdown();
a.countdown();
}
}).catch(function(err) {
wx.showToast({
title: '获取订单信息失败',
icon: 'none',
duration: 2000
});
setTimeout(() => {
wx.switchTab({
url: '/pages/index/index'
});
}, 2000);
});
},
/**