...
|
...
|
@@ -31,7 +31,8 @@ var $descColor = $('#desc-color'); |
|
|
var thumbsLoaded = {};
|
|
|
|
|
|
var $main = $('.main'),
|
|
|
id = $main.data('id');
|
|
|
id = $main.data('id'),
|
|
|
isTicket = $('input[name="isTicket"]').length > 0 && $('input[name="isTicket"]').val() === true;
|
|
|
|
|
|
var maxStock = -1; // 记录当前选中的颜色-尺码的库存量,若为-1,代表未选择尺码
|
|
|
|
...
|
...
|
@@ -196,6 +197,12 @@ $('.colors').on('click', 'li', function() { |
|
|
// 切换尺码显示
|
|
|
$sizes.not('.hide').addClass('hide').children('li').removeClass('focus');
|
|
|
$sizes.eq(index).removeClass('hide');
|
|
|
|
|
|
//是否展览票
|
|
|
if (isTicket) {
|
|
|
$sizes.eq(index).children('li').trigger('click');
|
|
|
$('.chose-size').addClass('hide');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
resetNum();
|
...
|
...
|
@@ -377,6 +384,50 @@ $('#keep-shopping').click(function() { |
|
|
$('#balance').slideUp(SLIDETIME);
|
|
|
});
|
|
|
|
|
|
//电子票立即购买
|
|
|
$('#buy-ticket').click(function() {
|
|
|
var sku,
|
|
|
buyNumber;
|
|
|
|
|
|
if (maxStock === -1) {
|
|
|
showSizeWarn();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($(this).hasClass('dis')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
sku = $('.size:not(.hide) li.focus').data('sku');
|
|
|
buyNumber = getNum();
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/cart/index/setTicket',
|
|
|
data: {
|
|
|
productSku: sku,
|
|
|
buyNumber: buyNumber
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
var $ticketForm,
|
|
|
myAlert;
|
|
|
|
|
|
if (data.code * 1 === 200) {
|
|
|
$ticketForm = $('form[name="ticket-form"]');
|
|
|
$ticketForm.html(
|
|
|
'<input name="productSku" value="' + sku + '" />' +
|
|
|
'<input name="buyNumber" value="' + buyNumber + '" />'
|
|
|
);
|
|
|
$ticketForm.submit();
|
|
|
} else if (data.code * 1 === 401) {
|
|
|
document.location.href = data.message;
|
|
|
} else {
|
|
|
myAlert = new Alert(data.message);
|
|
|
myAlert.show();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
// 立即购买
|
|
|
$('#buy-now').click(function() {
|
|
|
var sku,
|
...
|
...
|
|