Commit 139dfbc3 authored by XieZhiXiong's avatar XieZhiXiong

feat: 添加退款对应弹窗内容显示

parent 77608542
...@@ -41,6 +41,9 @@ const Balance: React.FC<BalanceProps> = ({ ...@@ -41,6 +41,9 @@ const Balance: React.FC<BalanceProps> = ({
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const getPayAssetAccountGetUserBalance = () => { const getPayAssetAccountGetUserBalance = () => {
if (!purchaserId || !purchaserRoleId) {
return;
}
setLoading(false); setLoading(false);
PublicApi.getPayAssetAccountGetChildUserBalance({ PublicApi.getPayAssetAccountGetChildUserBalance({
childMemberId: `${purchaserId}`, childMemberId: `${purchaserId}`,
......
import React, { useState } from 'react'; import React, { useState, useEffect } from 'react';
import { Descriptions, Space, Button } from 'antd'; import { Descriptions, Space, Button, Spin } from 'antd';
import { PublicApi } from '@/services/api';
interface bankAccount { interface Credit {
id: number, quota: number,
name: string, useQuota: number,
bankAccount: string, canUseQuota: number,
bankDeposit: string, isUsable: number,
memberId: number,
}; };
interface BalanceProps { interface BalanceProps {
...@@ -26,6 +26,22 @@ interface BalanceProps { ...@@ -26,6 +26,22 @@ interface BalanceProps {
* 弹窗提交 loading * 弹窗提交 loading
*/ */
submitLoading: boolean; submitLoading: boolean;
/**
* 采购商id
*/
purchaserId: number,
/**
* 采购商角色id
*/
purchaserRoleId: number,
/**
* 供应商id
*/
supplierId: number,
/**
* 供应商角色id
*/
supplierRoleId: number,
}; };
const Credit: React.FC<BalanceProps> = ({ const Credit: React.FC<BalanceProps> = ({
...@@ -33,23 +49,55 @@ const Credit: React.FC<BalanceProps> = ({ ...@@ -33,23 +49,55 @@ const Credit: React.FC<BalanceProps> = ({
handleConfirm, handleConfirm,
value, value,
submitLoading, submitLoading,
purchaserId,
purchaserRoleId,
supplierId,
supplierRoleId,
}) => { }) => {
const [bankAccount, setBankAccount] = useState<bankAccount>({ const [credit, setCredit] = useState<Credit>({
id: 0, quota: 0,
name: '', useQuota: 0,
bankAccount: '', canUseQuota: 0,
bankDeposit: '', isUsable: 0,
memberId: 0,
}); });
const [loading, setLoading] = useState(false);
const getMemberCredit = () => {
if (
!purchaserId ||
!purchaserRoleId ||
!supplierId ||
!supplierRoleId
) {
return;
}
setLoading(true);
PublicApi.getPayCreditGetMemberCredit({
memberId: `${purchaserId}`,
roleId: `${purchaserRoleId}`,
parentMemberId: `${supplierId}`,
parentMemberRoleId: `${supplierRoleId}`,
}).then(res => {
if (res.code === 1000) {
setCredit(res.data);
}
}).finally(() => {
setLoading(false);
});
};
useEffect(() => {
getMemberCredit();
}, []);
return ( return (
<> <Spin spinning={loading}>
<Descriptions title="授信额度信息" column={1}> <Descriptions title="授信额度信息" column={1}>
<Descriptions.Item label="总授信额度">500000.00</Descriptions.Item> <Descriptions.Item label="总授信额度">{credit.quota}</Descriptions.Item>
<Descriptions.Item label="已用授信额度">500000.00</Descriptions.Item> <Descriptions.Item label="已用授信额度">{credit.useQuota}</Descriptions.Item>
<Descriptions.Item label="可用授信额度">500000.00</Descriptions.Item> <Descriptions.Item label="可用授信额度">{credit.canUseQuota}</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>
...@@ -67,7 +115,7 @@ const Credit: React.FC<BalanceProps> = ({ ...@@ -67,7 +115,7 @@ const Credit: React.FC<BalanceProps> = ({
</Button> </Button>
</Space> </Space>
</div> </div>
</> </Spin>
) )
}; };
......
...@@ -7,10 +7,11 @@ import { uploadVoucherModalSchema } from './schema'; ...@@ -7,10 +7,11 @@ import { uploadVoucherModalSchema } from './schema';
const uploadVoucherFormActions = createFormActions(); const uploadVoucherFormActions = createFormActions();
interface bankAccount { interface BankAccount {
name: string, name: string,
bankAccount: string, bankAccount: string,
bankDeposit: string, bankDeposit: string,
id: number,
}; };
interface UploadVoucherProps { interface UploadVoucherProps {
...@@ -48,22 +49,23 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({ ...@@ -48,22 +49,23 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({
purchaserId, purchaserId,
purchaserRoleId, purchaserRoleId,
}) => { }) => {
const [bankAccount, setBankAccount] = useState<bankAccount>({ const [bankAccount, setBankAccount] = useState<BankAccount>({
name: '', name: '',
bankAccount: '', bankAccount: '',
bankDeposit: '', bankDeposit: '',
id: 0,
}); });
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
// 获取对公账户信息 // 获取对公账户信息
const getSettleAccountsCorporateAccountConfig = (memberId: number, memberRoleId: number) => { const getSettleAccountsGetMemberAccountConfig = () => {
if (!memberId || !memberRoleId) { if (!purchaserId || !purchaserRoleId) {
return; return;
} }
setLoading(true); setLoading(true);
PublicApi.getSettleAccountsCorporateAccountConfig({ PublicApi.getSettleAccountsGetMemberAccountConfig({
memberId: `${memberId}`, memberId: `${purchaserId}`,
memberRoleId: `${memberRoleId}`, roleId: `${purchaserRoleId}`,
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
setBankAccount(res.data); setBankAccount(res.data);
...@@ -74,11 +76,10 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({ ...@@ -74,11 +76,10 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({
}; };
useEffect(() => { useEffect(() => {
getSettleAccountsCorporateAccountConfig(purchaserId, purchaserRoleId); getSettleAccountsGetMemberAccountConfig();
}, []); }, []);
const beforeUploadVoucher = file => { const beforeUploadVoucher = file => {
console.log(file.size)
if (file.size / 1024 > 200) { if (file.size / 1024 > 200) {
message.warning('图片大小超过200K'); message.warning('图片大小超过200K');
return Promise.reject(); return Promise.reject();
...@@ -86,17 +87,17 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({ ...@@ -86,17 +87,17 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({
}; };
const handleUploadVoucherSubmit = values => { const handleUploadVoucherSubmit = values => {
const { fileList = [] } = values; const { fileList = [], id, ...rest } = values;
if (handleConfirm) { if (handleConfirm) {
if (!bankAccount || !bankAccount.name) { if (!bankAccount || !bankAccount.id) {
message.error('没有收款账户相关信息,无法退款'); message.error('没有收款账户相关信息,无法退款');
return; return;
} }
handleConfirm({ handleConfirm({
...value, ...value,
payProve: { payProve: {
...values, ...rest,
fileList: fileList.map(item => item.status === 'done' && ({ fileList: fileList.map(item => item.status === 'done' && ({
name: item.name, name: item.name,
proveUrl: item.data.url, proveUrl: item.data.url,
...@@ -110,7 +111,7 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({ ...@@ -110,7 +111,7 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({
<Spin spinning={loading}> <Spin spinning={loading}>
<NiceForm <NiceForm
previewPlaceholder="" previewPlaceholder=""
initialValues={bankAccount} value={bankAccount}
effects={($, { setFieldState }) => { effects={($, { setFieldState }) => {
}} }}
......
...@@ -41,6 +41,13 @@ const RefundModal: React.FC<RefundModalProps> = ({ ...@@ -41,6 +41,13 @@ const RefundModal: React.FC<RefundModalProps> = ({
value, value,
submitLoading, submitLoading,
}) => { }) => {
const {
purchaserId,
purchaserRoleId,
supplierId,
supplierRoleId,
...rest
} = value;
const tempMap = { const tempMap = {
uploadVoucher: { uploadVoucher: {
...@@ -49,9 +56,9 @@ const RefundModal: React.FC<RefundModalProps> = ({ ...@@ -49,9 +56,9 @@ const RefundModal: React.FC<RefundModalProps> = ({
render: () => ( render: () => (
<Suspense fallback={null}> <Suspense fallback={null}>
<UploadVoucher <UploadVoucher
value={value} value={rest}
purchaserId={value.purchaserId} purchaserId={purchaserId}
purchaserRoleId={value.purchaserRoleId} purchaserRoleId={purchaserRoleId}
handleConfirm={handleConfirm} handleConfirm={handleConfirm}
handleModalVisible={handleModalVisible} handleModalVisible={handleModalVisible}
submitLoading={submitLoading} submitLoading={submitLoading}
...@@ -65,7 +72,9 @@ const RefundModal: React.FC<RefundModalProps> = ({ ...@@ -65,7 +72,9 @@ const RefundModal: React.FC<RefundModalProps> = ({
render: () => ( render: () => (
<Suspense fallback={null}> <Suspense fallback={null}>
<Balance <Balance
value={value} value={rest}
purchaserId={purchaserId}
purchaserRoleId={purchaserRoleId}
handleConfirm={handleConfirm} handleConfirm={handleConfirm}
handleModalVisible={handleModalVisible} handleModalVisible={handleModalVisible}
submitLoading={submitLoading} submitLoading={submitLoading}
...@@ -79,7 +88,11 @@ const RefundModal: React.FC<RefundModalProps> = ({ ...@@ -79,7 +88,11 @@ const RefundModal: React.FC<RefundModalProps> = ({
render: () => ( render: () => (
<Suspense fallback={null}> <Suspense fallback={null}>
<Credit <Credit
value={value} value={rest}
purchaserId={purchaserId}
purchaserRoleId={purchaserRoleId}
supplierId={supplierId}
supplierRoleId={supplierRoleId}
handleConfirm={handleConfirm} handleConfirm={handleConfirm}
handleModalVisible={handleModalVisible} handleModalVisible={handleModalVisible}
submitLoading={submitLoading} submitLoading={submitLoading}
...@@ -93,7 +106,7 @@ const RefundModal: React.FC<RefundModalProps> = ({ ...@@ -93,7 +106,7 @@ const RefundModal: React.FC<RefundModalProps> = ({
render: () => ( render: () => (
<Suspense fallback={null}> <Suspense fallback={null}>
<COD <COD
value={value} value={rest}
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-28 13:53:00 * @LastEditTime: 2020-12-29 11:00:22
* @Description: 退款明细 * @Description: 退款明细
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
...@@ -66,6 +66,14 @@ interface ReturnDetailInfoProps { ...@@ -66,6 +66,14 @@ interface ReturnDetailInfoProps {
* 采购商角色id * 采购商角色id
*/ */
purchaserRoleId: number, purchaserRoleId: number,
/**
* 供应商id
*/
supplierId: number,
/**
* 供应商角色id
*/
supplierRoleId: number,
}; };
const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
...@@ -76,6 +84,8 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ ...@@ -76,6 +84,8 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
innerStatus, innerStatus,
purchaserId, purchaserId,
purchaserRoleId, purchaserRoleId,
supplierId,
supplierRoleId,
}) => { }) => {
const [visibleResult, setVisibleResult] = useState(false); const [visibleResult, setVisibleResult] = useState(false);
const [notReceivedLoading, setNotReceivedLoading] = useState(false); const [notReceivedLoading, setNotReceivedLoading] = useState(false);
...@@ -159,21 +169,37 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({ ...@@ -159,21 +169,37 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
case PAY_CHANNEL_BALANCE: { case PAY_CHANNEL_BALANCE: {
setModalName('balance'); setModalName('balance');
setRefundModalVisible(true); setRefundModalVisible(true);
setRefundModalValue({ id, refundAmount: amount }); setRefundModalValue({
id,
refundAmount: amount,
purchaserId,
purchaserRoleId,
});
break; break;
}; };
// 线下支付 // 线下支付
case PAY_CHANNEL_OFFLINE: { case PAY_CHANNEL_OFFLINE: {
setModalName('uploadVoucher'); setModalName('uploadVoucher');
setRefundModalVisible(true); setRefundModalVisible(true);
setRefundModalValue({ id, purchaserId, purchaserRoleId }); setRefundModalValue({
id,
purchaserId,
purchaserRoleId,
});
break; break;
}; };
// 授信支付 // 授信支付
case PAY_CHANNEL_CREDIT: { case PAY_CHANNEL_CREDIT: {
setModalName('credit'); setModalName('credit');
setRefundModalVisible(true); setRefundModalVisible(true);
setRefundModalValue({ id, refundAmount: amount }); setRefundModalValue({
id,
refundAmount: amount,
purchaserId,
purchaserRoleId,
supplierId,
supplierRoleId,
});
break; break;
}; };
// 货到付款 // 货到付款
......
...@@ -418,6 +418,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -418,6 +418,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
innerStatus={detailInfo?.innerStatus} innerStatus={detailInfo?.innerStatus}
purchaserId={detailInfo?.memberId} purchaserId={detailInfo?.memberId}
purchaserRoleId={detailInfo?.roleId} purchaserRoleId={detailInfo?.roleId}
supplierId={detailInfo?.parentMemberId}
supplierRoleId={detailInfo?.parentMemberRoleId}
isPurchaser isPurchaser
/> />
</Suspense> </Suspense>
......
...@@ -465,6 +465,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -465,6 +465,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
innerStatus={detailInfo?.innerStatus} innerStatus={detailInfo?.innerStatus}
purchaserId={detailInfo?.memberId} purchaserId={detailInfo?.memberId}
purchaserRoleId={detailInfo?.roleId} purchaserRoleId={detailInfo?.roleId}
supplierId={detailInfo?.parentMemberId}
supplierRoleId={detailInfo?.parentMemberRoleId}
/> />
</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