fix(admin-web): add null checks to prevent crash in system account report tabs
面对面结算和过期收益Tab在数据为空时会崩溃,添加空值检查修复此问题。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
66ace25935
commit
191b37a5de
|
|
@ -299,9 +299,18 @@ function RegionAccountsSection({ data, type }: { data: RegionAccountsSummary; ty
|
|||
|
||||
/**
|
||||
* 面对面结算统计区域
|
||||
* [2026-01-05] 更新:USDT改为绿积分
|
||||
* [2026-01-05] 更新:USDT改为绿积分,添加空值检查
|
||||
*/
|
||||
function OfflineSettlementSection({ data }: { data: SystemAccountReportResponse['offlineSettlement'] }) {
|
||||
function OfflineSettlementSection({ data }: { data: SystemAccountReportResponse['offlineSettlement'] | null | undefined }) {
|
||||
if (!data) {
|
||||
return (
|
||||
<div className={styles.section}>
|
||||
<h3 className={styles.sectionTitle}>面对面结算统计</h3>
|
||||
<div className={styles.emptyTable}>暂无面对面结算数据</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.section}>
|
||||
<h3 className={styles.sectionTitle}>面对面结算统计</h3>
|
||||
|
|
@ -310,7 +319,7 @@ function OfflineSettlementSection({ data }: { data: SystemAccountReportResponse[
|
|||
<div className={styles.summaryCards}>
|
||||
<div className={styles.summaryCard}>
|
||||
<span className={styles.summaryLabel}>总笔数</span>
|
||||
<span className={styles.summaryValue}>{data.totalCount}</span>
|
||||
<span className={styles.summaryValue}>{data.totalCount ?? 0}</span>
|
||||
</div>
|
||||
<div className={styles.summaryCard}>
|
||||
<span className={styles.summaryLabel}>总金额</span>
|
||||
|
|
@ -319,7 +328,7 @@ function OfflineSettlementSection({ data }: { data: SystemAccountReportResponse[
|
|||
</div>
|
||||
|
||||
{/* 按月统计 */}
|
||||
{data.byMonth.length > 0 && (
|
||||
{data.byMonth && data.byMonth.length > 0 && (
|
||||
<>
|
||||
<h4 className={styles.subTitle}>按月统计</h4>
|
||||
<div className={styles.tableWrapper}>
|
||||
|
|
@ -345,7 +354,7 @@ function OfflineSettlementSection({ data }: { data: SystemAccountReportResponse[
|
|||
</>
|
||||
)}
|
||||
|
||||
{data.byMonth.length === 0 && (
|
||||
{(!data.byMonth || data.byMonth.length === 0) && (
|
||||
<div className={styles.emptyTable}>暂无面对面结算数据</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
@ -354,9 +363,18 @@ function OfflineSettlementSection({ data }: { data: SystemAccountReportResponse[
|
|||
|
||||
/**
|
||||
* 过期收益统计区域
|
||||
* [2026-01-05] 更新:USDT改为绿积分
|
||||
* [2026-01-05] 更新:USDT改为绿积分,添加空值检查
|
||||
*/
|
||||
function ExpiredRewardsSection({ data }: { data: SystemAccountReportResponse['expiredRewards'] }) {
|
||||
function ExpiredRewardsSection({ data }: { data: SystemAccountReportResponse['expiredRewards'] | null | undefined }) {
|
||||
if (!data) {
|
||||
return (
|
||||
<div className={styles.section}>
|
||||
<h3 className={styles.sectionTitle}>过期收益统计</h3>
|
||||
<div className={styles.emptyTable}>暂无过期收益数据</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.section}>
|
||||
<h3 className={styles.sectionTitle}>过期收益统计</h3>
|
||||
|
|
@ -365,7 +383,7 @@ function ExpiredRewardsSection({ data }: { data: SystemAccountReportResponse['ex
|
|||
<div className={styles.summaryCards}>
|
||||
<div className={styles.summaryCard}>
|
||||
<span className={styles.summaryLabel}>总笔数</span>
|
||||
<span className={styles.summaryValue}>{data.totalCount}</span>
|
||||
<span className={styles.summaryValue}>{data.totalCount ?? 0}</span>
|
||||
</div>
|
||||
<div className={styles.summaryCard}>
|
||||
<span className={styles.summaryLabel}>总金额</span>
|
||||
|
|
@ -374,7 +392,7 @@ function ExpiredRewardsSection({ data }: { data: SystemAccountReportResponse['ex
|
|||
</div>
|
||||
|
||||
{/* 按权益类型统计 */}
|
||||
{data.byRightType.length > 0 && (
|
||||
{data.byRightType && data.byRightType.length > 0 && (
|
||||
<>
|
||||
<h4 className={styles.subTitle}>按权益类型统计</h4>
|
||||
<div className={styles.tableWrapper}>
|
||||
|
|
@ -401,7 +419,7 @@ function ExpiredRewardsSection({ data }: { data: SystemAccountReportResponse['ex
|
|||
)}
|
||||
|
||||
{/* 按月统计 */}
|
||||
{data.byMonth.length > 0 && (
|
||||
{data.byMonth && data.byMonth.length > 0 && (
|
||||
<>
|
||||
<h4 className={styles.subTitle}>按月统计</h4>
|
||||
<div className={styles.tableWrapper}>
|
||||
|
|
@ -427,7 +445,7 @@ function ExpiredRewardsSection({ data }: { data: SystemAccountReportResponse['ex
|
|||
</>
|
||||
)}
|
||||
|
||||
{data.byRightType.length === 0 && data.byMonth.length === 0 && (
|
||||
{(!data.byRightType || data.byRightType.length === 0) && (!data.byMonth || data.byMonth.length === 0) && (
|
||||
<div className={styles.emptyTable}>暂无过期收益数据</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue