From 285929024be06a14951d53a154bd2b69ee9c4fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B2=E8=BE=B0=E7=94=9F=E4=BA=A7?= Date: Sat, 11 Apr 2026 19:50:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E4=BA=A4=E8=A1=8C=E6=83=85=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=BB=9F=E8=AE=A1=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/News.jsx | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/frontend/src/pages/News.jsx b/frontend/src/pages/News.jsx index 892899e..981c766 100644 --- a/frontend/src/pages/News.jsx +++ b/frontend/src/pages/News.jsx @@ -481,6 +481,59 @@ export default function News() { ) : (
+ {/* 成交行情 - 统计区域 */} + {activeTab === 'deal' && (() => { + // 统计各维度 + const stats = { version: {}, packaging: {}, category: {}, platform: {}, date: {}, totalCount: infoList.length, totalAmount: 0 } + infoList.forEach(item => { + const content = item.content || '' + // 版本 + const serial = (item.title || '').split('-')[0] || '' + let version = '其他' + if (serial.startsWith('J0')) version = '龙钞' + else if (serial.startsWith('J1')) version = '马钞' + else if (serial.startsWith('J3')) version = '蛇钞' + stats.version[version] = (stats.version[version] || 0) + 1 + // 包装 + const pkg = content.match(/包装:\s*(.+?)(?:\n|$)/)?.[1]?.trim() || item.packaging || '-' + stats.packaging[pkg] = (stats.packaging[pkg] || 0) + 1 + // 分类 + const cat = content.match(/分类:\s*(.+?)(?:\n|$)/)?.[1]?.trim() || item.category || '-' + stats.category[cat] = (stats.category[cat] || 0) + 1 + // 平台 + const plat = content.match(/平台:\s*(.+?)(?:\n|$)/)?.[1]?.trim() || '-' + stats.platform[plat] = (stats.platform[plat] || 0) + 1 + // 日期 + const date = content.match(/日期:\s*(.+?)(?:\n|$)/)?.[1]?.trim() || item.deal_date || '-' + stats.date[date] = (stats.date[date] || 0) + 1 + // 总金额 + stats.totalAmount += item.deal_price || 0 + }) + + const renderStat = (title, data) => ( +
+
{title}
+
+ {Object.entries(data).sort((a,b) => b[1] - a[1]).map(([k, v]) => ( + {k} ({v}) + ))} +
+
+ ) + + return ( +
+
📊 成交行情统计
+
总成交 {stats.totalCount} 笔,总金额 ¥{stats.totalAmount.toLocaleString()}
+ {renderStat('版本分布', stats.version)} + {renderStat('包装分布', stats.packaging)} + {renderStat('号码分类', stats.category)} + {renderStat('成交平台', stats.platform)} + {renderStat('成交日期', stats.date)} +
+ ) + })()} + {infoList.map(item => { // 成交行情 tab - 按维度汇总展示 if (activeTab === 'deal') {