...
|
...
|
@@ -26,7 +26,12 @@ var dateText = 0, |
|
|
newHour = 0,
|
|
|
newMinus = 0;
|
|
|
|
|
|
var skuFlag;
|
|
|
var skuFlag,
|
|
|
hideNum,
|
|
|
hideIndex;
|
|
|
|
|
|
var oneIndex = 0,
|
|
|
twoIndex = 0;
|
|
|
|
|
|
require('../common');
|
|
|
|
...
|
...
|
@@ -64,10 +69,11 @@ $( |
|
|
$('.cart-bar').hide();
|
|
|
$('.current-price').hide();
|
|
|
var ajaxUrl = '/product/detail/seckillData/' + $('#productSkn').val();
|
|
|
var timestamp = Date.parse(new Date());
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: ajaxUrl,
|
|
|
url: ajaxUrl + '?tamp=' + timestamp,
|
|
|
success: function(data) {
|
|
|
// 秒杀是否结束
|
|
|
if (data.status !== 1 && data.status !== 2) {
|
...
|
...
|
@@ -112,23 +118,29 @@ $( |
|
|
|
|
|
// 如果秒杀库存为0
|
|
|
if (data.secKillSku[i].storageNum === 0) {
|
|
|
skuFlag = 0;
|
|
|
$(this).addClass('zero-stock');
|
|
|
oneIndex = $(this).index() + 1;
|
|
|
twoIndex = $(this).parent('ul').index() - 2;
|
|
|
$('.chose-panel .color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').addClass('zero-stock');
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// alert("没有匹配");
|
|
|
}
|
|
|
}
|
|
|
if (skuFlag === 0) {
|
|
|
$(this).addClass('zero-stock').attr('data-num', '1');
|
|
|
var oneIndex = $(this).index() + 1;
|
|
|
var twoIndex = $(this).parent('ul').index() - 2;
|
|
|
$(this).addClass('zero-stock').attr('data-num', '0').addClass('hide');
|
|
|
oneIndex = $(this).index() + 1;
|
|
|
twoIndex = $(this).parent('ul').index() - 2;
|
|
|
|
|
|
$('.chose-panel .color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').addClass('zero-stock');
|
|
|
$('.chose-panel .color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').addClass('zero-stock').addClass('hide');
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
|
|
|
seckHide();// 非秒杀库存置灰
|
|
|
|
|
|
$('.price-date').append(
|
|
|
'<div class="seckill-time seckill-time-border">' +
|
|
|
'<span>距结束 </span>' +
|
...
|
...
|
@@ -199,3 +211,47 @@ $( |
|
|
|
|
|
}
|
|
|
);
|
|
|
|
|
|
function seckHide() {
|
|
|
$('.chose-panel .size-list ul').each(
|
|
|
function() {
|
|
|
hideNum = 0;
|
|
|
$(this).find('li').each(
|
|
|
function() {
|
|
|
if ($(this).hasClass('hide')) {
|
|
|
oneIndex = $(this).index() + 1;
|
|
|
twoIndex = $(this).parent('ul').index() - 2;
|
|
|
$('.color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').hide();
|
|
|
} else {
|
|
|
hideNum++;
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
if (hideNum === 0) {
|
|
|
hideIndex = $(this).index() - 2;
|
|
|
$('.color-list ul:first li:eq(' + hideIndex + ')').hide();
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
|
|
|
$('.chose-panel .color-list ul').each(
|
|
|
function() {
|
|
|
hideNum = 0;
|
|
|
$(this).find('li').each(
|
|
|
function() {
|
|
|
if ($(this).hasClass('hide')) {
|
|
|
oneIndex = $(this).index() + 1;
|
|
|
twoIndex = $(this).parent('ul').index() - 2;
|
|
|
$('.size-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').hide();
|
|
|
} else {
|
|
|
hideNum++;
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
if (hideNum === 0) {
|
|
|
hideIndex = $(this).index() - 2;
|
|
|
$('.size-list ul:first li:eq(' + hideIndex + ')').hide();
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
} |
...
|
...
|
|