From 844e9dd7a12cec1fa2cf381459e338163e03b65e Mon Sep 17 00:00:00 2001 From: xudaotutou <13435638964@163.com> Date: Tue, 2 Jul 2024 17:15:34 +0800 Subject: [PATCH] fix:fix transfer billing --- .../costcenter/public/locales/en/applist.json | 10 +++ .../costcenter/public/locales/en/common.json | 6 +- .../costcenter/public/locales/zh/applist.json | 10 +++ .../costcenter/public/locales/zh/common.json | 6 +- .../src/components/billing/AppMenu.tsx | 6 +- .../src/components/billing/SwitchPage.tsx | 4 +- .../components/billing/TransferTabPnel.tsx | 41 +++++------ .../src/components/billing/TypeMenu.tsx | 16 ++--- .../src/components/billing/billingTable.tsx | 72 +++++++++---------- .../costcenter/src/constants/billing.ts | 11 ++- .../providers/costcenter/src/layout/index.tsx | 3 +- .../src/pages/api/account/transfer.ts | 11 +-- .../costcenter/src/pages/api/billing/index.ts | 2 +- .../src/pages/api/billing/transfer.ts | 66 +++++++++++++++++ .../costcenter/src/pages/billing/index.tsx | 2 +- .../providers/costcenter/src/types/billing.ts | 23 +++++- 16 files changed, 195 insertions(+), 94 deletions(-) create mode 100644 frontend/providers/costcenter/public/locales/en/applist.json create mode 100644 frontend/providers/costcenter/public/locales/zh/applist.json create mode 100644 frontend/providers/costcenter/src/pages/api/billing/transfer.ts diff --git a/frontend/providers/costcenter/public/locales/en/applist.json b/frontend/providers/costcenter/public/locales/en/applist.json new file mode 100644 index 00000000000..0843945ad4f --- /dev/null +++ b/frontend/providers/costcenter/public/locales/en/applist.json @@ -0,0 +1,10 @@ +{ + "TERMINAL": "TERMINAL", + "JOB":"JOB", + "OTHER": "OTHER", + "OBJECT-STORAGE": "OBJECT-STORAGE", + "CLOUD-VM":"CLOUD-VM", + "DB": "DATABASE", + "APP": "APP", + "All APP": "ALL" +} \ No newline at end of file diff --git a/frontend/providers/costcenter/public/locales/en/common.json b/frontend/providers/costcenter/public/locales/en/common.json index fcccf28f1ff..e1ff1f8ab09 100644 --- a/frontend/providers/costcenter/public/locales/en/common.json +++ b/frontend/providers/costcenter/public/locales/en/common.json @@ -158,9 +158,11 @@ "Remaining Quota": "remaining", "Receipts And Disbursements": "Receipts And Disbursements", "APP Name": "App name", - "All APP": "all", "APP Type": "App type", "Details": "Details", + "Transfer Type":"Transfer Type", "Handle": "Handle", - "currencyUnit": "Currency Unit" + "currencyUnit": "Currency Unit", + "Trader ID":"Trader" + } \ No newline at end of file diff --git a/frontend/providers/costcenter/public/locales/zh/applist.json b/frontend/providers/costcenter/public/locales/zh/applist.json new file mode 100644 index 00000000000..df42daf87e9 --- /dev/null +++ b/frontend/providers/costcenter/public/locales/zh/applist.json @@ -0,0 +1,10 @@ +{ + "TERMINAL": "终端", + "JOB":"任务", + "OTHER": "其他", + "OBJECT-STORAGE": "对象存储", + "CLOUD-VM":"云主机", + "DB": "数据库", + "APP": "应用", + "All APP": "所有应用" +} \ No newline at end of file diff --git a/frontend/providers/costcenter/public/locales/zh/common.json b/frontend/providers/costcenter/public/locales/zh/common.json index a9a63a0c5b7..bfbf3249587 100644 --- a/frontend/providers/costcenter/public/locales/zh/common.json +++ b/frontend/providers/costcenter/public/locales/zh/common.json @@ -158,9 +158,11 @@ "Remaining Quota": "剩余", "Receipts And Disbursements": "收支", "APP Name": "应用名称", - "All APP": "所有应用", + "APP Type": "应用类型", + "Transfer Type": "转账类型", "Details": "详情", "Handle": "操作", - "currencyUnit": "金额单位" + "currencyUnit": "金额单位", + "Trader ID": "交易用户" } \ No newline at end of file diff --git a/frontend/providers/costcenter/src/components/billing/AppMenu.tsx b/frontend/providers/costcenter/src/components/billing/AppMenu.tsx index 731fa097967..fab26906ec2 100644 --- a/frontend/providers/costcenter/src/components/billing/AppMenu.tsx +++ b/frontend/providers/costcenter/src/components/billing/AppMenu.tsx @@ -30,7 +30,8 @@ export default function AppMenu({ const { setAppType } = useBillingStore(); const { isOpen, onClose, onOpen } = useDisclosure(); const { t } = useTranslation(); - const appList: string[] = [t('All APP'), ...(data?.data?.appList || [])]; + const { t: appT } = useTranslation('applist'); + const appList: string[] = ['All APP', ...(data?.data?.appList || [])].map((v) => appT(v)); return ( @@ -91,9 +92,6 @@ export default function AppMenu({ setAppType(idx === 0 ? '' : appList[idx]); onClose(); }} - // _hover={{ - // bg: '' - // }} > {v} diff --git a/frontend/providers/costcenter/src/components/billing/SwitchPage.tsx b/frontend/providers/costcenter/src/components/billing/SwitchPage.tsx index 3cc7c188532..0c99d2dc3a9 100644 --- a/frontend/providers/costcenter/src/components/billing/SwitchPage.tsx +++ b/frontend/providers/costcenter/src/components/billing/SwitchPage.tsx @@ -47,7 +47,9 @@ export default function SwitchPage({ return ( {t('Total')}: - {totalItem} + + {totalItem} + - {LIST_TYPE.filter((x) => optional.includes(x.value)).map((v) => ( + {TRANSFER_LIST_TYPE.map((v) => (