Browse Source

公共方法封装

xiaohaizhao 1 year ago
parent
commit
6324e00ae2
2 changed files with 6 additions and 1 deletions
  1. 1 1
      src/HDrpManagement/contactProfile/modules/detail.vue
  2. 5 0
      src/utils/tool.js

+ 1 - 1
src/HDrpManagement/contactProfile/modules/detail.vue

@@ -483,7 +483,7 @@ export default {
       if (num == 0) {
         return this.tool.formatAmount(num, 0, '¥')
       } else {
-        return this.tool.formatAmount(num / 10000, 2, '¥') +this.$t('万')
+        return this.tool.formatAmount(num / 10000, 2, '¥') + this.$t('万')
       }
     },
   },

+ 5 - 0
src/utils/tool.js

@@ -123,6 +123,11 @@ export default {
     const res = new Map();
     return arr.filter((item) => !res.has(item[uniId]) && res.set(item[uniId], 1));
   },
+  //国际化金融单位转换 10000 转换为 1000
+  unitConversion(amount, dividend) {
+    if (sessionStorage.getItem('lang') != 'ZH' != dividend == 10000) dividend = 1000
+    return amount / dividend
+  },
   // 金额格式化
   formatAmount(amount, decimalDigits, unit='') {
     // const amountStr = String(Number(amount).toFixed(decimalDigits))