Commit 5da33494 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复未到账操作失败的问题

parent f6c028ac
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-05 18:02:18 * @Date: 2020-11-05 18:02:18
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-22 18:20:27 * @LastEditTime: 2021-01-28 10:22:16
* @Description: 退款明细 * @Description: 退款明细
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
...@@ -78,6 +78,11 @@ interface ReturnDetailInfoProps { ...@@ -78,6 +78,11 @@ interface ReturnDetailInfoProps {
* 供应商角色id * 供应商角色id
*/ */
supplierRoleId: number, supplierRoleId: number,
/**
* 是否可操作的
*/
isEdit?: boolean,
}; };
const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
...@@ -85,12 +90,12 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ ...@@ -85,12 +90,12 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
onRefund, onRefund,
onConfirm, onConfirm,
isPurchaser = false, isPurchaser = false,
innerStatus,
outerStatus, outerStatus,
purchaserId, purchaserId,
purchaserRoleId, purchaserRoleId,
supplierId, supplierId,
supplierRoleId, supplierRoleId,
isEdit = false,
}) => { }) => {
const [visibleResult, setVisibleResult] = useState(false); const [visibleResult, setVisibleResult] = useState(false);
const [notReceivedLoading, setNotReceivedLoading] = useState(false); const [notReceivedLoading, setNotReceivedLoading] = useState(false);
...@@ -235,9 +240,14 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ ...@@ -235,9 +240,14 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
const handleConfirm = (id, flag) => { const handleConfirm = (id, flag) => {
if (onConfirm) { if (onConfirm) {
flag === 1 ? setReceivedLoading(true) : setNotReceivedLoading(true); flag === 1 ? setReceivedLoading(true) : setNotReceivedLoading(true);
onConfirm(id, flag).finally(() => { onConfirm(id, flag)
flag === 1 ? setReceivedLoading(false) : setNotReceivedLoading(false); .then(() => {
}); setVisibleResult(false);
flag === 1 ? setReceivedLoading(false) : setNotReceivedLoading(false);
})
.catch(() => {
flag === 1 ? setReceivedLoading(false) : setNotReceivedLoading(false);
});
} }
}; };
...@@ -309,6 +319,7 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ ...@@ -309,6 +319,7 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
<div className={styles['deliver-item-actions']}> <div className={styles['deliver-item-actions']}>
{ {
isEdit &&
!isPurchaser && !isPurchaser &&
outerStatus === RETURN_OUTER_STATUS_TO_BE_REFUNDED && outerStatus === RETURN_OUTER_STATUS_TO_BE_REFUNDED &&
!!item.canRefund && ( !!item.canRefund && (
...@@ -328,6 +339,7 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ ...@@ -328,6 +339,7 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
{item.channel === PAY_CHANNEL_OFFLINE && ( {item.channel === PAY_CHANNEL_OFFLINE && (
<> <>
{ {
isEdit &&
isPurchaser && isPurchaser &&
outerStatus === RETURN_OUTER_STATUS_UNCONFIRMED_REFUNDED && ( outerStatus === RETURN_OUTER_STATUS_UNCONFIRMED_REFUNDED && (
item.outerStatus === REFUND_OUTER_STATUS_UNCONFIRMED_REFUND || item.outerStatus === REFUND_OUTER_STATUS_UNCONFIRMED_REFUND ||
......
...@@ -300,14 +300,21 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -300,14 +300,21 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
}; };
// 确认退款到账 // 确认退款到账
const handleConfirm = (id): Promise<any> => { const handleConfirm = (id, flag): Promise<void> => {
return PublicApi.postAsReturnGoodsConfirmRefund({ return new Promise((resolve, reject) => {
refundId: id, PublicApi.postAsReturnGoodsConfirmRefund({
isReceipt: 1, refundId: id,
}).then(res => { isReceipt: flag,
if (res.code === 1000) { }).then(res => {
getDetailInfo(); if (res.code === 1000) {
} getDetailInfo();
resolve();
} else {
reject();
}
}).catch(() => {
reject();
});
}); });
}; };
...@@ -430,6 +437,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -430,6 +437,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
purchaserRoleId={detailInfo?.roleId} purchaserRoleId={detailInfo?.roleId}
supplierId={detailInfo?.parentMemberId} supplierId={detailInfo?.parentMemberId}
supplierRoleId={detailInfo?.parentMemberRoleId} supplierRoleId={detailInfo?.parentMemberRoleId}
isEdit={isEdit}
isPurchaser isPurchaser
/> />
</Suspense> </Suspense>
......
...@@ -476,6 +476,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -476,6 +476,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
purchaserRoleId={detailInfo?.roleId} purchaserRoleId={detailInfo?.roleId}
supplierId={detailInfo?.parentMemberId} supplierId={detailInfo?.parentMemberId}
supplierRoleId={detailInfo?.parentMemberRoleId} supplierRoleId={detailInfo?.parentMemberRoleId}
isEdit={isEdit}
/> />
</Suspense> </Suspense>
</Col> </Col>
......
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