Explorar o código

🐛 fix(order): 修复订单金额显示问题和数据权限错误

- 修复金额字段可能为字符串类型导致的显示异常,确保数值正确格式化
- 修正数据权限配置中的用户ID字段,将salesperson改为userId以正确应用权限控制
yourname hai 7 meses
pai
achega
d1e49ef45b

+ 8 - 2
src/client/admin/components/client-detail/OrderRecordsTab.tsx

@@ -62,14 +62,20 @@ const OrderRecordsTab: React.FC<OrderRecordsTabProps> = ({ clientId }) => {
       dataIndex: 'orderAmount',
       key: 'orderAmount',
       width: 120,
-      render: (amount: number) => `¥${amount?.toFixed(2) || '0.00'}`,
+      render: (amount: number | string) => {
+        const num = typeof amount === 'string' ? parseFloat(amount) : amount;
+        return `¥${(num || 0).toFixed(2)}`;
+      },
     },
     {
       title: '预付款',
       dataIndex: 'advancePayment',
       key: 'advancePayment',
       width: 120,
-      render: (amount: number) => `¥${amount?.toFixed(2) || '0.00'}`,
+      render: (amount: number | string) => {
+        const num = typeof amount === 'string' ? parseFloat(amount) : amount;
+        return `¥${(num || 0).toFixed(2)}`;
+      },
     },
     {
       title: '订单状态',

+ 1 - 1
src/server/api/order-records/index.ts

@@ -18,7 +18,7 @@ const orderRecordRoutes = createCrudRoutes({
   },
   dataPermission: {
     entity: 'OrderRecord',
-    userIdField: 'salesperson'
+    userIdField: 'userId'
   }
 });