Commit d1076053 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复确认退款全部到账按钮未在特定条件显示的问题

parent 9cdcfbc3
...@@ -48,6 +48,9 @@ const ReturnAddressInfo = React.lazy(() => import('../../../components/ReturnAdd ...@@ -48,6 +48,9 @@ const ReturnAddressInfo = React.lazy(() => import('../../../components/ReturnAdd
const Score = React.lazy(() => import('../../../components/Score')); const Score = React.lazy(() => import('../../../components/Score'));
const FlowRecords = React.lazy(() => import('../../../components/FlowRecords')); const FlowRecords = React.lazy(() => import('../../../components/FlowRecords'));
export interface DetailInfoData extends GetAsReturnGoodsGetDetailByConsumerResponse {
fileList: FileData[];
};
interface DetailInfoProps { interface DetailInfoProps {
/** /**
* 记录id * 记录id
...@@ -64,10 +67,7 @@ interface DetailInfoProps { ...@@ -64,10 +67,7 @@ interface DetailInfoProps {
/** /**
* 头部右侧拓展 * 头部右侧拓展
*/ */
headExtra?: (info: DetailInfo) => React.ReactNode; headExtra?: (info: DetailInfoData) => React.ReactNode;
};
interface DetailInfo extends GetAsReturnGoodsGetDetailByConsumerResponse {
fileList: FileData[];
}; };
const DetailInfo: React.FC<DetailInfoProps> = ({ const DetailInfo: React.FC<DetailInfoProps> = ({
...@@ -76,7 +76,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -76,7 +76,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
target, target,
headExtra = null, headExtra = null,
}) => { }) => {
const [detailInfo, setDetailInfo] = useState<DetailInfo>(null); const [detailInfo, setDetailInfo] = useState<DetailInfoData>(null);
const [returnGoodsList, setReturnGoodsList] = useState<GetAsReturnGoodsPageReturnedGoodsResponse>({ data: [], totalCount: 0 }); const [returnGoodsList, setReturnGoodsList] = useState<GetAsReturnGoodsPageReturnedGoodsResponse>({ data: [], totalCount: 0 });
const [returnGoodsLoading, setReturnGoodsLoading] = useState(false); const [returnGoodsLoading, setReturnGoodsLoading] = useState(false);
const [infoLoading, setInfoloading] = useState(false); const [infoLoading, setInfoloading] = useState(false);
......
import React, { useState } from 'react'; /*
import { Button } from 'antd'; * @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-02-19 11:21:59
* @Description:
*/
import React from 'react';
import { Button, Modal } from 'antd';
import { history } from 'umi'; import { history } from 'umi';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { FormOutlined } from '@ant-design/icons'; import { FormOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { usePageStatus } from '@/hooks/usePageStatus'; import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from '../components/DetailInfo'; import { REFUND_OUTER_STATUS_RECEIVED } from '../../constants';
import DetailInfo, { DetailInfoData } from '../components/DetailInfo';
const { confirm } = Modal;
const ReturnPrConfirmResultVerify: React.FC = () => { const ReturnPrConfirmResultVerify: React.FC = () => {
const { id } = usePageStatus(); const { id } = usePageStatus();
const [submitLoading, setSubmitLoading] = useState(false);
const handleSubmit = values => { const handleSubmit = values => {
if (!id) { if (!id) {
return; return;
} }
setSubmitLoading(true); confirm({
PublicApi.postAsReturnGoodsConfirmAllRefund({ title: '提示',
dataId: id, icon: <ExclamationCircleOutlined />,
}).then(res => { content: `是否本单所有退款确认到账?`,
if (res.code === 1000) { onOk() {
history.goBack(); return PublicApi.postAsReturnGoodsConfirmAllRefund({
} dataId: id,
}).finally(() => { }).then(res => {
setSubmitLoading(false); if (res.code === 1000) {
history.goBack();
}
});
},
}); });
}; };
...@@ -30,16 +43,24 @@ const ReturnPrConfirmResultVerify: React.FC = () => { ...@@ -30,16 +43,24 @@ const ReturnPrConfirmResultVerify: React.FC = () => {
<> <>
<DetailInfo <DetailInfo
id={id} id={id}
headExtra={() => ( headExtra={(info: DetailInfoData) => {
<Button const { refundList = [] } = info || {};
type="primary" // 是否全部已退款,只有当退款明细中所有退款金额大于0的记录的状态都为确认退款到账时本按钮才可点击
icon={<FormOutlined />} const isAllRefunded = refundList.every((item) => item.detailList.every((detail) => detail.refundAmount > 0 && detail.outerStatus === REFUND_OUTER_STATUS_RECEIVED));
loading={submitLoading}
onClick={handleSubmit} return [
> isAllRefunded ? (
确认本单所有退款到账 <Button
</Button> type="primary"
)} icon={<FormOutlined />}
onClick={handleSubmit}
key="confirmAllRefunded"
>
确认本单所有退款到账
</Button>
) : null,
]
}}
target="/memberCenter/afterService/returnApplication/returnPrConfirmResult" target="/memberCenter/afterService/returnApplication/returnPrConfirmResult"
isEdit isEdit
/> />
......
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