Showing
1 changed file
with
18 additions
and
13 deletions
@@ -16,14 +16,21 @@ var $cartContent = $('.cart-content'), | @@ -16,14 +16,21 @@ var $cartContent = $('.cart-content'), | ||
16 | cartType = $('#cartType').val(), | 16 | cartType = $('#cartType').val(), |
17 | hasShowCartPresellTip = false; | 17 | hasShowCartPresellTip = false; |
18 | 18 | ||
19 | +var $cartContentShow = $cartContent.not('.hide'); | ||
20 | + | ||
19 | var navHammer, | 21 | var navHammer, |
20 | advanceBuyHammer, | 22 | advanceBuyHammer, |
21 | - freebieHammer; | 23 | + freebieHammer, |
24 | + switchChose = false; | ||
25 | + | ||
26 | +require('../product/recommend-for-you'); | ||
22 | 27 | ||
23 | -var hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; //是否有选中商品 | 28 | +function hasChecked() { |
29 | + return $cartContentShow.find('.icon-cb-checked').length > 0 ? true : false; | ||
30 | +} | ||
24 | 31 | ||
25 | function shouldSelectGift() { | 32 | function shouldSelectGift() { |
26 | - var $freebie = $('.freebie'); | 33 | + var $freebie = $cartContentShow.find('.freebie'); |
27 | 34 | ||
28 | if ($freebie.length <= 0) { | 35 | if ($freebie.length <= 0) { |
29 | return false; | 36 | return false; |
@@ -58,7 +65,7 @@ function showChooseGifDialog() { | @@ -58,7 +65,7 @@ function showChooseGifDialog() { | ||
58 | rightBtnText: '去选择' | 65 | rightBtnText: '去选择' |
59 | } | 66 | } |
60 | }, function() { | 67 | }, function() { |
61 | - window.location.href = $('.freebie').find('a').attr('href'); | 68 | + window.location.href = $cartContentShow.find('.freebie > a').attr('href'); |
62 | }, function() { | 69 | }, function() { |
63 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 70 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
64 | }); | 71 | }); |
@@ -93,9 +100,11 @@ if ($('.cart-nav').length > 0) { | @@ -93,9 +100,11 @@ if ($('.cart-nav').length > 0) { | ||
93 | return; | 100 | return; |
94 | } | 101 | } |
95 | 102 | ||
96 | - $('.shopping-cart-good .name').each(function() { | ||
97 | - this.mlellipsis(2); | ||
98 | - }); | 103 | + if (switchChose === false) { |
104 | + $('.shopping-cart-good .name').each(function() { | ||
105 | + this.mlellipsis(2); | ||
106 | + }); | ||
107 | + } | ||
99 | 108 | ||
100 | if (cartType === 'ordinary') { | 109 | if (cartType === 'ordinary') { |
101 | cartType = 'advance'; | 110 | cartType = 'advance'; |
@@ -111,7 +120,7 @@ if ($('.cart-nav').length > 0) { | @@ -111,7 +120,7 @@ if ($('.cart-nav').length > 0) { | ||
111 | //切换普通商品和预售商品购物车显示 | 120 | //切换普通商品和预售商品购物车显示 |
112 | $cartContent.toggleClass('hide'); | 121 | $cartContent.toggleClass('hide'); |
113 | 122 | ||
114 | - hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; | 123 | + $cartContentShow = $cartContent.not('.hide'); |
115 | 124 | ||
116 | //trigger lazyload | 125 | //trigger lazyload |
117 | $(window).trigger('scroll'); | 126 | $(window).trigger('scroll'); |
@@ -150,7 +159,7 @@ $('.btn-balance').on('touchend', function() { | @@ -150,7 +159,7 @@ $('.btn-balance').on('touchend', function() { | ||
150 | return false; | 159 | return false; |
151 | } | 160 | } |
152 | 161 | ||
153 | - if (hasChecked) { | 162 | + if (hasChecked()) { |
154 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 163 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
155 | } else { | 164 | } else { |
156 | tip.show('请先勾选商品'); | 165 | tip.show('请先勾选商品'); |
@@ -161,10 +170,6 @@ $('.chose').on('touchend', function() { | @@ -161,10 +170,6 @@ $('.chose').on('touchend', function() { | ||
161 | chosePanel.show(); | 170 | chosePanel.show(); |
162 | }); | 171 | }); |
163 | 172 | ||
164 | -if ($('.shopping-cart-good').length <= 0) { | ||
165 | - require('../product/recommend-for-you'); | ||
166 | -} | ||
167 | - | ||
168 | function notAllowScroll() { | 173 | function notAllowScroll() { |
169 | var docH = $(document).height(), | 174 | var docH = $(document).height(), |
170 | winH = $(window).height(); | 175 | winH = $(window).height(); |
-
Please register or login to post a comment