Sfoglia il codice sorgente

fix: 金额数据优化

mozhuangru 1 giorno fa
parent
commit
1c0f6e4e02

+ 8 - 4
src/main.js

@@ -35,10 +35,14 @@ Vue.filter('safeGet', function (obj, path, defaultValue = '无') {
   // 最终值为空时返回默认值
   return result || defaultValue
 })
-Vue.filter('formatNumber', function (num = 0) {
-  return (+num).toLocaleString('zh', {
-    maximumFractionDigits: 2
-  })
+Vue.filter('formatNumber', function (num) {
+  if (num) {
+    return (+num).toLocaleString('zh', {
+      maximumFractionDigits: 2
+    })
+  } else {
+    return 0
+  }
 })
 
 Vue.use(VueTianditu, {

+ 1 - 1
src/views/hui-jia/components/online-pay-day/index.vue

@@ -194,7 +194,7 @@ export default {
         },
         yAxis: [
           {
-            max: 500,
+            // max: 1000,
             axisLabel: {
               color: 'rgba(160, 179, 214, 0.7)',
               fontSize: 11,

+ 1 - 1
src/views/hui-jia/components/online-pay-week/index.vue

@@ -193,7 +193,7 @@ export default {
         },
         yAxis: [
           {
-            max: 500,
+            // max: 1000,
             axisLabel: {
               color: 'rgba(160, 179, 214, 0.7)',
               fontSize: 11,

+ 1 - 1
src/views/hui-jia/components/online-pay/index.vue

@@ -5,7 +5,7 @@
           <img src="./images/icon-total.png" alt="" class="icon">
         </div>
         <div>
-          总缴费(近12个月):¥{{ total }}
+          总缴费(近12个月):¥{{ total | formatNumber }}
         </div>
       </div>
       <div class="bar-con">

+ 5 - 5
src/views/hui-jia/components/online-water/index.vue

@@ -16,14 +16,14 @@
             <img src="./images/icon-once.png" alt="" class="icon">
           </div>
           <div class="info flex-1">
-            <p class="num">{{ onlineWaterInfo.recentAveAmount || 0 }}</p>
+            <p class="num">{{ onlineWaterInfo.recentAveAmount | formatNumber}}</p>
             <p class="title">单笔缴费金额</p>
             <p class="desc">(近12个月平均值)</p>
           </div>
         </div>
         <div class="bottom display-flex">
           <span class="title">单笔最大值</span>
-          <span class="num">{{ onlineWaterInfo.recentMaxAmount || 0 }}</span>
+          <span class="num">{{ onlineWaterInfo.recentMaxAmount | formatNumber}}</span>
         </div>
 
       </div>
@@ -33,14 +33,14 @@
             <img src="./images/icon-month.png" alt="" class="icon">
           </div>
           <div class="info flex-1">
-            <p class="num">{{ onlineWaterInfo.avgMonPayCnt || 0 }}</p>
+            <p class="num">{{ onlineWaterInfo.avgMonPayCnt | formatNumber}}</p>
             <p class="title">月在线缴费次数</p>
             <p class="desc">(近12个月平均值)</p>
           </div>
         </div>
         <div class="bottom display-flex">
           <span class="title">单笔最大值</span>
-          <span class="num">{{ onlineWaterInfo.maxMonthlyCnt || 0 }}</span>
+          <span class="num">{{ onlineWaterInfo.maxMonthlyCnt | formatNumber }}</span>
         </div>
       </div>
     </div>
@@ -55,7 +55,7 @@
         </div>
       </div>
       <div class="num">
-        {{ onlineWaterInfo.recentlySum || 0 }}
+        {{ onlineWaterInfo.recentlySum | formatNumber}}
       </div>
     </div>
   </Card>