Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Showing
5 changed files
with
38 additions
and
29 deletions
@@ -66,7 +66,7 @@ $('.freebie').on('touchend', function() { | @@ -66,7 +66,7 @@ $('.freebie').on('touchend', function() { | ||
66 | 66 | ||
67 | $('.btn-balance').on('touchend', function() { | 67 | $('.btn-balance').on('touchend', function() { |
68 | if ($('.low-stocks').length > 0) { | 68 | if ($('.low-stocks').length > 0) { |
69 | - tip.show('请先删除库存不足商品'); | 69 | + tip.show('库存不足无法结算'); |
70 | return false; | 70 | return false; |
71 | } | 71 | } |
72 | 72 |
@@ -310,7 +310,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -310,7 +310,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
310 | 310 | ||
311 | promotionId, | 311 | promotionId, |
312 | isEdit = 0, | 312 | isEdit = 0, |
313 | - numInCart = $('.num-tag').html() - 0, | ||
314 | num = parseInt($num.val(), 10); | 313 | num = parseInt($num.val(), 10); |
315 | 314 | ||
316 | //颜色尺码没有选择 | 315 | //颜色尺码没有选择 |
@@ -322,7 +321,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -322,7 +321,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
322 | return; | 321 | return; |
323 | } | 322 | } |
324 | 323 | ||
325 | - | ||
326 | //TODO status change | 324 | //TODO status change |
327 | if ($('#chose-btn-sure').html() === '已售罄') { | 325 | if ($('#chose-btn-sure').html() === '已售罄') { |
328 | return; | 326 | return; |
@@ -360,9 +358,15 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -360,9 +358,15 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
360 | cartType: queryString.cartType | 358 | cartType: queryString.cartType |
361 | } | 359 | } |
362 | }).done(function(res) { | 360 | }).done(function(res) { |
361 | + var cartNum; | ||
362 | + | ||
363 | loading.hideLoadingMask(); | 363 | loading.hideLoadingMask(); |
364 | if (res.code === 200) { | 364 | if (res.code === 200) { |
365 | - $('.num-tag').html(numInCart + buyNumber).removeClass('hide'); | 365 | + cartNum = res.data.goods_count; |
366 | + if (cartNum > 99) { | ||
367 | + cartNum = '99+'; | ||
368 | + } | ||
369 | + $('.num-tag').html(cartNum).removeClass('hide'); | ||
366 | confirming = false; | 370 | confirming = false; |
367 | 371 | ||
368 | if (cbFn) { | 372 | if (cbFn) { |
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | 6 | ||
7 | var $ = require('jquery'), | 7 | var $ = require('jquery'), |
8 | lazyLoad = require('yoho.lazyload'), | 8 | lazyLoad = require('yoho.lazyload'), |
9 | + Hammer = require('yoho.hammer'), | ||
9 | tip = require('../plugin/tip'), | 10 | tip = require('../plugin/tip'), |
10 | loading = require('../plugin/loading'), | 11 | loading = require('../plugin/loading'), |
11 | chosePanel = require('./chose-panel'); | 12 | chosePanel = require('./chose-panel'); |
@@ -35,10 +36,22 @@ function getProductInfo(skn, promotionId) { | @@ -35,10 +36,22 @@ function getProductInfo(skn, promotionId) { | ||
35 | }); | 36 | }); |
36 | } | 37 | } |
37 | 38 | ||
38 | -$page.on('touchend', '.chose', function() { | ||
39 | - var $this = $(this), | ||
40 | - id = $this.closest('.gift-advance-good').data('id'), | ||
41 | - promotionId = $this.closest('.advance-block').data('promotion-id'); | 39 | +$page.find('.chose').each(function(i, elem) { |
40 | + var choseHammer = new Hammer(elem); | ||
42 | 41 | ||
43 | - getProductInfo(id, promotionId); | 42 | + choseHammer.on('tap', function(e) { |
43 | + var $this = $(e.target), | ||
44 | + id = $this.closest('.gift-advance-good').data('id'), | ||
45 | + promotionId = $this.closest('.advance-block').data('promotion-id'); | ||
46 | + | ||
47 | + getProductInfo(id, promotionId); | ||
48 | + }); | ||
44 | }); | 49 | }); |
50 | + | ||
51 | +// $page.on('touchend', '.chose', function() { | ||
52 | +// var $this = $(this), | ||
53 | +// id = $this.closest('.gift-advance-good').data('id'), | ||
54 | +// promotionId = $this.closest('.advance-block').data('promotion-id'); | ||
55 | +// | ||
56 | +// getProductInfo(id, promotionId); | ||
57 | +// }); |
@@ -27,6 +27,13 @@ $('.shopping-cart-good .name').each(function() { | @@ -27,6 +27,13 @@ $('.shopping-cart-good .name').each(function() { | ||
27 | this.mlellipsis(2); | 27 | this.mlellipsis(2); |
28 | }); | 28 | }); |
29 | 29 | ||
30 | +function GoodInfo(properties) { | ||
31 | + this.goods_type = properties.goods_type; | ||
32 | + this.buy_number = properties.buy_number; | ||
33 | + this.product_sku = properties.product_sku; | ||
34 | + this.selected = properties.selected; | ||
35 | +} | ||
36 | + | ||
30 | //TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods | 37 | //TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods |
31 | $('.cart-goods').on('touchstart', '.checkbox', function() { | 38 | $('.cart-goods').on('touchstart', '.checkbox', function() { |
32 | var $this = $(this), | 39 | var $this = $(this), |
@@ -43,12 +50,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -43,12 +50,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
43 | isSelected = false; | 50 | isSelected = false; |
44 | } | 51 | } |
45 | 52 | ||
46 | - function GoodInfo(properties) { | ||
47 | - this.goods_type = properties.goods_type; | ||
48 | - this.buy_number = properties.buy_number; | ||
49 | - this.product_sku = properties.product_sku; | ||
50 | - this.selected = properties.selected; | ||
51 | - } | 53 | + |
52 | 54 | ||
53 | goodInfo.goods_type = cartType; | 55 | goodInfo.goods_type = cartType; |
54 | goodInfo.selected = isSelected ? 'N' : 'Y'; | 56 | goodInfo.selected = isSelected ? 'N' : 'Y'; |
@@ -174,17 +176,10 @@ function didUpdateAllGoodsCheckStatus() { | @@ -174,17 +176,10 @@ function didUpdateAllGoodsCheckStatus() { | ||
174 | } | 176 | } |
175 | 177 | ||
176 | function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { | 178 | function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { |
177 | - var goodInfo = {}; | ||
178 | - var $goods = $('.cart-content:not(.hide) .shopping-cart-good'); | ||
179 | - var $good = null; | ||
180 | - var goodsList = []; | ||
181 | - | ||
182 | - function GoodInfo(properties) { | ||
183 | - this.goods_type = properties.goods_type; | ||
184 | - this.buy_number = properties.buy_number; | ||
185 | - this.product_sku = properties.product_sku; | ||
186 | - this.selected = properties.selected; | ||
187 | - } | 179 | + var goodInfo = {}, |
180 | + $goods = $('.cart-content:not(.hide) .shopping-cart-good'), | ||
181 | + $good = null, | ||
182 | + goodsList = []; | ||
188 | 183 | ||
189 | goodInfo.goods_type = type; | 184 | goodInfo.goods_type = type; |
190 | goodInfo.selected = isSelected ? 'N' : 'Y'; | 185 | goodInfo.selected = isSelected ? 'N' : 'Y'; |
@@ -10,9 +10,6 @@ | @@ -10,9 +10,6 @@ | ||
10 | {{#if price}} | 10 | {{#if price}} |
11 | <span class="price market-price">¥{{marketPrice}}</span> | 11 | <span class="price market-price">¥{{marketPrice}}</span> |
12 | {{/if}} | 12 | {{/if}} |
13 | - <span class="count"> | ||
14 | - ×{{count}} | ||
15 | - </span> | ||
16 | </p> | 13 | </p> |
17 | <button class="chose">选择</button> | 14 | <button class="chose">选择</button> |
18 | </div> | 15 | </div> |
-
Please register or login to post a comment