Authored by 梁志锋

购物车修改

... ... @@ -124,6 +124,11 @@ function changeGoodImgWhenClickColor() {
}
}
function resetHasSelectedNum() {
$allChoseItems.find('.num .left-num').html('剩余' + 1 + '件');
$leftNum.val(1);
}
init();
$yohoPage.on('touchstart', '.chose-panel', function(e) {
... ... @@ -212,6 +217,9 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
// 修改颜色时修改商品图片
changeGoodImgWhenClickColor();
// 颜色切换时, 重置已经选择的商品数量
//resetHasSelectedNum();
}).on('touchstart', '.size-list .block', function() {
var $this = $(this),
index,
... ... @@ -263,6 +271,9 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
// 重置颜色块的样式
resetColorZeroStock($siblingBlock);
// 颜色尺码时, 重置已经选择的商品数量
//resetHasSelectedNum();
});
$yohoPage.on('touchstart', '.btn-minus', function() {
... ...
... ... @@ -41,25 +41,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
id = $good.data('id');
var goodsList = [],
goodInfo = {},
isSelected = true;
if ($this.hasClass('icon-cb-checked')) {
isSelected = true;
} else {
isSelected = false;
}
goodInfo = {};
goodInfo.goods_type = cartType;
goodInfo.selected = isSelected ? 'N' : 'Y';
goodInfo.selected = $this.hasClass('icon-cb-checked') ? 'N' : 'Y';
goodInfo.product_sku = id;
goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', '');
goodsList.push(new GoodInfo(goodInfo));
$.ajax({
type: 'post',
url: 'select',
... ... @@ -92,8 +81,8 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
rightBtnText: '确定'
}
}, function() {
var id = $this.closest('.shopping-cart-good').data('id');
var count = $this.data('count');
var id = $this.closest('.shopping-cart-good').data('id'),
count = $this.data('count');
$.ajax({
method: 'post',
... ... @@ -119,7 +108,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
tip.show('网络异常');
});
});
});
function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
... ... @@ -140,7 +128,7 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
tip.show(res.message);
}
},
error: function(err) {
error: function() {
tip.show('网络异常');
},
complete: function() {
... ... @@ -196,26 +184,9 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch);
}
//是否要全选
function willBeSelected($this) {
var isSelected = true;
if ($this.hasClass('icon-cb-checked')) {
isSelected = true;
} else {
isSelected = false;
}
return isSelected;
}
//全选按钮点击事件
$selectAllBtn.on('touchend', function() {
var $this = $(this);
bottomCheckBoxHandeler(willBeSelected($this), cartType, didUpdateAllGoodsCheckStatus);
bottomCheckBoxHandeler($(this).hasClass('icon-cb-checked'), cartType, didUpdateAllGoodsCheckStatus);
});
$('.down').on('touchend', function() {
... ...