Authored by 郭成尧

tick-tock-twice-bug-fixed

... ... @@ -18,7 +18,7 @@ var nowTime = 0;
var startTime = 0;
var endTime = 0,
diffTime = 0;// 误差时间
diffTime = 0; // 误差时间
var dateText = 0,
newDate = 0,
... ... @@ -74,7 +74,7 @@ seckillObj = {
$(
function() {
$('#goodsDiscount').hide();// 隐藏折扣楼层
$('#goodsDiscount').hide(); // 隐藏折扣楼层
$('.cart-bar').hide();
$('.current-price').hide();
var ajaxUrl = '/product/seckillDetail/seckillData/' + $('#productSkn').val();
... ... @@ -99,20 +99,20 @@ $(
if (data.status === 1) {
$('.cart-bar').before(
'<div class="seckill-count">' +
'<div class="seckill-count-bg"></div>' +
'<div class="seckill-count-num">距秒杀开始:' +
'<span class="day-c"><i class="tick day">00</i>天</span>' +
'<i class="tick hour">00</i>时' +
'<i class="tick minute">00</i>分' +
'<i class="tick second">00</i>秒' +
'</div>' +
'<div class="seckill-count-bg"></div>' +
'<div class="seckill-count-num">距秒杀开始:' +
'<span class="day-c"><i class="tick day">00</i>天</span>' +
'<i class="tick hour">00</i>时' +
'<i class="tick minute">00</i>分' +
'<i class="tick second">00</i>秒' +
'</div>' +
'</div>'
);
$('.current-price').text('¥' + data.secKillPrice).show();
$('.price-date').append(
$('.price-date').eq(0).append(
'<div class="seckill-time notStart">' +
'<span class="seckill-time-pic">秒杀预告</span>' +
'<span class="seckill-time-c">月日</span>' +
'<span class="seckill-time-pic">秒杀预告</span>' +
'<span class="seckill-time-c">月日</span>' +
'</div>'
);
$('.sold-out').hide();
... ... @@ -154,10 +154,10 @@ $(
}
);
seckHide();// 非秒杀库存置灰
seckHide(); // 非秒杀库存置灰
// 插入倒计时
addTimeout($('.price-date'));
addTimeout($('.price-date').eq(0));
addTimeout($('.text-info'));
secKillPrice = toDecimal2(data.secKillPrice);
$('.current-price').text('¥' + secKillPrice).show();
... ... @@ -191,7 +191,7 @@ $(
// nowTime = Date.parse(new Date()) / 1000;
nowTime = diffTime;// 使用请求服务器时间作为当前时间
nowTime = diffTime; // 使用请求服务器时间作为当前时间
if (startTime > nowTime) {
offsetTime = startTime - nowTime;
... ... @@ -269,13 +269,13 @@ function seckHide() {
function addTimeout(obj) {
obj.append(
'<div class="seckill-time seckill-time-border">' +
'<span>距结束&nbsp</span>' +
'<span class="end-time">' +
'<i class="tick day hide">00</i>' +
'<i class="tick hour">00</i>:' +
'<i class="tick minute">00</i>:' +
'<i class="tick second">00</i>' +
'</span>' +
'<span>距结束&nbsp</span>' +
'<span class="end-time">' +
'<i class="tick day hide">00</i>' +
'<i class="tick hour">00</i>:' +
'<i class="tick minute">00</i>:' +
'<i class="tick second">00</i>' +
'</span>' +
'</div>'
);
}
... ... @@ -297,4 +297,4 @@ function toDecimal2(num) {
s += '0';
}
return s;
}
}
\ No newline at end of file
... ...