From e29c26c88bd11efde82cf2cfc9cb366ce95e7493 Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Tue, 11 Nov 2025 11:19:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=B1=9E=E6=80=A7=E6=98=A0?= =?UTF-8?q?=E5=B0=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/CustomerManagement.vue | 50 +++------- components/customer-detail/InfoTab.vue | 13 +-- pages/customer/detail/index.vue | 39 ++------ pages/customer/follow/detail/index.vue | 61 ++---------- utils/customerMappings.js | 130 +++++++++++++++++++++++++ 5 files changed, 165 insertions(+), 128 deletions(-) create mode 100644 utils/customerMappings.js diff --git a/components/CustomerManagement.vue b/components/CustomerManagement.vue index ccc9b91..46ca3dc 100644 --- a/components/CustomerManagement.vue +++ b/components/CustomerManagement.vue @@ -169,6 +169,12 @@ import { ref, computed, onMounted, onUnmounted, watch } from 'vue'; import FabPlus from '@/components/FabPlus.vue'; import { usePagination } from '@/composables/usePagination'; import { getCustomerList, deleteCustomer } from '@/common/api/customer'; +import { + getCustomerStatusText, + getCustomerStatusClass, + getIntentLevelText, + getStatusListByFilter +} from '@/utils/customerMappings'; // 筛选状态 const showFilter = ref(false); @@ -193,36 +199,9 @@ const { defaultParams: {} }); -// 获取状态样式类 -const getStatusClass = (status) => { - return { - 'status-potential': status === '1', // 潜在 - 'status-intent': status === '2', // 意向 - 'status-deal': status === '3', // 成交 - 'status-invalid': status === '4' // 失效 - }; -}; - -// 获取状态文本 -const getStatusText = (status) => { - const statusMap = { - '1': '潜在', - '2': '意向', - '3': '成交', - '4': '失效' - }; - return statusMap[status] || '未知'; -}; - -// 获取意向强度文本 -const getIntentLevelText = (intentLevel) => { - const levelMap = { - '1': '高', - '2': '中', - '3': '低' - }; - return levelMap[intentLevel] || '--'; -}; +// 使用统一映射函数 +const getStatusClass = getCustomerStatusClass; +const getStatusText = getCustomerStatusText; // 截断文本 const truncateText = (text, maxLength) => { @@ -254,16 +233,9 @@ const buildQueryParams = () => { // 只有有效的筛选状态才添加statusList参数 if (filterStatus.value) { - const statusMap = { - 'potential': ['1'], // 潜在 - 'intent': ['2'], // 意向 - 'deal': ['3'], // 成交 - 'invalid': ['4'] // 失效 - }; + const statusList = getStatusListByFilter(filterStatus.value); - const statusList = statusMap[filterStatus.value]; - - if (statusList) { + if (statusList && statusList.length > 0) { params.statusList = statusList; console.log(`筛选状态: ${filterStatus.value} -> statusList:`, statusList); } else { diff --git a/components/customer-detail/InfoTab.vue b/components/customer-detail/InfoTab.vue index c267622..462d51e 100644 --- a/components/customer-detail/InfoTab.vue +++ b/components/customer-detail/InfoTab.vue @@ -69,6 +69,8 @@