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