no message

This commit is contained in:
PC-202306242200\Administrator
2024-09-20 18:32:02 +08:00
parent 43e4dfa700
commit 3211af2247
8 changed files with 15 additions and 13 deletions

151
src/pages/index/index.tsx Normal file
View File

@@ -0,0 +1,151 @@
import React, { useState, useEffect } from 'react';
import { PageContainer, ProTable } from '@ant-design/pro-components';
import { Card, Col, Row, Statistic, Divider, Tag, Image } from 'antd';
import { ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons';
import { statMallStatistics, getAmountAndGoodsCount } from '@/services/home/index'
import { Line } from '@ant-design/charts';
export default () => {
const [deviceData, setDeviceData] = useState([]);
const [profit, setProfit] = useState([]);
const [shop, setShop] = useState([]);
const deviceConfig = {
data: deviceData,
xField: 'name',
yField: 'value',
seriesField: 'type',
xAxis: {
type: 'time',
},
padding: 'auto',
legend: { position: 'right-top' },
yAxis: {
label: {
// 数值格式化为千分位
formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`),
},
},
};
useEffect(() => {
statMallStatistics().then((res) => {
setProfit(res.data)
})
getAmountAndGoodsCount().then((res) => {
let list = []
res.data.map((item, index) => {
list.push({
"name": item.createTime,
"category": "商品数量",
"value": item.goodsCount,
"type": 1
})
list.push({
"name": item.createTime,
"category": "金额",
"value": item.amountCount,
"type": 2
})
})
setDeviceData(list)
})
}, []);
return (
<>
<Divider></Divider>
<Row gutter={10}>
<Col span={6}>
<Card>
<Statistic
title="今日充电"
value={profit?.device_count?.today}
precision={2}
prefix="¥"
/>
</Card>
</Col>
<Col span={6}>
<Card>
<Statistic
title="昨日充电"
value={profit?.device_count?.yesterday}
precision={2}
prefix="¥"
/>
</Card>
</Col>
<Col span={6}>
<Card>
<Statistic
title="上周充电"
value={profit?.device_count?.week}
precision={2}
prefix="¥"
/>
</Card>
</Col>
<Col span={6}>
<Card>
<Statistic
title="上月充电"
value={profit?.device_count?.month}
precision={2}
prefix="¥"
/>
</Card>
</Col>
</Row>
<Divider></Divider>
<Row gutter={10}>
<Col span={6}>
<Card>
<Statistic
title="今天成交"
value={profit?.todayTransaction}
precision={2}
prefix="¥"
/>
</Card>
</Col>
<Col span={6}>
<Card>
<Statistic
title="昨天成交"
value={profit?.yesterdayTransaction}
precision={2}
prefix="¥"
/>
</Card>
</Col>
<Col span={6}>
<Card>
<Statistic
title="上周成交"
value={profit?.lastWeekTransaction}
precision={2}
prefix="¥"
/>
</Card>
</Col>
<Col span={6}>
<Card>
<Statistic
title="上月成交"
value={profit?.lastMonthTransaction}
precision={2}
prefix="¥"
/>
</Card>
</Col>
</Row>
<Divider>(/)-线</Divider>
<Line {...deviceConfig} />
</>
);
};