import { useEffect, useState } from 'react' import { Card, Col, Row, Statistic, Typography, Spin, message } from 'antd' import { ShopOutlined, ShoppingOutlined, DollarOutlined, PercentageOutlined, ClockCircleOutlined, } from '@ant-design/icons' import { dashboardApi } from '../api' import type { DashboardStats } from '../types' export default function Dashboard() { const [stats, setStats] = useState(null) const [loading, setLoading] = useState(true) useEffect(() => { dashboardApi .stats() .then(setStats) .catch((e) => message.error(e.message)) .finally(() => setLoading(false)) }, []) if (loading) { return (
) } return (
数据概览 } /> } /> } /> } suffix="元" /> } suffix="元" /> } valueStyle={{ color: (stats?.pending_order_count ?? 0) > 0 ? '#cf1322' : undefined }} />
) }