|
@@ -41,25 +41,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
|
@@ -41,25 +41,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
41
|
id = $good.data('id');
|
41
|
id = $good.data('id');
|
42
|
|
42
|
|
43
|
var goodsList = [],
|
43
|
var goodsList = [],
|
44
|
- goodInfo = {},
|
|
|
45
|
- isSelected = true;
|
|
|
46
|
-
|
|
|
47
|
- if ($this.hasClass('icon-cb-checked')) {
|
|
|
48
|
- isSelected = true;
|
|
|
49
|
- } else {
|
|
|
50
|
- isSelected = false;
|
|
|
51
|
- }
|
|
|
52
|
-
|
|
|
53
|
-
|
44
|
+ goodInfo = {};
|
54
|
|
45
|
|
55
|
goodInfo.goods_type = cartType;
|
46
|
goodInfo.goods_type = cartType;
|
56
|
- goodInfo.selected = isSelected ? 'N' : 'Y';
|
47
|
+ goodInfo.selected = $this.hasClass('icon-cb-checked') ? 'N' : 'Y';
|
57
|
goodInfo.product_sku = id;
|
48
|
goodInfo.product_sku = id;
|
58
|
goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', '');
|
49
|
goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', '');
|
59
|
-
|
|
|
60
|
goodsList.push(new GoodInfo(goodInfo));
|
50
|
goodsList.push(new GoodInfo(goodInfo));
|
61
|
|
51
|
|
62
|
-
|
|
|
63
|
$.ajax({
|
52
|
$.ajax({
|
64
|
type: 'post',
|
53
|
type: 'post',
|
65
|
url: 'select',
|
54
|
url: 'select',
|
|
@@ -92,8 +81,8 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
|
@@ -92,8 +81,8 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
92
|
rightBtnText: '确定'
|
81
|
rightBtnText: '确定'
|
93
|
}
|
82
|
}
|
94
|
}, function() {
|
83
|
}, function() {
|
95
|
- var id = $this.closest('.shopping-cart-good').data('id');
|
|
|
96
|
- var count = $this.data('count');
|
84
|
+ var id = $this.closest('.shopping-cart-good').data('id'),
|
|
|
85
|
+ count = $this.data('count');
|
97
|
|
86
|
|
98
|
$.ajax({
|
87
|
$.ajax({
|
99
|
method: 'post',
|
88
|
method: 'post',
|
|
@@ -119,7 +108,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
|
@@ -119,7 +108,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
119
|
tip.show('网络异常');
|
108
|
tip.show('网络异常');
|
120
|
});
|
109
|
});
|
121
|
});
|
110
|
});
|
122
|
-
|
|
|
123
|
});
|
111
|
});
|
124
|
|
112
|
|
125
|
function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
|
113
|
function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
|
|
@@ -140,7 +128,7 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) { |
|
@@ -140,7 +128,7 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) { |
140
|
tip.show(res.message);
|
128
|
tip.show(res.message);
|
141
|
}
|
129
|
}
|
142
|
},
|
130
|
},
|
143
|
- error: function(err) {
|
131
|
+ error: function() {
|
144
|
tip.show('网络异常');
|
132
|
tip.show('网络异常');
|
145
|
},
|
133
|
},
|
146
|
complete: function() {
|
134
|
complete: function() {
|
|
@@ -196,26 +184,9 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { |
|
@@ -196,26 +184,9 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { |
196
|
requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch);
|
184
|
requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch);
|
197
|
}
|
185
|
}
|
198
|
|
186
|
|
199
|
-
|
|
|
200
|
-
|
|
|
201
|
-//是否要全选
|
|
|
202
|
-function willBeSelected($this) {
|
|
|
203
|
- var isSelected = true;
|
|
|
204
|
-
|
|
|
205
|
- if ($this.hasClass('icon-cb-checked')) {
|
|
|
206
|
- isSelected = true;
|
|
|
207
|
- } else {
|
|
|
208
|
- isSelected = false;
|
|
|
209
|
- }
|
|
|
210
|
-
|
|
|
211
|
- return isSelected;
|
|
|
212
|
-}
|
|
|
213
|
-
|
|
|
214
|
//全选按钮点击事件
|
187
|
//全选按钮点击事件
|
215
|
$selectAllBtn.on('touchend', function() {
|
188
|
$selectAllBtn.on('touchend', function() {
|
216
|
- var $this = $(this);
|
|
|
217
|
-
|
|
|
218
|
- bottomCheckBoxHandeler(willBeSelected($this), cartType, didUpdateAllGoodsCheckStatus);
|
189
|
+ bottomCheckBoxHandeler($(this).hasClass('icon-cb-checked'), cartType, didUpdateAllGoodsCheckStatus);
|
219
|
});
|
190
|
});
|
220
|
|
191
|
|
221
|
$('.down').on('touchend', function() {
|
192
|
$('.down').on('touchend', function() {
|