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 @@ -