Commit 95710f94 authored by XieZhiXiong's avatar XieZhiXiong

feat: 新增退款余额、对公账户信息查询、新增申请单隐藏申请单号、内外部状态

parent da89aa65
import React, { useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Descriptions, Space, Button } from 'antd'; import { Descriptions, Space, Button, Spin } from 'antd';
import { PublicApi } from '@/services/api';
interface bankAccount {
id: number,
name: string,
bankAccount: string,
bankDeposit: string,
memberId: number,
};
interface BalanceProps { interface BalanceProps {
/** /**
...@@ -26,6 +19,14 @@ interface BalanceProps { ...@@ -26,6 +19,14 @@ interface BalanceProps {
* 弹窗提交 loading * 弹窗提交 loading
*/ */
submitLoading: boolean; submitLoading: boolean;
/**
* 采购商id
*/
purchaserId: number,
/**
* 采购商角色id
*/
purchaserRoleId: number,
}; };
const Balance: React.FC<BalanceProps> = ({ const Balance: React.FC<BalanceProps> = ({
...@@ -34,20 +35,35 @@ const Balance: React.FC<BalanceProps> = ({ ...@@ -34,20 +35,35 @@ const Balance: React.FC<BalanceProps> = ({
value, value,
submitLoading, submitLoading,
}) => { }) => {
const [bankAccount, setBankAccount] = useState<bankAccount>({ const [balance, setBalance] = useState(0);
id: 0, const [loading, setLoading] = useState(false);
name: '',
bankAccount: '', const getPayAssetAccountGetUserBalance = () => {
bankDeposit: '', // setLoading(false);
memberId: 0, // // todo 这个接口可能要改
}); // PublicApi.getPayAssetAccountGetUserBalance({
// payType: `${1}`,
// parentMemberId: `${0}`,
// parentMemberRoleId: `${0}`,
// }).then(res => {
// if (res.code === 1000) {
// setBalance(res.data);
// }
// }).finally(() => {
// setLoading(false);
// });
};
useEffect(() => {
getPayAssetAccountGetUserBalance();
}, []);
return ( return (
<> <Spin spinning={loading}>
<Descriptions title="账户余额信息" column={1}> <Descriptions title="账户余额信息" column={1}>
<Descriptions.Item label="账户可用余额">500000.00</Descriptions.Item> <Descriptions.Item label="账户可用余额">{balance}</Descriptions.Item>
<Descriptions.Item label="当前退款金额"> <Descriptions.Item label="当前退款金额">
<span style={{ color: '#EF6260' }}>6000.00</span> <span style={{ color: '#EF6260' }}>{value.refundAmount}</span>
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
...@@ -65,7 +81,7 @@ const Balance: React.FC<BalanceProps> = ({ ...@@ -65,7 +81,7 @@ const Balance: React.FC<BalanceProps> = ({
</Button> </Button>
</Space> </Space>
</div> </div>
</> </Spin>
) )
}; };
......
...@@ -34,13 +34,6 @@ const COD: React.FC<BalanceProps> = ({ ...@@ -34,13 +34,6 @@ const COD: React.FC<BalanceProps> = ({
value, value,
submitLoading, submitLoading,
}) => { }) => {
const [bankAccount, setBankAccount] = useState<bankAccount>({
id: 0,
name: '',
bankAccount: '',
bankDeposit: '',
memberId: 0,
});
return ( return (
<> <>
...@@ -53,7 +46,7 @@ const COD: React.FC<BalanceProps> = ({ ...@@ -53,7 +46,7 @@ const COD: React.FC<BalanceProps> = ({
<Descriptions column={1}> <Descriptions column={1}>
<Descriptions.Item label="支付方式">货到付款</Descriptions.Item> <Descriptions.Item label="支付方式">货到付款</Descriptions.Item>
<Descriptions.Item label="退款金额"> <Descriptions.Item label="退款金额">
<span style={{ color: '#EF6260' }}>6000.00</span> <span style={{ color: '#EF6260' }}>{value.refundAmount}</span>
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
......
import React, { useState } from 'react'; import React, { useState, useEffect } from 'react';
import { Button, Space, message } from 'antd'; import { Button, Space, message, Spin } from 'antd';
import { createFormActions } from '@formily/antd'; import { createFormActions } from '@formily/antd';
import { PublicApi } from '@/services/api';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
import { uploadVoucherModalSchema } from './schema'; import { uploadVoucherModalSchema } from './schema';
...@@ -29,6 +30,14 @@ interface UploadVoucherProps { ...@@ -29,6 +30,14 @@ interface UploadVoucherProps {
* 弹窗提交 loading * 弹窗提交 loading
*/ */
submitLoading: boolean; submitLoading: boolean;
/**
* 采购商id
*/
purchaserId: number,
/**
* 采购商角色id
*/
purchaserRoleId: number,
}; };
const UploadVoucher: React.FC<UploadVoucherProps> = ({ const UploadVoucher: React.FC<UploadVoucherProps> = ({
...@@ -36,12 +45,37 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({ ...@@ -36,12 +45,37 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({
handleModalVisible, handleModalVisible,
value, value,
submitLoading, submitLoading,
purchaserId,
purchaserRoleId,
}) => { }) => {
const [bankAccount, setBankAccount] = useState<bankAccount>({ const [bankAccount, setBankAccount] = useState<bankAccount>({
name: '', name: '',
bankAccount: '', bankAccount: '',
bankDeposit: '', bankDeposit: '',
}); });
const [loading, setLoading] = useState(false);
// 获取对公账户信息
const getSettleAccountsCorporateAccountConfig = (memberId: number, memberRoleId: number) => {
if (!memberId || !memberRoleId) {
return;
}
setLoading(true);
PublicApi.getSettleAccountsCorporateAccountConfig({
memberId: `${memberId}`,
memberRoleId: `${memberRoleId}`,
}).then(res => {
if (res.code === 1000) {
setBankAccount(res.data);
}
}).finally(() => {
setLoading(false);
});
};
useEffect(() => {
getSettleAccountsCorporateAccountConfig(purchaserId, purchaserRoleId);
}, []);
const beforeUploadVoucher = file => { const beforeUploadVoucher = file => {
console.log(file.size) console.log(file.size)
...@@ -73,7 +107,7 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({ ...@@ -73,7 +107,7 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({
}; };
return ( return (
<> <Spin spinning={loading}>
<NiceForm <NiceForm
previewPlaceholder="" previewPlaceholder=""
initialValues={bankAccount} initialValues={bankAccount}
...@@ -102,7 +136,7 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({ ...@@ -102,7 +136,7 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({
</Button> </Button>
</Space> </Space>
</div> </div>
</> </Spin>
) )
}; };
......
...@@ -50,6 +50,8 @@ const RefundModal: React.FC<RefundModalProps> = ({ ...@@ -50,6 +50,8 @@ const RefundModal: React.FC<RefundModalProps> = ({
<Suspense fallback={null}> <Suspense fallback={null}>
<UploadVoucher <UploadVoucher
value={value} value={value}
purchaserId={value.purchaserId}
purchaserRoleId={value.purchaserRoleId}
handleConfirm={handleConfirm} handleConfirm={handleConfirm}
handleModalVisible={handleModalVisible} handleModalVisible={handleModalVisible}
submitLoading={submitLoading} submitLoading={submitLoading}
......
...@@ -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: 2020-12-15 10:26:44 * @LastEditTime: 2020-12-28 13:53:00
* @Description: 退款明细 * @Description: 退款明细
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
...@@ -58,6 +58,14 @@ interface ReturnDetailInfoProps { ...@@ -58,6 +58,14 @@ interface ReturnDetailInfoProps {
* 退货申请单内部状态 * 退货申请单内部状态
*/ */
innerStatus: number; innerStatus: number;
/**
* 采购商id
*/
purchaserId: number,
/**
* 采购商角色id
*/
purchaserRoleId: number,
}; };
const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
...@@ -66,6 +74,8 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ ...@@ -66,6 +74,8 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
onConfirm, onConfirm,
isPurchaser = false, isPurchaser = false,
innerStatus, innerStatus,
purchaserId,
purchaserRoleId,
}) => { }) => {
const [visibleResult, setVisibleResult] = useState(false); const [visibleResult, setVisibleResult] = useState(false);
const [notReceivedLoading, setNotReceivedLoading] = useState(false); const [notReceivedLoading, setNotReceivedLoading] = useState(false);
...@@ -143,34 +153,34 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ ...@@ -143,34 +153,34 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
}, },
]; ];
const handleRefund = (id, channel) => { const handleRefund = (id, channel, amount) => {
switch(channel) { switch(channel) {
// 余额支付 // 余额支付
case PAY_CHANNEL_BALANCE: { case PAY_CHANNEL_BALANCE: {
setModalName('balance'); setModalName('balance');
setRefundModalVisible(true); setRefundModalVisible(true);
setRefundModalValue({ id }); setRefundModalValue({ id, refundAmount: amount });
break; break;
}; };
// 线下支付 // 线下支付
case PAY_CHANNEL_OFFLINE: { case PAY_CHANNEL_OFFLINE: {
setModalName('uploadVoucher'); setModalName('uploadVoucher');
setRefundModalVisible(true); setRefundModalVisible(true);
setRefundModalValue({ id }); setRefundModalValue({ id, purchaserId, purchaserRoleId });
break; break;
}; };
// 授信支付 // 授信支付
case PAY_CHANNEL_CREDIT: { case PAY_CHANNEL_CREDIT: {
setModalName('credit'); setModalName('credit');
setRefundModalVisible(true); setRefundModalVisible(true);
setRefundModalValue({ id }); setRefundModalValue({ id, refundAmount: amount });
break; break;
}; };
// 货到付款 // 货到付款
case PAY_CHANNEL_COD: { case PAY_CHANNEL_COD: {
setModalName('COD'); setModalName('COD');
setRefundModalVisible(true); setRefundModalVisible(true);
setRefundModalValue({ id }); setRefundModalValue({ id, refundAmount: amount });
break; break;
}; };
default: { default: {
...@@ -215,9 +225,11 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ ...@@ -215,9 +225,11 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
const handleRefundConfirm = (values, modalName) => { const handleRefundConfirm = (values, modalName) => {
setSubmitLoading(true); setSubmitLoading(true);
if (onRefund) {
onRefund(values).finally(() => { onRefund(values).finally(() => {
setSubmitLoading(false); setSubmitLoading(false);
}); });
}
}; };
return ( return (
...@@ -264,14 +276,15 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ ...@@ -264,14 +276,15 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
<div className={styles['deliver-item-actions']}> <div className={styles['deliver-item-actions']}>
{ {
!isPurchaser && !isPurchaser &&
innerStatus === RETURN_INNER_STATUS_TO_BE_REFUNDED && ( innerStatus === RETURN_INNER_STATUS_TO_BE_REFUNDED &&
!!item.canRefund && (
item.outerStatus === REFUND_OUTER_STATUS_NOT_RECEIVED || item.outerStatus === REFUND_OUTER_STATUS_NOT_RECEIVED ||
item.innerStatus === REFUND_INNER_STATUS_NO_REFUND || item.innerStatus === REFUND_INNER_STATUS_NO_REFUND ||
item.innerStatus === REFUND_INNER_STATUS_REFUND_FAILED item.innerStatus === REFUND_INNER_STATUS_REFUND_FAILED
) && ( ) && (
<div <div
className={styles['deliver-item-return']} className={styles['deliver-item-return']}
onClick={() => handleRefund(item.refundId, item.channel)} onClick={() => handleRefund(item.refundId, item.channel, item.refundAmount)}
> >
退款 退款
</div> </div>
......
...@@ -28,6 +28,7 @@ import { ...@@ -28,6 +28,7 @@ import {
const addSchemaAction = createFormActions(); const addSchemaAction = createFormActions();
const { const {
onFormInputChange$, onFormInputChange$,
onFormInit$,
} = FormEffectHooks; } = FormEffectHooks;
interface BillsFormProps { interface BillsFormProps {
...@@ -511,12 +512,22 @@ const ExchangeForm: React.FC<BillsFormProps> = ({ ...@@ -511,12 +512,22 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
}} }}
editable={isEdit || !id} editable={isEdit || !id}
effects={($, actions) => { effects={($, actions) => {
const { setFieldState } = actions;
createEffects($, actions) createEffects($, actions)
onFormInputChange$().subscribe(() => { onFormInputChange$().subscribe(() => {
if (!unsaved) { if (!unsaved) {
setUnsaved(true); setUnsaved(true);
} }
}); });
onFormInit$().subscribe(() => {
if (!id && isEdit) {
setFieldState('*(applyNo,outerStatus,innerStatus)', field => {
field.visible = false;
});
}
});
}} }}
onSubmit={handleSubmit} onSubmit={handleSubmit}
actions={addSchemaAction} actions={addSchemaAction}
......
...@@ -26,6 +26,7 @@ import { ...@@ -26,6 +26,7 @@ import {
const addSchemaAction = createFormActions(); const addSchemaAction = createFormActions();
const { const {
onFormInputChange$, onFormInputChange$,
onFormInit$,
} = FormEffectHooks; } = FormEffectHooks;
interface DetailInfo { interface DetailInfo {
...@@ -356,12 +357,22 @@ const RepairForm: React.FC<BillsFormProps> = ({ ...@@ -356,12 +357,22 @@ const RepairForm: React.FC<BillsFormProps> = ({
}} }}
editable={isEdit || !id} editable={isEdit || !id}
effects={($, actions) => { effects={($, actions) => {
const { setFieldState } = actions;
createEffects($, actions) createEffects($, actions)
onFormInputChange$().subscribe(() => { onFormInputChange$().subscribe(() => {
if (!unsaved) { if (!unsaved) {
setUnsaved(true); setUnsaved(true);
} }
}); });
onFormInit$().subscribe(() => {
if (!id && isEdit) {
setFieldState('*(applyNo,outerStatus,innerStatus)', field => {
field.visible = false;
});
}
});
}} }}
onSubmit={handleSubmit} onSubmit={handleSubmit}
actions={addSchemaAction} actions={addSchemaAction}
......
...@@ -416,6 +416,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -416,6 +416,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
dataSource={detailInfo && detailInfo.refundList ? detailInfo.refundList : []} dataSource={detailInfo && detailInfo.refundList ? detailInfo.refundList : []}
onConfirm={handleConfirm} onConfirm={handleConfirm}
innerStatus={detailInfo?.innerStatus} innerStatus={detailInfo?.innerStatus}
purchaserId={detailInfo?.memberId}
purchaserRoleId={detailInfo?.roleId}
isPurchaser isPurchaser
/> />
</Suspense> </Suspense>
......
...@@ -29,6 +29,7 @@ import { ...@@ -29,6 +29,7 @@ import {
const addSchemaAction = createFormActions(); const addSchemaAction = createFormActions();
const { const {
onFormInputChange$, onFormInputChange$,
onFormInit$,
} = FormEffectHooks; } = FormEffectHooks;
interface BillsFormProps { interface BillsFormProps {
...@@ -575,12 +576,22 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -575,12 +576,22 @@ const ReturnForm: React.FC<BillsFormProps> = ({
}} }}
editable={isEdit || !id} editable={isEdit || !id}
effects={($, actions) => { effects={($, actions) => {
const { setFieldState } = actions;
createEffects($, actions) createEffects($, actions)
onFormInputChange$().subscribe(() => { onFormInputChange$().subscribe(() => {
if (!unsaved) { if (!unsaved) {
setUnsaved(true); setUnsaved(true);
} }
}); });
onFormInit$().subscribe(() => {
if (!id && isEdit) {
setFieldState('*(applyNo,outerStatus,innerStatus)', field => {
field.visible = false;
});
}
});
}} }}
onSubmit={handleSubmit} onSubmit={handleSubmit}
actions={addSchemaAction} actions={addSchemaAction}
......
...@@ -329,7 +329,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -329,7 +329,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
// 退款 // 退款
const handleRefund = (values): Promise<any> => { const handleRefund = (values): Promise<any> => {
const { id, ...rest } = values; const { id, refundAmount, ...rest } = values;
return PublicApi.postAsReturnGoodsRefund({ return PublicApi.postAsReturnGoodsRefund({
dataId: id, dataId: id,
...rest, ...rest,
...@@ -463,6 +463,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -463,6 +463,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
dataSource={detailInfo && detailInfo.refundList ? detailInfo.refundList : []} dataSource={detailInfo && detailInfo.refundList ? detailInfo.refundList : []}
onRefund={handleRefund} onRefund={handleRefund}
innerStatus={detailInfo?.innerStatus} innerStatus={detailInfo?.innerStatus}
purchaserId={detailInfo?.memberId}
purchaserRoleId={detailInfo?.roleId}
/> />
</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