Commit e2a14177 authored by XieZhiXiong's avatar XieZhiXiong

feat: 对接中止申请相关

parent 88a9bc4c
...@@ -2,14 +2,11 @@ ...@@ -2,14 +2,11 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-05 14:25:41 * @Date: 2020-11-05 14:25:41
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-13 15:27:46 * @LastEditTime: 2021-08-26 11:14:09
* @Description: 换货申请单查询 * @Description: 换货申请单查询
*/ */
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
import { Card, Badge, Progress, Button } from 'antd'; import { Card, Badge, Button } from 'antd';
import {
ClockCircleOutlined,
} from '@ant-design/icons';
import { StandardTable } from 'god'; import { StandardTable } from 'god';
import moment from 'moment'; import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
...@@ -20,6 +17,11 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte ...@@ -20,6 +17,11 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'; import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { coverColFiltersItem } from '@/utils'; import { coverColFiltersItem } from '@/utils';
import {
EXCHANGE_INNER_STATUS_CONFIRM_SUCCESS,
EXCHANGE_INNER_STATUS_CONFIRM_FAILED,
EXCHANGE_INNER_STATUS_FINISHED,
} from '@/constants/afterService';
import EyePreview from '@/components/EyePreview'; import EyePreview from '@/components/EyePreview';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
import StatusTag from '@/components/StatusTag'; import StatusTag from '@/components/StatusTag';
...@@ -28,12 +30,17 @@ import { ...@@ -28,12 +30,17 @@ import {
EXCHANGE_OUTER_STATUS_TAG_MAP, EXCHANGE_OUTER_STATUS_TAG_MAP,
EXCHANGE_INNER_STATUS_BADGE_MAP, EXCHANGE_INNER_STATUS_BADGE_MAP,
} from '../../constants'; } from '../../constants';
import StopModal, { ValuesType } from '../../components/StopModal';
import styles from './index.less'; import styles from './index.less';
const formActions = createFormActions(); const formActions = createFormActions();
const ExchangeQuery: React.FC = () => { const ExchangeQuery: React.FC = () => {
const [stopModalVisible, setStopModalVisible] = useState(false);
const [stopModalSubmitLoading, setStopModalSubmitLoading] = useState(false);
const ref = useRef<any>({}); const ref = useRef<any>({});
const currentRecord = useRef<number>(0);
const defaultColumns: ColumnType<any>[] = [ const defaultColumns: ColumnType<any>[] = [
{ {
...@@ -84,6 +91,27 @@ const ExchangeQuery: React.FC = () => { ...@@ -84,6 +91,27 @@ const ExchangeQuery: React.FC = () => {
onFilter: (value, record) => record.innerStatus === value, onFilter: (value, record) => record.innerStatus === value,
render: (text, record) => <Badge color={EXCHANGE_INNER_STATUS_BADGE_MAP[record.innerStatus] || '#606266'} text={text} />, render: (text, record) => <Badge color={EXCHANGE_INNER_STATUS_BADGE_MAP[record.innerStatus] || '#606266'} text={text} />,
}, },
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text, record) => (
<>
{(
record.innerStatus >= EXCHANGE_INNER_STATUS_CONFIRM_SUCCESS
&& record.innerStatus <= EXCHANGE_INNER_STATUS_FINISHED
&& record.innerStatus !== EXCHANGE_INNER_STATUS_CONFIRM_FAILED
) && (
<Button
type="link"
onClick={() => handleStop(record.replaceId)}
>
终止
</Button>
)}
</>
),
},
]; ];
const [columns, setColumns] = useState<any[]>(defaultColumns); const [columns, setColumns] = useState<any[]>(defaultColumns);
...@@ -143,6 +171,30 @@ const ExchangeQuery: React.FC = () => { ...@@ -143,6 +171,30 @@ const ExchangeQuery: React.FC = () => {
return {}; return {};
}; };
const handleVisibleStopModal = (flag?: boolean) => {
setStopModalVisible(!!flag);
};
const handleStop = (recordId: number) => {
currentRecord.current = recordId;
handleVisibleStopModal(true);
};
const handleStopModalSubmit = (values: ValuesType) => {
setStopModalSubmitLoading(true);
PublicApi.postAsReplaceGoodsStopReturnGoods({
dataId: currentRecord.current,
remark: values.remark,
}).then(res => {
if (res.code === 1000) {
ref.current.reload();
handleVisibleStopModal(false);
}
}).finally(() => {
setStopModalSubmitLoading(false);
});
};
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
...@@ -174,6 +226,13 @@ const ExchangeQuery: React.FC = () => { ...@@ -174,6 +226,13 @@ const ExchangeQuery: React.FC = () => {
} }
/> />
</Card> </Card>
<StopModal
visible={stopModalVisible}
onClose={() => handleVisibleStopModal(false)}
onSubmit={handleStopModalSubmit}
submitLoading={stopModalSubmitLoading}
/>
</PageHeaderWrapper> </PageHeaderWrapper>
); );
}; };
......
...@@ -2,14 +2,11 @@ ...@@ -2,14 +2,11 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-05 14:25:41 * @Date: 2020-11-05 14:25:41
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-30 13:45:07 * @LastEditTime: 2021-08-26 11:05:57
* @Description: 退货申请单查询 * @Description: 退货申请单查询
*/ */
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
import { Card, Badge, Progress, Button } from 'antd'; import { Card, Badge, Button } from 'antd';
import {
ClockCircleOutlined,
} from '@ant-design/icons';
import { StandardTable } from 'god'; import { StandardTable } from 'god';
import moment from 'moment'; import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
...@@ -20,6 +17,11 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte ...@@ -20,6 +17,11 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'; import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { coverColFiltersItem } from '@/utils'; import { coverColFiltersItem } from '@/utils';
import {
RETURN_INNER_STATUS_CONFIRM_SUCCESS,
RETURN_INNER_STATUS_FINISHED,
RETURN_INNER_STATUS_CONFIRM_FAILED,
} from '@/constants/afterService';
import EyePreview from '@/components/EyePreview'; import EyePreview from '@/components/EyePreview';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
import StatusTag from '@/components/StatusTag'; import StatusTag from '@/components/StatusTag';
...@@ -28,12 +30,17 @@ import { ...@@ -28,12 +30,17 @@ import {
RETURN_OUTER_STATUS_TAG_MAP, RETURN_OUTER_STATUS_TAG_MAP,
RETURN_INNER_STATUS_BADGE_MAP, RETURN_INNER_STATUS_BADGE_MAP,
} from '../../constants'; } from '../../constants';
import StopModal, { ValuesType } from '../../components/StopModal';
import styles from './index.less'; import styles from './index.less';
const formActions = createFormActions(); const formActions = createFormActions();
const ReturnQuery: React.FC = () => { const ReturnQuery: React.FC = () => {
const [stopModalVisible, setStopModalVisible] = useState(false);
const [stopModalSubmitLoading, setStopModalSubmitLoading] = useState(false);
const ref = useRef<any>({}); const ref = useRef<any>({});
const currentRecord = useRef<number>(0);
const defaultColumns: ColumnType<any>[] = [ const defaultColumns: ColumnType<any>[] = [
{ {
...@@ -89,6 +96,27 @@ const ReturnQuery: React.FC = () => { ...@@ -89,6 +96,27 @@ const ReturnQuery: React.FC = () => {
onFilter: (value, record) => record.innerStatus === value, onFilter: (value, record) => record.innerStatus === value,
render: (text, record) => <Badge color={RETURN_INNER_STATUS_BADGE_MAP[record.innerStatus] || '#606266'} text={text} />, render: (text, record) => <Badge color={RETURN_INNER_STATUS_BADGE_MAP[record.innerStatus] || '#606266'} text={text} />,
}, },
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text, record) => (
<>
{(
record.innerStatus >= RETURN_INNER_STATUS_CONFIRM_SUCCESS
&& record.innerStatus <= RETURN_INNER_STATUS_FINISHED
&& record.innerStatus !== RETURN_INNER_STATUS_CONFIRM_FAILED
) && (
<Button
type="link"
onClick={() => handleStop(record.returnId)}
>
终止
</Button>
)}
</>
),
},
]; ];
const [columns, setColumns] = useState<any[]>(defaultColumns); const [columns, setColumns] = useState<any[]>(defaultColumns);
...@@ -148,6 +176,30 @@ const ReturnQuery: React.FC = () => { ...@@ -148,6 +176,30 @@ const ReturnQuery: React.FC = () => {
return {}; return {};
}; };
const handleVisibleStopModal = (flag?: boolean) => {
setStopModalVisible(!!flag);
};
const handleStop = (recordId: number) => {
currentRecord.current = recordId;
handleVisibleStopModal(true);
};
const handleStopModalSubmit = (values: ValuesType) => {
setStopModalSubmitLoading(true);
PublicApi.postAsReturnGoodsStopReturnGoods({
dataId: currentRecord.current,
remark: values.remark,
}).then(res => {
if (res.code === 1000) {
ref.current.reload();
handleVisibleStopModal(false);
}
}).finally(() => {
setStopModalSubmitLoading(false);
});
};
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
...@@ -179,6 +231,13 @@ const ReturnQuery: React.FC = () => { ...@@ -179,6 +231,13 @@ const ReturnQuery: React.FC = () => {
} }
/> />
</Card> </Card>
<StopModal
visible={stopModalVisible}
onClose={() => handleVisibleStopModal(false)}
onSubmit={handleStopModalSubmit}
submitLoading={stopModalSubmitLoading}
/>
</PageHeaderWrapper> </PageHeaderWrapper>
); );
}; };
......
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