Browse Source

修改利润表千分位

hongxudong 1 năm trước cách đây
mục cha
commit
f6bf817bf6
1 tập tin đã thay đổi với 17 bổ sung6 xóa
  1. 17 6
      src/view/fin/profit-report/index.vue

+ 17 - 6
src/view/fin/profit-report/index.vue

@@ -27,7 +27,7 @@
                 </Poptip>
                 </Poptip>
               </div>
               </div>
               <div class="top-card-money">
               <div class="top-card-money">
-                <span class="top-card-money-num">¥{{ profit.profit?.toThousandth() || 0 }}</span>
+                <span class="top-card-money-num">¥{{ toFixAndToLocaleString(profit.profit || 0) }}</span>
               </div>
               </div>
               <div style="clear: both;"/>
               <div style="clear: both;"/>
             </div>
             </div>
@@ -46,14 +46,14 @@
             <div class="top-card">
             <div class="top-card">
               <div class="top-card-bottom-text">
               <div class="top-card-bottom-text">
                 <div class="top-card-bottom-text-title">销售总额</div>
                 <div class="top-card-bottom-text-title">销售总额</div>
-                <span class="top-card-bottom-text-num">¥{{ profit.outbound?.toThousandth() || 0 }}</span>
+                <span class="top-card-bottom-text-num">¥{{ toFixAndToLocaleString(profit.outbound || 0) }}</span>
                 <div style="clear: both;"/>
                 <div style="clear: both;"/>
               </div>
               </div>
             </div>
             </div>
             <div class="top-card">
             <div class="top-card">
               <div class="top-card-bottom-text">
               <div class="top-card-bottom-text">
                 <div class="top-card-bottom-text-title">成本总额</div>
                 <div class="top-card-bottom-text-title">成本总额</div>
-                <span class="top-card-bottom-text-num">¥{{ profit.inbound?.toThousandth() || 0 }}</span>
+                <span class="top-card-bottom-text-num">¥{{ toFixAndToLocaleString(profit.inbound || 0) }}</span>
                 <div style="clear: both;"/>
                 <div style="clear: both;"/>
               </div>
               </div>
             </div>
             </div>
@@ -212,7 +212,7 @@ export default {
             color: '#41be92',
             color: '#41be92',
             tooltip: {
             tooltip: {
               valueFormatter: function (value) {
               valueFormatter: function (value) {
-                return '¥' + value.toThousandth()
+                return '¥' + _self.toFixAndToLocaleString(value)
               }
               }
             },
             },
             data: []
             data: []
@@ -288,7 +288,7 @@ export default {
                 fontSize: '14'
                 fontSize: '14'
               },
               },
               formatter: (value) => {
               formatter: (value) => {
-                return '¥ ' + value.toThousandth()
+                return '¥ ' + _self.toFixAndToLocaleString(value)
               },
               },
             },
             },
             data: []
             data: []
@@ -413,7 +413,18 @@ export default {
         let chart = echarts.getInstanceByDom(document.getElementById(id))
         let chart = echarts.getInstanceByDom(document.getElementById(id))
         if (chart) chart.dispose()
         if (chart) chart.dispose()
       }
       }
-    }
+    },
+    toFixAndToLocaleString(number){
+      if(!number){
+        return '0.00'
+      }
+      let arr = number.toString().split('.')
+      if(arr.length>1){
+        return parseInt(arr[0]).toLocaleString()+(parseFloat('.'+arr[1]).toFixed(2).slice(1,4))
+      }else{
+        return parseInt(arr[0]).toLocaleString()+'.00'
+      }
+    },
   },
   },
   created() {
   created() {
     this.getSaleProfit()
     this.getSaleProfit()