- API 用量
- } onClick={async () => { setRefreshing(true); await qc.invalidateQueries({ queryKey: ['billing'] }); setTimeout(() => setRefreshing(false), 800) }} loading={refreshing}>刷新
+
费用总览
+
+ } onClick={() => { setEditing(null); form.resetFields(); setModalOpen(true) }}>新增费用
+ } onClick={refresh} loading={refreshing}>刷新
+
-
{(data?.providers || []).map(p => )}
+
+ {/* API 卡片 */}
+
+ {providers.map((p: BillingInfo) => (
+
+ {p.name}{p.status === 'ok' ? '正常' : '未知'}}
+ extra={}>
+
+
+
+ ))}
+
+
+ {/* 统计数字 */}
+
+
+
+
+
+
+ {/* 自定义费用卡片 */}
+
费用明细
+
+ {summary.items.map((item: CostItem) => {
+ const daysLeft = item.expiryDate ? Math.ceil((new Date(item.expiryDate).getTime() - Date.now()) / 86400000) : null
+ const isExpired = daysLeft !== null && daysLeft <= 0
+ return (
+
+
+ } onClick={() => openEdit(item)} />
+ } onClick={() => deleteCost(item)} />
+
+ }>
+
+
+ {CATEGORIES.find(c => c.value === item.category)?.label || item.category}
+ {item.billingCycle === 'monthly' ? '月付' : item.billingCycle === 'yearly' ? '年付' : '一次性'}
+ {item.expiryDate && {isExpired ? '已过期' : `${daysLeft}天后到期`}}
+
+
+
+ )
+ })}
+
+
+ {/* 到期提醒 + 月度汇总 */}
+
+
+
+
+
+
+
+
+
+ {/* Add/Edit Modal */}
+
{ setModalOpen(false); setEditing(null) }} onOk={() => form.submit()} okText="保存">
+
+
+
+
+
+
+
+
+
)
}
+
export default function BillingPage() { return