...
|
...
|
@@ -3,11 +3,9 @@ |
|
|
* author: 陈峰<feng.chen@yoho.cn>
|
|
|
* date: 2016/09/08
|
|
|
*/
|
|
|
|
|
|
var $ = require('yoho-jquery'),
|
|
|
IScroll = require('yoho-iscroll'),
|
|
|
tip = require('../plugin/tip'),
|
|
|
seckillObj = {};
|
|
|
require('../common');
|
|
|
|
|
|
var timeObj = '';
|
|
|
|
...
|
...
|
@@ -15,17 +13,18 @@ var offsetTime = 0; |
|
|
|
|
|
var nowTime = Date.parse(new Date()) / 1000;
|
|
|
|
|
|
var startTime = $('.start-time-text').val();
|
|
|
var startTime = 0;
|
|
|
|
|
|
var endTime = $('.end-time-text').val();
|
|
|
var endTime = 0;
|
|
|
|
|
|
if (startTime > nowTime) {
|
|
|
offsetTime = startTime - nowTime;
|
|
|
timeObj = $('.seckill-count-num');
|
|
|
} else if (nowTime > startTime && nowTime < endTime) {
|
|
|
offsetTime = endTime - nowTime;
|
|
|
timeObj = $('.end-time');
|
|
|
}
|
|
|
var dateText = 0,
|
|
|
newDate = 0,
|
|
|
newMonth = 0,
|
|
|
newDay = 0,
|
|
|
newHour = 0,
|
|
|
newMinus = 0;
|
|
|
|
|
|
require('../common');
|
|
|
|
|
|
seckillObj = {
|
|
|
el: {
|
...
|
...
|
@@ -33,7 +32,6 @@ seckillObj = { |
|
|
currentTick: null
|
|
|
},
|
|
|
|
|
|
|
|
|
startTick: function(elem, offsetTime) {
|
|
|
var that = this,
|
|
|
$el = this.el,
|
...
|
...
|
@@ -57,21 +55,38 @@ seckillObj = { |
|
|
}
|
|
|
};
|
|
|
|
|
|
seckillObj.startTick(timeObj, offsetTime);
|
|
|
|
|
|
$(
|
|
|
function() {
|
|
|
var dateText = Number($('.start-time-text').val() * 1000);
|
|
|
var newDate = new Date(dateText);
|
|
|
var newMonth = newDate.getMonth() + 1;
|
|
|
var newDay = newDate.getDate();
|
|
|
var newHour = newDate.getHours();
|
|
|
var newMinus = newDate.getMinutes();
|
|
|
$('.notStart').find('.seckill-time-c').text(newMonth + '月' + newDay + '日' + newHour + ':' + newMinus);
|
|
|
$('.go-pay').click(
|
|
|
function() {
|
|
|
alert('去付款');
|
|
|
var ajaxUrl = '/product/detail/seckillData/' + $('.productSkn-text').val();
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: ajaxUrl,
|
|
|
success: function(data) {
|
|
|
|
|
|
startTime = data.startTime;
|
|
|
|
|
|
endTime = data.endTime;
|
|
|
|
|
|
if (startTime > nowTime) {
|
|
|
offsetTime = startTime - nowTime;
|
|
|
timeObj = $('.seckill-count-num');
|
|
|
} else if (nowTime > startTime && nowTime < endTime) {
|
|
|
offsetTime = endTime - nowTime;
|
|
|
timeObj = $('.end-time');
|
|
|
}
|
|
|
dateText = Number(data.startTime * 1000);
|
|
|
newDate = new Date(dateText);
|
|
|
newMonth = newDate.getMonth() + 1;
|
|
|
newDay = newDate.getDate();
|
|
|
newHour = newDate.getHours();
|
|
|
newMinus = newDate.getMinutes();
|
|
|
$('.notStart').find('.seckill-time-c').text(newMonth + '月' + newDay + '日' + newHour + ':' + newMinus);
|
|
|
seckillObj.startTick(timeObj, offsetTime);
|
|
|
},
|
|
|
error: function() {
|
|
|
// alert('err');
|
|
|
}
|
|
|
);
|
|
|
});
|
|
|
|
|
|
}
|
|
|
); |
...
|
...
|
|