Commit 701a9836 authored by Bill's avatar Bill

refactor: 重构首页

parent aa9d996a
...@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'; ...@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import { FilterTable, SchemaFlexRowLayout, SchemaFlexColumnLayout } from '../components/FilterTable'; import { FilterTable, SchemaFlexRowLayout, SchemaFlexColumnLayout } from '../components/FilterTable';
import { Card, Input, Button, Table, Dropdown, Menu, Select, Space, Popconfirm, Modal } from 'antd'; import { Card, Input, Button, Table, Dropdown, Menu, Select, Space, Popconfirm, Modal } from 'antd';
import { createVirtualBox, createFormActions, FormEffectHooks, createEffectHook } from '@formily/antd'; import { createVirtualBox, createFormActions, FormEffectHooks, createEffectHook } from '@formily/antd';
import { history, Link } from 'umi'; import { history, Link } from 'umi';
import { DownOutlined, DeleteOutlined, UpOutlined } from '@ant-design/icons'; import { DownOutlined, DeleteOutlined, UpOutlined } from '@ant-design/icons';
import { timeRange } from '@/utils/index'; import { timeRange } from '@/utils/index';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
...@@ -41,14 +41,14 @@ const Announcements = () => { ...@@ -41,14 +41,14 @@ const Announcements = () => {
state.visible = false; state.visible = false;
}) })
}) })
merge( merge(
onFieldValueChange$('columnType'), onFieldValueChange$('columnType'),
onFieldValueChange$('status'), onFieldValueChange$('status'),
onFieldValueChange$('time'), onFieldValueChange$('time'),
).subscribe( ).subscribe(
fieldState => { fieldState => {
if(fieldState.active && fieldState.value != null) { if(fieldState.active && fieldState.value != null) {
handleSearch({}) handleSearch({})
} }
...@@ -58,7 +58,7 @@ const Announcements = () => { ...@@ -58,7 +58,7 @@ const Announcements = () => {
onFieldValueChange$('pagination').subscribe((state) => { onFieldValueChange$('pagination').subscribe((state) => {
handleSearch({...state.value}) handleSearch({...state.value})
}) })
} }
const handleSearch = async (params) => { const handleSearch = async (params) => {
...@@ -71,9 +71,9 @@ const Announcements = () => { ...@@ -71,9 +71,9 @@ const Announcements = () => {
title: title || '', title: title || '',
columnType: columnType != 0 ? columnType : '', columnType: columnType != 0 ? columnType : '',
status: status != 0 ? status : '', status: status != 0 ? status : '',
startTime: st && st * 1000, startTime: st,
endTime: et && et * 1000, endTime: et,
current: 1, current: 1,
pageSize: 10, pageSize: 10,
...params ...params
} }
...@@ -91,7 +91,7 @@ const Announcements = () => { ...@@ -91,7 +91,7 @@ const Announcements = () => {
}) })
} }
}) })
} }
// 修改状态 // 修改状态
...@@ -115,7 +115,7 @@ const Announcements = () => { ...@@ -115,7 +115,7 @@ const Announcements = () => {
return ( return (
<Card> <Card>
<FilterTable <FilterTable
schema={advertisementSchema} schema={advertisementSchema}
components={{ components={{
CustomSearch, CustomSearch,
...@@ -155,7 +155,7 @@ const Announcements = () => { ...@@ -155,7 +155,7 @@ const Announcements = () => {
</span> </span>
) )
}, },
toggleFilters: () => { toggleFilters: () => {
actions.setFieldState('FILTERS', state => { actions.setFieldState('FILTERS', state => {
const visible = !state.visible; const visible = !state.visible;
...@@ -182,7 +182,7 @@ const Announcements = () => { ...@@ -182,7 +182,7 @@ const Announcements = () => {
<a> <a>
删除 删除
</a> </a>
</Menu.Item> </Menu.Item>
</Menu> </Menu>
) )
return ( return (
...@@ -198,7 +198,7 @@ const Announcements = () => { ...@@ -198,7 +198,7 @@ const Announcements = () => {
</Popconfirm> </Popconfirm>
{/* // 只有待上架, 已下架架才有 修改和删除 */} {/* // 只有待上架, 已下架架才有 修改和删除 */}
{ {
canModify.includes(record.status) canModify.includes(record.status)
? ( ? (
<Dropdown overlay={menu}> <Dropdown overlay={menu}>
<a> <a>
...@@ -219,4 +219,4 @@ const Announcements = () => { ...@@ -219,4 +219,4 @@ const Announcements = () => {
) )
} }
export default Announcements; export default Announcements;
\ No newline at end of file
...@@ -80,7 +80,8 @@ const ADVERTISE_APP_COLUMN_TYPE = { ...@@ -80,7 +80,8 @@ const ADVERTISE_APP_COLUMN_TYPE = {
// 内容管理 - 公告栏目 // 内容管理 - 公告栏目
const ANNOUNCE_COLUMN_TYPE = { const ANNOUNCE_COLUMN_TYPE = {
'1': '会员首页公告', '1': '会员首页公告',
'2': '注册须知' '2': '注册须知',
'3': '入库须知'
} }
// 内容管理 - 图片管理 - 使用场景 // 内容管理 - 图片管理 - 使用场景
......
...@@ -3,13 +3,19 @@ import React from 'react'; ...@@ -3,13 +3,19 @@ import React from 'react';
import { Chart, Tooltip, Point, Line, Interval } from "bizcharts"; import { Chart, Tooltip, Point, Line, Interval } from "bizcharts";
interface IProps { interface IProps {
currentIndex: number, data: {
dateTime: string | {},
count: number,
amount: number
}[],
height: number,
} }
const colors = ["#6394f9", "#62daaa"]; const colors = ["#6394f9", "#62daaa"];
const ColumnChart: React.FC<IProps> = (props) => { const ColumnChart: React.FC<IProps> = (props) => {
const { data, height } = props;
return ( return (
<Chart height={302} autoFit data={props.data} > <Chart height={height} autoFit data={data} >
<Tooltip shared /> <Tooltip shared />
<Interval <Interval
tooltip={['dateTime*count', (text, num) => { tooltip={['dateTime*count', (text, num) => {
...@@ -49,4 +55,8 @@ const ColumnChart: React.FC<IProps> = (props) => { ...@@ -49,4 +55,8 @@ const ColumnChart: React.FC<IProps> = (props) => {
) )
} }
ColumnChart.defaultProps = {
height: 302
}
export default ColumnChart; export default ColumnChart;
...@@ -12,46 +12,67 @@ const OrderContainer = () => { ...@@ -12,46 +12,67 @@ const OrderContainer = () => {
const { loading, responseData, ref } = useViewRequest<GetReportPlatformHomeGetTradeAndAfterSaleTallyResponse, any>(PublicApi.getReportPlatformHomeGetTradeAndAfterSaleTally, {}) const { loading, responseData, ref } = useViewRequest<GetReportPlatformHomeGetTradeAndAfterSaleTallyResponse, any>(PublicApi.getReportPlatformHomeGetTradeAndAfterSaleTally, {})
const { loading: orderStatisticsLoading, responseData: orderStatisticsData, ref: orderStatisticsRef } = useViewRequest<GetReportPlatformHomeGetOrderListResponse, any>(PublicApi.getReportPlatformHomeGetOrderList, {}) const { loading: orderStatisticsLoading, responseData: orderStatisticsData, ref: orderStatisticsRef } = useViewRequest<GetReportPlatformHomeGetOrderListResponse, any>(PublicApi.getReportPlatformHomeGetOrderList, {})
const renderLoading = () => {
return (
[1, 2, 3].map((_item) => {
return (
<Col xxl={24} xl={12} lg={12} md={24} sm={24} xs={24}>
<Card loading={true} />
</Col>
)
})
)
}
const renderChild = () => {
return (
responseData && Object.keys(responseData).map((item, key) => {
return (
<Col xxl={24} xl={12} lg={12} md={24} sm={24} xs={24} key={item}>
<Card
headStyle={{borderBottom:'none'}}
title={item === 'afterSaleList' ? '待处理售后' : '待处理交易'}
bordered={false}
style={{height: '100%'}}
className={key == 1 ? styles.lastCard : ''}
>
<List
itemLayout="horizontal"
className={styles.sideListBox}
>
{
responseData[item].map((row) => {
return (
<List.Item
key={row.name}
actions={[<Link to={row?.link}>查看&nbsp;<RightOutlined /></Link>]}
>
<List.Item.Meta
title={row.count.toString()}
description={row.name}
/>
</List.Item>
)
})
}
</List>
</Card>
</Col>
)
})
)
}
return ( return (
<Row gutter={[24, 12]} style={{display: 'flex', flexDirection: 'row'}} ref={ref}> <Row gutter={[24, 12]} style={{display: 'flex', flexDirection: 'row'}} ref={ref}>
<Col xxl={6} xl={24} lg={24} md={24} sm={24} xs={24} style={{display: 'flex', flexDirection: 'column'}}> <Col xxl={6} xl={24} lg={24} md={24} sm={24} xs={24} style={{display: 'flex', flexDirection: 'column'}}>
<Row style={{height: '100%'}} gutter={[24, 12]}> <Row style={{height: '100%'}} gutter={[24, 12]}>
{ {
responseData && Object.keys(responseData).map((item, key) => { (loading) && (
return ( renderLoading()
<Col xxl={24} xl={12} lg={12} md={24} sm={24} xs={24} key={item}> ) || (
<Card renderChild()
headStyle={{borderBottom:'none'}} )
title={item === 'afterSaleList' ? '待处理售后' : '待处理交易'}
bordered={false}
style={{height: '100%'}}
className={key == 1 ? styles.lastCard : ''}
>
<List
itemLayout="horizontal"
className={styles.sideListBox}
>
{
responseData[item].map((row) => {
return (
<List.Item
key={row.name}
actions={[<Link to={row?.link}>查看&nbsp;<RightOutlined /></Link>]}
>
<List.Item.Meta
title={row.count.toString()}
description={row.name}
/>
</List.Item>
)
})
}
</List>
</Card>
</Col>
)
})
} }
</Row> </Row>
</Col> </Col>
......
...@@ -13,13 +13,14 @@ import { GetReportPlatformHomeGetOrderListResponse } from '@/services/reportApi' ...@@ -13,13 +13,14 @@ import { GetReportPlatformHomeGetOrderListResponse } from '@/services/reportApi'
interface Iprops { interface Iprops {
orderData: GetReportPlatformHomeGetOrderListResponse | null, orderData: GetReportPlatformHomeGetOrderListResponse | null,
loading: boolean loading: boolean,
height?: number,
} }
const OrderStatistics: React.FC<Iprops> = (props) => { const OrderStatistics: React.FC<Iprops> = (props) => {
const { orderData, loading } = props const { orderData, loading, height } = props
const [timeRadio, setTimeRadio] = useState<TimeEnum>(TimeEnum.WEEK) const [timeRadio, setTimeRadio] = useState<TimeEnum>(TimeEnum.WEEK)
const [currentChartData, setCurrentChartData] = useState<Ilist[]>([]); const [currentChartData, setCurrentChartData] = useState<{dateTime: {}, count: number, amount: number}[]>([]);
const handleChangeTime = (e) => { const handleChangeTime = (e) => {
setTimeRadio(e.target.value) setTimeRadio(e.target.value)
const dataMap = { const dataMap = {
...@@ -61,7 +62,6 @@ const OrderStatistics: React.FC<Iprops> = (props) => { ...@@ -61,7 +62,6 @@ const OrderStatistics: React.FC<Iprops> = (props) => {
return ( return (
<Card <Card
headStyle={{borderBottom:'none'}} headStyle={{borderBottom:'none'}}
style={{height: '100%'}}
title="订单统计" title="订单统计"
bordered={false} bordered={false}
loading={loading} loading={loading}
...@@ -76,7 +76,7 @@ const OrderStatistics: React.FC<Iprops> = (props) => { ...@@ -76,7 +76,7 @@ const OrderStatistics: React.FC<Iprops> = (props) => {
<Row style={{margin: '36px 0 0 0'}}> <Row style={{margin: '36px 0 0 0'}}>
<Col span={24}> <Col span={24}>
{/* 折线图 */} {/* 折线图 */}
<ColumnChart data={currentChartData} /> <ColumnChart data={currentChartData} height={height!} />
</Col> </Col>
<Col span={24}> <Col span={24}>
<Row> <Row>
...@@ -85,7 +85,7 @@ const OrderStatistics: React.FC<Iprops> = (props) => { ...@@ -85,7 +85,7 @@ const OrderStatistics: React.FC<Iprops> = (props) => {
return ( return (
<Col xxl={6} xl={6} lg={12} md={12} sm={24} xs={24} key={key}> <Col xxl={6} xl={6} lg={12} md={12} sm={24} xs={24} key={key}>
<div className={styles.lineDesc}> <div className={styles.lineDesc}>
<img src={item.icon} className={styles.icon} alt=""/> <img src={item.icon} className={styles.icon}/>
<div className={styles.lineDescText}> <div className={styles.lineDescText}>
<p className={styles.lineDescTitle}>{item.value}</p> <p className={styles.lineDescTitle}>{item.value}</p>
<p className={styles.lineDescTip}>{item.tips}</p> <p className={styles.lineDescTip}>{item.tips}</p>
...@@ -102,4 +102,8 @@ const OrderStatistics: React.FC<Iprops> = (props) => { ...@@ -102,4 +102,8 @@ const OrderStatistics: React.FC<Iprops> = (props) => {
) )
} }
OrderStatistics.defaultProps = {
height: 302
}
export default OrderStatistics export default OrderStatistics
@media (min-width: 1600px) {
.lastCard {
margin-top: 12px;
}
}
.sideListBox{
:global{
.ant-list-item-meta-title{
font-size: 24px;
font-weight: 500;
color: #303133;
}
}
}
.lineDesc{
display: flex;
align-items: center;
margin-top: 14px;
.icon {
display: block;
width: 48px;
height: 48px;
margin: 24px 16px 24px 24px;
}
.lineDescText{
p{
margin-bottom: 8px;
line-height: 1;
}
.lineDescTitle{
font-size: 24px;
font-weight: 500;
color: #303133;
overflow: hidden;
}
.lineDescTip{
font-size: 12px;
font-weight: 400;
color: #909399;
}
}
}
import { PublicApi } from '@/services/api';
import { GetReportPlatformHomeGetTradeAndAfterSaleTallyResponse } from '@/services/reportApi';
import { GetReportMemberHomeGetPurchaseTallyResponse, GetReportPlatformHomeGetPurchaseListResponse } from '@/services/ReportV2Api';
import { RightOutlined } from '@ant-design/icons';
import { Col, Row, Card, List } from 'antd';
import React, { useMemo } from 'react';
import { Link } from 'umi';
import useViewRequest from '../../common/hooks/useViewRequest';
import OrderStatistics from '../Order/statisticsChart';
import styles from './index.less'
const PurchaseCenter = () => {
const { loading, responseData, ref } = useViewRequest<GetReportPlatformHomeGetTradeAndAfterSaleTallyResponse, any>(PublicApi.getReportPlatformHomeGetTradeAndAfterSaleTally, {})
const { loading: orderStatisticsLoading, responseData: orderStatisticsData, ref: orderStatisticsRef } = useViewRequest<GetReportPlatformHomeGetPurchaseListResponse, any>(PublicApi.getReportPlatformHomeGetPurchaseList, {})
const listItem = useMemo(() => {
return [
{
name: '待审核采购询价',
count: 0,
link: '/'
},
{
name: '待审核采购竞价',
count: 1,
link: '/'
},
{
name: '待审核招标项目',
count: 2,
link: '/'
}
]
}, [])
return (
<Row gutter={[24, 12]} style={{display: 'flex', flexDirection: 'row'}} ref={ref}>
<Col xxl={6} xl={24} lg={24} md={24} sm={24} xs={24} style={{display: 'flex', flexDirection: 'column'}}>
<Card
headStyle={{borderBottom:'none'}}
title={'待处理采购哦'}
bordered={false}
style={{height: '100%'}}
loading={loading}
>
<List
itemLayout="horizontal"
className={styles.sideListBox}
>
{
listItem.map((row) => {
return (
<List.Item
key={row.name}
actions={[<Link to={row?.link}>查看&nbsp;<RightOutlined /></Link>]}
>
<List.Item.Meta
title={row.count.toString()}
description={row.name}
/>
</List.Item>
)
})
}
</List>
</Card>
</Col>
<Col xxl={18} xl={24} lg={24} ref={orderStatisticsRef}>
<OrderStatistics height={158} orderData={orderStatisticsData} loading={orderStatisticsLoading}/>
</Col>
</Row>
)
}
export default PurchaseCenter
...@@ -8,6 +8,7 @@ import DataCenter from './components/DataCenter' ...@@ -8,6 +8,7 @@ import DataCenter from './components/DataCenter'
import RiskCenter from './components/RiseCenter'; import RiskCenter from './components/RiseCenter';
import MemberStatisticsContainer from './components/MemberStatistics/MemberStatisticsContainer'; import MemberStatisticsContainer from './components/MemberStatistics/MemberStatisticsContainer';
import OrderContainer from './components/Order'; import OrderContainer from './components/Order';
import PurchaseCenter from './components/PurchaseCenter';
const Home: React.FC<{}> = () => { const Home: React.FC<{}> = () => {
...@@ -25,12 +26,13 @@ const Home: React.FC<{}> = () => { ...@@ -25,12 +26,13 @@ const Home: React.FC<{}> = () => {
<Space direction="vertical" style={{width:'100%', height: '100%'}} > <Space direction="vertical" style={{width:'100%', height: '100%'}} >
<OrderContainer /> <OrderContainer />
</Space> </Space>
<Space direction="vertical" style={{width:'100%', height: '100%'}} >
<PurchaseCenter />
</Space>
{/* 商品品牌统计 */} {/* 商品品牌统计 */}
<div id="product"> <Space direction="vertical" style={{width:'100%'}}>
<Space direction="vertical" style={{width:'100%'}}> <StatisticsColumn />
<StatisticsColumn /> </Space>
</Space>
</div>
{/* 付款提现统计 */} {/* 付款提现统计 */}
<Space direction="vertical" style={{width:'100%'}}> <Space direction="vertical" style={{width:'100%'}}>
......
...@@ -15,6 +15,7 @@ import * as EnhanceApi from './enhanceApi'; ...@@ -15,6 +15,7 @@ import * as EnhanceApi from './enhanceApi';
import * as AfterServiceApi from './AfterServiceApi'; import * as AfterServiceApi from './AfterServiceApi';
import * as PurchaseApi from './PurchaseApi'; import * as PurchaseApi from './PurchaseApi';
import * as PlatformApi from './PlatformApi'; import * as PlatformApi from './PlatformApi';
import * as ReportApiV2 from './ReportV2Api';
/** /**
* 可在这里写入自定义的接口 * 可在这里写入自定义的接口
...@@ -42,4 +43,5 @@ export const PublicApi = { ...@@ -42,4 +43,5 @@ export const PublicApi = {
...AfterServiceApi, ...AfterServiceApi,
...PurchaseApi, ...PurchaseApi,
...PlatformApi, ...PlatformApi,
...ReportApiV2,
} }
...@@ -16,7 +16,8 @@ const tokenList = [ ...@@ -16,7 +16,8 @@ const tokenList = [
{ name: 'enhance', token: '594a7e7ff17f6f40fb9fb726c1da9a3f282a926a8d386eb6cbfd668a3f75f251', categoryIds: [0] }, // 加工服务 { name: 'enhance', token: '594a7e7ff17f6f40fb9fb726c1da9a3f282a926a8d386eb6cbfd668a3f75f251', categoryIds: [0] }, // 加工服务
{ name: 'AfterService', token: 'bac1c7ca2c63869ec87085b0b33e830fea19f707dea5763f1bf8f2dc5996bde8', categoryIds: [0] }, // 售后服务 { name: 'AfterService', token: 'bac1c7ca2c63869ec87085b0b33e830fea19f707dea5763f1bf8f2dc5996bde8', categoryIds: [0] }, // 售后服务
{ name: 'Platform', token: 'cadc3b13452c3ec67b5ef0c57063f12142e857a9eaa64669e80165adf42f5861', categoryIds: [0] }, // 平台后台v2 { name: 'Platform', token: 'cadc3b13452c3ec67b5ef0c57063f12142e857a9eaa64669e80165adf42f5861', categoryIds: [0] }, // 平台后台v2
{ name: 'MemberV2', token: '87f86a297246fbf1c0dff7d34f13729cb194935a95db077a5009ac4ea48cea6f', categoryIds: [0] } //会员服务 V2 { name: 'MemberV2', token: '87f86a297246fbf1c0dff7d34f13729cb194935a95db077a5009ac4ea48cea6f', categoryIds: [0] }, //会员服务 V2
{ name: 'ReportV2', token: 'dab50c384c27f1c981a03f2c44ad76d1e7e1f60b4520bd279cea67f5cf146cee', categoryIds: [0] }, // 报表服务v2
] ]
const getConfigMap = (tokens) => tokens.map(v => ({ const getConfigMap = (tokens) => tokens.map(v => ({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment