...
|
...
|
@@ -368,20 +368,143 @@ function getProductByPromotionId(promotionId) { |
|
|
|
|
|
function bindGiftWinAction($el) {
|
|
|
|
|
|
var pacList = 0;
|
|
|
|
|
|
$el.on('click', '.slide-img .img-list .img-item', function() {
|
|
|
|
|
|
var id = $(this).data('id');
|
|
|
var skn = $(this).data('skn');
|
|
|
|
|
|
/* getProductInfo(id, skn).then(res => {
|
|
|
|
|
|
getProductInfo(id, skn).then(res => {
|
|
|
$el.find('.product-detail-info').empty().append(productInfoTpl(res));
|
|
|
});*/
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$el.on('click', '.piclist li', function() {
|
|
|
var $this = $(this);
|
|
|
var idx = $(this).index();
|
|
|
|
|
|
$el.find('.detail-bigpic:not(.none) .piclist li').removeClass('active');
|
|
|
$this.addClass('active');
|
|
|
$el.find('.detail-bigpic:not(.none) .bigpic').hide().eq(idx).show();
|
|
|
});
|
|
|
|
|
|
$el.on('click', '.pre, .next', function(){
|
|
|
var $this = $(this);
|
|
|
var $detailBigpic = $this.closest('.detail-bigpic');
|
|
|
var curIndex = Number($detailBigpic.data('_index') || 0);
|
|
|
var $lis = $this.siblings('.con').find('li');
|
|
|
|
|
|
if ($this.hasClass('next')) {
|
|
|
if (curIndex >= $lis.length - 1) {
|
|
|
return false;
|
|
|
}
|
|
|
curIndex++;
|
|
|
} else {
|
|
|
if (curIndex < 1) {
|
|
|
return false;
|
|
|
}
|
|
|
curIndex--;
|
|
|
}
|
|
|
|
|
|
$detailBigpic.data('_index', curIndex);
|
|
|
|
|
|
$lis.removeClass('active').eq(curIndex).addClass('active');
|
|
|
$detailBigpic.find('.bigpic').hide().eq(curIndex).show();
|
|
|
});
|
|
|
|
|
|
$el.on('click', '.color', function(){
|
|
|
|
|
|
var $this = $(this);
|
|
|
var idx = $this.index();
|
|
|
var $detail = $this.closest('.detail-goods');
|
|
|
var $sizes = $detail.find('.showSizeBox');
|
|
|
var $detailBigpic = $detail.find('.detail-bigpic');
|
|
|
var $curSize = $sizes.eq(idx);
|
|
|
var $curDetailBig = $detailBigpic.eq(idx);
|
|
|
var bigPicIndex = 0; //默认显示大图中的第一个图
|
|
|
|
|
|
$curDetailBig.data('_index', bigPicIndex);
|
|
|
|
|
|
$this.siblings('.color').find('p').removeClass('active');
|
|
|
$this.find('p').addClass('active');
|
|
|
|
|
|
$sizes.addClass('none').eq(idx).removeClass('none');
|
|
|
|
|
|
if ($curSize.find('span').length < 2) {
|
|
|
$curSize.find('span:first').addClass('active');
|
|
|
}
|
|
|
|
|
|
getProductHtmlInfo(id).then(res => {
|
|
|
$el.find('.product-detail-info').empty().append(res);
|
|
|
$detailBigpic.addClass('none');
|
|
|
$curDetailBig.removeClass('active');
|
|
|
|
|
|
$curDetailBig.find('.bigpic').hide();
|
|
|
$curDetailBig.find('.bigpic').eq(bigPicIndex).show();
|
|
|
|
|
|
$curDetailBig.find('.con li').removeClass('active');
|
|
|
$curDetailBig.find('.con li').eq(bigPicIndex).addClass('active');
|
|
|
|
|
|
$sizes.eq(idx).find('span').each(function() {
|
|
|
if ($(this).hasClass('null-atcivec')) {
|
|
|
$el.find('.addcart').addClass('none');
|
|
|
$el.find('.btn_sellout').removeClass('none');
|
|
|
} else {
|
|
|
$el.find('.addcart').removeClass('none');
|
|
|
$el.find('.btn_sellout').addClass('none');
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$el.on('click', '.showSizeBox span', function(){
|
|
|
|
|
|
var $this = $(this);
|
|
|
var idx = $this.index();
|
|
|
var shopNumAll = $this.data('num');
|
|
|
|
|
|
$this.siblings('span').removeClass('active');
|
|
|
$this.addClass('active');
|
|
|
|
|
|
if (shopNumAll > 0) {
|
|
|
$el.find('.addcart').removeClass('none');
|
|
|
$el.find('.btn_sellout').addClass('none');
|
|
|
} else {
|
|
|
$el.find('.addcart').addClass('none');
|
|
|
$el.find('.btn_sellout').removeClass('none');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$el.on('click', '.cut, .add', function() {
|
|
|
|
|
|
var $this = $(this);
|
|
|
var $pinfo = $this.closest('.product-detail-info');
|
|
|
// var count = $this.hasClass('minus') ? 'decreaseNum' : 'increaseNum';
|
|
|
var promotionId = $pinfo.data('promotionid');
|
|
|
var $num = $el.find('#num');
|
|
|
var shopNum = Number($num.val() || 1);
|
|
|
|
|
|
if (promotionId) {
|
|
|
if ($this.hasClass('cut')) {
|
|
|
new Alert('-_-,已经是最后一件,不能再减了!').show();
|
|
|
} else {
|
|
|
new Alert('最多只能购买一件,您好像购买的太多了!').show();
|
|
|
}
|
|
|
} else {
|
|
|
if ($this.hasClass('add')) {
|
|
|
shopNum++;
|
|
|
} else {
|
|
|
shopNum--;
|
|
|
}
|
|
|
if (shopNum < 1) {
|
|
|
new Alert('-_-,已经是最后一件,不能在减了!').show();
|
|
|
shopNum = 1;
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
$num.val(shopNum);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function renderAndShowGiftWin(plist) {
|
...
|
...
|
|