diff --git a/src/api/crm/contract/index.ts b/src/api/crm/contract/index.ts index 86ad9632..bd9e93e0 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/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 3ddbd7db..be5a4535 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 } @@ -33,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/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/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/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 60206bf7..6738cd99 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/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 @@ - 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/components/ReceivablePlanList.vue b/src/views/crm/receivable/plan/components/ReceivablePlanList.vue index dc150cbc..0a3b56d6 100644 --- a/src/views/crm/receivable/plan/components/ReceivablePlanList.vue +++ b/src/views/crm/receivable/plan/components/ReceivablePlanList.vue @@ -9,43 +9,73 @@ - - - - - - + + + + + - - + + + + + + + + - - - @@ -53,45 +83,42 @@ -