Authored by biao

update for select all feature for cart. code review by LZF

... ... @@ -174,7 +174,9 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
$.ajax({
url: 'select',
type: 'post',
data: {'skuList': JSON.stringify(theGoods)},
data: {
skuList: JSON.stringify(theGoods)
},
success: function(res) {
if (res.code === 200) {
successHandeler();
... ... @@ -230,7 +232,7 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
}
goodInfo.goods_type = type;
goodInfo.selected = isSelected ? 'Y': 'N';
goodInfo.selected = isSelected ? 'Y' : 'N';
$goods.each(function(idx, good) {
$good = $(good);
... ... @@ -245,6 +247,7 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch);
}
//获取当前购物车类型
function getCartType() {
var $navItem = $('.cart-nav ').find('li'),
type = 'ordinary';
... ... @@ -258,6 +261,7 @@ function getCartType() {
return type;
}
//是否要全选
function willBeSelected() {
var isSelected = true;
var $this = $(this);
... ... @@ -271,20 +275,8 @@ function willBeSelected() {
return isSelected;
}
//全选按钮
//全选按钮点击事件
$selectAllBtn.on('touchend', function() {
// var $this = $(this);
// if ($this.hasClass('icon-cb-checked')) {
// $this.removeClass('icon-cb-checked').addClass('icon-checkbox');
// } else {
// $this.removeClass('icon-checkbox').addClass('icon-cb-checked');
// }
bottomCheckBoxHandeler(willBeSelected(), getCartType(), didUpdateAllGoodsCheckStatus);
});
... ...