From 6725318f27af0738ef3e44d5a6568baaf4e99899 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sat, 24 Feb 2024 23:01:29 +0800 Subject: [PATCH 1/3] =?UTF-8?q?CRM=EF=BC=9A=E5=AE=8C=E5=96=84=E5=9B=9E?= =?UTF-8?q?=E6=AC=BE=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/crm/contract/index.ts | 7 + src/api/crm/customer/index.ts | 5 + src/api/crm/receivable/plan/index.ts | 4 +- src/views/crm/customer/CustomerImportForm.vue | 14 +- .../receivable/plan/ReceivablePlanForm.vue | 248 ++++++++++-------- src/views/crm/receivable/plan/index.vue | 147 ++++++----- 6 files changed, 232 insertions(+), 193 deletions(-) diff --git a/src/api/crm/contract/index.ts b/src/api/crm/contract/index.ts index 1115e950..494c60c7 100644 --- a/src/api/crm/contract/index.ts +++ b/src/api/crm/contract/index.ts @@ -65,6 +65,13 @@ export const getContract = async (id: number) => { return await request.get({ url: `/crm/contract/get?id=` + id }) } +// 查询 CRM 合同下拉列表 +export const getCrmContractSimpleListByCustomerId = async (customerId: number) => { + return await request.get({ + url: `/crm/contract/list-all-simple-by-customer?customerId=${customerId}` + }) +} + // 新增 CRM 合同 export const createContract = async (data: ContractVO) => { return await request.post({ url: `/crm/contract/create`, data }) diff --git a/src/api/crm/customer/index.ts b/src/api/crm/customer/index.ts index cc15eb5e..c684e98d 100644 --- a/src/api/crm/customer/index.ts +++ b/src/api/crm/customer/index.ts @@ -90,6 +90,11 @@ export const importCustomerTemplate = () => { return request.download({ url: '/crm/customer/get-import-template' }) } +// 导入客户 +export const handleImport = async (formData) => { + return await request.upload({ url: `/crm/customer/import`, data: formData }) +} + // 客户列表 export const getCustomerSimpleList = async () => { return await request.get({ url: `/crm/customer/simple-list` }) diff --git a/src/api/crm/receivable/plan/index.ts b/src/api/crm/receivable/plan/index.ts index 3ddbd7db..98fadb0d 100644 --- a/src/api/crm/receivable/plan/index.ts +++ b/src/api/crm/receivable/plan/index.ts @@ -4,8 +4,7 @@ export interface ReceivablePlanVO { id: number period: number receivableId: number - status: number - checkStatus: string + finishStatus: number processInstanceId: number price: number returnTime: Date @@ -14,7 +13,6 @@ export interface ReceivablePlanVO { customerId: number contractId: number ownerUserId: number - sort: number remark: string } diff --git a/src/views/crm/customer/CustomerImportForm.vue b/src/views/crm/customer/CustomerImportForm.vue index 4290b361..af802ab2 100644 --- a/src/views/crm/customer/CustomerImportForm.vue +++ b/src/views/crm/customer/CustomerImportForm.vue @@ -4,7 +4,6 @@ @@ -45,6 +45,7 @@ import * as CustomerApi from '@/api/crm/customer' import { getAccessToken, getTenantId } from '@/utils/auth' import download from '@/utils/download' +import type { UploadUserFile } from 'element-plus' defineOptions({ name: 'SystemUserImportForm' }) @@ -53,11 +54,9 @@ const message = useMessage() // 消息弹窗 const dialogVisible = ref(false) // 弹窗的是否展示 const formLoading = ref(false) // 表单的加载中 const uploadRef = ref() -const importUrl = - import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/crm/customer/import' const uploadHeaders = ref() // 上传 Header 头 -const fileList = ref([]) // 文件列表 -const updateSupport = ref(0) // 是否更新已经存在的客户数据 +const fileList = ref([]) // 文件列表 +const updateSupport = ref(false) // 是否更新已经存在的客户数据 /** 打开弹窗 */ const open = () => { @@ -79,7 +78,10 @@ const submitForm = async () => { 'tenant-id': getTenantId() } formLoading.value = true - uploadRef.value!.submit() + const formData = new FormData() + formData.append('updateSupport', updateSupport.value) + formData.append('file', fileList.value[0].raw) + await CustomerApi.handleImport(formData) } /** 文件上传成功 */ diff --git a/src/views/crm/receivable/plan/ReceivablePlanForm.vue b/src/views/crm/receivable/plan/ReceivablePlanForm.vue index 29897b15..b6fa9799 100644 --- a/src/views/crm/receivable/plan/ReceivablePlanForm.vue +++ b/src/views/crm/receivable/plan/ReceivablePlanForm.vue @@ -1,95 +1,119 @@ - diff --git a/src/views/crm/receivable/plan/index.vue b/src/views/crm/receivable/plan/index.vue index decd79bc..16b54aee 100644 --- a/src/views/crm/receivable/plan/index.vue +++ b/src/views/crm/receivable/plan/index.vue @@ -2,49 +2,63 @@ - + placeholder="请选择客户" + @keyup.enter="handleQuery" + > + + - + - 搜索 - 重置 - - 新增 + + + 搜索 + + + + 重置 - 导出 + + 新增 + + + + 导出 @@ -52,68 +66,58 @@ - - - - - - + + + + + - - - - - - - - - - - + /> + - - + - + fixed="right" + label="完成状态" + prop="finishStatus" + width="130px" + > + + + - From 41e5cf667e0e10278e364e619757cffdfcc70c33 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 25 Feb 2024 00:35:50 +0800 Subject: [PATCH 2/3] =?UTF-8?q?CRM=EF=BC=9A=E5=AE=8C=E5=96=84=E5=9B=9E?= =?UTF-8?q?=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/crm/receivable/index.ts | 6 +- src/api/crm/receivable/plan/index.ts | 7 + src/views/crm/receivable/ReceivableForm.vue | 301 ++++++++++++-------- src/views/crm/receivable/index.vue | 169 ++++++----- src/views/crm/receivable/plan/index.vue | 4 +- 5 files changed, 293 insertions(+), 194 deletions(-) diff --git a/src/api/crm/receivable/index.ts b/src/api/crm/receivable/index.ts index a9812a76..7d2d3a2d 100644 --- a/src/api/crm/receivable/index.ts +++ b/src/api/crm/receivable/index.ts @@ -12,7 +12,6 @@ export interface ReceivableVO { returnType: string price: number ownerUserId: number - sort: number remark: string } @@ -50,3 +49,8 @@ export const deleteReceivable = async (id: number) => { export const exportReceivable = async (params) => { return await request.download({ url: `/crm/receivable/export-excel`, params }) } + +// 提交审核 +export const submitReceivable = async (id: number) => { + return await request.put({ url: `/crm/receivable/submit?id=${id}` }) +} diff --git a/src/api/crm/receivable/plan/index.ts b/src/api/crm/receivable/plan/index.ts index 98fadb0d..be5a4535 100644 --- a/src/api/crm/receivable/plan/index.ts +++ b/src/api/crm/receivable/plan/index.ts @@ -31,6 +31,13 @@ export const getReceivablePlan = async (id: number) => { return await request.get({ url: `/crm/receivable-plan/get?id=` + id }) } +// 查询回款计划下拉数据 +export const getReceivablePlanListByContractId = async (customerId: number, contractId: number) => { + return await request.get({ + url: `/crm/receivable-plan/list-all-simple-by-customer?customerId=${customerId}&contractId=${contractId}` + }) +} + // 新增回款计划 export const createReceivablePlan = async (data: ReceivablePlanVO) => { return await request.post({ url: `/crm/receivable-plan/create`, data }) diff --git a/src/views/crm/receivable/ReceivableForm.vue b/src/views/crm/receivable/ReceivableForm.vue index 60206bf7..a7f975b3 100644 --- a/src/views/crm/receivable/ReceivableForm.vue +++ b/src/views/crm/receivable/ReceivableForm.vue @@ -1,98 +1,134 @@ - diff --git a/src/views/crm/receivable/index.vue b/src/views/crm/receivable/index.vue index c5478c2f..17a1eb33 100644 --- a/src/views/crm/receivable/index.vue +++ b/src/views/crm/receivable/index.vue @@ -2,49 +2,63 @@ - + placeholder="请选择客户" + @keyup.enter="handleQuery" + > + + - 搜索 - 重置 - - 新增 + + + 搜索 + + + + 重置 - 导出 + + 新增 + + + + 导出 @@ -52,66 +66,63 @@ - - - - - - - - - - + + + + - + - - - - - + + + + - - - + - diff --git a/src/views/crm/receivable/plan/index.vue b/src/views/crm/receivable/plan/index.vue index 16b54aee..9cf21647 100644 --- a/src/views/crm/receivable/plan/index.vue +++ b/src/views/crm/receivable/plan/index.vue @@ -8,7 +8,7 @@ class="-mb-15px" label-width="68px" > - + - + Date: Sun, 25 Feb 2024 02:10:21 +0800 Subject: [PATCH 3/3] =?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 --- 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 @@ -