Authored by 陈峰

fix weixin pay lefttime

... ... @@ -14,7 +14,7 @@
<h3>请您及时付款,以便订单尽快处理!订单号:{{order_code}}</h3>
<p>
请您提交订单
<span>2小时</span>
<span class="js-time js-timer" data-time="{{pay_lefttime}}"></span>
内完成,否则订单会自动取消。
</p>
</div>
... ...
{
"name": "yohobuy-node",
"version": "6.8.21",
"version": "6.8.22",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -6,6 +6,9 @@ var $wOdetail = $('.w-odetail'),
$wPayment = $('.w-payment'),
$wAddrinfo = $('.w-addrinfo'),
$wPerm = $('.w-p-erm'),
time = $('.js-time').data('time'),
timeInterval,
$timer = $('.js-timer'),
orderCode = $wPayment.data('order');
require('../simple-header');
... ... @@ -20,6 +23,10 @@ wxPage = {
});
this.setEvent();
inter = setInterval(this.checkPayStatus, 3000);
this.setTimer();
timeInterval = setInterval(() => {
this.setTimer();
}, 1000);
},
setEvent: function() {
$wOdetail.on('click', function() {
... ... @@ -61,6 +68,25 @@ wxPage = {
}
}
});
},
setTimer: function() {
if (time < 0) {
return clearInterval(timeInterval);
}
let hour = Math.floor(time / 3600);
let minus = Math.floor((time % 3600) / 60);
let second = time % 60;
let text = '';
if (hour > 0) {
text += hour + '小时';
}
text += minus + '分' + second + '秒';
$timer.text(text);
time--;
}
};
... ...