Browse Source

feat: fix float parse

yz 1 month ago
parent
commit
8219fb6a7d
2 changed files with 11 additions and 1 deletions
  1. 10 0
      src/views/claim/claimMixin.js
  2. 1 1
      src/views/claim/index.vue

+ 10 - 0
src/views/claim/claimMixin.js

@@ -747,6 +747,16 @@ export default {
     },
     },
 
 
     /**
     /**
+     * 格式化审核金额,兼容字符串/空值
+     * @param {number|string} amount - 审核金额
+     * @returns {string} 格式化后的金额
+     */
+    formatAuditAmount(amount) {
+      const num = parseFloat(amount)
+      return Number.isNaN(num) ? '0.00' : num.toFixed(2)
+    },
+
+    /**
      * 获取审核结果文本
      * 获取审核结果文本
      * @param {number} result - 审核结果,使用 AUDIT_STATUS
      * @param {number} result - 审核结果,使用 AUDIT_STATUS
      * @returns {string} 结果文本 '通过' | '拒绝' | '未知'
      * @returns {string} 结果文本 '通过' | '拒绝' | '未知'

+ 1 - 1
src/views/claim/index.vue

@@ -358,7 +358,7 @@
         </el-table-column>
         </el-table-column>
         <el-table-column prop="auditAmount" label="审核金额" width="120">
         <el-table-column prop="auditAmount" label="审核金额" width="120">
           <template slot-scope="scope">
           <template slot-scope="scope">
-            ¥{{ (scope.row.auditAmount || 0).toFixed(2) }}
+            {{ formatAuditAmount(scope.row.auditAmount) }}
           </template>
           </template>
         </el-table-column>
         </el-table-column>
         <el-table-column prop="reasonDetail" label="审核说明" show-overflow-tooltip></el-table-column>
         <el-table-column prop="reasonDetail" label="审核说明" show-overflow-tooltip></el-table-column>