Skip to content

fix(classic): use configured top-up currency - #5537

Open
a0yark wants to merge 1 commit into
QuantumNous:mainfrom
a0yark:fix/classic-topup-currency
Open

fix(classic): use configured top-up currency#5537
a0yark wants to merge 1 commit into
QuantumNous:mainfrom
a0yark:fix/classic-topup-currency

Conversation

@a0yark

@a0yark a0yark commented Jun 16, 2026

Copy link
Copy Markdown

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

经典前端充值页的实付金额展示原先直接拼接 ,导致站点设置为 USD 或自定义货币时仍显示人民币单位。
本次改动复用已有的货币配置读取逻辑,根据当前 quota_display_type 对应的符号格式化支付金额,并让确认弹窗中的实付金额、原价和优惠金额保持一致。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

$ bunx prettier "src/components/topup/index.jsx" "src/components/topup/modals/PaymentConfirmModal.jsx" --check
Checking formatting...
All matched files use Prettier code style!

$ bun run build
$ rsbuild build
ready   built in 5.52 s

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The top-up component imports getCurrencyConfig and introduces a formatPaymentAmount helper that prepends the configured currency symbol and formats values to two decimal places. renderAmount is updated to use this helper instead of the hardcoded "元" suffix, and PaymentConfirmModal receives formatPaymentAmount as a new prop to apply the same formatting to original price and discount values.

Changes

Top-up currency formatting

Layer / File(s) Summary
formatPaymentAmount helper and renderAmount update
web/classic/src/components/topup/index.jsx
Adds getCurrencyConfig import, defines formatPaymentAmount (configured symbol + two-decimal numeric output), replaces hardcoded in renderAmount, and passes formatPaymentAmount to PaymentConfirmModal.
PaymentConfirmModal consumes formatPaymentAmount
web/classic/src/components/topup/modals/PaymentConfirmModal.jsx
Adds formatPaymentAmount to destructured props and applies it to render "原价" (original price) and "优惠" (discount) values, replacing inline toFixed(2) + hardcoded formatting.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

  • QuantumNous/new-api#2111: Also updates top-up amount rendering to use the configured currency symbol instead of a hardcoded suffix, specifically in RechargeCard.jsx, which is the same class of fix applied here to index.jsx and PaymentConfirmModal.jsx.

Suggested reviewers

  • seefs001

Poem

🐰 No more "元" glued on with paste,
The currency symbol's now correctly placed!
getCurrencyConfig hops into view,
$, , or ¥ — it picks the right cue.
The rabbit cheers: localization wins the race! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing hardcoded CNY currency to use configured currency for top-up display.
Linked Issues check ✅ Passed The PR fully addresses issue #5494 by importing getCurrencyConfig and replacing hardcoded '元' currency symbols with dynamically configured currency symbols in top-up components.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the currency display issue in the top-up component, with no unrelated modifications present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ardi4s

ardi4s commented Jun 21, 2026

Copy link
Copy Markdown

Thanks for the fix in the classic layout, it works perfectly now.

However, the same issue still persists in the new frontend (default). The subscription plan price is still hardcoded with the dollar ($), ignoring the configured currency settings. Could you please apply the same fix to the new frontend as well?

image

@Calcium-Ion
Calcium-Ion force-pushed the main branch 2 times, most recently from 51fdfc5 to 2b6f1df Compare August 30, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants