Commit 94effd5f authored by guang.wu's avatar guang.wu

fix: 修改上传发票逻辑

parent dfda61d6
import RoleType, { isPlatForm } from './role.config'; import RoleType, { isPlatForm } from './role.config';
const isProduction = process.env.NODE_ENV === 'production'; const isProduction = process.env.NODE_ENV === 'production';
const isPre = process.env.PRE_ENV === 'pre'; const isPre = process.env.PRE_ENV === 'pre';
const environment = 'sc'; const environment = 'yxm2';
const envAPi = { const envAPi = {
api: `https://security-${environment}.liangkebang.net`, //'https://security-xyqb.liangkebang.net', api: `https://security-${environment}.liangkebang.net`, //'https://security-xyqb.liangkebang.net',
......
import React, { useRef, useEffect } from 'react'; import React, { useRef, useEffect } from 'react';
import { Modal, Form, Upload, Input } from 'antd'; import { Modal, Form, Upload, Input } from 'antd';
import { merchantView } from '../service'; import { apiMerchantView } from '../service';
import { getFileData } from '@/utils/bll';
const formItemLayout = { const formItemLayout = {
labelCol: { span: 4 }, labelCol: { span: 4 },
...@@ -15,68 +16,30 @@ const InvoiceListModal = props => { ...@@ -15,68 +16,30 @@ const InvoiceListModal = props => {
const { id } = props; const { id } = props;
const getDetail = async () => { const getDetail = async () => {
// const data = await merchantView(id); const res = await apiMerchantView(id);
// if (data.businessCode === '0000') { if (res && res.data) {
// // settoExamineData({ ...data.data }); const { invoiceFiles = [], refuseReason } = res.data;
// // setToExamineModalVisibel(true); // 发票列表
// // setVisibleInvoiceList(true); const invoiceList = [];
// refForm.current?.setFieldsValue?.({ // 补录发票列表
// fileList: [{ url: 'https://kdspstatic.q-gp.com//CAA61F398F500001A395224099801D75.png', name: '18.png', uid: 0, status: 'done' }], const subInvoiceList = [];
// other: '11111',
// sFileList: [{ url: 'https://kdspstatic.q-gp.com//CAA61F398F500001A395224099801D75.png', name: '18.png', uid: 0, status: 'done' }], invoiceFiles.forEach(item => {
// sOther: '2222', if (item.supplementary) {
// }) subInvoiceList.push(item);
// } } else {
refForm.current?.setFieldsValue?.({ invoiceList.push(item);
fileList: [ }
{ });
url: 'https://kdspstatic.q-gp.com/CAA61F398F500001A395224099801D75.png',
name: '18.png', const params = {
uid: 0, fileList: getFileData(invoiceList, 'filePath', 'fileName'),
status: 'done', other: refuseReason,
}, sFileList: getFileData(subInvoiceList, 'filePath', 'fileName'),
], sOther: '',
other: '11111', };
sFileList: [ refForm.current?.setFieldsValue?.(params);
{ }
url: 'https://kdspstatic.q-gp.com/CAA61F398F500001A395224099801D75.png',
name: '18.png',
uid: 0,
status: 'done',
},
{
url: 'https://kdspstatic.q-gp.com/CAA61F398F500001A395224099801D75.png',
name: '18.png',
uid: 1,
status: 'done',
},
{
url: 'https://kdspstatic.q-gp.com/CAA61F398F500001A395224099801D75.png',
name: '18.png',
uid: 2,
status: 'done',
},
{
url: 'https://kdspstatic.q-gp.com/CAA61F398F500001A395224099801D75.png',
name: '18.png',
uid: 3,
status: 'done',
},
{
url: 'https://kdspstatic.q-gp.com/CAA61F398F500001A395224099801D75.png',
name: '18.png',
uid: 4,
status: 'done',
},
{
url: 'https://kdspstatic.q-gp.com/CAA61F398F500001A395224099801D75.png',
name: '18.png',
uid: 5,
status: 'done',
},
],
sOther: '2222',
});
}; };
useEffect(() => { useEffect(() => {
......
...@@ -2,7 +2,7 @@ import React, { useState, useRef } from 'react'; ...@@ -2,7 +2,7 @@ import React, { useState, useRef } from 'react';
import { Modal, notification, Form } from 'antd'; import { Modal, notification, Form } from 'antd';
import Upload from './CustomUpload'; import Upload from './CustomUpload';
import { formItemLayout } from '../data'; import { formItemLayout } from '../data';
import { uploadBill } from '../service'; import { apiUploadSupplementaryBill } from '../service';
/** /**
* 上传发票弹窗 * 上传发票弹窗
...@@ -20,7 +20,7 @@ const UploadInvoiceModal = props => { ...@@ -20,7 +20,7 @@ const UploadInvoiceModal = props => {
fileName: fileList[0]?.name || '', fileName: fileList[0]?.name || '',
id, id,
}; };
const data = await uploadBill(params); const data = await apiUploadSupplementaryBill(params);
if (data.businessCode === '0000') { if (data.businessCode === '0000') {
notification.success({ message: '上传成功' }); notification.success({ message: '上传成功' });
props.onCancel(true); props.onCancel(true);
......
...@@ -19,7 +19,7 @@ import { ...@@ -19,7 +19,7 @@ import {
selfPaymentExport, selfPaymentExport,
selfPaymentexportDetail, selfPaymentexportDetail,
settlement, settlement,
merchantView, apiMerchantView,
} from './service'; } from './service';
const { confirm } = Modal; const { confirm } = Modal;
...@@ -79,7 +79,7 @@ const PaymentMange = props => { ...@@ -79,7 +79,7 @@ const PaymentMange = props => {
}; };
// 查看发票 // 查看发票
const invoiceDetail = async params => { const invoiceDetail = async params => {
const data = await merchantView(params); const data = await apiMerchantView(params);
if (data.businessCode === '0000') { if (data.businessCode === '0000') {
settoExamineData({ ...data.data }); settoExamineData({ ...data.data });
// setToExamineModalVisibel(true); // setToExamineModalVisibel(true);
...@@ -95,9 +95,8 @@ const PaymentMange = props => { ...@@ -95,9 +95,8 @@ const PaymentMange = props => {
settoExamineData({ id }); settoExamineData({ id });
setToExamineModalVisibel(true); setToExamineModalVisibel(true);
} else if (status === 2) { } else if (status === 2) {
settoExamineData({ id });
setVisibleInvoiceList(true); setVisibleInvoiceList(true);
// setstatus(status);
// invoiceDetail(id);
} else if (status === 3) { } else if (status === 3) {
exportDetail(id); exportDetail(id);
} else if (status === 11) { } else if (status === 11) {
...@@ -238,8 +237,12 @@ const PaymentMange = props => { ...@@ -238,8 +237,12 @@ const PaymentMange = props => {
/> />
)} )}
</PageHeaderWrapper> </PageHeaderWrapper>
{visibleUploadInvoice && <UploadInvoiceModal onCancel={onCloseUploadInvoice} />} {visibleUploadInvoice && (
{visibleInvoiceList && <InvoiceListModal onCancel={setVisibleInvoiceList} />} <UploadInvoiceModal onCancel={onCloseUploadInvoice} id={toExamineData.id} />
)}
{visibleInvoiceList && (
<InvoiceListModal onCancel={setVisibleInvoiceList} id={toExamineData.id} />
)}
</Spin> </Spin>
); );
}; };
......
import UUID from '@/utils/uuid';
export const layout = { export const layout = {
labelCol: { span: 6 }, labelCol: { span: 6 },
wrapperCol: { span: 16 }, wrapperCol: { span: 16 },
}; };
/**
* 文件路径数组转Upload fileList 列表值
* * */
export const getFileData = (arr = [], urlKey, nameKey) =>
arr.map(item => {
let url = item;
let name = item;
if (urlKey) {
url = item[urlKey];
}
if (nameKey) {
name = item[nameKey];
}
return {
url,
name,
uid: UUID.createUUID(),
status: 'done',
};
});
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