From 7f0568af771ff93322d227da85ec499131732e30 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 25 Feb 2024 02:10:21 +0800 Subject: [PATCH] =?UTF-8?q?CRM=EF=BC=9A=E5=AE=8C=E5=96=84=E5=9B=9E?= =?UTF-8?q?=E6=AC=BE=E9=9B=86=E6=88=90=E5=AE=A2=E6=88=B7=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=92=8C=E5=90=88=E5=90=8C=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 174724da981d7cf4e7634114c62bd5ab07dae444) --- src/views/crm/contract/detail/index.vue | 24 ++- src/views/crm/customer/detail/index.vue | 12 +- src/views/crm/receivable/ReceivableForm.vue | 14 +- .../receivable/components/ReceivableList.vue | 135 +++++++++------ src/views/crm/receivable/index.vue | 2 +- .../plan/components/ReceivablePlanList.vue | 154 ++++++++++++------ src/views/crm/receivable/plan/index.vue | 6 +- 7 files changed, 226 insertions(+), 121 deletions(-) diff --git a/src/views/crm/contract/detail/index.vue b/src/views/crm/contract/detail/index.vue index 9cdb9234..96613dac 100644 --- a/src/views/crm/contract/detail/index.vue +++ b/src/views/crm/contract/detail/index.vue @@ -19,8 +19,18 @@ - - 123 + + + + () @@ -94,8 +106,14 @@ const getOperateLog = async (contractId: number) => { logList.value = data.list } +/** 从回款计划创建回款 */ +const receivableListRef = ref>() // 回款列表 Ref +const crateReceivable = (planData: any) => { + receivableListRef.value?.crateReceivable(planData) +} + /** 转移 */ -// TODO @puhui999:这个组件,要不传递业务类型,然后组件里判断 title 和 api 能调用哪个;整体治理掉; +// TODO @puhui999:这个组件,要不传递业务类型,然后组件里判断 title 和 api 能调用哪个;整体治理掉;好呢 const transferFormRef = ref>() // 合同转移表单 ref const transferContract = () => { transferFormRef.value?.open('合同转移', contract.value.id, ContractApi.transferContract) diff --git a/src/views/crm/customer/detail/index.vue b/src/views/crm/customer/detail/index.vue index 7271875c..aed4c6f2 100644 --- a/src/views/crm/customer/detail/index.vue +++ b/src/views/crm/customer/detail/index.vue @@ -26,7 +26,7 @@ > 锁定 - 领取 + 领取 分配 @@ -64,8 +64,8 @@ - - + + @@ -197,6 +197,12 @@ const getOperateLog = async () => { logList.value = data.list } +/** 从回款计划创建回款 */ +const receivableListRef = ref>() // 回款列表 Ref +const crateReceivable = (planData: any) => { + receivableListRef.value?.crateReceivable(planData) +} + const close = () => { delView(unref(currentRoute)) push({ name: 'CrmCustomer' }) diff --git a/src/views/crm/receivable/ReceivableForm.vue b/src/views/crm/receivable/ReceivableForm.vue index a7f975b3..6738cd99 100644 --- a/src/views/crm/receivable/ReceivableForm.vue +++ b/src/views/crm/receivable/ReceivableForm.vue @@ -150,9 +150,8 @@ const formRef = ref() // 表单 Ref const customerList = ref([]) // 客户列表 const contractList = ref([]) // 合同列表 const receivablePlanList = ref([]) // 回款计划列表 - /** 打开弹窗 */ -const open = async (type: string, id?: number) => { +const open = async (type: string, id?: number, planData?: ReceivablePlanApi.ReceivablePlanVO) => { dialogVisible.value = true dialogTitle.value = t('action.' + type) formType.value = type @@ -174,6 +173,12 @@ const open = async (type: string, id?: number) => { if (formType.value === 'create') { formData.value.ownerUserId = useUserStore().getUser.id } + // 从回款计划创建回款 + if (planData) { + formData.value.customerId = planData.customerId + formData.value.contractId = planData.contractId + formData.value.planId = planData.id + } } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 @@ -249,9 +254,12 @@ watch( return } const receivablePlan = receivablePlanList.value.find((item) => item.id === newVal) + if (!receivablePlan) { + return + } // 只有没有金额的时候才设置 if (!formData.value.price || formData.value.price === 0) { - formData.value.price = receivablePlan!.price + formData.value.price = receivablePlan.price } } ) diff --git a/src/views/crm/receivable/components/ReceivableList.vue b/src/views/crm/receivable/components/ReceivableList.vue index 5f7881f2..587db1c5 100644 --- a/src/views/crm/receivable/components/ReceivableList.vue +++ b/src/views/crm/receivable/components/ReceivableList.vue @@ -9,40 +9,51 @@ - - - - - + + + + - - - - - + + + + + + + + + @@ -50,45 +61,43 @@ -