添加客户补充添加跟进人

This commit is contained in:
WindowBird 2025-11-13 15:02:30 +08:00
parent f4fd1f39a3
commit d0e59ca68f

View File

@ -40,12 +40,14 @@
:show-customer-status-picker="showCustomerStatusPicker"
:show-work-wechat-picker="showWorkWechatPicker"
:show-next-follow-time-picker="showNextFollowTimePicker"
:show-follow-user-picker="showFollowUserPicker"
:customer-type-options="customerTypeOptions"
:source-options="sourceOptions"
:intent-options="intentOptions"
:intent-level-options="intentLevelOptions"
:customer-status-options="customerStatusOptions"
:work-wechat-options="workWechatOptions"
:follow-user-options="followUserOptions"
:address-list="addressList"
:region-loading="regionLoading"
:form-data="formData"
@ -61,7 +63,7 @@
<script setup>
import { ref, onMounted, nextTick } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { updateCustomer, getCustomerDetail } from '@/api';
import { updateCustomer, getCustomerDetail, getUserListAll } from '@/api';
import { useUserStore } from '@/store/user';
import { useCustomerForm } from '@/composables/useCustomerForm';
import CustomerFormNavbar from '@/components/customer/customer-form/CustomerFormNavbar.vue';
@ -111,7 +113,9 @@ const formData = ref({
pain: '',
attention: '',
demand: '',
nextFollowTime: ''
nextFollowTime: '',
followId: null,
followName: ''
});
//
@ -124,6 +128,10 @@ const showIntentLevelPicker = ref(false);
const showCustomerStatusPicker = ref(false);
const showWorkWechatPicker = ref(false);
const showNextFollowTimePicker = ref(false);
const showFollowUserPicker = ref(false);
//
const followUserOptions = ref([]);
const pickersRef = ref(null);
@ -165,7 +173,9 @@ const loadCustomerDetail = async () => {
pain: res.pain || '',
attention: res.attention || '',
demand: res.demand || '',
nextFollowTime: res.nextFollowTime || ''
nextFollowTime: res.nextFollowTime || '',
followId: res.followId || res.followUserId || null,
followName: res.followName || res.followUserName || ''
};
console.log('表单数据:', formData.value);
//
@ -213,6 +223,9 @@ const handleOpenPicker = (pickerType) => {
case 'nextFollowTime':
showNextFollowTimePicker.value = true;
break;
case 'followUser':
showFollowUserPicker.value = true;
break;
}
};
@ -240,6 +253,9 @@ const handleClosePicker = (pickerType) => {
case 'nextFollowTime':
showNextFollowTimePicker.value = false;
break;
case 'followUser':
showFollowUserPicker.value = false;
break;
}
};
@ -258,12 +274,30 @@ const handleCancel = () => {
uni.navigateBack();
};
//
const loadUserList = async () => {
try {
const res = await getUserListAll();
if (res && res.data && Array.isArray(res.data)) {
followUserOptions.value = res.data;
} else if (res && Array.isArray(res)) {
followUserOptions.value = res;
} else {
followUserOptions.value = [];
}
} catch (error) {
console.error('加载用户列表失败:', error);
followUserOptions.value = [];
}
};
//
onMounted(async () => {
await Promise.all([
loadRegionTree(),
loadDictData(),
loadWechatList()
loadWechatList(),
loadUserList()
]);
//
if (formData.value.regionIds && formData.value.regionIds.length > 0 && pickersRef.value) {
@ -292,7 +326,9 @@ const handleSave = async () => {
saving.value = true;
try {
const userStore = useUserStore();
const userId = userStore.userInfo?.id || userStore.userInfo?.userId || '1';
const defaultUserId = userStore.userInfo?.id || userStore.userInfo?.userId || '1';
// 使ID使ID
const followId = formData.value.followId || defaultUserId;
const now = new Date();
const formatDateTime = (date) => {
@ -318,7 +354,7 @@ const handleSave = async () => {
wechat: (formData.value.wechat && formData.value.wechat.trim()) ? formData.value.wechat.trim() : null,
source: formData.value.source || null,
intents: intentsArray,
followId: userId,
followId: followId,
remark: formData.value.remark.trim() || null,
type: formData.value.customerType || '2',
workWechatId: formData.value.workWechatId || null,