...
|
...
|
@@ -58,11 +58,82 @@ seckillObj = { |
|
|
|
|
|
$(
|
|
|
function() {
|
|
|
var ajaxUrl = '/product/detail/seckillData/' + $('.productSkn-text').val();
|
|
|
$('.cart-bar').hide();
|
|
|
$('.current-price').hide();
|
|
|
var ajaxUrl = '/product/detail/seckillData/' + $('#productSkn').val();
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: ajaxUrl,
|
|
|
success: function(data) {
|
|
|
// 秒杀是否结束
|
|
|
if (data.status !== 1 && data.status !== 2) {
|
|
|
$('.cart-bar').show();
|
|
|
$('.current-price').show();
|
|
|
} else {
|
|
|
// 秒杀开始前
|
|
|
if (data.status === 1) {
|
|
|
$('.cart-bar').before(
|
|
|
'<div class="seckill-count">' +
|
|
|
'<div class="seckill-count-bg"></div>' +
|
|
|
'<div class="seckill-count-num">距秒杀开始:' +
|
|
|
'<i class="tick hour">00</i>时' +
|
|
|
'<i class="tick minute">00</i>分' +
|
|
|
'<i class="tick second">00</i>秒' +
|
|
|
'</div>' +
|
|
|
'</div>'
|
|
|
);
|
|
|
$('.price-date').append(
|
|
|
'<div class="seckill-time notStart">' +
|
|
|
'<span class="seckill-time-pic">秒杀预告</span>' +
|
|
|
'<span class="seckill-time-c">月日</span>' +
|
|
|
'</div>'
|
|
|
);
|
|
|
$('.cart-bar a:first').append('<a href="javascript:;" class="sold-out">即将开抢</a>');
|
|
|
$('.addto-cart').hide();
|
|
|
$('.cart-bar').show();
|
|
|
}
|
|
|
|
|
|
// 秒杀进行中
|
|
|
if (data.status === 2) {
|
|
|
$('.price-date').append(
|
|
|
'<div class="seckill-time seckill-time-border">' +
|
|
|
'<span>距结束 </span>' +
|
|
|
'<span class="end-time">' +
|
|
|
'<i class="tick hour">00</i>:' +
|
|
|
'<i class="tick minute">00</i>:' +
|
|
|
'<i class="tick second">00</i>' +
|
|
|
'</span>' +
|
|
|
'</div>'
|
|
|
);
|
|
|
$('.text-info').append(
|
|
|
'<div class="seckill-time seckill-time-border seckill-chose">' +
|
|
|
'<span>距结束 </span>' +
|
|
|
'<span class="end-time">' +
|
|
|
'<i class="tick hour">00</i>:' +
|
|
|
'<i class="tick minute">00</i>:' +
|
|
|
'<i class="tick second">00</i>' +
|
|
|
'</span>' +
|
|
|
'</div>'
|
|
|
);
|
|
|
$('.current-price').text('¥' + data.secKillPrice).show();
|
|
|
$('.sale-price').text('¥' + data.secKillPrice).show();
|
|
|
$('.chose-items .num').find('.clearfix').append(
|
|
|
'<span class="limit-num-text">限购1件</span>'
|
|
|
);
|
|
|
$('.left-num').hide();
|
|
|
$('.btn-plus').removeClass('btn-plus');
|
|
|
$('.addto-cart').text('立即购买');
|
|
|
$('#chose-btn-sure').text('立即抢购').addClass('isSecKill');
|
|
|
$('.cart-bar').show();
|
|
|
var seckillNum = 0;
|
|
|
for (var i = 0; i < data.secKillSku.length; i++) {
|
|
|
seckillNum = seckillNum + data.secKillSku[i].storageNum;
|
|
|
}
|
|
|
if (seckillNum == 0) {
|
|
|
var thisSkn = $('#productSkn').val();
|
|
|
window.location.href = '/product/show_' + thisSkn + '.html';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
startTime = data.startTime;
|
|
|
|
...
|
...
|
@@ -83,6 +154,7 @@ $( |
|
|
newMinus = newDate.getMinutes();
|
|
|
$('.notStart').find('.seckill-time-c').text(newMonth + '月' + newDay + '日' + newHour + ':' + newMinus);
|
|
|
seckillObj.startTick(timeObj, offsetTime);
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络异常~');
|
...
|
...
|
|