Commit 0b925212 authored by XieZhiXiong's avatar XieZhiXiong
parents 8687048c 01193fb1
...@@ -14,7 +14,7 @@ import { schema } from './schema'; ...@@ -14,7 +14,7 @@ import { schema } from './schema';
import StatusTag, { STATUS_TYPE } from '@/components/StatusTag' import StatusTag, { STATUS_TYPE } from '@/components/StatusTag'
import { fetchOptions } from '../../common'; import { fetchOptions } from '../../common';
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable'; import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable';
import { numFormat, priceFormat } from '@/utils/numberFomat'; import { priceFormat } from '@/utils/numberFomat';
import { import {
getSettleAccountsCommonGetPayStatus, getSettleAccountsCommonGetPayStatus,
getSettleAccountsCommonGetReceiptInvoiceStatus, getSettleAccountsCommonGetReceiptInvoiceStatus,
...@@ -44,6 +44,7 @@ const SettlementList: React.FC = () => { ...@@ -44,6 +44,7 @@ const SettlementList: React.FC = () => {
const [invoiceInfo, setInvoiceInfo] = useState<any>(null) const [invoiceInfo, setInvoiceInfo] = useState<any>(null)
const [selectedRowKeys, setSelectedRowKeys] = useState<any>([]) const [selectedRowKeys, setSelectedRowKeys] = useState<any>([])
const [selectedRows, setSelectedRows] = useState<any>([]) const [selectedRows, setSelectedRows] = useState<any>([])
const [submitLoading, setSubmitLoading] = useState<boolean>(false)
/** /**
* 获取开票管理列表 * 获取开票管理列表
* @param params * @param params
...@@ -119,16 +120,18 @@ const SettlementList: React.FC = () => { ...@@ -119,16 +120,18 @@ const SettlementList: React.FC = () => {
res[item] = array res[item] = array
}) })
/** 批量开票 */ /** 批量开票 */
if (invoiceInfo[0].receiptInvoiceIds.length > 0) { if (invoiceInfo?.[0]?.receiptInvoiceIds?.length > 0) {
const _postData = { ...invoiceInfo[0], proveList: res[`list-0`] }; const _postData = { ...invoiceInfo[0], proveList: res[`list-0`] };
setSubmitLoading(true);
postSettleAccountsMemberSettlementBatchInvoiceProve(_postData).then((res) => { postSettleAccountsMemberSettlementBatchInvoiceProve(_postData).then((res) => {
if (res.code === 1000) { if (res.code === 1000) {
setSelectedRows([]); setSelectedRows([]);
setSelectedRowKeys([]); setSelectedRowKeys([]);
formActions.submit(); formActions.submit();
setVisible(false); setVisible(false);
setSubmitLoading(false);
} }
}) }).catch(() => {setSubmitLoading(false)})
return; return;
} }
/** 退货类型 */ /** 退货类型 */
...@@ -147,7 +150,9 @@ const SettlementList: React.FC = () => { ...@@ -147,7 +150,9 @@ const SettlementList: React.FC = () => {
} }
}) })
} }
setSubmitLoading(true);
const { data, code, message: msg } = await postSettleAccountsMemberSettlementInvoiceByReturn(postDataList); const { data, code, message: msg } = await postSettleAccountsMemberSettlementInvoiceByReturn(postDataList);
setSubmitLoading(false);
if (code !== 1000) { if (code !== 1000) {
message.error(msg); message.error(msg);
return return
...@@ -165,7 +170,9 @@ const SettlementList: React.FC = () => { ...@@ -165,7 +170,9 @@ const SettlementList: React.FC = () => {
// type: typeName == intl.formatMessage({id: 'balance.qiye'}) ? 1 : 2, // type: typeName == intl.formatMessage({id: 'balance.qiye'}) ? 1 : 2,
proveList: res[`list-0`] proveList: res[`list-0`]
} }
setSubmitLoading(true);
const { data, code, message: msg } = await postSettleAccountsMemberSettlementInvoiceProve(defaultPostData); const { data, code, message: msg } = await postSettleAccountsMemberSettlementInvoiceProve(defaultPostData);
setSubmitLoading(false);
if (code === 1000) { if (code === 1000) {
setVisible(false) setVisible(false)
formActions.submit(); formActions.submit();
...@@ -410,6 +417,7 @@ const SettlementList: React.FC = () => { ...@@ -410,6 +417,7 @@ const SettlementList: React.FC = () => {
invoiceInfoData={invoiceInfo} invoiceInfoData={invoiceInfo}
onCancel={handleOnCancel} onCancel={handleOnCancel}
onSubmit={handleForm} onSubmit={handleForm}
onSubmitLoading={submitLoading}
/> />
</PageHeaderWrapper> </PageHeaderWrapper>
......
...@@ -17,6 +17,7 @@ const formActions = createFormActions(); ...@@ -17,6 +17,7 @@ const formActions = createFormActions();
interface Iprops { interface Iprops {
visible: boolean, visible: boolean,
onCancel: () => void, onCancel: () => void,
onSubmitLoading?: boolean,
onSubmit?: (values: any) => void, onSubmit?: (values: any) => void,
mode?: 'edit' | 'view', mode?: 'edit' | 'view',
invoiceInfoData: any invoiceInfoData: any
...@@ -30,7 +31,7 @@ type ProveListType = { ...@@ -30,7 +31,7 @@ type ProveListType = {
} }
const InvoiceDrawerInfo: React.FC<Iprops> = (props: Iprops) => { const InvoiceDrawerInfo: React.FC<Iprops> = (props: Iprops) => {
const { visible, onCancel, invoiceInfoData, onSubmit, mode } = props; const { visible, onCancel, invoiceInfoData, onSubmit, mode, onSubmitLoading = false } = props;
const [initialValue, setInitialValue] = useState<{ [key: string]: ProveListType }>({}); const [initialValue, setInitialValue] = useState<{ [key: string]: ProveListType }>({});
const disabled = useMemo(() => mode === 'view', [mode]) const disabled = useMemo(() => mode === 'view', [mode])
...@@ -44,7 +45,7 @@ const InvoiceDrawerInfo: React.FC<Iprops> = (props: Iprops) => { ...@@ -44,7 +45,7 @@ const InvoiceDrawerInfo: React.FC<Iprops> = (props: Iprops) => {
<Button onClick={handleCancel} style={{ marginRight: 8 }}> <Button onClick={handleCancel} style={{ marginRight: 8 }}>
{intl.formatMessage({ id: 'balance.components.invoiceCreate.invoiceDrawer.renderFooter.button.1' })} {intl.formatMessage({ id: 'balance.components.invoiceCreate.invoiceDrawer.renderFooter.button.1' })}
</Button> </Button>
<Button onClick={() => formActions.submit()} type="primary"> <Button onClick={() => formActions.submit()} loading={onSubmitLoading} type="primary">
{intl.formatMessage({ id: 'balance.components.invoiceCreate.invoiceDrawer.renderFooter.button.2' })} {intl.formatMessage({ id: 'balance.components.invoiceCreate.invoiceDrawer.renderFooter.button.2' })}
</Button> </Button>
</div> </div>
...@@ -81,7 +82,7 @@ const InvoiceDrawerInfo: React.FC<Iprops> = (props: Iprops) => { ...@@ -81,7 +82,7 @@ const InvoiceDrawerInfo: React.FC<Iprops> = (props: Iprops) => {
onSubmit={handleSubmit} onSubmit={handleSubmit}
components={{ ArrayCustom: ArrayList, Input: Input, DatePicker, InvoiceInfo }} components={{ ArrayCustom: ArrayList, Input: Input, DatePicker, InvoiceInfo }}
actions={formActions} actions={formActions}
// editable={mode === 'edit'} // editable={mode === 'edit'}
> >
{ {
invoiceInfoData?.map((_item, key) => { invoiceInfoData?.map((_item, key) => {
...@@ -160,7 +161,7 @@ const InvoiceDrawerInfo: React.FC<Iprops> = (props: Iprops) => { ...@@ -160,7 +161,7 @@ const InvoiceDrawerInfo: React.FC<Iprops> = (props: Iprops) => {
}} }}
x-rules={ x-rules={
[ [
{ required: true, message: intl.formatMessage({id: 'balance.qingtianxiekaipiaojine'}) } { required: true, message: intl.formatMessage({ id: 'balance.qingtianxiekaipiaojine' }) }
] ]
} }
/> />
......
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