diff --git a/src/api/company.ts b/src/api/company.ts index 25ed266..bff8a41 100644 --- a/src/api/company.ts +++ b/src/api/company.ts @@ -77,4 +77,9 @@ export function getDepositRechargeTransferVoucherList(params: any) { return request.get({ url: '/company/getDepositRechargeTransferVoucherList', params }) } +// 根据公司id获取甲方公司信息 +export function getPartyAbyCompanyId(params: any) { + return request.get({ url: '/company/getPartyA', params }) +} + diff --git a/src/views/finance/component/voucher.vue b/src/views/finance/component/voucher.vue index 772c544..55a473b 100644 --- a/src/views/finance/component/voucher.vue +++ b/src/views/finance/component/voucher.vue @@ -4,16 +4,32 @@ ref="popupRef" :title="popupTitle" :async="true" - width="550px" + width="580px" @confirm="handleSubmit" @close="handleClose" > + + + + + + { formData.voucher = e.data.uri; }; -// 查看凭证 -const openTransfer = (uri: any) => { - window.open(uri); -}; - // 获取详情 const setFormData = async (data: Record) => { let obj = { @@ -206,17 +213,40 @@ const setFormData = async (data: Record) => { formData[key] = data[key]; } } + getDetail(); }; -const getDetail = async (row: Record) => { - const data = await apiWithdrawDetail({ - id: row.id, +// 甲方公司信息 +const partyA = reactive({ + company_name: "", + qualification: { + corporate_account: "", + }, +}); +const getDetail = async () => { + getPartyAbyCompanyId({ + company_id: formData.id, + }).then((data) => { + partyA["company_name"] = data["company_name"]; + if (typeof data.qualification == "string") { + data.qualification = JSON.parse(data.qualification); + partyA.qualification.corporate_account = + data.qualification.corporate_account; + } else { + partyA.qualification.corporate_account = + data.qualification.corporate_account; + } + if (!partyA.qualification.corporate_account) { + ElMessage.error("甲方公司没有对公账号,请补充账号后再试"); + } }); - setFormData(data); }; // 提交按钮 const handleSubmit = async () => { + if (!partyA.company_name) return ElMessage.error("甲方公司不可为空"); + if (!partyA.qualification.corporate_account) + return ElMessage.error("甲方公司对公账户不可为空"); if (!formData.id) return ElMessage.error("请先选择公司"); await formRef.value?.validate(); const data = { ...formData }; @@ -244,7 +274,6 @@ const handleClose = () => { defineExpose({ open, setFormData, - getDetail, }); \ No newline at end of file