Commit d25b8c11 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents a59f7ad4 5e562b00
import React, { Suspense, useEffect, useState } from 'react';
import {
PageHeader,
Descriptions,
Card,
Spin,
Button,
Row,
Col,
Badge,
Switch,
message,
} from 'antd';
import { FormOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { GetAsReturnGoodsGetDetailBySupplierResponse } from '@/services/AfterServiceApi';
import { CREDIT_INNER_STATUS, CREDIT_OUTER_STATUS, CREDIT_STATUS } from '@/constants';
import { normalizeFiledata, FileData, findLastIndexFlowState } from '@/utils';
import AvatarWrap from '@/components/AvatarWrap';
import StatusTag from '@/components/StatusTag';
import EyePreview from '@/components/EyePreview';
import AuditProcess from '@/components/AuditProcess';
import { EditableColumns } from '@/components/PolymericTable/interface';
import ReturnInfoDrawer from '../../../components/ReturnInfoDrawer';
import { } from '../../../constants';
const ProductList = React.lazy(() => import('../../../components/ProductList'));
const ReturnInfo = React.lazy(() => import('../../../components/ReturnInfo'));
const ReturnDetailInfo = React.lazy(() => import('../../../components/ReturnDetailInfo'));
const FileList = React.lazy(() => import('../../../components/FileList'));
const ReturnAddressInfo = React.lazy(() => import('../../../components/ReturnAddressInfo'));
const Score = React.lazy(() => import('../../../components/Score'));
const OuterCirculationRecord = React.lazy(() => import('../../../components/OuterCirculationRecord'));
interface DetailInfoProps {
// 记录id
id: string;
// 是否是编辑的
isEdit?: boolean;
// 历史记录目标路径
target?: string;
// 头部右侧拓展
headExtra?: React.ReactNode;
};
const DetailInfo: React.FC<DetailInfoProps> = ({
id,
isEdit = false,
target,
headExtra = null,
}) => {
const [detailInfo, setDetailInfo] = useState<GetAsReturnGoodsGetDetailBySupplierResponse>(null);
const [infoLoading, setInfoloading] = useState(false);
const [visibleOrderDetial, setVisibleReturnInfo] = useState<boolean>(false);
const handleCheckOrderDetial = record => {
setVisibleReturnInfo(true);
};
const handleReturn = record => {
if (!isEdit) {
return;
}
console.log('否后退货', record)
};
const productColumns: EditableColumns[] = [
{
title: '订单号',
dataIndex: 'orderNo',
render: (text, record) => (
<EyePreview
url={`${target ? target : '/memberCenter/payandSettle/creditApplication/quotaPrSubmit/detail'}?id=${record.id}`}
>
{text}
</EyePreview>
),
},
{
title: 'ID',
dataIndex: 'id',
align: 'center',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
},
{
title: '采购数量',
dataIndex: 'quantity',
align: 'center',
},
{
title: '采购单价',
dataIndex: 'price',
align: 'center',
},
{
title: '采购金额',
dataIndex: 'amount',
align: 'center',
},
{
title: '已支付金额',
dataIndex: 'payAmount',
align: 'center',
},
{
title: '退货数量',
dataIndex: 'num',
align: 'center',
},
{
title: '退货金额',
dataIndex: 'returnAmount',
align: 'center',
},
{
title: '是否退货',
dataIndex: 'status',
align: 'center',
render: (text, record) => (
<>
{!isEdit ? (
text
) : (
<Switch checked={text} onChange={() => handleReturn(record)} />
)}
</>
),
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text, record) => (
<>
<Button
type="link"
onClick={() => handleCheckOrderDetial(record)}
>
查看详情
</Button>
</>
),
},
];
// 获取退货申请详情
const getDetailInfo = () => {
if (!id) {
return;
}
setInfoloading(true);
PublicApi.getAsReturnGoodsGetDetailBySupplier({
returnId: id,
}).then(res => {
if (res.code === 1000) {
setDetailInfo(res.data);
}
}).finally(() => {
setInfoloading(false);
});
};
useEffect(() => {
getDetailInfo();
}, []);
return (
<Spin spinning={infoLoading}>
<PageHeaderWrapper
style={{
padding: 24,
}}
title={
<>
<PageHeader
style={{ padding: '0' }}
onBack={() => history.goBack()}
title={
<AvatarWrap
info={{
aloneTxt: '单',
name: `申请单号:${detailInfo?.applyNo}`,
}}
/>
}
extra={(
<>
{headExtra}
</>
)}
>
<Descriptions
size="small"
column={3}
style={{
padding: '0 32px',
}}
>
<Descriptions.Item label="申请单摘要:">{detailInfo?.applyAbstract}</Descriptions.Item>
<Descriptions.Item label="采购会员">{detailInfo?.consumerName}</Descriptions.Item>
<Descriptions.Item label="单据时间">{detailInfo?.applyTime}</Descriptions.Item>
<Descriptions.Item label="外部状态">
<StatusTag type="success" title={'售后完成'} />
</Descriptions.Item>
<Descriptions.Item label="内部状态">
<Badge color={'#41CC9E'} text={'已确认售后完成'} />
</Descriptions.Item>
</Descriptions>
</PageHeader>
</>
}
>
<Row gutter={[24, 24]}>
<Col span={24}>
<Suspense fallback={null}>
<AuditProcess
outerVerifySteps={
detailInfo && detailInfo.outerTaskList ?
detailInfo.outerTaskList.map(item => ({
step: item.step,
stepName: item.taskName,
roleName: item.roleName,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
outerVerifyCurrent={findLastIndexFlowState(detailInfo?.outerTaskList)}
innerVerifySteps={
detailInfo && detailInfo.innerTaskList ?
detailInfo.innerTaskList.map(item => ({
step: item.step,
stepName: item.taskName,
roleName: item.roleName,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
innerVerifyCurrent={findLastIndexFlowState(detailInfo?.innerTaskList)}
/>
</Suspense>
</Col>
<Col span={24}>
<Suspense fallback={null}>
<ProductList
title="退货商品"
columns={productColumns}
dataSource={[
{
id: 1,
applyNo: '123',
},
]}
/>
</Suspense>
</Col>
<Col span={24}>
<Suspense fallback={null}>
<ReturnInfo
received={[]}
deliver={[
{
id: 1,
orderNo: '123',
childData: [],
},
]}
/>
</Suspense>
</Col>
<Col span={24}>
<Suspense fallback={null}>
<ReturnDetailInfo
dataSource={[
{
id: 1,
orderNo: '123',
},
]}
/>
</Suspense>
</Col>
<Col span={24}>
<Row
gutter={24}
>
<Col span={6}>
<Suspense fallback={null}>
<FileList />
</Suspense>
</Col>
<Col span={12}>
<Suspense fallback={null}>
<ReturnAddressInfo isEdit={isEdit} />
</Suspense>
</Col>
<Col span={6}>
<Suspense fallback={null}>
<Score />
</Suspense>
</Col>
</Row>
</Col>
<Col span={24}>
<Suspense fallback={null}>
<OuterCirculationRecord dataSource={[]} />
</Suspense>
</Col>
</Row>
<ReturnInfoDrawer
visible={visibleOrderDetial}
onClose={() => setVisibleReturnInfo(false)}
/>
</PageHeaderWrapper>
</Spin>
);
};
export default DetailInfo;
\ No newline at end of file
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 14:25:41
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-11 15:24:34
* @LastEditTime: 2020-11-12 09:40:11
* @Description: 退货申请单查询
*/
import React, { useState, useRef } from 'react';
......@@ -43,7 +43,7 @@ const ExchangeQuery: React.FC = () => {
render: (text, record) => (
<>
<EyePreview
url={`/memberCenter/afterService/returnManage/returnQuery/detail?id=${record.id}`}
url={`/memberCenter/afterService/exchangeManage/exchangeQuery/detail?id=${record.id}`}
>
{text}
</EyePreview>
......@@ -107,9 +107,11 @@ const ExchangeQuery: React.FC = () => {
// });
return Promise.resolve({
totalCount: 10,
data: {
applyNo: '123',
},
data: [
{
applyNo: '123',
}
],
});
};
......@@ -153,7 +155,7 @@ const ExchangeQuery: React.FC = () => {
<Card>
<StandardTable
tableProps={{
rowKey: 'id',
rowKey: 'applyNo',
}}
columns={columns}
currentRef={ref}
......
......@@ -144,18 +144,7 @@ const ReceivedDetail: React.FC = () => {
}
extra={(
<>
{
pageStatus === PageStatus.EDIT && (
<Button
type="primary"
icon={<FormOutlined />}
loading={submitLoading}
onClick={() => formActions.submit()}
>
修改
</Button>
)
}
</>
)}
>
......
......@@ -144,18 +144,7 @@ const ReceivedDetail: React.FC = () => {
}
extra={(
<>
{
pageStatus === PageStatus.EDIT && (
<Button
type="primary"
icon={<FormOutlined />}
loading={submitLoading}
onClick={() => formActions.submit()}
>
修改
</Button>
)
}
</>
)}
>
......
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