Skip to content

fix(admin): seed the order list search filter from the URL - #181

Closed
echoowall wants to merge 1 commit into
perfect-panel:mainfrom
echoowall:fix/order-search-param
Closed

fix(admin): seed the order list search filter from the URL#181
echoowall wants to merge 1 commit into
perfect-panel:mainfrom
echoowall:fix/order-search-param

Conversation

@echoowall

Copy link
Copy Markdown
Contributor

问题

管理端的日志页把订单号渲染成链接(OrderLink),点击后跳转到 /dashboard/order?search=<order_no>
但订单列表只从 URL 里取 user_id

// apps/admin/src/sections/order/index.tsx
const initialFilters = {
  user_id: sp.user_id ? Number(sp.user_id) : undefined,
};

search 没有被读入,于是跳过去之后搜索框是空的、列表是未筛选的全量,点击等于只做了一次页面跳转。

筛选项本身已经声明了(同文件里的 { key: "search" }),后端 GetOrderList 也支持这个参数 —— 缺的只是把 URL 参数种进初始筛选这一步

影响范围

所有经 OrderLink 渲染订单号的页面:

页面 文件
余额日志 sections/log/balance/index.tsx
订单创建日志 sections/log/order/index.tsx
重置订阅日志 sections/log/reset-subscribe/index.tsx
赠送日志 sections/log/gift/index.tsx
佣金日志 sections/log/commission/index.tsx

改动

const initialFilters = {
  search: sp.search || undefined,
  user_id: sp.user_id ? Number(sp.user_id) : undefined,
};

与用户列表页(sections/user/index.tsx)的处理方式一致 —— 那边把声明过的筛选项都从 URL 种了进去。

订单页另外还声明了 statussubscribe_id 两个筛选项,同样没有从 URL 读取;但目前仓库里没有任何地方带着这两个参数跳转过来,所以本次未一并改动,避免扩大范围。

测试

新增 apps/admin/src/sections/order/order-search-param.test.tsx,mock 掉 ProTable 以捕获 initialFilters

用例 断言
URL 带 search initialFilters.search 等于该值
URL 带 user_id initialFilters.user_id 仍是数字 42

第一个用例在撤掉本次改动后会失败(expected { user_id: undefined } to match object { search }),第二个用例改动前后都通过,用作既有行为的回归护栏。

Test Files  8 passed (8)
     Tests  35 passed (35)

biome check 对改动的两个文件无告警。

`OrderLink` navigates to /dashboard/order?search=<order_no>, but the
order list only reads `user_id` out of the URL, so the search box stays
empty and the unfiltered list is shown. The filter itself is already
declared (`{ key: "search" }`) and the API supports it — only the
seeding was missing.

Every order number rendered through `OrderLink` is affected: the
balance, order-creation, subscription-reset, gift and commission logs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for ppane-docs ready!

Name Link
🔨 Latest commit 59e597f
🔍 Latest deploy log https://app.netlify.com/projects/ppane-docs/deploys/6a9aeebadf7f1100085e5b56
😎 Deploy Preview https://deploy-preview-181--ppane-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@web-ppanel

Copy link
Copy Markdown
Contributor

This pull request was created with an AI agent during triage. We do not merge agent-generated pull requests in this repository, even when the proposed change is narrowly scoped. Closing without merging. A maintainer can apply the underlying one-line fix independently if desired.

@web-ppanel web-ppanel closed this Sep 4, 2026
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.

2 participants