Commit 3f12471a authored by 李腾's avatar 李腾

feat: 首页添加权限控制

parent eeb906ed
...@@ -6,10 +6,18 @@ import { Link } from 'umi'; ...@@ -6,10 +6,18 @@ import { Link } from 'umi';
import { FileTextOutlined } from '@ant-design/icons'; import { FileTextOutlined } from '@ant-design/icons';
import style from './styles.less'; import style from './styles.less';
import { getPendingNum } from './service'; import { getPendingNum } from './service';
import { connect } from 'dva';
import {
AFTER_SALE_ORDER,
CANCEL_BILL_MANAGE,
PENDING_DELIVERY_ORDER,
} from '@/../config/permission.config';
const Admin = () => { const Admin = props => {
const [pendingNum, setpendingNum] = useState({}); const [pendingNum, setpendingNum] = useState({});
const showAfterSaleList = props.permissions[AFTER_SALE_ORDER.LIST];
const showCancelBillList = props.permissions[CANCEL_BILL_MANAGE.LIST];
const showPendingDeliveryOrderList = props.permissions[PENDING_DELIVERY_ORDER.LIST];
useEffect(() => { useEffect(() => {
const qurey = async () => { const qurey = async () => {
const { data } = await getPendingNum(); const { data } = await getPendingNum();
...@@ -28,63 +36,87 @@ const Admin = () => { ...@@ -28,63 +36,87 @@ const Admin = () => {
</div> </div>
<div style={{ marginTop: '20px' }}> <div style={{ marginTop: '20px' }}>
<Row className={style.orderContent}> <Row className={style.orderContent}>
<Col span={2} className="titleOne"> {showPendingDeliveryOrderList || showCancelBillList ? (
<div> <Col span={2} className="titleOne">
<FileTextOutlined /> <div>
<p>订单</p> <FileTextOutlined />
</div> <p>订单</p>
</Col> </div>
<Col span={2}> </Col>
<Link ) : (
to={{ ''
pathname: '/orderManage/pendingDeliveryOrder', )}
}}
> {showPendingDeliveryOrderList ? (
<strong>{pendingNum?.pendingShipNum || 0}</strong> <>
<p>待发货</p> <Col span={2}>
</Link> <Link
</Col> to={{
<Col span={3}> pathname: '/orderManage/pendingDeliveryOrder',
<Link }}
to={{ >
pathname: '/orderManage/pendingDeliveryOrder', <strong>{pendingNum?.pendingShipNum || 0}</strong>
state: { status: 1 }, <p>待发货</p>
}} </Link>
> </Col>
<strong>{pendingNum?.timeOutShipNum || 0}</strong> <Col span={3}>
<p>超时发货{'>'}48小时</p> <Link
</Link> to={{
</Col> pathname: '/orderManage/pendingDeliveryOrder',
<Col span={4}> state: { status: 1 },
<Link }}
to={{ >
pathname: 'cancelBillManage', <strong>{pendingNum?.timeOutShipNum || 0}</strong>
}} <p>超时发货{'>'}48小时</p>
> </Link>
<strong>{pendingNum?.cancelOrderPendingAuditNum || 0}</strong> </Col>
<p>取消订单审核{'<'}24小时</p> </>
</Link> ) : (
</Col> ''
<Col span={2} className="titleTwo" offset={4}> )}
<div> {showCancelBillList ? (
<FileTextOutlined /> <Col span={4}>
<p> 售后</p> <Link
</div> to={{
</Col> pathname: 'cancelBillManage',
<Col span={3}> }}
<Link >
to={{ <strong>{pendingNum?.cancelOrderPendingAuditNum || 0}</strong>
pathname: 'afterSaleManage', <p>取消订单审核{'<'}24小时</p>
}} </Link>
> </Col>
<strong>{pendingNum?.afterOrderPendingAuditNum || 0}</strong> ) : (
<p>退款待审核{'<'}24小时</p> ''
</Link> )}
</Col> {showAfterSaleList ? (
<>
<Col span={2} className="titleTwo" offset={4}>
<div>
<FileTextOutlined />
<p> 售后</p>
</div>
</Col>
<Col span={3}>
<Link
to={{
pathname: 'afterSaleManage',
}}
>
<strong>{pendingNum?.afterOrderPendingAuditNum || 0}</strong>
<p>退款待审核{'<'}24小时</p>
</Link>
</Col>
</>
) : (
''
)}
</Row> </Row>
</div> </div>
</div> </div>
</div> </div>
); );
}; };
export default Admin; export default connect(({ menu }) => ({
permissions: menu.permissions,
}))(Admin);
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