From 5151824110335e970188d72a7139378fd04c07af Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 14 Jan 2024 20:57:06 +0800 Subject: [PATCH] =?UTF-8?q?crm-=E5=AE=A2=E6=88=B7=EF=BC=9A=E5=85=AC?= =?UTF-8?q?=E6=B5=B7=E6=8A=BD=E7=A6=BB=EF=BC=8C=E5=AE=8C=E5=96=84=E8=B7=9F?= =?UTF-8?q?=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/crm/business/index.ts | 7 +- src/api/crm/contact/index.ts | 2 +- src/api/crm/customer/index.ts | 9 +- src/router/modules/remaining.ts | 6 +- src/views/crm/contact/ContactForm.vue | 32 +- src/views/crm/contact/index.vue | 109 +++---- src/views/crm/customer/detail/index.vue | 4 +- src/views/crm/customer/pool/index.vue | 279 ++++++++++++++++++ src/views/crm/followup/FollowUpRecordForm.vue | 45 ++- .../crm/followup/components/ContactList.vue | 7 +- 10 files changed, 414 insertions(+), 86 deletions(-) create mode 100644 src/views/crm/customer/pool/index.vue diff --git a/src/api/crm/business/index.ts b/src/api/crm/business/index.ts index 7a903c6a..3fac5fff 100644 --- a/src/api/crm/business/index.ts +++ b/src/api/crm/business/index.ts @@ -36,6 +36,11 @@ export const getBusiness = async (id: number) => { return await request.get({ url: `/crm/business/get?id=` + id }) } +// 获得 CRM 商机列表(精简) +export const getSimpleBusinessList = async () => { + return await request.get({ url: `/crm/business/simple-all-list` }) +} + // 新增 CRM 商机 export const createBusiness = async (data: BusinessVO) => { return await request.post({ url: `/crm/business/create`, data }) @@ -63,5 +68,5 @@ export const getBusinessPageByContact = async (params) => { // 获得 CRM 商机列表 export const getBusinessListByIds = async (val: number[]) => { - return await request.get({ url: '/crm/business/list-by-ids', params: { ids: val } }) + return await request.get({ url: '/crm/business/list-by-ids', params: { ids: val.join(',') } }) } diff --git a/src/api/crm/contact/index.ts b/src/api/crm/contact/index.ts index dc3042ef..4144c931 100644 --- a/src/api/crm/contact/index.ts +++ b/src/api/crm/contact/index.ts @@ -73,7 +73,7 @@ export const getSimpleContactList = async () => { // 获得 CRM 联系人列表 export const getContactListByIds = async (val: number[]) => { - return await request.get({ url: '/crm/contact/list-by-ids', params: { ids: val } }) + return await request.get({ url: '/crm/contact/list-by-ids', params: { ids: val.join(',') } }) } // 批量新增联系人商机关联 diff --git a/src/api/crm/customer/index.ts b/src/api/crm/customer/index.ts index 5ec8a3ea..0484bc43 100644 --- a/src/api/crm/customer/index.ts +++ b/src/api/crm/customer/index.ts @@ -64,8 +64,8 @@ export const exportCustomer = async (params: any) => { } // 客户列表 -export const queryAllList = async () => { - return await request.get({ url: `/crm/customer/query-all-list` }) +export const getSimpleCustomerList = async () => { + return await request.get({ url: `/crm/customer/list-all-simple` }) } // 查询客户操作日志 @@ -80,13 +80,12 @@ export const lockCustomer = async (id: number, lockStatus: boolean) => { return await request.put({ url: `/crm/customer/lock`, data: { id, lockStatus } }) } -// TODO @puhui999:方法名,改成和后端一致哈 // 领取公海客户 -export const receive = async (ids: any[]) => { +export const receiveCustomer = async (ids: any[]) => { return await request.put({ url: '/crm/customer/receive', params: { ids: ids.join(',') } }) } // 客户放入公海 -export const putPool = async (id: number) => { +export const putCustomerPool = async (id: number) => { return await request.put({ url: `/crm/customer/put-pool?id=${id}` }) } diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index a562ea85..b2e5fac9 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -504,7 +504,8 @@ const remainingRouter: AppRouteRecordRaw[] = [ meta: { title: '客户详情', noCache: true, - hidden: true + hidden: true, + activeMenu: '/crm/customer/index' }, component: () => import('@/views/crm/customer/detail/index.vue') }, @@ -514,7 +515,8 @@ const remainingRouter: AppRouteRecordRaw[] = [ meta: { title: '联系人详情', noCache: true, - hidden: true + hidden: true, + activeMenu: '/crm/contact' }, component: () => import('@/views/crm/contact/detail/index.vue') } diff --git a/src/views/crm/contact/ContactForm.vue b/src/views/crm/contact/ContactForm.vue index fc691a21..f8c35af6 100644 --- a/src/views/crm/contact/ContactForm.vue +++ b/src/views/crm/contact/ContactForm.vue @@ -1,25 +1,25 @@ - diff --git a/src/views/crm/customer/detail/index.vue b/src/views/crm/customer/detail/index.vue index 901aee8c..995990cb 100644 --- a/src/views/crm/customer/detail/index.vue +++ b/src/views/crm/customer/detail/index.vue @@ -113,7 +113,7 @@ const handleUnlock = async () => { /** 领取客户 */ const handleReceive = async () => { await message.confirm(`确定领取客户【${customer.value.name}】 吗?`) - await CustomerApi.receive([unref(customerId.value)]) + await CustomerApi.receiveCustomer([unref(customerId.value)]) message.success(`领取客户【${customer.value.name}】成功`) await getCustomer() } @@ -121,7 +121,7 @@ const handleReceive = async () => { /** 客户放入公海 */ const handlePutPool = async () => { await message.confirm(`确定将客户【${customer.value.name}】放入公海吗?`) - await CustomerApi.putPool(unref(customerId.value)) + await CustomerApi.putCustomerPool(unref(customerId.value)) message.success(`客户【${customer.value.name}】放入公海成功`) close() } diff --git a/src/views/crm/customer/pool/index.vue b/src/views/crm/customer/pool/index.vue new file mode 100644 index 00000000..c200f7dc --- /dev/null +++ b/src/views/crm/customer/pool/index.vue @@ -0,0 +1,279 @@ + + + diff --git a/src/views/crm/followup/FollowUpRecordForm.vue b/src/views/crm/followup/FollowUpRecordForm.vue index a7aa0c1c..e4d476ff 100644 --- a/src/views/crm/followup/FollowUpRecordForm.vue +++ b/src/views/crm/followup/FollowUpRecordForm.vue @@ -37,21 +37,43 @@ - - - 选择添加联系人 - + + + + + + + + + + - - - 选择添加商机 - + + + + + + + + + + @@ -65,6 +87,8 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { FollowUpRecordApi, FollowUpRecordVO } from '@/api/crm/followup' import { BusinessList, ContactList } from './components' +import * as ContactApi from '@/api/crm/contact' +import * as BusinessApi from '@/api/crm/business' /** 跟进记录 表单 */ defineOptions({ name: 'FollowUpRecordForm' }) @@ -82,7 +106,10 @@ const formRules = reactive({ content: [{ required: true, message: '跟进内容不能为空', trigger: 'blur' }], nextTime: [{ required: true, message: '下次联系时间不能为空', trigger: 'blur' }] }) + const formRef = ref() // 表单 Ref +const allContactList = ref([]) // 所有联系人列表 +const allBusinessList = ref([]) // 所有商家列表 /** 打开弹窗 */ const open = async (bizType: number, bizId: number, type: string, id?: number) => { @@ -92,6 +119,8 @@ const open = async (bizType: number, bizId: number, type: string, id?: number) = resetForm() formData.value.bizType = bizType formData.value.bizId = bizId + allContactList.value = await ContactApi.getSimpleContactList() + allBusinessList.value = await BusinessApi.getSimpleBusinessList() // 修改时,设置数据 if (id) { formLoading.value = true diff --git a/src/views/crm/followup/components/ContactList.vue b/src/views/crm/followup/components/ContactList.vue index 5f763258..2cd7ccf0 100644 --- a/src/views/crm/followup/components/ContactList.vue +++ b/src/views/crm/followup/components/ContactList.vue @@ -67,13 +67,18 @@ const props = withDefaults(defineProps<{ contactIds: number[] }>(), { contactIds: () => [] }) const list = ref([] as ContactApi.ContactVO[]) +const getContactList = async () => { + list.value = (await ContactApi.getContactListByIds( + props.contactIds + )) as unknown as ContactApi.ContactVO[] +} watch( () => props.contactIds, (val) => { if (!val || val.length === 0) { return } - list.value = ContactApi.getContactListByIds(val) as unknown as ContactApi.ContactVO[] + getContactList() } ) const emits = defineEmits<{