38 lines
1.6 KiB
TypeScript
38 lines
1.6 KiB
TypeScript
import React, { useEffect, useState } from 'react';
|
|||
|
|
import { PageContainer } from '@ant-design/pro-components';
|
||
|
|
import { Card, Col, Row, Statistic, message, Button } from 'antd';
|
||
|
|
import TenantScopeFilter from '@/components/TenantScopeFilter';
|
||
|
|
import { ordersApi } from '@/services/orders';
|
||
|
|
import { ActionBar } from '@/components/ui';
|
||
|
|
|
||
|
|
const ProfitSharingStatisticsPage: React.FC = () => {
|
||
|
|
const [loading, setLoading] = useState(false);
|
||
|
|
const [stat, setStat] = useState<any>({});
|
||
|
|
|
||
|
|
const load = async () => {
|
||
|
|
setLoading(true);
|
||
|
|
try {
|
||
|
|
const res = await ordersApi.getProfitSharingStatistics();
|
||
|
|
setStat(res?.data || res);
|
||
|
|
} catch (e) {
|
||
|
|
message.error('加载统计失败');
|
||
|
|
} finally { setLoading(false); }
|
||
|
|
};
|
||
|
|
|
||
|
|
useEffect(() => { load(); }, []);
|
||
|
|
|
||
|
|
return (
|
||
|
|
<PageContainer header={{ title: '分账统计' }} extra={<TenantScopeFilter onChanged={() => load()} /> }>
|
||
|
|
<ActionBar right={<Button size="middle" onClick={() => load()}>刷新</Button>} />
|
||
|
|
<Row gutter={16}>
|
||
|
|
<Col span={6}><Card loading={loading}><Statistic title="总分账额" value={stat?.totalSharingAmount || 0} precision={2} /></Card></Col>
|
||
|
|
<Col span={6}><Card loading={loading}><Statistic title="分账笔数" value={stat?.sharingCount || 0} /></Card></Col>
|
||
|
|
<Col span={6}><Card loading={loading}><Statistic title="成功笔数" value={stat?.successCount || 0} /></Card></Col>
|
||
|
|
<Col span={6}><Card loading={loading}><Statistic title="失败笔数" value={stat?.failedCount || 0} /></Card></Col>
|
||
|
|
</Row>
|
||
|
|
</PageContainer>
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
export default ProfitSharingStatisticsPage;
|