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 @@