diff --git a/src/app/(main)/coupon-data/page.tsx b/src/app/(main)/coupon-data/page.tsx index 8f4ed8f..1258b7c 100644 --- a/src/app/(main)/coupon-data/page.tsx +++ b/src/app/(main)/coupon-data/page.tsx @@ -76,6 +76,7 @@ interface CouponDataRow { claimed_count: number | null; point_success_count: number | null; point_total_count: number | null; + point_event_count?: number; // 兼容旧后端的内嵌明细;新后端不再返回,改为点击后按 trace 加载。 point_details?: CouponPointDetail[]; trace_url: string | null; @@ -145,15 +146,22 @@ function PointScorePopover({ row }: { row: CouponDataRow }) { const [loading, setLoading] = useState(false); const [loadError, setLoadError] = useState(null); - if (row.point_success_count == null || row.point_total_count == null || row.point_total_count <= 0) { + const abandonedWithoutScoredResult = + row.status === 'abandoned' && row.point_success_count === 0 && row.point_total_count === 0; + if ( + row.point_success_count == null || + row.point_total_count == null || + (row.point_total_count <= 0 && !abandonedWithoutScoredResult) + ) { return -; } const score = `${row.point_success_count}/${row.point_total_count}`; - const scoreWithRate = `${score}(${( - row.point_success_count / row.point_total_count * 100 - ).toFixed(1)}%)`; + const hasPointDetails = (row.point_event_count ?? 0) > 0; + const scoreWithRate = abandonedWithoutScoredResult + ? `0.0%(${hasPointDetails ? '无有效结果' : '退出前无结果'})` + : `${score}(${(row.point_success_count / row.point_total_count * 100).toFixed(1)}%)`; const scoreColor = - row.point_success_count === row.point_total_count + row.point_total_count > 0 && row.point_success_count === row.point_total_count ? STATUS_TAG.completed.color : STATUS_TAG.abandoned.color; const loadDetails = async () => { @@ -174,6 +182,14 @@ function PointScorePopover({ row }: { row: CouponDataRow }) { } }; + if (abandonedWithoutScoredResult && !hasPointDetails) { + return ( + + {scoreWithRate} + + ); + } + return (