feat(admin-web): show per-session ad revenue column in comparison + coupon tables

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
guke
2026-07-10 15:08:35 +08:00
parent d5acf3d1e1
commit 5bf6db7ae4
3 changed files with 27 additions and 2 deletions
+13 -1
View File
@@ -184,6 +184,18 @@ export default function ComparisonRecordsPage() {
<b style={{ color: r.saved_amount_cents > 0 ? '#3f8600' : '#999' }}>{yuan(r.saved_amount_cents)}</b> <b style={{ color: r.saved_amount_cents > 0 ? '#3f8600' : '#999' }}>{yuan(r.saved_amount_cents)}</b>
), ),
}, },
{
title: '广告收益',
key: 'ad_revenue',
width: 96,
align: 'right',
render: (_, r) =>
r.ad_revenue_yuan > 0 ? (
<span style={{ color: '#3f8600' }}>¥{r.ad_revenue_yuan.toFixed(4)}</span>
) : (
<span style={{ color: '#ccc' }}>-</span>
),
},
{ title: '耗时', dataIndex: 'total_ms', width: 64, render: fmtMs }, { title: '耗时', dataIndex: 'total_ms', width: 64, render: fmtMs },
{ title: '步', dataIndex: 'step_count', width: 48, render: (v) => v ?? '-' }, { title: '步', dataIndex: 'step_count', width: 48, render: (v) => v ?? '-' },
{ title: 'LLM', dataIndex: 'llm_call_count', width: 56, render: (v) => v ?? '-' }, { title: 'LLM', dataIndex: 'llm_call_count', width: 56, render: (v) => v ?? '-' },
@@ -297,7 +309,7 @@ export default function ComparisonRecordsPage() {
showTotal: (t) => `${t}`, showTotal: (t) => `${t}`,
onChange, onChange,
}} }}
scroll={{ x: 1820 }} scroll={{ x: 1920 }}
onRow={(r) => ({ onClick: () => openDetail(r.id), style: { cursor: 'pointer' } })} onRow={(r) => ({ onClick: () => openDetail(r.id), style: { cursor: 'pointer' } })}
/> />
+13 -1
View File
@@ -73,6 +73,7 @@ interface CouponDataRow {
started_at: string; started_at: string;
claimed_count: number | null; claimed_count: number | null;
trace_url: string | null; trace_url: string | null;
ad_revenue_yuan: number; // 本次领券看的信息流广告预估收益(元)
} }
interface CouponDataReport { interface CouponDataReport {
date_from: string; date_from: string;
@@ -123,6 +124,10 @@ const fmtSec = (ms: number | null | undefined): string =>
const fmtPct = (v: number | null | undefined): string => const fmtPct = (v: number | null | undefined): string =>
v == null ? '-' : `${(v * 100).toFixed(1)}%`; v == null ? '-' : `${(v * 100).toFixed(1)}%`;
// 元(小数)→ "¥0.0050"(空/≤0 显示 -)。单次广告收益很小,保留 4 位。
const fmtYuan = (v: number | null | undefined): string =>
v == null || v <= 0 ? '-' : `¥${v.toFixed(4)}`;
// 汇总卡成功率口径 tooltip 文案 // 汇总卡成功率口径 tooltip 文案
const FULL_RATE_HINT = const FULL_RATE_HINT =
'整单成功率:一次领券勾选的平台全部至少领到一张的场次 ÷ 领券发起数;基数含未完成/失败/中途退出。'; '整单成功率:一次领券勾选的平台全部至少领到一张的场次 ÷ 领券发起数;基数含未完成/失败/中途退出。';
@@ -469,6 +474,13 @@ export default function CouponDataPage() {
align: 'right', align: 'right',
render: (v: number | null) => fmtSec(v), render: (v: number | null) => fmtSec(v),
}, },
{
title: '广告收益',
dataIndex: 'ad_revenue_yuan',
width: 100,
align: 'right',
render: (v: number) => fmtYuan(v),
},
{ {
title: '美团耗时', title: '美团耗时',
key: 'mt_elapsed', key: 'mt_elapsed',
@@ -863,7 +875,7 @@ export default function CouponDataPage() {
onChange: (p) => load(p, queriedLimit), onChange: (p) => load(p, queriedLimit),
}} }}
size="small" size="small"
scroll={{ x: 1450 }} scroll={{ x: 1560 }}
/> />
<UserRecordsDrawer<CouponDataRow> <UserRecordsDrawer<CouponDataRow>
+1
View File
@@ -359,6 +359,7 @@ export interface ComparisonRecordListItem {
rom_name: string | null; rom_name: string | null;
android_version: string | null; android_version: string | null;
app_version: string | null; app_version: string | null;
ad_revenue_yuan: number; // 本次比价看的信息流广告预估收益(元)
created_at: string; created_at: string;
} }