feat: 订单列表按市场分组功能重构

- 后端实现按市场分组的订单列表接口
  - 添加 MarketGroupedOrdersRequest、MarketOrderStats、MarketOrderGroup、MarketGroupedOrdersResponse DTO
  - 实现 getBuyOrderListGroupedByMarket 和 getSellOrderListGroupedByMarket 方法
  - 添加 POST /api/copy-trading/orders/grouped-by-market 接口
  - 支持分页和统计信息(订单数、总金额、盈亏、成交状态等)

- 前端重构:移除前端分组逻辑,改为调用后端分组接口
  - BuyOrdersTab 和 SellOrdersTab 使用后端分组接口
  - 移除前端 useMemo 分组计算逻辑
  - 添加分组数据状态管理和分页支持

- 分组默认折叠状态
  - 移除桌面端自动展开逻辑
  - 所有设备默认折叠,用户手动展开

- 修复 moneyline URL 逻辑
  - getPolymarketUrl 函数添加 isMoneyline 参数
  - 暂时不自动跳转到 moneyline 页面(需要后端提供标识)

- 多语言支持
  - 添加 markets 翻译键(中文、繁体中文、英文)
This commit is contained in:
WrBug
2026-01-08 13:19:52 +08:00
parent 2af2c0e86a
commit 3d5a923caf
11 changed files with 524 additions and 182 deletions
+9 -6
View File
@@ -96,24 +96,27 @@ export const isAutoGeneratedOrderId = (orderId: string | undefined | null): bool
/**
* 构建 Polymarket 市场 URL
* 对于 spread 市场(sports 分类),跳转到 moneyline 页面
* 对于 moneyline 市场,跳转到 moneyline 页面
* 注意:目前无法自动判断市场是否为 moneyline,需要后端提供标识
* @param marketSlug - 市场 slug
* @param marketCategory - 市场分类(sports, crypto 等)
* @param marketId - 市场ID(作为后备)
* @param isMoneyline - 是否为 moneyline 市场(需要后端提供)
* @returns Polymarket URL,如果无法构建则返回 null
*/
export const getPolymarketUrl = (
marketSlug?: string | null,
marketCategory?: string | null,
marketId?: string | null
_marketCategory?: string | null, // 保留参数以便未来使用
marketId?: string | null,
isMoneyline?: boolean
): string | null => {
// 优先使用 slug
if (marketSlug) {
// 如果是 sports 分类,跳转到 moneyline 页面spread 市场)
if (marketCategory?.toLowerCase() === 'sports') {
// 如果是 moneyline 市场,跳转到 moneyline 页面
if (isMoneyline === true) {
return `https://polymarket.com/event/${marketSlug}/moneyline`
}
// 其他分类跳转到普通市场页面
// 其他市场跳转到普通市场页面
return `https://polymarket.com/event/${marketSlug}`
}