|
@@ -133,10 +133,22 @@ function displayGoodNum(curGoodNum) { |
|
@@ -133,10 +133,22 @@ function displayGoodNum(curGoodNum) { |
133
|
}
|
133
|
}
|
134
|
|
134
|
|
135
|
//老的选中尺码去掉勾选,新的选中尺码加上勾选
|
135
|
//老的选中尺码去掉勾选,新的选中尺码加上勾选
|
136
|
-function changeSizeChosed(oldSizeIndex) {
|
136
|
+function changeSizeChosed(newSizeIndex) {
|
|
|
137
|
+ var sizes,
|
|
|
138
|
+ queryString,
|
|
|
139
|
+ i;
|
|
|
140
|
+
|
137
|
if (curColorIndex && $curSizeBlock && $curSizeBlock.length > 0) {
|
141
|
if (curColorIndex && $curSizeBlock && $curSizeBlock.length > 0) {
|
138
|
$curSizeBlock.removeClass('chosed');
|
142
|
$curSizeBlock.removeClass('chosed');
|
139
|
- $curSizeBlock = $($sizeRowList.eq(oldSizeIndex).children().get(curColorIndex - 1));
|
143
|
+ sizes = $sizeRowList.eq(newSizeIndex).children();
|
|
|
144
|
+ for (i = 0; i < sizes.length; i++) {
|
|
|
145
|
+ if ($(sizes[i]).data('name') === $curSizeBlock.data('name')) {
|
|
|
146
|
+ $curSizeBlock = $(sizes[i]);
|
|
|
147
|
+ queryString = '#' + $curSizeBlock.data('name');
|
|
|
148
|
+ curColorIndex = $(queryString).data('index');
|
|
|
149
|
+ }
|
|
|
150
|
+ }
|
|
|
151
|
+
|
140
|
$curSizeBlock.addClass('chosed');
|
152
|
$curSizeBlock.addClass('chosed');
|
141
|
return $curSizeBlock.data('num');
|
153
|
return $curSizeBlock.data('num');
|
142
|
}
|
154
|
}
|
|
@@ -144,10 +156,10 @@ function changeSizeChosed(oldSizeIndex) { |
|
@@ -144,10 +156,10 @@ function changeSizeChosed(oldSizeIndex) { |
144
|
}
|
156
|
}
|
145
|
|
157
|
|
146
|
//老的选中颜色去掉勾选,新的选中颜色加上勾选
|
158
|
//老的选中颜色去掉勾选,新的选中颜色加上勾选
|
147
|
-function changeColorChosed(oldColorIndex) {
|
159
|
+function changeColorChosed(newColorIndex) {
|
148
|
if (curSizeIndex && $curColorBlock && $curColorBlock.length > 0) {
|
160
|
if (curSizeIndex && $curColorBlock && $curColorBlock.length > 0) {
|
149
|
$curColorBlock.removeClass('chosed');
|
161
|
$curColorBlock.removeClass('chosed');
|
150
|
- $curColorBlock = $($colorRowList.eq(oldColorIndex).children().get(curSizeIndex - 1));
|
162
|
+ $curColorBlock = $($colorRowList.eq(newColorIndex).children().get(curSizeIndex - 1));
|
151
|
$curColorBlock.addClass('chosed');
|
163
|
$curColorBlock.addClass('chosed');
|
152
|
return $curColorBlock.data('num');
|
164
|
return $curColorBlock.data('num');
|
153
|
}
|
165
|
}
|
|
@@ -195,15 +207,15 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
|
@@ -195,15 +207,15 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
195
|
} else {
|
207
|
} else {
|
196
|
hasChooseColor = true;
|
208
|
hasChooseColor = true;
|
197
|
|
209
|
|
|
|
210
|
+ // 尺码行当前行隐藏
|
|
|
211
|
+ $sizeRowList.eq(curSizeIndex).addClass('hide');
|
|
|
212
|
+
|
198
|
//老的选中尺码去掉勾选,新的选中尺码加上勾选
|
213
|
//老的选中尺码去掉勾选,新的选中尺码加上勾选
|
199
|
curGoodNum = changeSizeChosed(index + 1);
|
214
|
curGoodNum = changeSizeChosed(index + 1);
|
200
|
|
215
|
|
201
|
// 显示剩余数量
|
216
|
// 显示剩余数量
|
202
|
displayGoodNum(curGoodNum);
|
217
|
displayGoodNum(curGoodNum);
|
203
|
|
218
|
|
204
|
- // 尺码行当前行隐藏
|
|
|
205
|
- $sizeRowList.eq(curSizeIndex).addClass('hide');
|
|
|
206
|
-
|
|
|
207
|
//尺码对应行显示
|
219
|
//尺码对应行显示
|
208
|
$sizeRowList.eq(index + 1).removeClass('hide');
|
220
|
$sizeRowList.eq(index + 1).removeClass('hide');
|
209
|
|
221
|
|
|
@@ -223,7 +235,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
|
@@ -223,7 +235,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
223
|
updateConformButtonClassAndText();
|
235
|
updateConformButtonClassAndText();
|
224
|
}).on('touchstart', '.size-list .block', function() {
|
236
|
}).on('touchstart', '.size-list .block', function() {
|
225
|
var $this = $(this),
|
237
|
var $this = $(this),
|
226
|
- index = $this.index(),
|
238
|
+ index,
|
227
|
curGoodNum;
|
239
|
curGoodNum;
|
228
|
|
240
|
|
229
|
// 当前尺码已经是选中状态,再点击时
|
241
|
// 当前尺码已经是选中状态,再点击时
|
|
@@ -235,10 +247,10 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
|
@@ -235,10 +247,10 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
235
|
hasChooseSize = false;
|
247
|
hasChooseSize = false;
|
236
|
|
248
|
|
237
|
//当前颜色行隐藏
|
249
|
//当前颜色行隐藏
|
238
|
- $colorRowList.eq(curColorIndex).removeClass('show').addClass('hide');
|
250
|
+ $colorRowList.eq(curColorIndex).addClass('hide');
|
239
|
|
251
|
|
240
|
//目标颜色行显示
|
252
|
//目标颜色行显示
|
241
|
- $colorRowList.eq(0).removeClass('hide').addClass('show');
|
253
|
+ $colorRowList.eq(0).removeClass('hide');
|
242
|
|
254
|
|
243
|
curColorIndex = 0;
|
255
|
curColorIndex = 0;
|
244
|
|
256
|
|
|
@@ -249,17 +261,19 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
|
@@ -249,17 +261,19 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
249
|
} else {
|
261
|
} else {
|
250
|
hasChooseSize = true;
|
262
|
hasChooseSize = true;
|
251
|
|
263
|
|
|
|
264
|
+ index = $('#' + $this.data('name')).data('index') - 1;
|
|
|
265
|
+
|
|
|
266
|
+ // 颜色当前行隐藏
|
|
|
267
|
+ $colorRowList.eq(curColorIndex).addClass('hide');
|
|
|
268
|
+
|
252
|
//老的选中颜色去掉勾选,新的选中颜色加上勾选
|
269
|
//老的选中颜色去掉勾选,新的选中颜色加上勾选
|
253
|
curGoodNum = changeColorChosed(index + 1);
|
270
|
curGoodNum = changeColorChosed(index + 1);
|
254
|
|
271
|
|
255
|
// 显示剩余数量
|
272
|
// 显示剩余数量
|
256
|
displayGoodNum(curGoodNum);
|
273
|
displayGoodNum(curGoodNum);
|
257
|
|
274
|
|
258
|
- // 颜色当前行隐藏
|
|
|
259
|
- $colorRowList.eq(curColorIndex).removeClass('show').addClass('hide');
|
|
|
260
|
-
|
|
|
261
|
//颜色对应行显示
|
275
|
//颜色对应行显示
|
262
|
- $colorRowList.eq(index + 1).removeClass('hide').addClass('show');
|
276
|
+ $colorRowList.eq(index + 1).removeClass('hide');
|
263
|
|
277
|
|
264
|
curColorIndex = index + 1;
|
278
|
curColorIndex = index + 1;
|
265
|
$curSizeBlock = $this;
|
279
|
$curSizeBlock = $this;
|