fix(mining-admin-web): 适配planting-ledger后端返回数据格式

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-12 04:12:22 -08:00
parent bc191791e8
commit 4ca4fc9135
1 changed files with 11 additions and 17 deletions

View File

@ -138,41 +138,35 @@ export function PlantingLedger({ accountSequence }: PlantingLedgerProps) {
<Table> <Table>
<TableHeader> <TableHeader>
<TableRow> <TableRow>
<TableHead></TableHead> <TableHead>ID</TableHead>
<TableHead className="text-right"></TableHead> <TableHead className="text-right"></TableHead>
<TableHead className="text-right"></TableHead> <TableHead className="text-right"></TableHead>
<TableHead></TableHead> <TableHead className="text-right"></TableHead>
<TableHead></TableHead> <TableHead></TableHead>
<TableHead></TableHead> <TableHead></TableHead>
<TableHead></TableHead>
</TableRow> </TableRow>
</TableHeader> </TableHeader>
<TableBody> <TableBody>
{data.items.length === 0 ? ( {data.items.length === 0 ? (
<TableRow> <TableRow>
<TableCell colSpan={7} className="text-center py-8 text-muted-foreground"> <TableCell colSpan={6} className="text-center py-8 text-muted-foreground">
</TableCell> </TableCell>
</TableRow> </TableRow>
) : ( ) : (
data.items.map((item) => ( data.items.map((item: any) => (
<TableRow key={item.orderId}> <TableRow key={item.id || item.orderId}>
<TableCell className="font-mono text-sm">{item.orderNo}</TableCell> <TableCell className="font-mono text-sm">{item.originalAdoptionId || item.orderNo}</TableCell>
<TableCell className="text-right font-mono">{formatNumber(item.treeCount)}</TableCell> <TableCell className="text-right font-mono">{formatNumber(item.treeCount)}</TableCell>
<TableCell className="text-right font-mono">{formatDecimal(item.totalAmount, 2)}</TableCell> <TableCell className="text-right font-mono">{formatDecimal(item.contributionPerTree || '0', 4)}</TableCell>
<TableCell className="text-sm"> <TableCell className="text-right font-mono">{formatDecimal(item.totalContribution || item.totalAmount || '0', 4)}</TableCell>
{item.selectedProvince || '-'} / {item.selectedCity || '-'}
</TableCell>
<TableCell> <TableCell>
<Badge variant={getStatusVariant(item.status)}> <Badge variant={getStatusVariant(item.status)}>
{plantingStatusLabels[item.status] || item.status} {plantingStatusLabels[item.status] || item.status}
</Badge> </Badge>
</TableCell> </TableCell>
<TableCell className="text-sm text-muted-foreground"> <TableCell className="text-sm text-muted-foreground">
{formatDateTime(item.createdAt)} {item.adoptionDate ? formatDateTime(item.adoptionDate) : (item.createdAt ? formatDateTime(item.createdAt) : '-')}
</TableCell>
<TableCell className="text-sm text-muted-foreground">
{item.paidAt ? formatDateTime(item.paidAt) : '-'}
</TableCell> </TableCell>
</TableRow> </TableRow>
)) ))