Browse Source

金额格式

sqg 3 năm trước cách đây
mục cha
commit
93730823ee

+ 13 - 0
front-vue/src/views/service/credit/pdfShow.vue

@@ -657,6 +657,19 @@ export default {
     handleInput(str) {
         return amtformat(str, 2, ".", ",");
     },
+    //格式化金额 
+    amtFormat(cellValue) {
+      if(cellValue == null || cellValue== undefined || cellValue == ''){
+      cellValue = '0.00'
+      }
+      cellValue += '';
+            if (!cellValue.includes('.')) {
+      cellValue += '.00';
+      }
+      return cellValue.replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
+        return $1 + ',';
+      }).replace(/\.$/, '');
+    },
     /* //  将数字金额转换为大写金额 */
     smallToBig(money) {
       //  将数字金额转换为大写金额

+ 13 - 0
front-vue/src/views/service/financeRecord/pdfShow.vue

@@ -674,6 +674,19 @@ export default {
     handleInput(str) {
         return amtformat(str, 2, ".", ",");
     },
+    //格式化金额 
+    amtFormat(cellValue) {
+      if(cellValue == null || cellValue== undefined || cellValue == ''){
+      cellValue = '0.00'
+      }
+      cellValue += '';
+            if (!cellValue.includes('.')) {
+      cellValue += '.00';
+      }
+      return cellValue.replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
+        return $1 + ',';
+      }).replace(/\.$/, '');
+    },
     /* //  将数字金额转换为大写金额 */
     smallToBig(money) {
       //  将数字金额转换为大写金额