Commit 74d819f7 authored by XieZhiXiong's avatar XieZhiXiong

chore: 完善联动逻辑

parent e6bb5ed2
...@@ -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-08-27 16:09:15 * @LastEditTime: 2021-08-30 19:38:32
* @Description: 退款明细 * @Description: 退款明细
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-03 18:30:47 * @Date: 2020-11-03 18:30:47
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-13 11:43:00 * @LastEditTime: 2021-08-31 10:34:04
* @Description: 联动逻辑相关 * @Description: 联动逻辑相关
*/ */
import BigNumber from 'bignumber.js'; import BigNumber from 'bignumber.js';
...@@ -37,7 +37,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -37,7 +37,7 @@ export const useBusinessEffects = (context, actions) => {
const { value } = fieldState; const { value } = fieldState;
const purchasePriceValue = await getFieldValue('purchasePrice'); const purchasePriceValue = await getFieldValue('purchasePrice');
const orderTypeValue = await getFieldValue('orderType'); const orderTypeValue = await getFieldValue('orderType');
const payListValue = await getFieldValue('payList'); const payListValue = await getFieldValue('payList') || [];
const isMateriel = ( const isMateriel = (
orderTypeValue === ORDER_TYPE_INQUIRY_CONTRACT orderTypeValue === ORDER_TYPE_INQUIRY_CONTRACT
...@@ -45,6 +45,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -45,6 +45,7 @@ export const useBusinessEffects = (context, actions) => {
|| orderTypeValue === ORDER_TYPE_TENDER_CONTRACT || orderTypeValue === ORDER_TYPE_TENDER_CONTRACT
); );
if (!isMateriel) {
const newData = [...payListValue].map(item => { const newData = [...payListValue].map(item => {
const refundAmount = item.payTime ? +(new BigNumber(+value).multipliedBy(purchasePriceValue).multipliedBy(new BigNumber(item.payRatio).dividedBy(100))).toFixed(2) : 0; const refundAmount = item.payTime ? +(new BigNumber(+value).multipliedBy(purchasePriceValue).multipliedBy(new BigNumber(item.payRatio).dividedBy(100))).toFixed(2) : 0;
return { return {
...@@ -53,6 +54,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -53,6 +54,7 @@ export const useBusinessEffects = (context, actions) => {
}; };
}); });
setFieldValue('payList', newData); setFieldValue('payList', newData);
}
if (isMateriel) { if (isMateriel) {
const refundAmount = +(new BigNumber(+value).multipliedBy(purchasePriceValue).toFixed(2)); const refundAmount = +(new BigNumber(+value).multipliedBy(purchasePriceValue).toFixed(2));
...@@ -62,7 +64,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -62,7 +64,7 @@ export const useBusinessEffects = (context, actions) => {
// 校验退货数量 // 校验退货数量
onFieldInputChange$('returnCount').subscribe(async (fieldState) => { onFieldInputChange$('returnCount').subscribe(async (fieldState) => {
const { name, value } = fieldState; const { value } = fieldState;
// 剩余数量 // 剩余数量
const remainingValue = await getFieldValue('remaining'); const remainingValue = await getFieldValue('remaining');
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-05 17:36:45 * @Date: 2020-11-05 17:36:45
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-26 19:54:01 * @LastEditTime: 2021-08-31 10:33:36
* @Description: 查看退货数量与退款金额 抽屉 * @Description: 查看退货数量与退款金额 抽屉
*/ */
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
...@@ -22,9 +22,6 @@ import Stamp from '../Stamp'; ...@@ -22,9 +22,6 @@ import Stamp from '../Stamp';
import SteamerTicket from './components/SteamerTicket'; import SteamerTicket from './components/SteamerTicket';
const schemaAction = createAsyncFormActions(); const schemaAction = createAsyncFormActions();
const {
onFormMount$,
} = FormEffectHooks;
export type PayListItem = { export type PayListItem = {
/** /**
...@@ -219,7 +216,7 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({ ...@@ -219,7 +216,7 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({
refundAmount: +(new BigNumber(+applyInfo.remaining).multipliedBy(applyInfo.purchasePrice).multipliedBy(new BigNumber(item.payRate * 100).dividedBy(100))).toFixed(2), refundAmount: +(new BigNumber(+applyInfo.remaining).multipliedBy(applyInfo.purchasePrice).multipliedBy(new BigNumber(item.payRate * 100).dividedBy(100))).toFixed(2),
payTime: item.payTime, payTime: item.payTime,
payRuleId: item.fundMode, payRuleId: item.fundMode,
externalState: 3, externalState: 3, // 这个状态写死了,因为现在只有付款了才会出现这条支付信息
transactionPayId: item.tradeNo, // 微信 或 其他第三方支付返回的 code,原路退款需要 transactionPayId: item.tradeNo, // 微信 或 其他第三方支付返回的 code,原路退款需要
})); }));
} }
...@@ -237,6 +234,7 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({ ...@@ -237,6 +234,7 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({
...applyInfo, ...applyInfo,
payList, payList,
returnCount: applyInfo.returnCount || applyInfo.remaining, // 默认赋值 returnCount: applyInfo.returnCount || applyInfo.remaining, // 默认赋值
refundAmount: applyInfo.refundAmount || +(new BigNumber(+applyInfo.remaining).multipliedBy(applyInfo.purchasePrice)), // 默认赋值
}); });
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-03 18:30:47 * @Date: 2020-11-03 18:30:47
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-21 16:26:34 * @LastEditTime: 2021-08-31 10:42:22
* @Description: 联动逻辑相关 * @Description: 联动逻辑相关
*/ */
import { Modal } from 'antd'; import { Modal } from 'antd';
...@@ -77,7 +77,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -77,7 +77,7 @@ export const useBusinessEffects = (context, actions) => {
}); });
// 供应会员联动 单据明细 // 供应会员联动 单据明细
onFieldInputChange$('supplierMember').subscribe(fieldState => { onFieldInputChange$('*(supplierMember,orderType)').subscribe(fieldState => {
const replaceGoodsListValue = getFieldValue('replaceGoodsList'); const replaceGoodsListValue = getFieldValue('replaceGoodsList');
if (replaceGoodsListValue && replaceGoodsListValue.length) { if (replaceGoodsListValue && replaceGoodsListValue.length) {
setFieldValue('replaceGoodsList', []); setFieldValue('replaceGoodsList', []);
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-03 18:30:47 * @Date: 2020-11-03 18:30:47
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-05 11:40:35 * @LastEditTime: 2021-08-31 10:32:33
* @Description: 联动逻辑相关 * @Description: 联动逻辑相关
*/ */
import { FormEffectHooks, FormPath } from '@formily/antd'; import { FormEffectHooks } from '@formily/antd';
import { useLinkageUtils } from '@/utils/formEffectUtils'; import { useLinkageUtils } from '@/utils/formEffectUtils';
const { const {
...@@ -17,8 +17,6 @@ export const useBusinessEffects = (context, actions) => { ...@@ -17,8 +17,6 @@ export const useBusinessEffects = (context, actions) => {
const { const {
getFieldValue, getFieldValue,
setFieldValue, setFieldValue,
getFieldState,
setFieldState,
} = actions; } = actions;
const linkage = useLinkageUtils(); const linkage = useLinkageUtils();
...@@ -49,8 +47,8 @@ export const useBusinessEffects = (context, actions) => { ...@@ -49,8 +47,8 @@ export const useBusinessEffects = (context, actions) => {
}; };
}); });
// 供应会员联动 单据明细 // 供应会员、售后订单类型联动 单据明细
onFieldInputChange$('supplierMember').subscribe(fieldState => { onFieldInputChange$('*(supplierMember,orderType)').subscribe(fieldState => {
const replaceGoodsListValue = getFieldValue('returnGoodsList'); const replaceGoodsListValue = getFieldValue('returnGoodsList');
if (replaceGoodsListValue && replaceGoodsListValue.length) { if (replaceGoodsListValue && replaceGoodsListValue.length) {
setFieldValue('returnGoodsList', []); setFieldValue('returnGoodsList', []);
......
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