成交行情添加统计区域
This commit is contained in:
parent
55f0c9aa23
commit
285929024b
|
|
@ -481,6 +481,59 @@ export default function News() {
|
|||
</div>
|
||||
) : (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
||||
{/* 成交行情 - 统计区域 */}
|
||||
{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) => (
|
||||
<div style={{ marginBottom: '12px' }}>
|
||||
<div style={{ color: '#94a3b8', fontSize: '12px', marginBottom: '6px' }}>{title}</div>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '6px' }}>
|
||||
{Object.entries(data).sort((a,b) => b[1] - a[1]).map(([k, v]) => (
|
||||
<span key={k} style={{ background: '#3b82f6', color: '#fff', padding: '4px 10px', borderRadius: '6px', fontSize: '12px' }}>{k} ({v})</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
return (
|
||||
<div style={{ background: '#1e293b', borderRadius: '12px', padding: '16px', marginBottom: '12px' }}>
|
||||
<div style={{ color: '#fff', fontSize: '16px', fontWeight: '600', marginBottom: '12px' }}>📊 成交行情统计</div>
|
||||
<div style={{ color: '#22c55e', fontSize: '14px', marginBottom: '16px' }}>总成交 {stats.totalCount} 笔,总金额 ¥{stats.totalAmount.toLocaleString()}</div>
|
||||
{renderStat('版本分布', stats.version)}
|
||||
{renderStat('包装分布', stats.packaging)}
|
||||
{renderStat('号码分类', stats.category)}
|
||||
{renderStat('成交平台', stats.platform)}
|
||||
{renderStat('成交日期', stats.date)}
|
||||
</div>
|
||||
)
|
||||
})()}
|
||||
|
||||
{infoList.map(item => {
|
||||
// 成交行情 tab - 按维度汇总展示
|
||||
if (activeTab === 'deal') {
|
||||
|
|
|
|||
Loading…
Reference in New Issue