feat: format points to K unit when >= 1000

main
sp mac bookpro 2605 2026-06-12 23:44:16 +08:00
parent e9e0b360ad
commit 257f6a3c3b
8 changed files with 29 additions and 30 deletions

View File

@ -51,7 +51,7 @@ const NAV_GROUPS: Array<{
{
label: '商城',
items: [
{ to: '/points-mall', icon: <CompassOutlined />, label: '积分商城' }
{ to: '/points-mall', icon: <CompassOutlined />, label: 'Token商城' }
]
}
];

View File

@ -53,10 +53,10 @@ export function usePointsMallPageLogic() {
setCategoryId(cats[0].id);
}
if (meRes.status === 'rejected') {
message.error('获取积分信息失败,请稍后重试');
message.error('获取Token信息失败,请稍后重试');
}
} catch {
message.error('获取积分信息失败,请稍后重试');
message.error('获取Token信息失败,请稍后重试');
setOverview({ ...MOCK_OVERVIEW, me: { points: 0, level: 'Lv.0' } });
setCategories(MOCK_OVERVIEW.categories);
} finally {
@ -135,7 +135,7 @@ export function usePointsMallPageLogic() {
return { ...prev, me: { ...prev.me, points: remainingPoints } };
});
}
message.success('已冻结积分并预扣库存,请继续填写收件信息');
message.success('已冻结Token并预扣库存,请继续填写收件信息');
} catch (e: any) {
const msg = e?.response?.data?.message || e?.response?.data?.error || e?.message || '兑换失败,请稍后重试';
message.error(msg);

View File

@ -52,8 +52,8 @@ export default function PointsMallH5Products({ logic }: Props) {
options={[
{ value: 'popular', label: '热度优先' },
{ value: 'newest', label: '最新上架' },
{ value: 'price_asc', label: '积分从低到高' },
{ value: 'price_desc', label: '积分从高到低' }
{ value: 'price_asc', label: 'Token从低到高' },
{ value: 'price_desc', label: 'Token从高到低' }
]}
/>
<Select
@ -95,8 +95,8 @@ export default function PointsMallH5Products({ logic }: Props) {
</div>
<div className="points-mall-product-price-row h5-points-mall-product-price-row">
<div>
<span className="points-mall-product-price">{Number(p.pointsPrice).toLocaleString()}</span>
<span className="points-mall-product-price-label"></span>
<span className="points-mall-product-price">{p.pointsPrice >= 1000 ? `${(p.pointsPrice / 1000).toFixed(1)}K` : Number(p.pointsPrice).toLocaleString()}</span>
<span className="points-mall-product-price-label">Token</span>
</div>
<Button
type="primary"
@ -104,7 +104,7 @@ export default function PointsMallH5Products({ logic }: Props) {
disabled={userPoints < p.pointsPrice || exchangeLoading}
onClick={() => handleExchangeClick(p)}
>
{userPoints < p.pointsPrice ? '积分不足' : '兑换'}
{userPoints < p.pointsPrice ? 'Token不足' : '兑换'}
</Button>
</div>
<div className="points-mall-product-footer">

View File

@ -24,9 +24,9 @@ export default function PointsMallH5Top({ logic }: Props) {
<div className="points-mall-hero h5-points-mall-hero">
<div className="points-mall-header h5-points-mall-header">
<div className="points-mall-title-section">
<h1 className="page-title stats-page-title h5-page-title"></h1>
<h1 className="page-title stats-page-title h5-page-title">Token</h1>
<p className="page-subtitle stats-page-subtitle h5-page-subtitle">
使<br /> API 1 = 1000
使tokentoken API
</p>
</div>
<div className="points-mall-balance-card h5-points-mall-balance-card">
@ -35,8 +35,8 @@ export default function PointsMallH5Top({ logic }: Props) {
) : (
<div className="points-balance-row h5-points-balance-row">
<div className="points-balance-main">
<div className="points-balance-label"></div>
<div className="points-balance-value">{userPoints.toLocaleString()}</div>
<div className="points-balance-label">Token</div>
<div className="points-balance-value">{userPoints >= 1000 ? `${(userPoints / 1000).toFixed(1)}K` : userPoints.toLocaleString()}</div>
<div className="points-balance-subtext">
${typeof totalSpentUSD === 'number' ? totalSpentUSD.toFixed(2) : '--'}
</div>

View File

@ -49,8 +49,8 @@ export default function PointsMallPageWeb({ logic }: Props) {
<div className="points-mall-hero">
<div className="points-mall-header">
<div className="points-mall-title-section">
<h1 className="page-title stats-page-title"></h1>
<p className="page-subtitle stats-page-subtitle">使 API 1 = 1000 </p>
<h1 className="page-title stats-page-title">Token</h1>
<p className="page-subtitle stats-page-subtitle">使tokentoken API </p>
</div>
<div className="points-mall-balance-card">
{overviewLoading ? (
@ -58,8 +58,8 @@ export default function PointsMallPageWeb({ logic }: Props) {
) : (
<div className="points-balance-row">
<div>
<div className="points-balance-label"></div>
<div className="points-balance-value">{userPoints.toLocaleString()}</div>
<div className="points-balance-label">Token</div>
<div className="points-balance-value">{userPoints >= 1000 ? `${(userPoints / 1000).toFixed(1)}K` : userPoints.toLocaleString()}</div>
<div className="points-balance-subtext">
${typeof totalSpentUSD === 'number' ? totalSpentUSD.toFixed(2) : '--'}
</div>
@ -152,8 +152,8 @@ export default function PointsMallPageWeb({ logic }: Props) {
options={[
{ value: 'popular', label: '热度优先' },
{ value: 'newest', label: '最新上架' },
{ value: 'price_asc', label: '积分从低到高' },
{ value: 'price_desc', label: '积分从高到低' },
{ value: 'price_asc', label: 'Token从低到高' },
{ value: 'price_desc', label: 'Token从高到低' },
]}
/>
<Select
@ -196,8 +196,8 @@ export default function PointsMallPageWeb({ logic }: Props) {
</div>
<div className="points-mall-product-price-row">
<div>
<span className="points-mall-product-price">{Number(p.pointsPrice).toLocaleString()}</span>
<span className="points-mall-product-price-label"></span>
<span className="points-mall-product-price">{p.pointsPrice >= 1000 ? `${(p.pointsPrice / 1000).toFixed(1)}K` : Number(p.pointsPrice).toLocaleString()}</span>
<span className="points-mall-product-price-label">Token</span>
</div>
<Button
type="primary"
@ -205,7 +205,7 @@ export default function PointsMallPageWeb({ logic }: Props) {
disabled={userPoints < p.pointsPrice || exchangeLoading}
onClick={() => handleExchangeClick(p)}
>
{userPoints < p.pointsPrice ? '积分不足' : '兑换'}
{userPoints < p.pointsPrice ? 'Token不足' : '兑换'}
</Button>
</div>
<div className="points-mall-product-footer">

View File

@ -13,7 +13,7 @@ export const MOCK_OVERVIEW: PointsMallOverview = {
banners: [{ id: 'b1', title: '本期活动', subtitle: 'Up to 25% Off', imageUrl: '', linkUrl: '' }],
promoEntries: [
{ id: 'p1', title: '促销活动', subtitle: '本周精选', linkUrl: '' },
{ id: 'p2', title: '积分任务', subtitle: '快速涨积分', linkUrl: '' }
{ id: 'p2', title: 'Token任务', subtitle: '快速涨Token', linkUrl: '' }
]
};

View File

@ -23,7 +23,6 @@ export default function StatsPageWeb({ logic }: { logic: StatsPageLogic }) {
<h1 className="page-title stats-page-title"></h1>
<p className="page-subtitle stats-page-subtitle">
使
1 1000
</p>
</div>
<div className="stats-page-summary-card">

View File

@ -6,9 +6,9 @@ export default function StatsPointsCard({ logic }: { logic: StatsPageLogic }) {
return (
<div className="points-integration-section">
<Card
title="消费与积分"
title="消费与Token"
className="points-integration-card"
extra={<Tag bordered={false} className="stats-soft-tag">1 USD = 1000 </Tag>}
extra={<Tag bordered={false} className="stats-soft-tag">1 USD = 1000 Token</Tag>}
>
<div className="points-integration-row">
<div className="points-integration-item">
@ -22,7 +22,7 @@ export default function StatsPointsCard({ logic }: { logic: StatsPageLogic }) {
<div className="points-integration-item">
<div className="points-integration-label">
<GiftOutlined className="stats-tone-brand-text" />
Token
</div>
<div className="points-integration-value">{logic.formatPoints(logic.totalPoints)}</div>
<div className="points-integration-desc"></div>
@ -30,10 +30,10 @@ export default function StatsPointsCard({ logic }: { logic: StatsPageLogic }) {
<div className="points-integration-item">
<div className="points-integration-label">
<BarChartOutlined className="stats-tone-success-text" />
Token
</div>
<div className="points-integration-value">1:1000</div>
<div className="points-integration-desc"> 1 1000 </div>
{/* <div className="points-integration-value">100:1</div> */}
{/* <div className="points-integration-desc">每消费 100 token 获得 1 Token</div> */}
</div>
</div>
</Card>