Authored by biao

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

@@ -174,7 +174,9 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) { @@ -174,7 +174,9 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
174 $.ajax({ 174 $.ajax({
175 url: 'select', 175 url: 'select',
176 type: 'post', 176 type: 'post',
177 - data: {'skuList': JSON.stringify(theGoods)}, 177 + data: {
  178 + skuList: JSON.stringify(theGoods)
  179 + },
178 success: function(res) { 180 success: function(res) {
179 if (res.code === 200) { 181 if (res.code === 200) {
180 successHandeler(); 182 successHandeler();
@@ -230,7 +232,7 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { @@ -230,7 +232,7 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
230 } 232 }
231 233
232 goodInfo.goods_type = type; 234 goodInfo.goods_type = type;
233 - goodInfo.selected = isSelected ? 'Y': 'N'; 235 + goodInfo.selected = isSelected ? 'Y' : 'N';
234 236
235 $goods.each(function(idx, good) { 237 $goods.each(function(idx, good) {
236 $good = $(good); 238 $good = $(good);
@@ -245,6 +247,7 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { @@ -245,6 +247,7 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
245 requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch); 247 requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch);
246 } 248 }
247 249
  250 +//获取当前购物车类型
248 function getCartType() { 251 function getCartType() {
249 var $navItem = $('.cart-nav ').find('li'), 252 var $navItem = $('.cart-nav ').find('li'),
250 type = 'ordinary'; 253 type = 'ordinary';
@@ -258,6 +261,7 @@ function getCartType() { @@ -258,6 +261,7 @@ function getCartType() {
258 return type; 261 return type;
259 } 262 }
260 263
  264 +//是否要全选
261 function willBeSelected() { 265 function willBeSelected() {
262 var isSelected = true; 266 var isSelected = true;
263 var $this = $(this); 267 var $this = $(this);
@@ -271,20 +275,8 @@ function willBeSelected() { @@ -271,20 +275,8 @@ function willBeSelected() {
271 return isSelected; 275 return isSelected;
272 } 276 }
273 277
274 -  
275 -  
276 -  
277 -//全选按钮 278 +//全选按钮点击事件
278 $selectAllBtn.on('touchend', function() { 279 $selectAllBtn.on('touchend', function() {
279 - // var $this = $(this);  
280 -  
281 -  
282 - // if ($this.hasClass('icon-cb-checked')) {  
283 - // $this.removeClass('icon-cb-checked').addClass('icon-checkbox');  
284 - // } else {  
285 - // $this.removeClass('icon-checkbox').addClass('icon-cb-checked');  
286 - // }  
287 -  
288 bottomCheckBoxHandeler(willBeSelected(), getCartType(), didUpdateAllGoodsCheckStatus); 280 bottomCheckBoxHandeler(willBeSelected(), getCartType(), didUpdateAllGoodsCheckStatus);
289 }); 281 });
290 282