修改数字格式化bug

master
joeyoyo 5 years ago
parent 2277033a29
commit 84b891516d
  1. 1
      html/wallet/js/wallet.api.js
  2. 27
      lib/js/app.js

@ -180,6 +180,7 @@ define(['mui', 'app', 'ajaxUtil', 'jsencrypt'], function(mui, app, ajaxUtil, jse
* @param {Object} coins * @param {Object} coins
*/ */
function moduleType(type, coin) { function moduleType(type, coin) {
console.log(JSON.stringify(coin));
coin.moduleType = type; coin.moduleType = type;
coin.balance = app.formatValue(coin.balance); coin.balance = app.formatValue(coin.balance);
coin.freeBalance = app.formatValue(coin.freeBalance); coin.freeBalance = app.formatValue(coin.freeBalance);

@ -678,23 +678,24 @@
val = -val; val = -val;
} }
if(val < 0.0001) { if(val < 0.0001) {
value = compute.Mul(value, 1e8, 8); val = compute.Mul(val, 1e8, 8);
value = compute.Div(value, 1e8, 8); val = compute.Div(val, 1e8, 8);
value = value.toFixed(8); val = val.toFixed(8);
} else if(val < 0.1) { } else if(val < 0.1) {
value = compute.Mul(value, 1e6, 6); val = compute.Mul(val, 1e6, 6);
value = compute.Div(value, 1e6, 6); val = compute.Div(val, 1e6, 6);
value = value.toFixed(6); val = val.toFixed(6);
} else if(val < 10) { } else if(val < 10) {
value = compute.Mul(value, 1e4, 4); val = compute.Mul(val, 1e4, 4);
value = compute.Div(value, 1e4, 4); val = compute.Div(val, 1e4, 4);
value = value.toFixed(4); val = val.toFixed(4);
} else { } else {
value = compute.Mul(value, 1e2, 2); val = compute.Mul(val, 1e2, 2);
value = compute.Div(value, 1e2, 2); val = compute.Div(val, 1e2, 2);
value = value.toFixed(2); val = val.toFixed(2);
console.log(val);
} }
return value; return val;
} }
/*** /***

Loading…
Cancel
Save