Authored by htoooth

增加定单时间

... ... @@ -13,7 +13,7 @@
<h2>您的订单已成功,现在就去付款吧~</h2>
<h3>您的订单号:<strong class="order-num">{{order_code}}</strong> 应付金额:<strong>{{payment_amount}}</strong>&nbsp; &nbsp;
支付方式:在线支付 &nbsp; &nbsp; &nbsp; 送货时间:{{deliveryTimes}}</h3>
<h4>{{{htmlEncode ../username}}},如果2小时内您无法完成付款,系统会将您的订单取消。</h4>
<h4 class="js-time" data-time="{{pay_lefttime}}">{{{htmlEncode ../username}}},如果在 <strong class="js-timer" style="color: #e8044f;"></strong> 内您无法完成付款,系统会将您的订单取消。</h4>
</div>
{{/order}}
... ...
... ... @@ -10,6 +10,8 @@ var $btnby = $('input.btnby'),
amount = $btnby.data('amount'),
$formGo = $('.form-go'),
Alert = dialog.Alert,
time = $('.js-time').data('time'),
$timer = $('.js-timer'),
C_ID;
require('../simple-header');
... ... @@ -21,6 +23,8 @@ payPage = {
this.goPay();
},
setEvent: function() {
var self = this;
// tab切 事件
$('ul.tabs').on('click', function(e) {
var $li = $(e.target).closest('li');
... ... @@ -55,6 +59,11 @@ payPage = {
document.location.href = '//www.yohobuy.com/home/orders';
});
});
this.setTimer();
setInterval(function() {
self.setTimer();
}, 1000);
},
goPay: function() {
var payType;
... ... @@ -128,6 +137,21 @@ payPage = {
}
});
});
},
setTimer: function() {
var hour = Math.floor(time / 3600);
var minus = Math.floor((time % 3600) / 60);
var second = time % 60;
var text = '';
if (hour > 0) {
text += hour + '小时';
}
text += minus + '分' + second + '秒';
$timer.text(text);
time--;
}
};
... ...