Browse Source

🐛 fix(contracts): 修复金额显示可能出现的非数字类型错误

- 在金额格式化前添加Number()转换,确保toFixed()方法调用安全
- 解决当amount为非数字类型时可能导致的页面报错问题
yourname 8 months ago
parent
commit
ba97e52f75
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/client/admin/pages/Contracts.tsx

+ 1 - 1
src/client/admin/pages/Contracts.tsx

@@ -196,7 +196,7 @@ const Contracts: React.FC = () => {
       dataIndex: 'amount',
       dataIndex: 'amount',
       key: 'amount',
       key: 'amount',
       render: (amount: number, record: HetongItem) => 
       render: (amount: number, record: HetongItem) => 
-        `${record.currency || 'CNY'} ${amount.toFixed(2)}`,
+        `${record.currency || 'CNY'} ${Number(amount).toFixed(2)}`,
     },
     },
     {
     {
       title: '状态',
       title: '状态',