|
|
@@ -199,22 +199,24 @@
|
|
|
let inputStr = num.toString()
|
|
|
let arr = inputStr.split('.')
|
|
|
let floatNum = arr[1]
|
|
|
- if (floatNum.length > 2) {
|
|
|
- num = inputStr.substring(0, arr[0].length + 3)
|
|
|
- if (Number(floatNum.charAt(2)) >= 1) {
|
|
|
- num = (Math.ceil(Number(num) * 100) + 1) / 100
|
|
|
- let inputStr1 = num.toString()
|
|
|
- let arr1 = inputStr1.split('.')
|
|
|
- let floatNum1 = arr1[1]
|
|
|
- if (num.toString().indexOf('.') === -1) {
|
|
|
- num += '.00'
|
|
|
- }
|
|
|
- if (floatNum1.length === 1) {
|
|
|
- num = num + '0'
|
|
|
+ if (floatNum) {
|
|
|
+ if (floatNum.length > 2) {
|
|
|
+ num = inputStr.substring(0, arr[0].length + 3)
|
|
|
+ if (Number(floatNum.charAt(2)) >= 1) {
|
|
|
+ num = (Math.ceil(Number(num) * 100) + 1) / 100
|
|
|
+ let inputStr1 = num.toString()
|
|
|
+ let arr1 = inputStr1.split('.')
|
|
|
+ let floatNum1 = arr1[1]
|
|
|
+ if (num.toString().indexOf('.') === -1) {
|
|
|
+ num += '.00'
|
|
|
+ }
|
|
|
+ if (floatNum1.length === 1) {
|
|
|
+ num = num + '0'
|
|
|
+ }
|
|
|
}
|
|
|
+ } else if (floatNum.length === 1) {
|
|
|
+ num = num + '0'
|
|
|
}
|
|
|
- } else if (floatNum.length === 1) {
|
|
|
- num = num + '0'
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -232,13 +234,15 @@
|
|
|
let inputStr = num.toString()
|
|
|
let arr = inputStr.split('.')
|
|
|
let floatNum = arr[1]
|
|
|
- if (floatNum.length > 6) {
|
|
|
- num = inputStr.substring(0, arr[0].length + 7)
|
|
|
- if (Number(floatNum.charAt(6)) > 4) {
|
|
|
- num = (Number(num) * 1000000 + 1) / 1000000
|
|
|
+ if (floatNum) {
|
|
|
+ if (floatNum.length > 6) {
|
|
|
+ num = inputStr.substring(0, arr[0].length + 7)
|
|
|
+ if (Number(floatNum.charAt(6)) > 4) {
|
|
|
+ num = (Number(num) * 1000000 + 1) / 1000000
|
|
|
+ }
|
|
|
+ } else if (floatNum.length === 1) {
|
|
|
+ num = num + '0'
|
|
|
}
|
|
|
- } else if (floatNum.length === 1) {
|
|
|
- num = num + '0'
|
|
|
}
|
|
|
}
|
|
|
}
|