Showing
7 changed files
with
48 additions
and
29 deletions
@@ -583,8 +583,11 @@ class Helpers | @@ -583,8 +583,11 @@ class Helpers | ||
583 | $oneGoods['isVipPrice'] = $value['sales_price'] !== $value['last_vip_price']; | 583 | $oneGoods['isVipPrice'] = $value['sales_price'] !== $value['last_vip_price']; |
584 | $oneGoods['count'] = $value['buy_number']; | 584 | $oneGoods['count'] = $value['buy_number']; |
585 | 585 | ||
586 | - if ($isValid) { // 库存不足 | 586 | + if ($isValid) { |
587 | + // 库存不足 | ||
587 | $oneGoods['lowStocks'] = ($value['buy_number'] > $value['storage_number']); | 588 | $oneGoods['lowStocks'] = ($value['buy_number'] > $value['storage_number']); |
589 | + } else { // 失效商品 | ||
590 | + $oneGoods['inValid'] = true; | ||
588 | } | 591 | } |
589 | 592 | ||
590 | //gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品; | 593 | //gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品; |
@@ -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 |
@@ -311,7 +311,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -311,7 +311,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
311 | 311 | ||
312 | promotionId, | 312 | promotionId, |
313 | isEdit = 0, | 313 | isEdit = 0, |
314 | - numInCart = $('.num-tag').html() - 0, | ||
315 | num = parseInt($num.val(), 10); | 314 | num = parseInt($num.val(), 10); |
316 | 315 | ||
317 | //颜色尺码没有选择 | 316 | //颜色尺码没有选择 |
@@ -356,9 +355,15 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -356,9 +355,15 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
356 | cartType: queryString.cartType | 355 | cartType: queryString.cartType |
357 | } | 356 | } |
358 | }).done(function(res) { | 357 | }).done(function(res) { |
358 | + var cartNum; | ||
359 | + | ||
359 | loading.hideLoadingMask(); | 360 | loading.hideLoadingMask(); |
360 | if (res.code === 200) { | 361 | if (res.code === 200) { |
361 | - $('.num-tag').html(numInCart + buyNumber).removeClass('hide'); | 362 | + cartNum = res.data.goods_count; |
363 | + if (cartNum > 99) { | ||
364 | + cartNum = '99+'; | ||
365 | + } | ||
366 | + $('.num-tag').html(cartNum).removeClass('hide'); | ||
362 | confirming = false; | 367 | confirming = false; |
363 | 368 | ||
364 | if (cbFn) { | 369 | 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'; |
@@ -119,7 +119,10 @@ | @@ -119,7 +119,10 @@ | ||
119 | } | 119 | } |
120 | 120 | ||
121 | .coupon-use { | 121 | .coupon-use { |
122 | + box-sizing: border-box; | ||
123 | + position: relative; | ||
122 | float: right; | 124 | float: right; |
125 | + padding-right: 30rem / $pxConvertRem; | ||
123 | color: #999; | 126 | color: #999; |
124 | text-align: right; | 127 | text-align: right; |
125 | width: 360rem / $pxConvertRem; | 128 | width: 360rem / $pxConvertRem; |
@@ -128,6 +131,9 @@ | @@ -128,6 +131,9 @@ | ||
128 | overflow: hidden; | 131 | overflow: hidden; |
129 | 132 | ||
130 | .iconfont { | 133 | .iconfont { |
134 | + position: absolute; | ||
135 | + top:0; | ||
136 | + right: 0; | ||
131 | color: #999; | 137 | color: #999; |
132 | } | 138 | } |
133 | } | 139 | } |
@@ -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