项目中
1.实现订单二次支付功能
- 用户已下单
- 用户未支付
- 代码
var m, s;
let {createTime} = this.data.orderData,
currentTime = (new Date()).getTime(),
createTime1 = (new Date(createTime.replace(/-/g, '/')).getTime()) + 10 * 60000
let countDownTime = createTime1 - currentTime
if (countDownTime > 0) {
let that = this
m = Math.floor(countDownTime / 1000 / 60 % 60);
s = Math.floor(countDownTime / 1000 % 60);
that.setData({
countdown: (m < 10 ? '0' + m : m) + ":" + (s < 10 ? '0' + s : s),
})
setTimeout(that.getcurrentTime, 1000);
} else {
this.setData({
isPayStatus: true,
countdown: '00:00'
})
}
2.实现订单列表局部刷新
- 修改订单状态
- 刷新列表
- 实现思路
(1)点击列表其中某一条数据时,缓存当前点击元素的id wx.setStorageSync(‘orderId’, id)
(2)修改当前点击数据的状态
(3)从详情页面返回列表页面 在onShow中
1.
let orderId = wx.getStorageSync('orderId')
2.
getCusSignupList().then(res => {
res.data.list.forEach((el, i) => {
if (orderId == el.id) {
this.setData({
index: i
})
}
})
this.setData({
['registOrderList[' + this.data.index + ']']: res.data.list[this.data.index]
})
})