...
|
...
|
@@ -12,8 +12,7 @@ var $ = require('jquery'), |
|
|
var dialog = require('../me/dialog'),
|
|
|
tip = require('../plugin/tip');
|
|
|
|
|
|
var $names,
|
|
|
$selectAllBtn = $('.balance .iconfont'),
|
|
|
var $selectAllBtn = $('.balance .checkbox'),
|
|
|
cartType = $('#cartType').val(),
|
|
|
requesting = false;
|
|
|
|
...
|
...
|
@@ -23,11 +22,9 @@ lazyLoad({ |
|
|
try_again_css: 'good-failure'
|
|
|
});
|
|
|
|
|
|
|
|
|
$names = $('.name');
|
|
|
if ($names.length > 0) {
|
|
|
$names[0].mlellipsis(2);
|
|
|
}
|
|
|
$('.shopping-cart-good .name').each(function() {
|
|
|
this.mlellipsis(2);
|
|
|
});
|
|
|
|
|
|
//TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods
|
|
|
$('.cart-goods').on('touchstart', '.checkbox', function() {
|
...
|
...
|
@@ -73,44 +70,12 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
|
|
} else {
|
|
|
$this.removeClass('icon-checkbox').addClass('icon-cb-checked');
|
|
|
}
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: 'getCartData',
|
|
|
data: {
|
|
|
id: id
|
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data) {
|
|
|
if (cartType === 'ordinary') {
|
|
|
$('#good-totalprice').html('¥' + data.commonCart.price);
|
|
|
$('#good-activityPrice').html('¥' + data.commonCart.activityPrice);
|
|
|
$('#good-total').html('总计:¥' + data.commonCart.sumPrice + ' (' + data.commonCart.count + '件)');
|
|
|
if (data.commonCart.isAllSelected) {
|
|
|
$('.balance span').removeClass('icon-checkbox').addClass('icon-cb-checked');
|
|
|
} else {
|
|
|
$('.balance span').removeClass('icon-cb-checked').addClass('icon-checkbox');
|
|
|
}
|
|
|
} else {
|
|
|
$('#good-totalprice').html('¥' + data.preSellCart.price);
|
|
|
$('#good-activityPrice').html('¥' + data.preSellCart.activityPrice);
|
|
|
$('#good-total').html('总计:¥' + data.preSellCart.sumPrice + ' (' + data.preSellCart.count + '件)');
|
|
|
if (data.preSellCart.isAllSelected) {
|
|
|
$('.balance span').removeClass('icon-checkbox').addClass('icon-cb-checked');
|
|
|
} else {
|
|
|
$('.balance span').removeClass('icon-cb-checked').addClass('icon-checkbox');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络错误');
|
|
|
}
|
|
|
});
|
|
|
window.history.go(0);
|
|
|
} else if (data.code === 400) {
|
|
|
tip.show('网络错误');
|
|
|
tip.show('网络异常');
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
tip.show('网络错误');
|
|
|
}, function() {
|
|
|
tip.show('网络异常');
|
|
|
});
|
|
|
}).on('touchstart', '.icon-del', function(e) {
|
|
|
var $this = $(this);
|
...
|
...
|
@@ -143,10 +108,10 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
|
|
});
|
|
|
history.go(0);
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
}, function() {
|
|
|
dialog.showDialog({
|
|
|
autoHide: true,
|
|
|
dialogText: '网络错误~'
|
|
|
dialogText: '网络异常'
|
|
|
});
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -203,6 +168,7 @@ function didUpdateAllGoodsCheckStatus() { |
|
|
$(checkedBox).removeClass('icon-cb-checked').addClass('icon-checkbox');
|
|
|
});
|
|
|
}
|
|
|
window.history.go(0);
|
|
|
}
|
|
|
|
|
|
function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
|
...
|
...
|
@@ -251,6 +217,7 @@ function willBeSelected($this) { |
|
|
//全选按钮点击事件
|
|
|
$selectAllBtn.on('touchend', function() {
|
|
|
var $this = $(this);
|
|
|
|
|
|
bottomCheckBoxHandeler(willBeSelected($this), cartType, didUpdateAllGoodsCheckStatus);
|
|
|
});
|
|
|
|
...
|
...
|
|