removed goods when empty
Showing
1 changed file
with
1 additions
and
48 deletions
@@ -48,54 +48,7 @@ var Util = { | @@ -48,54 +48,7 @@ var Util = { | ||
48 | * @params { Function } callback 购物车刷新后回调 | 48 | * @params { Function } callback 购物车刷新后回调 |
49 | */ | 49 | */ |
50 | refreshCart: function(data, callback) { | 50 | refreshCart: function(data, callback) { |
51 | - // var template; | ||
52 | - | ||
53 | - if (!data.hasGoods) { | ||
54 | - $('#cart_content').html(emptyCartTpl); | ||
55 | - return; | ||
56 | - } | ||
57 | - | ||
58 | - // // helpers start | ||
59 | - // hbs.registerHelper('multiple', function(num1, num2) { | ||
60 | - // num1 = typeof num1 === 'number' ? num1 : parseFloat(num1, 10); | ||
61 | - // num2 = typeof num2 === 'number' ? num2 : parseFloat(num2, 10); | ||
62 | - | ||
63 | - // if (num1 && num2) { | ||
64 | - // return num1 * num2; | ||
65 | - // } | ||
66 | - // }); | ||
67 | - | ||
68 | - // hbs.registerHelper('isEqual', function(v1, v2, options) { | ||
69 | - // if (v1 === v2) { | ||
70 | - // return options.fn(this); | ||
71 | - // } | ||
72 | - // return options.inverse(this); | ||
73 | - // }); | ||
74 | - | ||
75 | - // hbs.registerHelper('round', function(num, fixedNum) { | ||
76 | - // num = typeof num === 'number' ? num : parseFloat(num, 10); | ||
77 | - // return num.toFixed(fixedNum); | ||
78 | - // }); | ||
79 | - | ||
80 | - // hbs.registerHelper('showStorage', function(leftNumber) { | ||
81 | - // leftNumber = typeof num1 === 'number' ? leftNumber : parseFloat(leftNumber, 10); | ||
82 | - | ||
83 | - // if (leftNumber <= 3 && leftNumber >= 0) { | ||
84 | - // return '仅剩' + leftNumber + '件'; | ||
85 | - // } else if (leftNumber < 0) { | ||
86 | - // return '库存不足'; | ||
87 | - // } | ||
88 | - // }); | ||
89 | - | ||
90 | - // hbs.registerHelper('image', function(url, width, height, mode) { | ||
91 | - // mode = parseInt(mode, 10) ? mode : 2; | ||
92 | - // url = url || ''; | ||
93 | - // return url.replace(/{width}/g, width).replace(/{height}/g, height).replace(/{mode}/g, mode); | ||
94 | - // }); | ||
95 | - | ||
96 | - // helpers end | ||
97 | - // template = hbs.compile($('#cart-content-tpl').html()); | ||
98 | - $('#cart_content').html(cartTpl(data)); | 51 | + $('#cart_content').html(data.hasGoods ? cartTpl(data) : emptyCartTpl); |
99 | 52 | ||
100 | if (callback) { | 53 | if (callback) { |
101 | return callback(); | 54 | return callback(); |
-
Please register or login to post a comment