Skip to content

feat(account): add subscription purchase page - #949

Merged
xiaocheny214 merged 2 commits into
1024XEngineer:mainfrom
huyanxius:feat/947-subscription-ui
Sep 20, 2026
Merged

xiaocheny214 merged 2 commits into
1024XEngineer:mainfrom
huyanxius:feat/947-subscription-ui

Conversation

@huyanxius

Copy link
Copy Markdown
Collaborator

为登录用户新增订阅与积分充值页面,补齐账号菜单升级入口与账号设置入口,并在支付未接入时给出明确说明。

Why

#947 需要一个可审阅的前端购买入口,让用户能快速比较套餐、选择积分充值金额并看到当前 Free 方案包含的能力。

支付、订单、会员账期和积分接口尚未接入,本次先把真实产品路由和明确的未接入提示落下来,避免点击购买后产生错误预期。

Changes

  • 新增受保护路由 /account/subscription,提供 Plus、Pro、Max 月度套餐和积分充值页签。
  • 在头像菜单显示当前 Free 方案与「升级」入口,账号设置增加「订阅与充值」入口。
  • 三张套餐卡片使用统一布局,Pro 仅显示「最受欢迎」标签,点击卡片可看到选中态。
  • 支持六个固定充值档位和自定义整数金额,前端显示按 ¥0.08/积分计算的预览值。
  • 点击购买只打开说明弹窗:支付还没有接入,请联系管理员;不会发起支付请求。

Implementation

  • 页面挂在现有 AppShellRoute 下,使用现有 React Router 和设计变量,不新增平行 mock 路由。
  • 套餐和充值金额只作为页面展示配置,不伪造接口响应;当前订阅状态保留明确的 Free 文案,等待真实会员接口接入。
  • 购买行为封装为原生 dialog 提示,后续可在同一入口替换为真实支付流程。

Verification

  • npx vitest run src/pages/subscription/index.test.tsx src/app/layout/app-header.test.tsx src/pages/account/index.test.tsx:3 个文件、58 个测试通过
  • npx tsc -b:通过
  • npx oxlint src/app/app.tsx src/app/layout/app-header.tsx src/pages/account/index.tsx src/pages/subscription/index.tsx src/pages/subscription/index.test.tsx:通过
  • npx oxfmt --check src/app/app.tsx src/app/layout/app-header.tsx src/pages/account/index.tsx src/pages/subscription/index.tsx src/pages/subscription/index.test.tsx src/pages/subscription/subscription.css:通过
  • npm run build:生产构建通过
  • git diff --check:通过

Scope

  • 本 PR 不包含支付、订单、会员账期、积分发放或真实会员/余额接口。
  • 本 PR 不包含看板娘、图片素材或独立开发的本地 mock 页面。
  • 后续接入支付与会员状态时,沿用本页入口替换说明弹窗,关联产品提案 [Proposal]: 积分充值与 Plus / Pro / Max 月度订阅 #947。

Related Issues

Closes #948
Refs #947

Signed-in users need a direct place to compare plans and buy credits.

Add the protected subscription route, account entry points, aligned plan cards, and credits purchase controls.

Keep payment and account subscription APIs out of this frontend-only delivery and explain the unavailable payment flow in a dialog.
Subscription selection and credit validation need regression coverage.

Cover rounded credit calculations, invalid custom amounts, plan selection, and the payment-unavailable dialog.

Keep the browser behavior explicit while no payment request is made.
@vercel

vercel Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
windup Ready Ready Preview Sep 19, 2026 4:00pm UTC

@codecov

codecov Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #949   +/-   ##
=======================================
  Coverage   91.27%   91.27%           
=======================================
  Files         193      193           
  Lines       13204    13204           
=======================================
  Hits        12052    12052           
  Misses       1152     1152           
Flag Coverage Δ
backend 91.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审阅了受保护路由、账号入口、套餐/充值交互和未接入支付提示。充值金额计算与路由接入符合 #947 的当前前端范围;git diff --check 通过。当前环境缺少可用的本地 Vitest 依赖,因此无法启动声明中的测试命令。

Comment thread frontend/src/pages/subscription/index.tsx
@xiaocheny214
xiaocheny214 merged commit 24e53b5 into 1024XEngineer:main Sep 20, 2026
10 checks passed

This branch was successfully deployed

1 active deployment
Preview — 6d2660f1 Deployed Sep 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: add subscription and credit purchase page

2 participants