From b8363b31aba76cff57d8ce1a390a894c28862e48 Mon Sep 17 00:00:00 2001 From: linkeyu <798648091@qq.com> Date: Sat, 1 Aug 2026 14:12:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=9D=E7=95=99=E8=B7=B3=E8=BF=87?= =?UTF-8?q?=E5=8D=95=E5=88=B8=E6=98=8E=E7=BB=86=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(main)/coupon-data/page.tsx | 33 +++++++++++++++++------------ 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/app/(main)/coupon-data/page.tsx b/src/app/(main)/coupon-data/page.tsx index 37ca3a8..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,24 +146,22 @@ function PointScorePopover({ row }: { row: CouponDataRow }) { const [loading, setLoading] = useState(false); const [loadError, setLoadError] = useState(null); - const abandonedWithoutPointResult = + const abandonedWithoutScoredResult = row.status === 'abandoned' && row.point_success_count === 0 && row.point_total_count === 0; - if (abandonedWithoutPointResult) { - return ( - - 0.0%(退出前无结果) - - ); - } - if (row.point_success_count == null || row.point_total_count == null || 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 () => { @@ -183,6 +182,14 @@ function PointScorePopover({ row }: { row: CouponDataRow }) { } }; + if (abandonedWithoutScoredResult && !hasPointDetails) { + return ( + + {scoreWithRate} + + ); + } + return (