|
@@ -16,6 +16,9 @@ var dialog = require('../me/dialog'), |
|
@@ -16,6 +16,9 @@ var dialog = require('../me/dialog'), |
16
|
var $selectAllBtn = $('.balance .checkbox'),
|
16
|
var $selectAllBtn = $('.balance .checkbox'),
|
17
|
requesting = false;
|
17
|
requesting = false;
|
18
|
|
18
|
|
|
|
19
|
+//上次编辑的商品skn
|
|
|
20
|
+var previousEditSkn;
|
|
|
21
|
+
|
19
|
ellipsis.init();
|
22
|
ellipsis.init();
|
20
|
|
23
|
|
21
|
lazyLoad({
|
24
|
lazyLoad({
|
|
@@ -86,11 +89,12 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
|
@@ -86,11 +89,12 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
86
|
*
|
89
|
*
|
87
|
* @param {Bool} isSelected. 所要编辑的商品是否被选中
|
90
|
* @param {Bool} isSelected. 所要编辑的商品是否被选中
|
88
|
*
|
91
|
*
|
89
|
- * @return false;
|
92
|
+ * @param {Bool} isEditNum. 所要编辑的商品是否被选中
|
|
|
93
|
+ *
|
|
|
94
|
+ * @return false or undefined
|
90
|
*
|
95
|
*
|
91
|
*/
|
96
|
*/
|
92
|
-function showEditPannelWithSku(html, id, isSelected) {
|
|
|
93
|
-
|
97
|
+function showEditPannelWithSku(html, id, isSelected, isEditNum) {
|
94
|
if (html.length < 2) {
|
98
|
if (html.length < 2) {
|
95
|
tip.show('出错啦!');
|
99
|
tip.show('出错啦!');
|
96
|
return false;
|
100
|
return false;
|
|
@@ -100,22 +104,48 @@ function showEditPannelWithSku(html, id, isSelected) { |
|
@@ -100,22 +104,48 @@ function showEditPannelWithSku(html, id, isSelected) { |
100
|
chosePanel.remove();
|
104
|
chosePanel.remove();
|
101
|
|
105
|
|
102
|
$(html).appendTo('#mainCart');
|
106
|
$(html).appendTo('#mainCart');
|
|
|
107
|
+
|
|
|
108
|
+
|
103
|
chosePanel.init();
|
109
|
chosePanel.init();
|
104
|
chosePanel.setEditModeWithSknId(id, isSelected);
|
110
|
chosePanel.setEditModeWithSknId(id, isSelected);
|
105
|
- chosePanel.show();
|
|
|
106
|
|
111
|
|
107
|
- return false;
|
112
|
+ if (!isEditNum) {
|
|
|
113
|
+ chosePanel.disableNumEdit();
|
|
|
114
|
+ }
|
|
|
115
|
+
|
|
|
116
|
+ chosePanel.show();
|
108
|
}
|
117
|
}
|
109
|
|
118
|
|
110
|
|
119
|
|
111
|
$('.icon-edit').on('touchstart', function(e) {
|
120
|
$('.icon-edit').on('touchstart', function(e) {
|
112
|
var $this = $(this),
|
121
|
var $this = $(this),
|
|
|
122
|
+ skn = $this.closest('.shopping-cart-good').data('skn');
|
|
|
123
|
+
|
|
|
124
|
+ var $checkBox,
|
|
|
125
|
+ $tag;
|
|
|
126
|
+
|
|
|
127
|
+ var id,
|
|
|
128
|
+ count,
|
|
|
129
|
+ canEditNum;
|
|
|
130
|
+
|
|
|
131
|
+ //如果点击的是上次编辑的商品,直接显示chose-pannel
|
|
|
132
|
+ if (skn === previousEditSkn) {
|
|
|
133
|
+ chosePanel.show();
|
|
|
134
|
+ return;
|
|
|
135
|
+ }
|
|
|
136
|
+
|
|
|
137
|
+ previousEditSkn = skn;
|
|
|
138
|
+
|
|
|
139
|
+
|
113
|
$checkBox = $this.closest('.info').siblings('.checkbox');
|
140
|
$checkBox = $this.closest('.info').siblings('.checkbox');
|
|
|
141
|
+ $tag = $this.closest('.deps').siblings('.few-tag');
|
114
|
|
142
|
|
115
|
- var skn = $this.closest('.shopping-cart-good').data('skn'),
|
|
|
116
|
- id = $this.closest('.shopping-cart-good').data('id'),
|
143
|
+ id = $this.closest('.shopping-cart-good').data('id');
|
117
|
count = $this.data('count');
|
144
|
count = $this.data('count');
|
118
|
|
145
|
|
|
|
146
|
+ //加价购或者赠品不能编辑数量
|
|
|
147
|
+ canEditNum = $tag.hasClass('gift-tag') || $tag.hasClass('plus-tag') ? false : true;
|
|
|
148
|
+
|
119
|
e.stopPropagation();
|
149
|
e.stopPropagation();
|
120
|
|
150
|
|
121
|
loading.showLoadingMask();
|
151
|
loading.showLoadingMask();
|
|
@@ -128,7 +158,7 @@ $('.icon-edit').on('touchstart', function(e) { |
|
@@ -128,7 +158,7 @@ $('.icon-edit').on('touchstart', function(e) { |
128
|
buy_num: count
|
158
|
buy_num: count
|
129
|
},
|
159
|
},
|
130
|
success: function(res) {
|
160
|
success: function(res) {
|
131
|
- showEditPannelWithSku(res, id, $checkBox.hasClass('icon-cb-checked'));
|
161
|
+ showEditPannelWithSku(res, id, $checkBox.hasClass('icon-cb-checked'), canEditNum);
|
132
|
},
|
162
|
},
|
133
|
error: function() {
|
163
|
error: function() {
|
134
|
tip.show('网络异常');
|
164
|
tip.show('网络异常');
|