feat: 订单列表按市场分组并支持跳转到Polymarket

- 后端添加市场slug和分类字段
  - 在 BuyOrderInfo、SellOrderInfo、MatchedOrderInfo DTO 中添加 marketSlug 和 marketCategory 字段
  - 在 CopyTradingStatisticsService 中填充这些字段(从 Market 实体获取)

- 前端实现按市场分组功能
  - 添加分组视图切换开关(列表视图/分组视图)
  - 分组显示:按市场分组,显示市场名称、订单数、总金额、盈亏等统计信息
  - 买入订单分组显示是否完全成交状态(全部成交/部分成交)
  - 卖出订单分组显示总盈亏
  - 支持展开/折叠功能(单个和全部)
  - 桌面端默认全部展开,移动端默认全部折叠

- 市场名称点击跳转功能
  - 添加 getPolymarketUrl 工具函数,根据市场分类构建URL
  - sports 分类市场跳转到 /moneyline 页面(spread 市场)
  - 其他分类市场跳转到普通市场页面
  - 如果没有 slug,使用 marketId 作为后备(跳转到 condition 页面)
  - 分组视图、列表视图、移动端卡片视图均支持点击跳转

- 多语言支持
  - 添加分组相关翻译键:groupByMarket、expandAll、collapseAll、allFullyMatched、partiallyMatched、orderCount、totalAmount、totalPnl、statusBreakdown
This commit is contained in:
WrBug
2026-01-08 12:39:09 +08:00
parent d376a82ccc
commit 2af2c0e86a
9 changed files with 868 additions and 101 deletions
@@ -41,6 +41,8 @@ data class BuyOrderInfo(
val leaderTradeId: String,
val marketId: String,
val marketTitle: String? = null, // 市场名称
val marketSlug: String? = null, // 市场 slug(用于构建 URL
val marketCategory: String? = null, // 市场分类(sports, crypto 等)
val side: String,
val quantity: String,
val price: String,
@@ -59,6 +61,8 @@ data class SellOrderInfo(
val leaderTradeId: String,
val marketId: String,
val marketTitle: String? = null, // 市场名称
val marketSlug: String? = null, // 市场 slug(用于构建 URL
val marketCategory: String? = null, // 市场分类(sports, crypto 等)
val side: String,
val quantity: String,
val price: String,
@@ -75,6 +79,8 @@ data class MatchedOrderInfo(
val buyOrderId: String,
val marketId: String? = null, // 市场ID(从买入订单获取)
val marketTitle: String? = null, // 市场名称
val marketSlug: String? = null, // 市场 slug(用于构建 URL
val marketCategory: String? = null, // 市场分类(sports, crypto 等)
val matchedQuantity: String,
val buyPrice: String,
val sellPrice: String,
@@ -179,6 +179,8 @@ class CopyTradingStatisticsService(
leaderTradeId = order.leaderBuyTradeId,
marketId = order.marketId,
marketTitle = market?.title,
marketSlug = market?.slug,
marketCategory = market?.category,
side = order.side,
quantity = order.quantity.toString(),
price = order.price.toString(),
@@ -232,6 +234,8 @@ class CopyTradingStatisticsService(
leaderTradeId = record.leaderSellTradeId,
marketId = record.marketId,
marketTitle = market?.title,
marketSlug = market?.slug,
marketCategory = market?.category,
side = record.side,
quantity = record.totalMatchedQuantity.toString(),
price = record.sellPrice.toString(),
@@ -293,6 +297,8 @@ class CopyTradingStatisticsService(
buyOrderId = detail.buyOrderId,
marketId = matchRecord?.marketId,
marketTitle = market?.title,
marketSlug = market?.slug,
marketCategory = market?.category,
matchedQuantity = detail.matchedQuantity.toString(),
buyPrice = detail.buyPrice.toString(),
sellPrice = detail.sellPrice.toString(),