Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
5 changed files
with
25 additions
and
46 deletions
@@ -23,16 +23,17 @@ class Yohobuy | @@ -23,16 +23,17 @@ class Yohobuy | ||
23 | // const SERVICE_URL = 'http://service.api.yohobuy.com/'; | 23 | // const SERVICE_URL = 'http://service.api.yohobuy.com/'; |
24 | // const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 24 | // const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
25 | 25 | ||
26 | -// const API_URL = 'http://apih5.yoho.cn/'; | 26 | + // const API_URL = 'http://apih5.yoho.cn/'; |
27 | // const API_URL2 = 'http://apih5.yoho.cn/'; | 27 | // const API_URL2 = 'http://apih5.yoho.cn/'; |
28 | // const SERVICE_URL = 'http://serviceh5.yoho.cn/'; | 28 | // const SERVICE_URL = 'http://serviceh5.yoho.cn/'; |
29 | // const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 29 | // const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
30 | 30 | ||
31 | /* 测试环境 */ | 31 | /* 测试环境 */ |
32 | - const API_URL = 'http://testapi.yoho.cn:28078/'; | 32 | + const API_URL = 'http://testapi.yoho.cn:28078/'; |
33 | const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; | 33 | const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; |
34 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 34 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
35 | 35 | ||
36 | + | ||
36 | /** | 37 | /** |
37 | * 私钥列表 | 38 | * 私钥列表 |
38 | * | 39 | * |
@@ -124,6 +124,11 @@ function changeGoodImgWhenClickColor() { | @@ -124,6 +124,11 @@ function changeGoodImgWhenClickColor() { | ||
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | +//function resetHasSelectedNum() { | ||
128 | +// $allChoseItems.find('.num .left-num').html('剩余' + 1 + '件'); | ||
129 | +// $leftNum.val(1); | ||
130 | +//} | ||
131 | + | ||
127 | init(); | 132 | init(); |
128 | 133 | ||
129 | $yohoPage.on('touchstart', '.chose-panel', function(e) { | 134 | $yohoPage.on('touchstart', '.chose-panel', function(e) { |
@@ -212,6 +217,9 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | @@ -212,6 +217,9 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | ||
212 | 217 | ||
213 | // 修改颜色时修改商品图片 | 218 | // 修改颜色时修改商品图片 |
214 | changeGoodImgWhenClickColor(); | 219 | changeGoodImgWhenClickColor(); |
220 | + | ||
221 | + // 颜色切换时, 重置已经选择的商品数量 | ||
222 | + //resetHasSelectedNum(); | ||
215 | }).on('touchstart', '.size-list .block', function() { | 223 | }).on('touchstart', '.size-list .block', function() { |
216 | var $this = $(this), | 224 | var $this = $(this), |
217 | index, | 225 | index, |
@@ -263,6 +271,9 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | @@ -263,6 +271,9 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | ||
263 | 271 | ||
264 | // 重置颜色块的样式 | 272 | // 重置颜色块的样式 |
265 | resetColorZeroStock($siblingBlock); | 273 | resetColorZeroStock($siblingBlock); |
274 | + | ||
275 | + // 颜色尺码时, 重置已经选择的商品数量 | ||
276 | + //resetHasSelectedNum(); | ||
266 | }); | 277 | }); |
267 | 278 | ||
268 | $yohoPage.on('touchstart', '.btn-minus', function() { | 279 | $yohoPage.on('touchstart', '.btn-minus', function() { |
@@ -275,10 +286,11 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -275,10 +286,11 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
275 | } | 286 | } |
276 | 287 | ||
277 | if (num === 1 || 0 === leftNum - 0) { | 288 | if (num === 1 || 0 === leftNum - 0) { |
289 | + tip.show('您选择的数量不能为零~'); | ||
278 | return; | 290 | return; |
279 | } | 291 | } |
280 | - if (num < 1) { | ||
281 | - $num.val(1); | 292 | + if (num < 0) { |
293 | + tip.show('您选择的数量不能为零~'); | ||
282 | return; | 294 | return; |
283 | } | 295 | } |
284 | 296 | ||
@@ -299,7 +311,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -299,7 +311,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
299 | 311 | ||
300 | //TODO:库存数验证 | 312 | //TODO:库存数验证 |
301 | if (num > leftNum - 1) { | 313 | if (num > leftNum - 1) { |
302 | - $num.val(leftNum); | 314 | + tip.show('您选择的数量超过了最大库存量~'); |
303 | return; | 315 | return; |
304 | } | 316 | } |
305 | $num.val(num + 1); | 317 | $num.val(num + 1); |
@@ -316,10 +328,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -316,10 +328,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
316 | if (!checkColorSizeNum()) { | 328 | if (!checkColorSizeNum()) { |
317 | return; | 329 | return; |
318 | } | 330 | } |
319 | - if (isNaN(num)) { | ||
320 | - tip.show('您选择的数量不是一个数字~'); | ||
321 | - return; | ||
322 | - } | ||
323 | 331 | ||
324 | //TODO status change | 332 | //TODO status change |
325 | if ($('#chose-btn-sure').html() === '已售罄') { | 333 | if ($('#chose-btn-sure').html() === '已售罄') { |
@@ -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() { |
@@ -139,7 +139,6 @@ | @@ -139,7 +139,6 @@ | ||
139 | height: 90rem / $pxConvertRem; | 139 | height: 90rem / $pxConvertRem; |
140 | line-height: 90rem / $pxConvertRem; | 140 | line-height: 90rem / $pxConvertRem; |
141 | margin-bottom: 10rem / $pxConvertRem; | 141 | margin-bottom: 10rem / $pxConvertRem; |
142 | - background: #f8f8f8; | ||
143 | padding: 0 20rem / $pxConvertRem; | 142 | padding: 0 20rem / $pxConvertRem; |
144 | 143 | ||
145 | &:last-child { | 144 | &:last-child { |
@@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
52 | <a class="btn btn-minus" href="javascript:void(0);"> | 52 | <a class="btn btn-minus" href="javascript:void(0);"> |
53 | <span class="iconfont {{#if promotionId}}disabled{{/if}}"></span> | 53 | <span class="iconfont {{#if promotionId}}disabled{{/if}}"></span> |
54 | </a> | 54 | </a> |
55 | - <input id="good-num" class="good-num {{#if promotionId}}disabled{{/if}}" type="text" value="1" {{#if promotionId}}disabled="true"{{/if}}> | 55 | + <input id="good-num" class="good-num disabled" type="text" value="1" disabled="true"> |
56 | <a class="btn btn-plus" href="javascript:void(0);"> | 56 | <a class="btn btn-plus" href="javascript:void(0);"> |
57 | <span class="iconfont {{#if promotionId}}disabled{{/if}}"></span> | 57 | <span class="iconfont {{#if promotionId}}disabled{{/if}}"></span> |
58 | </a> | 58 | </a> |
-
Please register or login to post a comment