Commit b6692a78 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复物料订单退款金额显示为0的问题

parent c8d88aff
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 17:36:45
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-09-15 10:08:33
* @LastEditTime: 2021-09-16 10:31:19
* @Description: 查看退货数量与退款金额 抽屉
*/
import React, { useEffect, useState } from 'react';
......@@ -179,21 +179,23 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({
onSubmit,
isEdit = false,
}) => {
const [innerApplyInfo, setInnerApplyInfo] = useState<ReturnApplyInfo | null>(null);
const [innerApplyInfo, setInnerApplyInfo] = useState<ReturnApplyInfo | null>(applyInfo);
const [payInfoLoading, setPayInfoLoading] = useState(false);
const { orderType } = (innerApplyInfo || {});
const isMateriel = (
orderType === ORDER_TYPE_INQUIRY_CONTRACT
|| orderType === ORDER_TYPE_BIDDING_CONTRACT
|| orderType === ORDER_TYPE_TENDER_CONTRACT
);
const getPayInfo = async () => {
if (!applyInfo || !applyInfo.orderId) {
return;
}
const isMateriel = (
applyInfo.orderType === ORDER_TYPE_INQUIRY_CONTRACT
|| applyInfo.orderType === ORDER_TYPE_BIDDING_CONTRACT
|| applyInfo.orderType === ORDER_TYPE_TENDER_CONTRACT
);
if (isMateriel) {
schemaAction.setFieldState('productName', state => {
state.title = '物料名称';
});
}
let payList = applyInfo.payList ? applyInfo.payList.map((item) => ({
...item,
payRatio: +(new BigNumber(item.payRatio).multipliedBy(100)).toFixed(2),
......@@ -201,7 +203,7 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({
setPayInfoLoading(true);
try {
// 编辑状态才请求支付信息,否则默认取申请信息里边的支付信息
if (isEdit) {
if (isEdit && isMateriel) {
const res = await PublicApi.getOrderCommonAfterSalePaymentFind({
orderId: `${applyInfo.orderId}`,
});
......@@ -247,9 +249,7 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({
};
useEffect(() => {
if (!isMateriel) {
getPayInfo();
}
getPayInfo();
}, [applyInfo]);
const handleClose = () => {
......
......@@ -736,7 +736,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
returnReason: extraData.returnReason,
orderType: orderTypeValue,
});
setVisibleReturnInfoDrawer(true)
setVisibleReturnInfoDrawer(true);
};
const handleReturnInfoSubmit = values => {
......
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