添加客户补充添加跟进人
This commit is contained in:
parent
f4fd1f39a3
commit
d0e59ca68f
|
|
@ -40,12 +40,14 @@
|
||||||
:show-customer-status-picker="showCustomerStatusPicker"
|
:show-customer-status-picker="showCustomerStatusPicker"
|
||||||
:show-work-wechat-picker="showWorkWechatPicker"
|
:show-work-wechat-picker="showWorkWechatPicker"
|
||||||
:show-next-follow-time-picker="showNextFollowTimePicker"
|
:show-next-follow-time-picker="showNextFollowTimePicker"
|
||||||
|
:show-follow-user-picker="showFollowUserPicker"
|
||||||
:customer-type-options="customerTypeOptions"
|
:customer-type-options="customerTypeOptions"
|
||||||
:source-options="sourceOptions"
|
:source-options="sourceOptions"
|
||||||
:intent-options="intentOptions"
|
:intent-options="intentOptions"
|
||||||
:intent-level-options="intentLevelOptions"
|
:intent-level-options="intentLevelOptions"
|
||||||
:customer-status-options="customerStatusOptions"
|
:customer-status-options="customerStatusOptions"
|
||||||
:work-wechat-options="workWechatOptions"
|
:work-wechat-options="workWechatOptions"
|
||||||
|
:follow-user-options="followUserOptions"
|
||||||
:address-list="addressList"
|
:address-list="addressList"
|
||||||
:region-loading="regionLoading"
|
:region-loading="regionLoading"
|
||||||
:form-data="formData"
|
:form-data="formData"
|
||||||
|
|
@ -61,7 +63,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, nextTick } from 'vue';
|
import { ref, onMounted, nextTick } from 'vue';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import { updateCustomer, getCustomerDetail } from '@/api';
|
import { updateCustomer, getCustomerDetail, getUserListAll } from '@/api';
|
||||||
import { useUserStore } from '@/store/user';
|
import { useUserStore } from '@/store/user';
|
||||||
import { useCustomerForm } from '@/composables/useCustomerForm';
|
import { useCustomerForm } from '@/composables/useCustomerForm';
|
||||||
import CustomerFormNavbar from '@/components/customer/customer-form/CustomerFormNavbar.vue';
|
import CustomerFormNavbar from '@/components/customer/customer-form/CustomerFormNavbar.vue';
|
||||||
|
|
@ -111,7 +113,9 @@ const formData = ref({
|
||||||
pain: '',
|
pain: '',
|
||||||
attention: '',
|
attention: '',
|
||||||
demand: '',
|
demand: '',
|
||||||
nextFollowTime: ''
|
nextFollowTime: '',
|
||||||
|
followId: null,
|
||||||
|
followName: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
// 显示状态
|
// 显示状态
|
||||||
|
|
@ -124,6 +128,10 @@ const showIntentLevelPicker = ref(false);
|
||||||
const showCustomerStatusPicker = ref(false);
|
const showCustomerStatusPicker = ref(false);
|
||||||
const showWorkWechatPicker = ref(false);
|
const showWorkWechatPicker = ref(false);
|
||||||
const showNextFollowTimePicker = ref(false);
|
const showNextFollowTimePicker = ref(false);
|
||||||
|
const showFollowUserPicker = ref(false);
|
||||||
|
|
||||||
|
// 用户列表
|
||||||
|
const followUserOptions = ref([]);
|
||||||
|
|
||||||
const pickersRef = ref(null);
|
const pickersRef = ref(null);
|
||||||
|
|
||||||
|
|
@ -165,7 +173,9 @@ const loadCustomerDetail = async () => {
|
||||||
pain: res.pain || '',
|
pain: res.pain || '',
|
||||||
attention: res.attention || '',
|
attention: res.attention || '',
|
||||||
demand: res.demand || '',
|
demand: res.demand || '',
|
||||||
nextFollowTime: res.nextFollowTime || ''
|
nextFollowTime: res.nextFollowTime || '',
|
||||||
|
followId: res.followId || res.followUserId || null,
|
||||||
|
followName: res.followName || res.followUserName || ''
|
||||||
};
|
};
|
||||||
console.log('表单数据:', formData.value);
|
console.log('表单数据:', formData.value);
|
||||||
// 数据加载完成后初始化地区数据
|
// 数据加载完成后初始化地区数据
|
||||||
|
|
@ -213,6 +223,9 @@ const handleOpenPicker = (pickerType) => {
|
||||||
case 'nextFollowTime':
|
case 'nextFollowTime':
|
||||||
showNextFollowTimePicker.value = true;
|
showNextFollowTimePicker.value = true;
|
||||||
break;
|
break;
|
||||||
|
case 'followUser':
|
||||||
|
showFollowUserPicker.value = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -240,6 +253,9 @@ const handleClosePicker = (pickerType) => {
|
||||||
case 'nextFollowTime':
|
case 'nextFollowTime':
|
||||||
showNextFollowTimePicker.value = false;
|
showNextFollowTimePicker.value = false;
|
||||||
break;
|
break;
|
||||||
|
case 'followUser':
|
||||||
|
showFollowUserPicker.value = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -258,12 +274,30 @@ const handleCancel = () => {
|
||||||
uni.navigateBack();
|
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 () => {
|
onMounted(async () => {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
loadRegionTree(),
|
loadRegionTree(),
|
||||||
loadDictData(),
|
loadDictData(),
|
||||||
loadWechatList()
|
loadWechatList(),
|
||||||
|
loadUserList()
|
||||||
]);
|
]);
|
||||||
// 如果客户详情已加载,初始化地区选择器
|
// 如果客户详情已加载,初始化地区选择器
|
||||||
if (formData.value.regionIds && formData.value.regionIds.length > 0 && pickersRef.value) {
|
if (formData.value.regionIds && formData.value.regionIds.length > 0 && pickersRef.value) {
|
||||||
|
|
@ -292,7 +326,9 @@ const handleSave = async () => {
|
||||||
saving.value = true;
|
saving.value = true;
|
||||||
try {
|
try {
|
||||||
const userStore = useUserStore();
|
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 now = new Date();
|
||||||
const formatDateTime = (date) => {
|
const formatDateTime = (date) => {
|
||||||
|
|
@ -318,7 +354,7 @@ const handleSave = async () => {
|
||||||
wechat: (formData.value.wechat && formData.value.wechat.trim()) ? formData.value.wechat.trim() : null,
|
wechat: (formData.value.wechat && formData.value.wechat.trim()) ? formData.value.wechat.trim() : null,
|
||||||
source: formData.value.source || null,
|
source: formData.value.source || null,
|
||||||
intents: intentsArray,
|
intents: intentsArray,
|
||||||
followId: userId,
|
followId: followId,
|
||||||
remark: formData.value.remark.trim() || null,
|
remark: formData.value.remark.trim() || null,
|
||||||
type: formData.value.customerType || '2',
|
type: formData.value.customerType || '2',
|
||||||
workWechatId: formData.value.workWechatId || null,
|
workWechatId: formData.value.workWechatId || null,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user