🌈 style(eslint): 解决eslint的错误❌

This commit is contained in:
xuan
2022-12-01 18:10:18 +08:00
parent bd06efef61
commit 9e7b4d7d56
22 changed files with 222 additions and 223 deletions
+8 -8
View File
@@ -18,9 +18,9 @@ const smallToBig = function(money) {
const cnInteger = '整' // 整数金额时后面跟的字符
const cnIntLast = '元' // 整数完以后的单位
// 最大处理的数字
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
const maxNum = 999999999999999.9999
let integerNum // 金额整数部分
let decimalNum // 金额小数部分
// 输出的中文金额字符串
let chineseStr = ''
let parts // 分离金额后用的数组,预定义
@@ -40,15 +40,15 @@ const smallToBig = function(money) {
// 四舍五入保留两位小数,转换为字符串
money = Math.round(money * 100).toString()
integerNum = money.substr(0, money.length - 2)
decimalNum = money.substr(money.length - 2)
const integerNum = money.substr(0, money.length - 2) // 金额整数部分
const decimalNum = money.substr(money.length - 2) // 金额小数部分
// 获取整型部分转换
if (parseInt(integerNum, 10) > 0) {
let zeroCount = 0
const IntLen = integerNum.length
for (var i = 0; i < IntLen; i++) {
var n = integerNum.substr(i, 1)
for (let i = 0; i < IntLen; i++) {
const n = integerNum.substr(i, 1)
const p = IntLen - i - 1
const q = p / 4
const m = p % 4
@@ -72,8 +72,8 @@ const smallToBig = function(money) {
// 小数部分
if (decimalNum != '') {
const decLen = decimalNum.length
for (var i = 0; i < decLen; i++) {
var n = decimalNum.substr(i, 1)
for (let i = 0; i < decLen; i++) {
const n = decimalNum.substr(i, 1)
if (n != '0') {
chineseStr += cnNums[Number(n)] + cnDecUnits[i]
}