优化删除购物车商品后页面颜色。 code review by LZF
Showing
2 changed files
with
15 additions
and
1 deletions
@@ -10,11 +10,13 @@ var $ = require('jquery'), | @@ -10,11 +10,13 @@ var $ = require('jquery'), | ||
10 | 10 | ||
11 | var chosePanel = require('./chose-panel'), | 11 | var chosePanel = require('./chose-panel'), |
12 | dialog = require('../me/dialog'), | 12 | dialog = require('../me/dialog'), |
13 | + loading = require('../plugin/loading'), | ||
13 | tip = require('../plugin/tip'); | 14 | tip = require('../plugin/tip'); |
14 | 15 | ||
15 | var $cartContent = $('.cart-content'), | 16 | var $cartContent = $('.cart-content'), |
16 | cartType = $('#cartType').val(), | 17 | cartType = $('#cartType').val(), |
17 | $cartNav = $('.cart-nav'), | 18 | $cartNav = $('.cart-nav'), |
19 | + $cartPage = $('.shopping-cart-page'), | ||
18 | hasShowCartPresellTip = false; | 20 | hasShowCartPresellTip = false; |
19 | 21 | ||
20 | var navHammer, | 22 | var navHammer, |
@@ -22,19 +24,30 @@ var navHammer, | @@ -22,19 +24,30 @@ var navHammer, | ||
22 | freebieHammer, | 24 | freebieHammer, |
23 | switchChose = false; | 25 | switchChose = false; |
24 | 26 | ||
27 | +var isRefreshByDelete = window.cookie('_yoho-cart-refreshByDelete') === 'true' ? true : false; | ||
28 | + | ||
29 | + | ||
30 | +loading.showLoadingMask(); | ||
25 | 31 | ||
26 | function needLoadRecommandForYou() { | 32 | function needLoadRecommandForYou() { |
27 | return window.isCookiesEnabled() ? | 33 | return window.isCookiesEnabled() ? |
28 | - $('.cart-goods').length <= 0 && window.cookie('_yoho-cart-refreshByDelete') !== 'true' : | 34 | + $('.cart-goods').length <= 0 && !isRefreshByDelete : |
29 | $('.cart-goods').length <= 0; | 35 | $('.cart-goods').length <= 0; |
30 | } | 36 | } |
31 | 37 | ||
38 | + | ||
32 | if (needLoadRecommandForYou()) { | 39 | if (needLoadRecommandForYou()) { |
33 | require('../product/recommend-for-you'); | 40 | require('../product/recommend-for-you'); |
34 | } else { | 41 | } else { |
42 | + if (isRefreshByDelete) { | ||
43 | + $('body').css('background-color', '#f0f0f0'); | ||
44 | + } | ||
35 | require('./good'); | 45 | require('./good'); |
36 | } | 46 | } |
37 | 47 | ||
48 | +$cartPage.css('display', 'block'); | ||
49 | +loading.hideLoadingMask(); | ||
50 | + | ||
38 | window.setCookie('_yoho-cart-refreshByDelete', false); | 51 | window.setCookie('_yoho-cart-refreshByDelete', false); |
39 | 52 | ||
40 | ellipsis.init(); | 53 | ellipsis.init(); |
-
Please register or login to post a comment