import { useState } from 'react'
import { useQuery, useQueryClient } from '@tanstack/react-query'
import { Card, Row, Col, Statistic, Button, Tag, Space, Typography, App } from 'antd'
import { DollarOutlined, ReloadOutlined, LinkOutlined } from '@ant-design/icons'
import { getBilling, type BillingInfo } from '@/services/billing-api'
const { Text } = Typography
function BillingCard({ p }: { p: BillingInfo }) {
const color = p.status === 'ok' ? (parseFloat(p.balance) < 10 ? '#faad14' : '#52c41a') : '#999'
return (
{p.name}{p.status === 'ok' ? '正常' : '未知'}}
extra={} href={p.consoleUrl} target="_blank">控制台}>
{p.currency}} />
模型: {p.model}
{p.note}
)
}
function BillingContent() {
const qc = useQueryClient(); const [refreshing, setRefreshing] = useState(false)
const { data } = useQuery({ queryKey: ['billing'], queryFn: getBilling, staleTime: 60_000 })
return (
API 用量
} onClick={async () => { setRefreshing(true); await qc.invalidateQueries({ queryKey: ['billing'] }); setTimeout(() => setRefreshing(false), 800) }} loading={refreshing}>刷新
{(data?.providers || []).map(p => )}
)
}
export default function BillingPage() { return }