Commit dce67c92 authored by 卢均锐's avatar 卢均锐

feat: 业务请款-对账单请款逻辑

parent 616ff752
......@@ -8,7 +8,7 @@ import { GlobalConfig } from '@/global/config'
import { formatTimeString } from '@/utils'
import { priceFormat } from '@/utils/numberFomat';
import StatusTag from '@/components/StatusTag';
import { getSettleAccountsBusinessReconciliationItemPayType, getSettleAccountsPlatformSettlementTypeList, postSettleAccountsBusinessApplyAmountSaveApplyAmount } from '@/services/SettleV2Api'
import { getSettleAccountsBusinessReconciliationItemPayType, getSettleAccountsPlatformSettlementTypeList, postSettleAccountsBusinessApplyAmountSaveApplyAmount, getSettleAccountsCorporateAccountConfig } from '@/services/SettleV2Api'
import PeripheralLayout from '@/pages/transaction/purchaseAbility/components/detail';
import Card from '@/pages/transaction/purchaseAbility/components/card';
......@@ -61,8 +61,6 @@ const Add = () => {
const [documentType, setDocumentType] = useState<number>(1);
const [writeOffData, setWriteOffData] = useState<any>({});
console.log(_state)
const _tabs = useMemo(() => {
let _list = [];
TABLINK.forEach((item) => {
......@@ -100,7 +98,7 @@ const Add = () => {
setMoneyPayWayOptions(res.data.map((item) => { return { label: item.methodName, value: item.methodCode } }));
}
})
if (_state?.data?.applyNo) {
if (_state?.data?.vendorMemberId) {
form.setFieldsValue({
applyAbstract: _state?.data.applyAbstract,
payee: _state?.data.payee,
......@@ -148,13 +146,43 @@ const Add = () => {
const _handleOk = () => {
form.validateFields().then(formRes => {
const _params = { ...formRes, ...dataSource, rows: tabelSource, expectPayTime: formatTimeString(formRes.expectPayTime, 'YYYY-MM-DD') };
const _params = {
...dataSource,
...formRes,
rows: tabelSource,
expectPayTime: formatTimeString(formRes.expectPayTime, 'YYYY-MM-DD')
};
setSubmitLoading(true);
if (_isAdd) {
postSettleAccountsBusinessApplyAmountSaveApplyAmount(_params).then((res) => {
if (res.code === 1000) {
history.replace('memberCenter/balance/businessRequestFunds/admin')
history.replace('/memberCenter/balance/businessRequestFunds/admin')
} else {
setSubmitLoading(false)
}
})
}).catch(() => { setSubmitLoading(false) })
}
})
}
const _handleMemberOk = (record: any) => {
const _params = {
memberId: record.memberId,
memberRoleId: record.roleId
}
getSettleAccountsCorporateAccountConfig(_params).then((res) => {
if (res.code === 1000) {
const data = res.data;
const _dataSource = { ...dataSource };
_dataSource.payee = record.name;
_dataSource.vendorMemberId = record.memberId;
_dataSource.vendorRoleId = record.roleId;
_dataSource.accountName = data.name;
_dataSource.bankDeposit = data.bankDeposit;
_dataSource.bankAccount = data.bankAccount;
form.setFieldsValue({ payee: record.name })
setDataSource(_dataSource)
setMemberDrawerVisible(false)
}
})
}
......@@ -431,7 +459,7 @@ const Add = () => {
name='applyType'
rules={[{ required: true, message: '请选择请款类型' }]}
>
<Select placeholder={'请选择请款类型'} options={applyOptions} />
<Select placeholder={'请选择请款类型'} disabled={!_isAdd} options={applyOptions} />
</Form.Item>
</Col>
</Row>
......@@ -453,7 +481,7 @@ const Add = () => {
name='payWay'
rules={[{ required: true, message: '请选择付款方式' }]}
>
<Radio.Group onChange={_handlePayWay}>
<Radio.Group value={payWay} onChange={_handlePayWay}>
{payWayData?.map((item) => <Radio.Button value={item.id} key={`radioButton_${item.id}`}>{item.text}</Radio.Button>)}
</Radio.Group>
</Form.Item>
......@@ -501,7 +529,7 @@ const Add = () => {
label='收款方'
name='payee'
>
<Input className={styles['revise_style']} readOnly maxLength={80} addonAfter={<Button disabled={_isFunds} type='primary' icon={<LinkOutlined />} onClick={() => { setMemberDrawerVisible(true) }} />} />
<Input className={styles['revise_style']} readOnly maxLength={80} addonAfter={<Button disabled={_isFunds || !_isAdd} type='primary' icon={<LinkOutlined />} onClick={() => { setMemberDrawerVisible(true) }} />} />
</Form.Item>
</Col>
</Row>
......@@ -509,7 +537,7 @@ const Add = () => {
<Form.Item
label='账号名称'
>
{dataSource['name']}
{dataSource['accountName']}
</Form.Item>
</Row>
<Row>
......@@ -587,7 +615,7 @@ const Add = () => {
/>
<WriteOffDrawer visible={writeOffDrawer} record={writeOffData} editAble={true} onClose={() => { setWriteOffDrawer(false) }} onOk={_handleWriteOffOk} />
<ContractDrawer visible={contractDrawerVisible} onClose={() => { setContractDrawerVisible(false) }} />
<MemberDrawer visible={memberDrawerVisible} onClose={() => { setMemberDrawerVisible(false) }} />
<MemberDrawer visible={memberDrawerVisible} onClose={() => { setMemberDrawerVisible(false) }} onOk={_handleMemberOk} />
<RequestFundsDrawer visible={requestFundsDrawerVisible} onClose={() => { setRequestFundsDrawerVisible(false) }} />
<Prompt when={unsaved} message={intl.formatMessage({ id: 'common.tip.save.confirm' }, { default: '您还有未保存的内容,是否确定要离开?' })} />
</>
......
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