Authored by xuqi

round cost when render in clinet

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