...
|
...
|
@@ -7,7 +7,9 @@ const BUY_AGAIN = 'buy_again'; |
|
|
const NOW_BUY = 'now_buy';
|
|
|
const SHOW_DETAIL = 'show_detail';
|
|
|
const SHOW_EXPRESS = 'show_express';
|
|
|
import event from '../../utils/event'
|
|
|
import event from '../../utils/event';
|
|
|
|
|
|
let interval;
|
|
|
|
|
|
Component({
|
|
|
/**
|
...
|
...
|
@@ -53,27 +55,28 @@ attached: function () { |
|
|
let leftTime = that.data.lefttime;
|
|
|
let timer = that.data.timer;
|
|
|
|
|
|
if(timer > 0){
|
|
|
let interval = setInterval(() => {
|
|
|
if (timer > 0){
|
|
|
interval = setInterval(() => {
|
|
|
timer = timer - 1;
|
|
|
leftTime = formatTimeByMin(timer, 'm:s');
|
|
|
leftTime = formatTimeByMin(timer, 'm:s');
|
|
|
if (timer <= 0) {
|
|
|
leftTime = '00:00'
|
|
|
event.emit('refresh-order');
|
|
|
leftTime = '00:00';
|
|
|
setTimeout(() => {
|
|
|
event.emit('refresh-order');
|
|
|
}, 2000);
|
|
|
clearInterval(interval);
|
|
|
}
|
|
|
that.setData({
|
|
|
lefttime: leftTime,
|
|
|
timer: timer
|
|
|
});
|
|
|
}, 1000);
|
|
|
that.setData({ interval: interval});
|
|
|
}
|
|
|
|
|
|
}
|
|
|
},
|
|
|
|
|
|
detached: function () {
|
|
|
let interval = this.interval;
|
|
|
if (interval){
|
|
|
clearInterval(interval);
|
|
|
}
|
...
|
...
|
|