|
|
@@ -87,44 +87,48 @@
|
|
|
this.cardShow = false
|
|
|
},
|
|
|
formatNumber (num, type) {
|
|
|
- if (num.toString().indexOf('E') !== -1) {
|
|
|
- let arr = num.toString().split('E')
|
|
|
- num = arr[0] * Math.pow(10, arr[1])
|
|
|
- }
|
|
|
- if (num > 99999999) {
|
|
|
- let str2 = num.toString()
|
|
|
- num = Math.floor(num / 100000000)
|
|
|
- if (parseInt(str2.charAt(str2.length - 8)) > 8) {
|
|
|
- num = num + 1
|
|
|
- }
|
|
|
- num += '<span style="color: #333">亿</span>'
|
|
|
- } else if (num > 9999) {
|
|
|
- let str = num.toString()
|
|
|
- num = Math.floor(num / 10000)
|
|
|
- if (parseInt(str.charAt(str.length - 4)) > 4) {
|
|
|
- num = num + 1
|
|
|
+ if (num) {
|
|
|
+ if (num.toString().indexOf('E') !== -1) {
|
|
|
+ let arr = num.toString().split('E')
|
|
|
+ num = arr[0] * Math.pow(10, arr[1])
|
|
|
}
|
|
|
- num += '<span style="color: #333">万</span>'
|
|
|
- } else {
|
|
|
- if (type === 1 || type === 2) {
|
|
|
- num += '<span style="color: #333">元</span>'
|
|
|
+ if (num > 99999999) {
|
|
|
+ let str2 = num.toString()
|
|
|
+ num = Math.floor(num / 100000000)
|
|
|
+ if (parseInt(str2.charAt(str2.length - 8)) > 8) {
|
|
|
+ num = num + 1
|
|
|
+ }
|
|
|
+ num += '<span style="color: #333">亿</span>'
|
|
|
+ } else if (num > 9999) {
|
|
|
+ let str = num.toString()
|
|
|
+ num = Math.floor(num / 10000)
|
|
|
+ if (parseInt(str.charAt(str.length - 4)) > 4) {
|
|
|
+ num = num + 1
|
|
|
+ }
|
|
|
+ num += '<span style="color: #333">万</span>'
|
|
|
} else {
|
|
|
- num += ''
|
|
|
+ if (type === 1 || type === 2) {
|
|
|
+ num += '<span style="color: #333">元</span>'
|
|
|
+ } else {
|
|
|
+ num += ''
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return num
|
|
|
},
|
|
|
formatDouble (num) {
|
|
|
- if (num.toString().indexOf('E') !== -1) {
|
|
|
- let arr = num.toString().split('E')
|
|
|
- num = arr[0] * Math.pow(10, arr[1])
|
|
|
- }
|
|
|
- if (num > 99999999) {
|
|
|
- num = (num / 100000000).toFixed(2).slice(num.length - 1, 4) + '亿'
|
|
|
- } else if (num > 9999) {
|
|
|
- num = (num / 10000).toFixed(2).slice(num.length - 1, 4) + '万'
|
|
|
- } else {
|
|
|
+ if (num) {
|
|
|
+ if (num.toString().indexOf('E') !== -1) {
|
|
|
+ let arr = num.toString().split('E')
|
|
|
+ num = arr[0] * Math.pow(10, arr[1])
|
|
|
+ }
|
|
|
+ if (num > 99999999) {
|
|
|
+ num = (num / 100000000).toFixed(2).slice(num.length - 1, 4) + '亿'
|
|
|
+ } else if (num > 9999) {
|
|
|
+ num = (num / 10000).toFixed(2).slice(num.length - 1, 4) + '万'
|
|
|
+ } else {
|
|
|
num += ''
|
|
|
+ }
|
|
|
}
|
|
|
return num
|
|
|
},
|