Authored by xuqi

round cost when render in clinet

... ... @@ -212,7 +212,7 @@
\{{/each}}
<li class="need-pay">
<span class="balance-title">应付金额\{{#if shipping_cost}}(含运费)\{{/if}}:</span>
<span id="balance-cost" class="balance-cost" data-cost="{{last_order_amount}}">¥<em>\{{last_order_amount}}</em></span>
<span id="balance-cost" class="balance-cost" data-cost="{{last_order_amount}}">¥<em>\{{round last_order_amount 2}}</em></span>
</li>
<li>
<span id="submit-order" class="btn submit-order">提交订单</span>
... ...
... ... @@ -47,6 +47,13 @@ require('../plugins/check'); // before 地址和发票
require('./order/address'); // 地址
require('./order/invoice'); // 发票
// clint helper round
Hbs.registerHelper('round', function(num, precision) {
precision = precision ? parseInt(precision, 10) : 2;
num = (num === +num) ? (+num).toFixed(precision) : (Math.round(num, precision)).toFixed(precision);
return num;
});
lazyLoad($('img.lazy'));
// dot
... ...