...
|
...
|
@@ -578,6 +578,8 @@ var Cart = { |
|
|
var $this = $(this);
|
|
|
var index = $this.index('.dt');
|
|
|
var $srows = $this.closest('.goods-info').find('.choose-size .size-row');
|
|
|
var $bigImgs = $this.closest('.goods-choose-box').find('.goods-info-bigImg');
|
|
|
|
|
|
|
|
|
if ($this.hasClass('active')) return;
|
|
|
|
...
|
...
|
@@ -588,6 +590,8 @@ var Cart = { |
|
|
$srows.hide();
|
|
|
$srows.indexOf(index).show();
|
|
|
|
|
|
$bigImgs.hide();
|
|
|
$bigImgs.indexOf(index).show();
|
|
|
},
|
|
|
selectSize: function() {
|
|
|
|
...
|
...
|
@@ -648,102 +652,22 @@ $payWapper.on('click', '.minus, .plus', Cart.modNum); // 修改购物车数量 |
|
|
$cartnewSum.on('click', '.clean-all-disable', Cart.cleanAllDisable);
|
|
|
$('.btn_account').on('click', Cart.submit); // 结算
|
|
|
|
|
|
/** 重新选择商品颜色尺码 **/
|
|
|
$payWapper.on('click', 'li[data-role="pitem"] .pay-pro-detail', Cart.showColorSizePanel);
|
|
|
$payWapper.on('click', 'li[data-role="pitem"] .button-cancel', Cart.hideColorSizePanel);
|
|
|
$payWapper.on('click', 'li[data-role="pitem"] .button-sure', Cart.editColorOrSize);
|
|
|
$payWapper.on('click', 'li[data-role="pitem"] .goods-choose-box .choose-color .dt', Cart.selectColor);
|
|
|
$payWapper.on('click', 'li[data-role="pitem"] .goods-choose-box .choose-size .dt', Cart.selectSize);
|
|
|
|
|
|
|
|
|
// / 绑定颜色尺码弹窗事件 begin
|
|
|
/*
|
|
|
oldProductSku = editTarget.find('.current').attr('data-sku');
|
|
|
|
|
|
// rebind events(Tips依赖接口数据,so 不能delegate)
|
|
|
editTarget.find('#confirm').click(function(e) {
|
|
|
e.preventDefault();
|
|
|
|
|
|
newProductSku = editTarget.find('.current-sizes .active').attr('data-sku');
|
|
|
|
|
|
// 没有重新选择颜色-尺码,则不用重新请求显示
|
|
|
if (!oldProductSku || !newProductSku || newProductSku === oldProductSku) {
|
|
|
editTarget.find('.edit-color-size').remove();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
Util.ajax({
|
|
|
url: '/shopping/cart/updateProduct',
|
|
|
type: 'PUT',
|
|
|
data: {
|
|
|
swapData: JSON.stringify([{
|
|
|
buy_number: '1',
|
|
|
selected: 'Y',
|
|
|
new_product_sku: newProductSku,
|
|
|
old_product_sku: oldProductSku
|
|
|
}])
|
|
|
},
|
|
|
success: function(newCartData) {
|
|
|
editTarget.find('.edit-color-size').remove();
|
|
|
Util.refreshCart(newCartData);
|
|
|
setEditable();
|
|
|
}
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
editTarget.find('#cancel').click(function(e) {
|
|
|
e.preventDefault();
|
|
|
editTarget.find('.edit-color-size').remove();
|
|
|
setEditable();
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
editTarget.find('.edit-color-size').click(function(e) {
|
|
|
e.preventDefault();
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
editTarget.find('.color-item').click(function(e) {
|
|
|
e.preventDefault();
|
|
|
selectColor = $(this);
|
|
|
if (!selectColor.hasClass('current-color')) {
|
|
|
selectColor.addClass('current-color').siblings().removeClass('current-color');
|
|
|
selectColor.parent().siblings('.current-sizes').hide().removeClass('current-sizes');
|
|
|
editTarget.find('#' + selectColor.attr('data-target')).show().addClass('current-sizes')
|
|
|
.end()
|
|
|
.find('.right img').attr({
|
|
|
src: selectColor.attr('data-imageurl'),
|
|
|
title: selectColor.attr('data-title')
|
|
|
})
|
|
|
.end()
|
|
|
.find('.selected-color').text(selectColor.attr('data-title'));
|
|
|
}
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
editTarget.find('.size-item').click(function() {
|
|
|
var $this = $(this);
|
|
|
|
|
|
if ($this.hasClass('active') || $this.hasClass('disabled')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$(this).addClass('active').siblings('.active').removeClass('active');
|
|
|
});
|
|
|
|
|
|
// 初始化size list选中项(其他颜色中第一个尺码)
|
|
|
editTarget.find('.sizes-list.mb10').each(function() {
|
|
|
if ($(this).find('.active').length === 0) {
|
|
|
$(this).find('.size-item:not(.disabled)').first().addClass('active');
|
|
|
}
|
|
|
});*/
|
|
|
|
|
|
// / 绑定颜色尺码弹窗事件 end
|
|
|
|
|
|
/** 赠品加价购弹窗 **/
|
|
|
// 显示赠品
|
|
|
var giftBtn = '[data-role=gift-view-btn],[data-role=gift-resel-btn],[data-role=gift-sel-btn]';
|
|
|
var giftBtn = [ '[data-role=gift-view-btn]',
|
|
|
'[data-role=gift-resel-btn]',
|
|
|
'[data-role=gift-sel-btn]',
|
|
|
'[data-role=pg-sel-btn]',
|
|
|
'[data-role=pg-resel-btn]'];
|
|
|
|
|
|
$('.shop-cart').on('click', giftBtn, function() {
|
|
|
$('.shop-cart').on('click', giftBtn.join(','), function() {
|
|
|
|
|
|
var $this = $(this);
|
|
|
var $win = $this.closest('[data-role=promotion-wrap]').find('[data-role=cart-gift-win]');
|
...
|
...
|
@@ -752,8 +676,6 @@ $('.shop-cart').on('click', giftBtn, function() { |
|
|
$win.show();
|
|
|
});
|
|
|
|
|
|
$('.shop-cart').on('click', '[data-role="cart-gift-win"] .close', function(){
|
|
|
$('.shop-cart').on('click', '[data-role="cart-gift-win"] .close', function() {
|
|
|
$(this).closest('[data-role="cart-gift-win"]').hide();
|
|
|
}); |
|
|
|
|
|
// 显示加价购 |
...
|
...
|
|