From 5cb86589c6466836ae5632b50091c3c760d3b65d Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 25 Feb 2024 09:23:36 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E2=9C=A8=20CRM=EF=BC=9A=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E5=9B=9E=E6=AC=BE=20plan=20=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/crm/receivable/plan/index.ts | 4 + src/views/crm/customer/CustomerImportForm.vue | 1 + src/views/crm/receivable/plan/index.vue | 95 +++++++++++++++++-- 3 files changed, 90 insertions(+), 10 deletions(-) diff --git a/src/api/crm/receivable/plan/index.ts b/src/api/crm/receivable/plan/index.ts index be5a4535..3136aede 100644 --- a/src/api/crm/receivable/plan/index.ts +++ b/src/api/crm/receivable/plan/index.ts @@ -14,6 +14,10 @@ export interface ReceivablePlanVO { contractId: number ownerUserId: number remark: string + receivable?: { + price: number + returnTime: Date + } } // 查询回款计划列表 diff --git a/src/views/crm/customer/CustomerImportForm.vue b/src/views/crm/customer/CustomerImportForm.vue index af802ab2..7f92dc83 100644 --- a/src/views/crm/customer/CustomerImportForm.vue +++ b/src/views/crm/customer/CustomerImportForm.vue @@ -81,6 +81,7 @@ const submitForm = async () => { const formData = new FormData() formData.append('updateSupport', updateSupport.value) formData.append('file', fileList.value[0].raw) + // TODO @芋艿:后面是不是可以采用这种形式,去掉 uploadHeaders await CustomerApi.handleImport(formData) } diff --git a/src/views/crm/receivable/plan/index.vue b/src/views/crm/receivable/plan/index.vue index 39923080..8ddf3a3b 100644 --- a/src/views/crm/receivable/plan/index.vue +++ b/src/views/crm/receivable/plan/index.vue @@ -67,10 +67,27 @@ - + + + + - + - + + + + + + + + + + + + + + + - - + + + { } } -/** 打开客户详情 */ +/** 打开详情 */ const { push } = useRouter() +const openDetail = (id: number) => { + push({ name: 'CrmReceivablePlanDetail', params: { id } }) +} + +/** 打开客户详情 */ const openCustomerDetail = (id: number) => { push({ name: 'CrmCustomerDetail', params: { id } }) } From 56d92e5bfb20f3b4296bf0ae700db8a64f0ea812 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 25 Feb 2024 16:09:22 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E2=9C=A8=20CRM=EF=BC=9A=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E5=9B=9E=E6=AC=BE=20plan=20=E6=96=B0=E5=A2=9E/=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/crm/contract/index.ts | 4 +- src/api/crm/receivable/plan/index.ts | 3 +- src/views/crm/receivable/ReceivableForm.vue | 6 +- .../receivable/plan/ReceivablePlanForm.vue | 113 ++++++++++-------- 4 files changed, 72 insertions(+), 54 deletions(-) diff --git a/src/api/crm/contract/index.ts b/src/api/crm/contract/index.ts index bd9e93e0..eb7b1505 100644 --- a/src/api/crm/contract/index.ts +++ b/src/api/crm/contract/index.ts @@ -66,9 +66,9 @@ export const getContract = async (id: number) => { } // 查询 CRM 合同下拉列表 -export const getCrmContractSimpleListByCustomerId = async (customerId: number) => { +export const getContractSimpleList = async (customerId: number) => { return await request.get({ - url: `/crm/contract/list-all-simple-by-customer?customerId=${customerId}` + url: `/crm/contract/simple-list?customerId=${customerId}` }) } diff --git a/src/api/crm/receivable/plan/index.ts b/src/api/crm/receivable/plan/index.ts index d5a72871..f11ca17c 100644 --- a/src/api/crm/receivable/plan/index.ts +++ b/src/api/crm/receivable/plan/index.ts @@ -5,10 +5,10 @@ export interface ReceivablePlanVO { period: number receivableId: number finishStatus: number - processInstanceId: number price: number returnTime: Date remindDays: number + returnType: number remindTime: Date customerId: number customerName?: string @@ -43,6 +43,7 @@ export const getReceivablePlan = async (id: number) => { } // 查询回款计划下拉数据 +// TODO @芋艿:再看看这里 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}` diff --git a/src/views/crm/receivable/ReceivableForm.vue b/src/views/crm/receivable/ReceivableForm.vue index 6738cd99..537173f9 100644 --- a/src/views/crm/receivable/ReceivableForm.vue +++ b/src/views/crm/receivable/ReceivableForm.vue @@ -75,7 +75,7 @@ { } const getContractList = async (customerId: number) => { - contractList.value = await ContractApi.getCrmContractSimpleListByCustomerId(customerId) + contractList.value = await ContractApi.getContractSimpleList(customerId) } const getReceivablePlanList = async (contractId: number) => { receivablePlanList.value = await ReceivablePlanApi.getReceivablePlanListByContractId( diff --git a/src/views/crm/receivable/plan/ReceivablePlanForm.vue b/src/views/crm/receivable/plan/ReceivablePlanForm.vue index b6fa9799..8401e5a2 100644 --- a/src/views/crm/receivable/plan/ReceivablePlanForm.vue +++ b/src/views/crm/receivable/plan/ReceivablePlanForm.vue @@ -7,10 +7,40 @@ :rules="formRules" label-width="110px" > + + + + + + + + + + + + + + - + - - - - - - - + + @@ -69,6 +92,8 @@ /> + + - - + + + + - + @@ -113,10 +135,11 @@ import * as UserApi from '@/api/system/user' import * as CustomerApi from '@/api/crm/customer' import * as ContractApi from '@/api/crm/contract' import { useUserStore } from '@/store/modules/user' +import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 -const userList = ref([]) // 用户列表 +const userOptions = ref([]) // 用户列表 const dialogVisible = ref(false) // 弹窗的是否展示 const dialogTitle = ref('') // 弹窗的标题 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 @@ -125,7 +148,6 @@ const formData = ref({} as ReceivablePlanApi const formRules = reactive({ price: [{ required: true, message: '计划回款金额不能为空', trigger: 'blur' }], returnTime: [{ required: true, message: '计划回款日期不能为空', trigger: 'blur' }], - remindTime: [{ required: true, message: '提醒日期不能为空', trigger: 'blur' }], customerId: [{ required: true, message: '客户编号不能为空', trigger: 'blur' }], contractId: [{ required: true, message: '合同编号不能为空', trigger: 'blur' }], ownerUserId: [{ required: true, message: '负责人不能为空', trigger: 'blur' }] @@ -133,6 +155,7 @@ const formRules = reactive({ const formRef = ref() // 表单 Ref const customerList = ref([]) // 客户列表 const contractList = ref([]) // 合同列表 + /** 打开弹窗 */ const open = async (type: string, id?: number) => { dialogVisible.value = true @@ -148,9 +171,8 @@ const open = async (type: string, id?: number) => { formLoading.value = false } } - // 获得用户列表 - userList.value = await UserApi.getSimpleUserList() + userOptions.value = await UserApi.getSimpleUserList() // 获得客户列表 customerList.value = await CustomerApi.getCustomerSimpleList() // 默认新建时选中自己 @@ -160,22 +182,6 @@ const open = async (type: string, id?: number) => { } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 -const getContractList = async (customerId: number) => { - contractList.value = await ContractApi.getCrmContractSimpleListByCustomerId(customerId) -} -watch( - () => formData.value.customerId, - (newVal) => { - if (!newVal) { - return - } - getContractList(newVal) - }, - { - immediate: true - } -) - /** 提交表单 */ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 const submitForm = async () => { @@ -207,4 +213,15 @@ const resetForm = () => { formData.value = {} as ReceivablePlanApi.ReceivablePlanVO formRef.value?.resetFields() } + +/** 处理切换客户 */ +const handleCustomerChange = async (customerId: number) => { + // 重置合同编号 + formData.value.contractId = undefined + // 获得合同列表 + if (customerId) { + contractList.value = [] + contractList.value = await ContractApi.getContractSimpleList(customerId) + } +} From 70bf234133c1b5750d8f93f212c6802313b19c25 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 25 Feb 2024 16:52:07 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E2=9C=A8=20CRM=EF=BC=9A=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E5=9B=9E=E6=AC=BE=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/crm/contract/index.vue | 7 ++ src/views/crm/receivable/index.vue | 99 ++++++++++++++++++++++--- src/views/crm/receivable/plan/index.vue | 13 ++++ 3 files changed, 110 insertions(+), 9 deletions(-) diff --git a/src/views/crm/contract/index.vue b/src/views/crm/contract/index.vue index ed266057..80529d57 100644 --- a/src/views/crm/contract/index.vue +++ b/src/views/crm/contract/index.vue @@ -248,6 +248,7 @@ import ContractForm from './ContractForm.vue' import { DICT_TYPE } from '@/utils/dict' import { erpPriceTableColumnFormatter } from '@/utils' import * as CustomerApi from '@/api/crm/customer' +import { TabsPaneContext } from 'element-plus' defineOptions({ name: 'CrmContract' }) @@ -271,6 +272,12 @@ const exportLoading = ref(false) // 导出的加载中 const activeName = ref('1') // 列表 tab const customerList = ref([]) // 客户列表 +/** tab 切换 */ +const handleTabClick = (tab: TabsPaneContext) => { + queryParams.sceneType = tab.paneName + handleQuery() +} + /** 查询列表 */ const getList = async () => { loading.value = true diff --git a/src/views/crm/receivable/index.vue b/src/views/crm/receivable/index.vue index afacc34e..a02847ba 100644 --- a/src/views/crm/receivable/index.vue +++ b/src/views/crm/receivable/index.vue @@ -66,10 +66,35 @@ + + + + + - - - + + + + + + + + - - - + + + + + + + - diff --git a/src/views/crm/receivable/detail/ReceivableDetailsInfo.vue b/src/views/crm/receivable/detail/ReceivableDetailsInfo.vue new file mode 100644 index 00000000..003029fb --- /dev/null +++ b/src/views/crm/receivable/detail/ReceivableDetailsInfo.vue @@ -0,0 +1,62 @@ + + diff --git a/src/views/crm/receivable/detail/index.vue b/src/views/crm/receivable/detail/index.vue new file mode 100644 index 00000000..51a3ad20 --- /dev/null +++ b/src/views/crm/receivable/detail/index.vue @@ -0,0 +1,98 @@ + + diff --git a/src/views/crm/receivable/index.vue b/src/views/crm/receivable/index.vue index 0ec29bdb..856a07f1 100644 --- a/src/views/crm/receivable/index.vue +++ b/src/views/crm/receivable/index.vue @@ -72,7 +72,13 @@ - + + +