Showing
1 changed file
with
9 additions
and
2 deletions
| @@ -76,8 +76,15 @@ export struct CardSourceInfo { | @@ -76,8 +76,15 @@ export struct CardSourceInfo { | ||
| 76 | const num2: string = num.slice(-4, -3); // 千 | 76 | const num2: string = num.slice(-4, -3); // 千 |
| 77 | return num2 === '0' ? num1 + '万' : num1 + '.' + num2 + '万' | 77 | return num2 === '0' ? num1 + '万' : num1 + '.' + num2 + '万' |
| 78 | } else if (Number.parseInt(num) > 99999999) { | 78 | } else if (Number.parseInt(num) > 99999999) { |
| 79 | - const num1: string = num.slice(0, -8); // 亿 | ||
| 80 | - const num2: string = num.slice(-8, -7); | 79 | + let num1: string = num.slice(0, -8); // 亿 |
| 80 | + let num2: string = num.slice(-8, -7); | ||
| 81 | + const num3: string = `0.${num.slice(-7, -6)}` | ||
| 82 | + if (Math.round(Number(num3)) > Number(num3)) { | ||
| 83 | + if (`${Number(num2) + 1}`.length === 2) { | ||
| 84 | + num1 = `${Number(num1) + 1}` | ||
| 85 | + num2 = '0' | ||
| 86 | + } | ||
| 87 | + } | ||
| 81 | return num2 === '0' ? num1 + '亿' : num1 + '.' + num2 + '亿' | 88 | return num2 === '0' ? num1 + '亿' : num1 + '.' + num2 + '亿' |
| 82 | } | 89 | } |
| 83 | return num | 90 | return num |
-
Please register or login to post a comment