iv-npm 1.6.2 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iv-npm",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "公共通用包",
5
5
  "author": "Mr.Cong",
6
6
  "license": "ISC",
@@ -89,6 +89,15 @@ declare enum LineIDEnum {
89
89
  "tx05" = 16
90
90
  }
91
91
 
92
- declare function getAmountByUnit(amount: number): string;
92
+ /**
93
+ * @description 将金额转换为大写,最大九位数。不足用¥填充
94
+ * @param amount
95
+ * */
96
+ declare function getAmountByUnit(amount: number): string;
97
+ /**
98
+ * @description 将金额保留两位小数。如果包含元字,处理结果也会返回元
99
+ * @param amount
100
+ * */
101
+ declare const amountToFixed: (_v?: number | string) => string | 0;
93
102
 
94
- export { LineIDEnum, ProjectStausEnum, SignStatusEnum, apiConfiger, arrToTree, assign, buildURL as buildUrl, dateFormat, filterOptionHeadle, findTree, formatType, getAmountByUnit, hostConfiger, isDate, isObject, isPlainObject, isURLSearchParams, onChangeTail, tranListToTreeData, yearMonthDayFormat, yearMonthFormat };
103
+ export { LineIDEnum, ProjectStausEnum, SignStatusEnum, amountToFixed, apiConfiger, arrToTree, assign, buildURL as buildUrl, dateFormat, filterOptionHeadle, findTree, formatType, getAmountByUnit, hostConfiger, isDate, isObject, isPlainObject, isURLSearchParams, onChangeTail, tranListToTreeData, yearMonthDayFormat, yearMonthFormat };
@@ -384,10 +384,26 @@ function getAmountByUnit(amount) {
384
384
  }
385
385
  return resultStr;
386
386
  }
387
+ var amountToFixed = (_v) => {
388
+ if (!_v)
389
+ return 0;
390
+ let value = _v;
391
+ let flag = false;
392
+ if (typeof _v === "string") {
393
+ if (_v.includes("\u5143")) {
394
+ flag = true;
395
+ value = parseFloat(_v.split("\u5143")[0]);
396
+ } else {
397
+ value = parseFloat(_v);
398
+ }
399
+ }
400
+ return (!Number.isNaN(value) ? value.toFixed(2) : 0) + (flag ? " \u5143" : "");
401
+ };
387
402
  export {
388
403
  LineIDEnum,
389
404
  ProjectStausEnum,
390
405
  SignStatusEnum,
406
+ amountToFixed,
391
407
  apiConfiger,
392
408
  arrToTree,
393
409
  assign,