From b7a10ca678629b4f572468e714fd583689baebd2 Mon Sep 17 00:00:00 2001
From: jinghui
Date: Fri, 13 Nov 2026 18:53:57 +0800
Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E7=AB=99=E7=82=B9=E8=B4=A7?=
=?UTF-8?q?=E5=B8=81=E5=8D=95=E4=BD=8D=E7=94=B1=E7=BE=8E=E5=85=83=E6=94=B9?=
=?UTF-8?q?=E4=B8=BA=E4=BA=BA=E6=B0=91=E5=B8=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- currency.ts: formatCurrency/formatPrice/formatBalance/getCurrencySymbol 默认币种
USD→CNY,Intl locale en-US→zh-CN,显示为 ¥ 而非 CN¥
- 平台配置与管理后台默认 currency: USD→CNY
- 硬编码 $ 符号处(商品价格/余额表/充值弹窗/控制台营收/主题 Demo)全部改 ¥
- i18n: 'Minimum recharge amount is $1' key 改为 ¥1(中英同步)
- 说明: 易支付 exchange_rate=1,余额数值即人民币,仅改显示符号不改数值
---
frontend/public/locales/en/translation.json | 2 +-
frontend/public/locales/zh-CN/translation.json | 2 +-
frontend/src/components/console/ConsoleStats.tsx | 6 +++---
.../components/dashboard/AccountBalanceTable.tsx | 16 ++++++++--------
frontend/src/components/theme/default/Demo.tsx | 4 ++--
frontend/src/components/theme/temu/Demo.tsx | 4 ++--
.../user-management/AdminRechargeModal.tsx | 4 ++--
frontend/src/hooks/useSystemConfigManagement.ts | 2 +-
.../src/shared/components/marketplace/Price.tsx | 6 +++---
.../shared/components/modal/RechargeModal.tsx | 4 ++--
.../shared/contexts/PlatformConfigContext.tsx | 2 +-
frontend/src/shared/utils/currency.ts | 12 ++++++------
12 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/frontend/public/locales/en/translation.json b/frontend/public/locales/en/translation.json
index 1984410..88c5167 100644
--- a/frontend/public/locales/en/translation.json
+++ b/frontend/public/locales/en/translation.json
@@ -328,7 +328,7 @@
"Current Balance": "Current Balance",
"User recharged successfully": "User recharged successfully",
"Please enter a valid amount": "Please enter a valid amount",
- "Minimum recharge amount is $1": "Minimum recharge amount is $1",
+ "Minimum recharge amount is ¥1": "Minimum recharge amount is ¥1",
"User not selected": "User not selected",
"Recharge failed": "Recharge failed",
"Network error, please try again": "Network error, please try again",
diff --git a/frontend/public/locales/zh-CN/translation.json b/frontend/public/locales/zh-CN/translation.json
index c480386..5184b71 100644
--- a/frontend/public/locales/zh-CN/translation.json
+++ b/frontend/public/locales/zh-CN/translation.json
@@ -330,7 +330,7 @@
"Current Balance": "当前余额",
"User recharged successfully": "用户充值成功",
"Please enter a valid amount": "请输入有效金额",
- "Minimum recharge amount is $1": "最低充值金额为 $1",
+ "Minimum recharge amount is ¥1": "最低充值金额为 ¥1",
"User not selected": "未选择用户",
"Recharge failed": "充值失败",
"Network error, please try again": "网络错误,请重试",
diff --git a/frontend/src/components/console/ConsoleStats.tsx b/frontend/src/components/console/ConsoleStats.tsx
index acaed56..cc7ece6 100644
--- a/frontend/src/components/console/ConsoleStats.tsx
+++ b/frontend/src/components/console/ConsoleStats.tsx
@@ -233,9 +233,9 @@ const ConsoleStats: React.FC = () => {
return transformToChartData(analyticsData);
}, [analyticsData]);
- // Format revenue as currency (USD by default)
- const formatCurrency = (value: number, currency: string = "USD") =>
- new Intl.NumberFormat("en-US", { style: "currency", currency }).format(
+ // Format revenue as currency (CNY by default)
+ const formatCurrency = (value: number, currency: string = "CNY") =>
+ new Intl.NumberFormat("zh-CN", { style: "currency", currency }).format(
value
);
if (loading) {
diff --git a/frontend/src/components/dashboard/AccountBalanceTable.tsx b/frontend/src/components/dashboard/AccountBalanceTable.tsx
index 5aeabb1..1d1afd7 100644
--- a/frontend/src/components/dashboard/AccountBalanceTable.tsx
+++ b/frontend/src/components/dashboard/AccountBalanceTable.tsx
@@ -170,25 +170,25 @@ const AccountBalanceTable: React.FC = ({ userId, sourc
);
};
- // 格式化金额,带正负号和美元符号
+ // 格式化金额,带正负号和人民币符号
const formatAmount = (amount: string | number): string => {
const numAmount = typeof amount === 'string' ? parseFloat(amount) : amount;
- if (isNaN(numAmount)) return '$0.00';
+ if (isNaN(numAmount)) return '¥0.00';
const absAmount = Math.abs(numAmount).toFixed(2);
if (numAmount > 0) {
- return `+$${absAmount}`;
+ return `+¥${absAmount}`;
} else if (numAmount < 0) {
- return `-$${absAmount}`;
+ return `-¥${absAmount}`;
}
- return `$${absAmount}`;
+ return `¥${absAmount}`;
};
- // 格式化余额,只显示美元符号,不带正负号
+ // 格式化余额,只显示人民币符号,不带正负号
const formatBalance = (balance: string | number): string => {
const numBalance = typeof balance === 'string' ? parseFloat(balance) : balance;
- if (isNaN(numBalance)) return '$0.00';
+ if (isNaN(numBalance)) return '¥0.00';
- return `$${Math.abs(numBalance).toFixed(2)}`;
+ return `¥${Math.abs(numBalance).toFixed(2)}`;
};
const getStatusColor = (status: number) => {
diff --git a/frontend/src/components/theme/default/Demo.tsx b/frontend/src/components/theme/default/Demo.tsx
index 4171ea3..7d35964 100644
--- a/frontend/src/components/theme/default/Demo.tsx
+++ b/frontend/src/components/theme/default/Demo.tsx
@@ -67,7 +67,7 @@ const DefaultDemo: React.FC = () => {
Beta
- $0.02 /Per Call
+ ¥0.02 /Per Call
@@ -79,7 +79,7 @@ const DefaultDemo: React.FC = () => {
Beta
- $0.02 /Per Call
+ ¥0.02 /Per Call
diff --git a/frontend/src/components/theme/temu/Demo.tsx b/frontend/src/components/theme/temu/Demo.tsx
index 4e0da48..d39a0bc 100644
--- a/frontend/src/components/theme/temu/Demo.tsx
+++ b/frontend/src/components/theme/temu/Demo.tsx
@@ -68,7 +68,7 @@ const TemuDemo: React.FC = () => {
-
$9.99
+
¥9.99
4.8
@@ -87,7 +87,7 @@ const TemuDemo: React.FC = () => {
-
$14.99
+
¥14.99
4.9
diff --git a/frontend/src/components/user-management/AdminRechargeModal.tsx b/frontend/src/components/user-management/AdminRechargeModal.tsx
index 957b80b..8687e13 100644
--- a/frontend/src/components/user-management/AdminRechargeModal.tsx
+++ b/frontend/src/components/user-management/AdminRechargeModal.tsx
@@ -46,7 +46,7 @@ export const AdminRechargeModal: React.FC
= ({
}
if (numAmount < 1) {
- setError(t("Minimum recharge amount is $1"));
+ setError(t("Minimum recharge amount is ¥1"));
return;
}
@@ -102,7 +102,7 @@ export const AdminRechargeModal: React.FC = ({
onChange={handleAmountChange}
startContent={
- $
+ ¥
}
isInvalid={!!error}
diff --git a/frontend/src/hooks/useSystemConfigManagement.ts b/frontend/src/hooks/useSystemConfigManagement.ts
index 8394660..fd2c570 100644
--- a/frontend/src/hooks/useSystemConfigManagement.ts
+++ b/frontend/src/hooks/useSystemConfigManagement.ts
@@ -18,7 +18,7 @@ export const useSystemConfigManagement = () => {
const [platformConfig, setPlatformConfig] = useState({
name: "",
logo: "",
- currency: "USD",
+ currency: "CNY",
});
const [platformLoading, setPlatformLoading] = useState(false);
const [platformError, setPlatformError] = useState(null);
diff --git a/frontend/src/shared/components/marketplace/Price.tsx b/frontend/src/shared/components/marketplace/Price.tsx
index 5fb16aa..bb2f6a2 100644
--- a/frontend/src/shared/components/marketplace/Price.tsx
+++ b/frontend/src/shared/components/marketplace/Price.tsx
@@ -38,7 +38,7 @@ export const Price: React.FC = ({
return (
- ${priceText.toFixed(2)}
+ ¥{priceText.toFixed(2)}
/{t("Per Call")}
@@ -51,14 +51,14 @@ export const Price: React.FC = ({
{t("Input")}:
- ${inputPrice.toFixed(2)}
+ ¥{inputPrice.toFixed(2)}
/{t("1M tokens")}
{t("Output")}:
- ${outputPrice.toFixed(2)}
+ ¥{outputPrice.toFixed(2)}
/{t("1M tokens")}
diff --git a/frontend/src/shared/components/modal/RechargeModal.tsx b/frontend/src/shared/components/modal/RechargeModal.tsx
index cfe9ed1..dbec0fe 100644
--- a/frontend/src/shared/components/modal/RechargeModal.tsx
+++ b/frontend/src/shared/components/modal/RechargeModal.tsx
@@ -36,7 +36,7 @@ export const RechargeModal: React.FC = ({
// payment channels arrive asynchronously -- fall back to the first one so the
// confirm button is not stuck disabled on a modal opened before they load.
const effectiveChannel = selectedPaymentChannel || paymentChannels[0]?.id || "";
- const currencySymbol = effectiveChannel === "epay" ? "¥" : "$";
+ const currencySymbol = effectiveChannel === "epay" ? "¥" : "¥";
const channelLabel = (id: string, name: string) => {
if (id === "epay") return t("Epay (Alipay / WeChat)");
@@ -55,7 +55,7 @@ export const RechargeModal: React.FC = ({
}
if (numAmount < 1) {
- setError(t("Minimum recharge amount is $1"));
+ setError(t("Minimum recharge amount is ¥1"));
return;
}
diff --git a/frontend/src/shared/contexts/PlatformConfigContext.tsx b/frontend/src/shared/contexts/PlatformConfigContext.tsx
index edd5cfd..30d8f01 100644
--- a/frontend/src/shared/contexts/PlatformConfigContext.tsx
+++ b/frontend/src/shared/contexts/PlatformConfigContext.tsx
@@ -14,7 +14,7 @@ import {
export const _DefaultPlatformConfig: PlatformConfig = {
name: "XPack",
logo: "/static/logo/logo.png",
- currency: "USD",
+ currency: "CNY",
language: "en",
website_title: "Connect Your AI Agent to the Real World - XPack",
headline: "Connect Your AI Agent to the Real World",
diff --git a/frontend/src/shared/utils/currency.ts b/frontend/src/shared/utils/currency.ts
index e3cb066..44bb421 100644
--- a/frontend/src/shared/utils/currency.ts
+++ b/frontend/src/shared/utils/currency.ts
@@ -17,7 +17,7 @@ export interface CurrencyFormatOptions {
*/
export const formatCurrency = (
amount: number | undefined | null,
- currency: string = 'USD',
+ currency: string = 'CNY',
options: CurrencyFormatOptions = {}
): string => {
// 处理无效值
@@ -33,7 +33,7 @@ export const formatCurrency = (
try {
if (showSymbol) {
- return new Intl.NumberFormat('en-US', {
+ return new Intl.NumberFormat('zh-CN', {
style: 'currency',
currency: currency,
minimumFractionDigits,
@@ -64,7 +64,7 @@ export const formatCurrency = (
*/
export const formatPrice = (
priceInCents: number | undefined | null,
- currency: string = 'USD',
+ currency: string = 'CNY',
options: CurrencyFormatOptions = {}
): string => {
if (priceInCents === undefined || priceInCents === null || isNaN(priceInCents)) {
@@ -80,9 +80,9 @@ export const formatPrice = (
* @param currency 货币代码
* @returns 货币符号
*/
-export const getCurrencySymbol = (currency: string = 'USD'): string => {
+export const getCurrencySymbol = (currency: string = 'CNY'): string => {
try {
- const formatter = new Intl.NumberFormat('en-US', {
+ const formatter = new Intl.NumberFormat('zh-CN', {
style: 'currency',
currency: currency,
minimumFractionDigits: 0,
@@ -114,7 +114,7 @@ export const getCurrencySymbol = (currency: string = 'USD'): string => {
*/
export const formatBalance = (
balance: number | undefined | null,
- currency: string = 'USD'
+ currency: string = 'CNY'
): string => {
return formatCurrency(balance, currency, {
minimumFractionDigits: 2,