0000
This commit is contained in:
parent
ffcfda1f4b
commit
8a8fb8c16d
@ -17,10 +17,39 @@ Page({
|
|||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const orderInfo = wx.getStorageSync('progressorder');
|
var a = this;
|
||||||
if (!orderInfo) {
|
e.request('/miniprogram/index/balance', {}, !0).then(function(res) {
|
||||||
|
if (!res.data || !res.data.progressorder) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '没有进行中的订单',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
wx.switchTab({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
});
|
||||||
|
}, 2000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const orderInfo = res.data.progressorder;
|
||||||
|
const currentTime = Math.floor(Date.now() / 1000);
|
||||||
|
const remainingTime = Math.max(0, orderInfo.timestamp + orderInfo.siteoccupationTime * 60 - currentTime);
|
||||||
|
|
||||||
|
a.setData({
|
||||||
|
agentname: orderInfo.agentname,
|
||||||
|
devicecode: orderInfo.devicecode,
|
||||||
|
remainingTime: remainingTime,
|
||||||
|
orderid: orderInfo.id
|
||||||
|
});
|
||||||
|
|
||||||
|
if (remainingTime > 0) {
|
||||||
|
a.countdown();
|
||||||
|
}
|
||||||
|
}).catch(function(err) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '没有进行中的订单',
|
title: '获取订单信息失败',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
@ -29,22 +58,7 @@ Page({
|
|||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
});
|
});
|
||||||
}, 2000);
|
}, 2000);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const currentTime = Math.floor(Date.now() / 1000);
|
|
||||||
const remainingTime = Math.max(0, orderInfo.timestamp + orderInfo.siteoccupationTime * 60 - currentTime);
|
|
||||||
|
|
||||||
this.setData({
|
|
||||||
agentname: orderInfo.agentname,
|
|
||||||
devicecode: orderInfo.devicecode,
|
|
||||||
remainingTime: remainingTime,
|
|
||||||
orderid: orderInfo.id
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (remainingTime > 0) {
|
|
||||||
this.countdown();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user