Commit 9b44fd86 authored by 卢均锐's avatar 卢均锐

feat: 缓存业务请款

parent a6e79be4
......@@ -18,7 +18,7 @@ import RequestFundsDrawer from '../components/requestFundsDrawer';
import styles from './add.less';
const { Text } = Typography;
const { Text, Link } = Typography;
const layout: any = {
colon: false,
......@@ -38,14 +38,16 @@ const Add = () => {
id,
no
},
state,
pathname,
} = history.location;
const _state: any = state
const [form] = Form.useForm();
const [pathPci] = useState(pathname.split('/')[pathname.split('/').length - 2]);
const [path] = useState(pathname.split('/')[pathname.split('/').length - 1]);
const [payWayData, setPayWayData] = useState<any>([]);
const [payWay, setPayWay] = useState<number>(1);
const [dataSource, setDataSource] = useState<any>({});
const [dataSource, setDataSource] = useState<any>(_state?.data ?? {});
const [tabelSource, setTabelSource] = useState<any>([]);
const [ids, setIds] = useState<any>([]);
const [contractDrawerVisible, setContractDrawerVisible] = useState<boolean>(false);
......@@ -66,10 +68,17 @@ const Add = () => {
const _title = useMemo(() => {
switch (path) {
case 'add': return '新增请款单';
case 'edit': return '对账单请款';
case 'edit': return '修改请款单';
case 'funds':
case 'fundsEdit':
return '对账单请款';
}
}, [path])
const _isFunds = useMemo(() => {
return path !== 'add' && path !== 'edit';
}, [path])
const _editAble = useMemo(() => {
return path !== 'preview';
}, [path])
......@@ -181,8 +190,8 @@ const Add = () => {
const columns: ColumnType<any>[] = [{
title: '单据号',
key: 'orderNo',
dataIndex: 'orderNo',
key: 'billNo',
dataIndex: 'billNo',
}, {
title: '单据摘要',
key: 'orderDetails',
......@@ -231,12 +240,96 @@ const Add = () => {
dataIndex: 'money',
}];
const fundsColumns: ColumnType<any>[] = [{
title: '单据号',
key: 'orderNo',
dataIndex: 'orderNo',
fixed: 'left',
width: 100,
render: (text: any, record: any) => <Link>{text}</Link>
}, {
title: '单据摘要',
key: 'billAbstract',
dataIndex: 'billAbstract',
width: 300,
render: (text: any) => (
<Space direction='vertical' style={{ width: 300 }}>
<Text type='secondary'>{text}</Text>
</Space>
)
}, {
title: '单据类型',
key: 'billType',
dataIndex: 'billType',
width: 150,
}, {
title: '单据时间',
key: 'billTime',
dataIndex: 'billTime',
width: 150,
}, {
title: '单据状态',
key: 'billStatus',
dataIndex: 'billStatus',
width: 150,
}, {
title: '单据金额',
key: 'billAmount',
dataIndex: 'billAmount',
width: 150,
}, {
title: '含税/税率',
key: 'taxRate',
dataIndex: 'taxRate',
width: 150,
render: (text: any) => {
return text > 0 ? `是/${text}%` : '否';
}
}, {
title: '已付款',
key: 'paidAmount',
dataIndex: 'paidAmount',
width: 150,
render: (text: any) => ${priceFormat(text)}`
}, {
title: '已请款待付款',
key: 'appliedNotPayAmount',
dataIndex: 'appliedNotPayAmount',
width: 150,
render: (text: any) => ${priceFormat(text)}`
}, {
title: '对账金额',
key: 'reconciliationAmount',
dataIndex: 'reconciliationAmount',
width: 150,
render: (text: any) => ${priceFormat(text)}`
}, {
title: '请款金额',
key: 'applyAmount',
dataIndex: 'applyAmount',
width: 150,
render: (text: any) => ${priceFormat(text)}`
}, {
title: '核销金额',
key: 'writeOffAmount',
dataIndex: 'writeOffAmount',
width: 150,
render: (text: any) => ${priceFormat(text)}`
}, {
title: '操作',
key: 'operate',
dataIndex: 'operate',
fixed: 'right',
width: 100,
render: (_, record: any) => <Link>核销</Link>
}];
return (
<div style={{ margin: '-24px -24px 0' }}>
<PeripheralLayout
no={_title}
tabLink={_tabs}
effect={_editAble && _returnTopButton()}
effect={_returnTopButton()}
components={
<Form
{...layout}
......@@ -335,7 +428,7 @@ const Add = () => {
<Form.Item
label='收款方'
>
<Input className={styles['revise_style']} readOnly maxLength={80} addonAfter={<Button type='primary' icon={<LinkOutlined />} onClick={() => { setMemberDrawerVisible(true) }} />} />
<Input className={styles['revise_style']} readOnly maxLength={80} addonAfter={<Button disabled={_isFunds} type='primary' icon={<LinkOutlined />} onClick={() => { setMemberDrawerVisible(true) }} />} />
</Form.Item>
</Col>
</Row>
......@@ -343,35 +436,51 @@ const Add = () => {
<Form.Item
label='账号名称'
>
广州白马家具交易中心
{dataSource['name']}
</Form.Item>
</Row>
<Row>
<Form.Item
label='银行账号'
>
6214 7812 3456 7891 1234
{dataSource['bankAccount']}
</Form.Item>
</Row>
<Row>
<Form.Item
label='开户行'
>
中国建设银行广州市分行营业部
{dataSource['bankDeposit']}
</Form.Item>
</Row>
<Row>
<Form.Item
label='请款金额'
>
¥ 10,000.00
¥ {priceFormat(dataSource['totalApplyAmount'])}
</Form.Item>
</Row>
{_isFunds && <>
<Row>
<Form.Item
label='核销金额'
>
¥ {dataSource['totalWriteOffAmount']}
</Form.Item>
</Row>
<Row>
<Form.Item
label='对账单号'
>
<Link>{dataSource['reconciliationNo']}</Link>
</Form.Item>
</Row>
</>}
</Col>
</Row>
</Card>
<Card id='billLayout' title={'请款明细'}>
{_editAble ? <>
{!_isFunds ? <>
<Row gutter={[8, 8]}>
<Col span={24}>
<Form.Item
......@@ -398,7 +507,7 @@ const Add = () => {
{intl.formatMessage({ id: 'balance.xuanze' })}
</Button>
</> : null}
<Table dataSource={tabelSource} columns={columns} pagination={false} />
<Table dataSource={tabelSource} columns={_isFunds ? fundsColumns : columns} scroll={{ x: 1300 }} pagination={false} />
</Card>
</Form>
}
......
......@@ -12,7 +12,7 @@ import StatusTag from '@/components/StatusTag';
import { formatTimeString } from '@/utils'
import { priceFormat } from '@/utils/numberFomat'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { getSettleAccountsBusinessApplyAmountToAddApplyAmountList } from '@/services/SettleV2Api'
import { getSettleAccountsBusinessApplyAmountToAddApplyAmountList, postSettleAccountsBusinessApplyAmountSubmitApplyAmount, postSettleAccountsBusinessApplyAmountDelete } from '@/services/SettleV2Api'
import { createFormActions } from '@formily/antd'
import { history, getIntl, Link } from 'umi';
const intl = getIntl();
......@@ -89,18 +89,20 @@ const Admin: React.FC = () => {
title: intl.formatMessage({ id: 'balance.caozuo' }),
dataIndex: 'operate',
align: 'center',
render: (text: any, record: any) => <>
{record.status === 1 && <Popconfirm title={intl.formatMessage({ id: 'balance.quedingyaotijiaoma' })} okText={intl.formatMessage({ id: 'balance.shi' })} cancelText={intl.formatMessage({ id: 'balance.fou' })} onConfirm={() => fetchSubmitBatch(record.reconciliationId)}>
render: (_: any, record: any) => <>
<Popconfirm title={intl.formatMessage({ id: 'balance.quedingyaotijiaoma' })} okText={intl.formatMessage({ id: 'balance.shi' })} cancelText={intl.formatMessage({ id: 'balance.fou' })} onConfirm={() => fetchSubmitBatch(record.id)}>
<Button type='link'>
{intl.formatMessage({ id: 'balance.tijiao' })}
</Button>
</Popconfirm>}
</Popconfirm>
<Dropdown overlay={() => (
<Menu onClick={(e) => handleMenuClick(e, record)}>
<Menu.Item key="1">{intl.formatMessage({ id: 'balance.bianji' })}</Menu.Item>
<Popconfirm title={intl.formatMessage({ id: 'balance.quedingyaotijiaoma' })} okText={intl.formatMessage({ id: 'balance.shi' })} cancelText={intl.formatMessage({ id: 'balance.fou' })} onConfirm={() => fetchDelete(record.reconciliationId)}>
{record.hasSubmit && (
<Popconfirm title={intl.formatMessage({ id: 'balance.quedingyaotijiaoma' })} okText={intl.formatMessage({ id: 'balance.shi' })} cancelText={intl.formatMessage({ id: 'balance.fou' })} onConfirm={() => fetchDelete(record.id)}>
<Menu.Item key="2">{intl.formatMessage({ id: 'balance.shanchu' })}</Menu.Item>
</Popconfirm>
)}
</Menu>
)}>
<Button type='link'>{intl.formatMessage({ id: 'balance.gengduo' })}<CaretDownOutlined /></Button>
......@@ -108,20 +110,20 @@ const Admin: React.FC = () => {
</>
}];
const fetchSubmitBatch = (id: number) => {
// postSettleAccountsBusinessReconciliationSubmitReconciliation({ id }).then((res) => {
// if (res.code === 1000) {
// ref.current.reload();
// }
// })
const fetchSubmitBatch = (id: string) => {
postSettleAccountsBusinessApplyAmountSubmitApplyAmount({ id }).then((res) => {
if (res.code === 1000) {
ref.current.reload();
}
})
}
const fetchDelete = (id: number) => {
// postSettleAccountsBusinessReconciliationDeleteReconciliation({ id }).then((res) => {
// if (res.code === 1000) {
// ref.current.reload();
// }
// })
postSettleAccountsBusinessApplyAmountDelete({ id }).then((res) => {
if (res.code === 1000) {
ref.current.reload();
}
})
}
const handleMenuClick = (e: any, record: any) => {
......
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