Commit 35326988 authored by 程卓's avatar 程卓

物业应急指挥体系和运行体征的静态

parent 306eb16a
...@@ -33,4 +33,34 @@ export default { ...@@ -33,4 +33,34 @@ export default {
return path.reduce(reducer, obj) return path.reduce(reducer, obj)
} }
}, },
/**
* 转换为金钱格式(千分位且保留两位小数)
* @param {Number | String} num [需转换的数字或字符串]
*/
toMoney(num) {
if (!num) {
return 0.00
}
num = this.toFloat(num).toFixed(2)
const arr = num.toString().split('.')
let int = (arr[0] || 0).toString(),
result = ''
while (int.length > 3) {
result = ',' + int.slice(-3) + result
int = int.slice(0, int.length - 3)
}
if (int) {
result = int + result
}
return `${result}.${arr[1]}`
},
//
//
// 转换为千位分隔符
//
format (num) {
var reg=/\d{1,3}(?=(\d{3})+$)/g
return (num + '').replace(reg, '$&,')
}
} }
...@@ -88,4 +88,6 @@ img ...@@ -88,4 +88,6 @@ img
color skyblue color skyblue
span span
font-size 1.25rem font-size 1.25rem
color #ffffff
</style> </style>
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
<div class="operation"> <div class="operation">
<div class="o-card" v-for="(i,k) in datas" :key="k"> <div class="o-card" v-for="(i,k) in datas" :key="k">
<div class="p-left"> <div class="p-left">
<img :src="require('@/assets/images/icon4.png')" alt=""> <img :src="require('@/assets/images/icon1.png')" alt="">
</div> </div>
<div class="p-right"> <div class="p-right">
<p>{{i.title}}</p> <p>{{i.title}}</p>
<span>{{i.num}}</span> <span>{{$com.format(i.num)}}</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -77,6 +77,8 @@ img ...@@ -77,6 +77,8 @@ img
font-size .8rem font-size .8rem
color skyblue color skyblue
span span
font-size 1.25rem font-size 1.35rem
font-weight 700
color rgb(109,234,253)
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment