60939ab0
杜志良
feat(cas): 索赔复核审批...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import currency from 'currency.js';
type RMBOption = { price?: number; symbol?: boolean; precision?: boolean };
// 人民币格式化
const RMB = ({ price = 0, symbol = true, precision = true }: RMBOption) => {
return currency(price, {
symbol: symbol ? '¥' : '',
precision: precision ? 2 : 0,
}).format();
};
// 人民币格式化-不包含符号和小数
const rmb = (price?: number) => RMB({ price, symbol: false, precision: false });
// 人民币格式化-包含符号,不包含小数
const rmbS = (price?: number) => RMB({ price, precision: false });
// 人民币格式化-包含小数,不包含符号
const rmbP = (price?: number) => RMB({ price, symbol: false });
// 人民币格式化-包含符号和小数
const rmbSP = (price?: number) => RMB({ price });
export default {
_: rmb,
s: rmbS,
p: rmbP,
sp: rmbSP,
};
|