feat(billing): show subscription quota usage in admin usage records (#6)
This commit was merged in pull request #6.
This commit is contained in:
@@ -450,6 +450,11 @@ function UsageRecordsTable({
|
||||
result: PagedResult<UsageRecord>;
|
||||
onPage: (page: number) => void;
|
||||
}) {
|
||||
const formatBillingSource = (row: UsageRecord) => {
|
||||
if (row.billingSource === 'subscription') return '套餐额度';
|
||||
return `¥${formatYuan(row.costCents)}`;
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="admin-table-wrap">
|
||||
@@ -474,8 +479,10 @@ function UsageRecordsTable({
|
||||
</td>
|
||||
<td className="billing-num">{row.inputTokens.toLocaleString()}</td>
|
||||
<td className="billing-num">{row.outputTokens.toLocaleString()}</td>
|
||||
<td className="billing-num">¥{formatYuan(row.costCents)}</td>
|
||||
<td className="billing-num">¥{formatYuan(row.balanceAfterCents)}</td>
|
||||
<td className="billing-num">{formatBillingSource(row)}</td>
|
||||
<td className="billing-num">
|
||||
{row.billingSource === 'subscription' ? '—' : `¥${formatYuan(row.balanceAfterCents)}`}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
|
||||
@@ -238,7 +238,9 @@ export function DashboardPage() {
|
||||
<td>
|
||||
in {row.inputTokens} / out {row.outputTokens}
|
||||
</td>
|
||||
<td>¥{formatYuan(row.costCents)}</td>
|
||||
<td>
|
||||
{row.billingSource === 'subscription' ? '套餐额度' : `¥${formatYuan(row.costCents)}`}
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user