fix: standardize currency and input selection styles

This commit is contained in:
hectorzhao
2026-07-11 10:49:00 +08:00
parent 20f89d14aa
commit a4d42cf702
15 changed files with 52 additions and 33 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
import { useEffect, useMemo, useState } from 'react';
import { ClipboardCopy, FileText } from 'lucide-react';
import { clientApi, type ApplicationCmppParams, type ClientSmsApplication } from '@/api/adminApi';
import { formatCents } from '@/utils/currency';
import { Button, Modal, Pagination, Tag } from '@/components/ui';
type LinkStatus = 'connected' | 'degraded' | 'disconnected' | 'inactive';
@@ -33,7 +34,7 @@ function normalizeStatus(application: ClientSmsApplication): LinkStatus {
}
function formatPrice(cents?: number | null) {
return `${((cents ?? 0) / 100).toFixed(4)}`;
return `${formatCents(cents)}`;
}
function mapParams(params: ApplicationCmppParams): ParamRow[] {
+2 -1
View File
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
import { CreditCard } from 'lucide-react';
import { Button, Pagination, Tag } from '@/components/ui';
import { clientApi, type BillingPlan } from '@/api/adminApi';
import { formatCents } from '@/utils/currency';
export function ClientBillingPage() {
const [plans, setPlans] = useState<BillingPlan[]>([]);
@@ -54,7 +55,7 @@ export function ClientBillingPage() {
<strong>{plan.smsUnits.toLocaleString('zh-CN')} </strong>
<p className="muted">{plan.description ?? '适合阶段性短信发送和活动通知。'}</p>
<Button icon={<CreditCard size={16} />} onClick={() => createOrder(plan)} variant={plan.smsUnits >= 100000 ? 'primary' : 'ghost'}>
¥{(plan.amountCents / 100).toLocaleString('zh-CN')}
¥{formatCents(plan.amountCents)}
</Button>
</article>
))}
+5 -4
View File
@@ -14,6 +14,7 @@ import { Button, Chart, Table, Tag, type TableColumn } from '@/components/ui';
import { clientApi, type DashboardResponse } from '@/api/adminApi';
import { createLineOption, createPieOption } from '@/theme/chartOptions';
import { formatDateTime } from '@/utils/dateTime';
import { formatAmount, formatCents } from '@/utils/currency';
type RecentTaskRow = {
id: string;
@@ -102,8 +103,8 @@ export function ClientHome() {
<div className="dashboard-grid">
<div className="surface metric-card metric-card--featured">
<span></span>
<strong>¥{availableBalance.toLocaleString('zh-CN', { minimumFractionDigits: 2 })}</strong>
<small> ¥{todaySpend.toLocaleString('zh-CN', { minimumFractionDigits: 2 })}</small>
<strong>¥{formatAmount(availableBalance)}</strong>
<small> ¥{formatAmount(todaySpend)}</small>
</div>
<div className="surface metric-card">
<span></span>
@@ -112,7 +113,7 @@ export function ClientHome() {
</div>
<div className="surface metric-card">
<span></span>
<strong>¥{todayRefund.toLocaleString('zh-CN', { minimumFractionDigits: 2 })}</strong>
<strong>¥{formatAmount(todayRefund)}</strong>
<small>退</small>
</div>
</div>
@@ -169,7 +170,7 @@ export function ClientHome() {
</div>
<div>
<span></span>
<strong>{latestRecharge ? `¥${(latestRecharge.amountCents / 100).toFixed(2)}` : '暂无充值'}</strong>
<strong>{latestRecharge ? `¥${formatCents(latestRecharge.amountCents)}` : '暂无充值'}</strong>
</div>
</div>
<div>