UNPKG

fd-gulp-convert-encoding

Version:

convert file to assigned charset

49 lines (42 loc) 1.59 kB
define('detail.modules.title.Module', ['exports'], function(exports) { exports.view = function(model) { model.tenThousandSep = function(number, isPrice) { var thousandSep = '万', millionSep = '亿', billionSep = '兆', result = number, resultUnit = ''; if (number >= 10000) { do { number = number / 10000; if (number < 1) { break; } result = number; resultUnit = thousandSep + resultUnit; if (resultUnit.match('^' + thousandSep + thousandSep)) { resultUnit = millionSep; } else if (resultUnit.match('^' + thousandSep + millionSep)) { resultUnit = billionSep; } } while (true); result = roundingSep(result); } else { if (isPrice) { result = roundingPriceSep(result); } else { result = roundingSep(result); } } return result + resultUnit; }; function roundingSep(number){ var result = Math.round(number * 100).toFixed(2) / 100; return result; } function roundingPriceSep(number){ var result = Math.round(number * 100).toFixed(2) / 100; return result.toFixed(2); } }; });