Ver código fonte

fix(credit-balance-ui): 修复变更记录中变更类型显示为中文

- 添加getChangeTypeText函数将枚举值转换为中文
- SET_LIMIT → 设置额度
- PAYMENT → 支付扣减
- CHECKOUT → 结账恢复
- CANCEL_ORDER → 取消订单恢复
- REFUND → 退款恢复
- ADJUST → 调整额度
- 默认情况返回原值

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname 6 dias atrás
pai
commit
2fb02cbd76

+ 21 - 1
packages/credit-balance-management-ui-mt/src/components/CreditBalanceDialog.tsx

@@ -85,6 +85,26 @@ type SetLimitFormData = SetLimitRequest;
 type AdjustLimitFormData = AdjustLimitRequest;
 type CheckoutFormData = CheckoutRequest;
 
+// 变更类型转换为中文
+const getChangeTypeText = (changeType: string): string => {
+  switch (changeType) {
+    case 'SET_LIMIT':
+      return '设置额度';
+    case 'PAYMENT':
+      return '支付扣减';
+    case 'CHECKOUT':
+      return '结账恢复';
+    case 'CANCEL_ORDER':
+      return '取消订单恢复';
+    case 'REFUND':
+      return '退款恢复';
+    case 'ADJUST':
+      return '调整额度';
+    default:
+      return changeType;
+  }
+};
+
 export const CreditBalanceDialog: React.FC<CreditBalanceDialogProps> = ({
   userId,
   userName = '用户',
@@ -871,7 +891,7 @@ export const CreditBalanceDialog: React.FC<CreditBalanceDialogProps> = ({
                             </TableCell>
                             <TableCell>
                               <Badge variant="outline">
-                                {log.changeType}
+                                {getChangeTypeText(log.changeType)}
                               </Badge>
                             </TableCell>
                             <TableCell className={log.changeAmount >= 0 ? 'text-green-600' : 'text-red-600'}>