...
|
...
|
@@ -34,6 +34,67 @@ var orderHammer, |
|
|
$reaMask = $('.reason-mask'),
|
|
|
reasonSwiper;
|
|
|
|
|
|
// 减少计时
|
|
|
function downCount(item) {
|
|
|
var hoursItem = item.find('.hours');
|
|
|
|
|
|
var difference = hoursItem.text(),// difference of dates
|
|
|
interval;
|
|
|
/**
|
|
|
* Main downCount function that calculates everything
|
|
|
*/
|
|
|
function countdown() {
|
|
|
|
|
|
// basic math variables
|
|
|
var _second = 1000,
|
|
|
_minute = _second * 60,
|
|
|
_hour = _minute * 60,
|
|
|
_day = _hour * 24,
|
|
|
days,
|
|
|
hours,
|
|
|
minutes,
|
|
|
seconds;
|
|
|
|
|
|
// calculate dates
|
|
|
days = Math.floor(difference / _day),
|
|
|
hours = Math.floor((difference % _day) / _hour),
|
|
|
minutes = Math.floor((difference % _hour) / _minute),
|
|
|
seconds = Math.floor((difference % _minute) / _second);
|
|
|
|
|
|
// fix dates so that it will show two digets
|
|
|
days = (String(days).length >= 2) ? days : '0' + days;
|
|
|
hours = (String(hours).length >= 2) ? hours : '0' + hours;
|
|
|
minutes = (String(minutes).length >= 2) ? minutes : '0' + minutes;
|
|
|
seconds = (String(seconds).length >= 2) ? seconds : '0' + seconds;
|
|
|
|
|
|
// set to DOM
|
|
|
item.removeClass('hide');
|
|
|
hoursItem.text('剩余' + hours + ':' + minutes + ':' + seconds);
|
|
|
|
|
|
difference -= 1000;
|
|
|
|
|
|
if (difference < 0) {
|
|
|
clearInterval(interval);// stop timer
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
if (difference !== '' && difference > 0) {
|
|
|
interval = setInterval(countdown, 1000);// start
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 初始化时间
|
|
|
function setTime() {
|
|
|
|
|
|
$('.orders').each(function() {
|
|
|
var item = $(this).find('.count-down');
|
|
|
|
|
|
if (!$(this).hasClass('hide')) {
|
|
|
downCount(item);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//加载订单
|
|
|
function getOrders(option) {
|
|
|
var opt = {
|
...
|
...
|
@@ -82,6 +143,7 @@ function getOrders(option) { |
|
|
|
|
|
inAjax = false;
|
|
|
show && loading.hideLoadingMask();
|
|
|
setTime();
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
|