|
@@ -13,9 +13,9 @@ var dialog = require('../me/dialog'), |
|
@@ -13,9 +13,9 @@ var dialog = require('../me/dialog'), |
13
|
tip = require('../plugin/tip');
|
13
|
tip = require('../plugin/tip');
|
14
|
|
14
|
|
15
|
var $names,
|
15
|
var $names,
|
16
|
- $selectAllBtn = $('.balance .iconfont');
|
|
|
17
|
-
|
|
|
18
|
-var requesting = false;
|
16
|
+ $selectAllBtn = $('.balance .iconfont'),
|
|
|
17
|
+ cartType = $('#cartType').val(),
|
|
|
18
|
+ requesting = false;
|
19
|
|
19
|
|
20
|
ellipsis.init();
|
20
|
ellipsis.init();
|
21
|
|
21
|
|
|
@@ -29,20 +29,6 @@ if ($names.length > 0) { |
|
@@ -29,20 +29,6 @@ if ($names.length > 0) { |
29
|
$names[0].mlellipsis(2);
|
29
|
$names[0].mlellipsis(2);
|
30
|
}
|
30
|
}
|
31
|
|
31
|
|
32
|
-//获取当前购物车类型
|
|
|
33
|
-function getCartType() {
|
|
|
34
|
- var $navItem = $('.cart-nav ').find('li'),
|
|
|
35
|
- type = 'ordinary';
|
|
|
36
|
-
|
|
|
37
|
- if ($navItem.eq(0).hasClass('active')) {
|
|
|
38
|
- type = 'ordinary';
|
|
|
39
|
- } else {
|
|
|
40
|
- type = 'advance';
|
|
|
41
|
- }
|
|
|
42
|
-
|
|
|
43
|
- return type;
|
|
|
44
|
-}
|
|
|
45
|
-
|
|
|
46
|
//TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods
|
32
|
//TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods
|
47
|
$('.cart-goods').on('touchstart', '.checkbox', function() {
|
33
|
$('.cart-goods').on('touchstart', '.checkbox', function() {
|
48
|
var $this = $(this),
|
34
|
var $this = $(this),
|
|
@@ -95,13 +81,24 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
|
@@ -95,13 +81,24 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
95
|
},
|
81
|
},
|
96
|
success: function(data) {
|
82
|
success: function(data) {
|
97
|
if (data) {
|
83
|
if (data) {
|
98
|
- $('#good-totalprice').html('¥' + data.commonCart.price);
|
|
|
99
|
- $('#good-activityPrice').html('¥' + data.commonCart.activityPrice);
|
|
|
100
|
- $('#good-total').html('总计:¥' + data.commonCart.sumPrice + ' (' + data.commonCart.count + '件)');
|
|
|
101
|
- if (data.commonCart.isAllSelected) {
|
|
|
102
|
- $('.balance span').removeClass('icon-checkbox').addClass('icon-cb-checked');
|
84
|
+ if (cartType === 'ordinary') {
|
|
|
85
|
+ $('#good-totalprice').html('¥' + data.commonCart.price);
|
|
|
86
|
+ $('#good-activityPrice').html('¥' + data.commonCart.activityPrice);
|
|
|
87
|
+ $('#good-total').html('总计:¥' + data.commonCart.sumPrice + ' (' + data.commonCart.count + '件)');
|
|
|
88
|
+ if (data.commonCart.isAllSelected) {
|
|
|
89
|
+ $('.balance span').removeClass('icon-checkbox').addClass('icon-cb-checked');
|
|
|
90
|
+ } else {
|
|
|
91
|
+ $('.balance span').removeClass('icon-cb-checked').addClass('icon-checkbox');
|
|
|
92
|
+ }
|
103
|
} else {
|
93
|
} else {
|
104
|
- $('.balance span').removeClass('icon-cb-checked').addClass('icon-checkbox');
|
94
|
+ $('#good-totalprice').html('¥' + data.preSellCart.price);
|
|
|
95
|
+ $('#good-activityPrice').html('¥' + data.preSellCart.activityPrice);
|
|
|
96
|
+ $('#good-total').html('总计:¥' + data.preSellCart.sumPrice + ' (' + data.preSellCart.count + '件)');
|
|
|
97
|
+ if (data.preSellCart.isAllSelected) {
|
|
|
98
|
+ $('.balance span').removeClass('icon-checkbox').addClass('icon-cb-checked');
|
|
|
99
|
+ } else {
|
|
|
100
|
+ $('.balance span').removeClass('icon-cb-checked').addClass('icon-checkbox');
|
|
|
101
|
+ }
|
105
|
}
|
102
|
}
|
106
|
}
|
103
|
}
|
107
|
},
|
104
|
},
|
|
@@ -115,26 +112,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
|
@@ -115,26 +112,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
115
|
}).fail(function() {
|
112
|
}).fail(function() {
|
116
|
tip.show('网络错误');
|
113
|
tip.show('网络错误');
|
117
|
});
|
114
|
});
|
118
|
-}).on('touchstart', '.icon-edit', function() {
|
|
|
119
|
-
|
|
|
120
|
- //var $this = $(this);
|
|
|
121
|
- //
|
|
|
122
|
- //var $cartgood = $this.closest('.shopping-cart-good');
|
|
|
123
|
- //
|
|
|
124
|
- ////var id = $this.closest('.shopping-cart-good').data('id');
|
|
|
125
|
- //
|
|
|
126
|
- //var $viewGood = $cartgood.find('.deps');
|
|
|
127
|
- // $editGoot = $cartgood.find('.calculate-num');
|
|
|
128
|
- //
|
|
|
129
|
- //if ($viewGood.hasClass('show')) {
|
|
|
130
|
- // $viewGood.removeClass('show').addClass('hide');
|
|
|
131
|
- // $editGoot.removeClass('hide').addClass('show');
|
|
|
132
|
- //} else {
|
|
|
133
|
- // $viewGood.removeClass('hide').addClass('show');
|
|
|
134
|
- // $editGoot.removeClass('show').addClass('hide');
|
|
|
135
|
- //}
|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
}).on('touchstart', '.icon-del', function(e) {
|
115
|
}).on('touchstart', '.icon-del', function(e) {
|
139
|
var $this = $(this);
|
116
|
var $this = $(this);
|
140
|
|
117
|
|
|
@@ -274,7 +251,7 @@ function willBeSelected($this) { |
|
@@ -274,7 +251,7 @@ function willBeSelected($this) { |
274
|
//全选按钮点击事件
|
251
|
//全选按钮点击事件
|
275
|
$selectAllBtn.on('touchend', function() {
|
252
|
$selectAllBtn.on('touchend', function() {
|
276
|
var $this = $(this);
|
253
|
var $this = $(this);
|
277
|
- bottomCheckBoxHandeler(willBeSelected($this), getCartType(), didUpdateAllGoodsCheckStatus);
|
254
|
+ bottomCheckBoxHandeler(willBeSelected($this), cartType, didUpdateAllGoodsCheckStatus);
|
278
|
});
|
255
|
});
|
279
|
|
256
|
|
280
|
$('.down').on('touchend', function() {
|
257
|
$('.down').on('touchend', function() {
|