添加客户补充工作微信
This commit is contained in:
parent
1c33bd6c42
commit
3a6d9d1b6b
|
|
@ -224,3 +224,15 @@ export const getCustomerStatusDict = () => {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取微信列表
|
||||
* @returns {Promise} 返回微信列表 { total: number, rows: array }
|
||||
*/
|
||||
export const getWechatList = () => {
|
||||
return uni.$uv.http.get(`bst/wechat/list`, {
|
||||
custom: {
|
||||
auth: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -372,7 +372,8 @@ import {
|
|||
getCustomerIntentLevelDict,
|
||||
getCustomerSourceDict,
|
||||
getCustomerTypeDict,
|
||||
getCustomerStatusDict
|
||||
getCustomerStatusDict,
|
||||
getWechatList
|
||||
} from '@/common/api';
|
||||
import { useUserStore } from '@/store/user';
|
||||
|
||||
|
|
@ -500,6 +501,30 @@ const loadDictData = async () => {
|
|||
}
|
||||
};
|
||||
|
||||
// 加载微信列表数据
|
||||
const loadWechatList = async () => {
|
||||
try {
|
||||
const res = await getWechatList();
|
||||
const rows = res?.rows || [];
|
||||
|
||||
// 处理微信列表数据,使用 id 作为值(传递给后端的 workWechatId)
|
||||
workWechatOptions.value = rows.map(item => ({
|
||||
label: item.nickName ? `${item.nickName} (${item.wechatId})` : item.wechatId,
|
||||
value: String(item.id), // 使用数据库主键 id,转换为字符串
|
||||
id: item.id,
|
||||
wechatId: item.wechatId // 保留 wechatId 用于显示
|
||||
}));
|
||||
|
||||
console.log('微信列表加载成功:', workWechatOptions.value);
|
||||
} catch (err) {
|
||||
console.error('加载微信列表失败:', err);
|
||||
uni.showToast({
|
||||
title: '加载微信列表失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 加载地区树数据
|
||||
const loadRegionTree = async () => {
|
||||
try {
|
||||
|
|
@ -569,13 +594,8 @@ const handlePickValueDefault = () => {
|
|||
}
|
||||
};
|
||||
|
||||
// 工作微信选项(示例数据,实际应从API获取,包含ID和名称)
|
||||
const workWechatOptions = [
|
||||
{ label: '工作微信1', value: '工作微信1', id: '1' },
|
||||
{ label: '工作微信2', value: '工作微信2', id: '2' },
|
||||
{ label: '工作微信3', value: '工作微信3', id: '3' },
|
||||
{ label: '工作微信4', value: '工作微信4', id: '4' }
|
||||
];
|
||||
// 工作微信选项(从API获取)
|
||||
const workWechatOptions = ref([]);
|
||||
|
||||
// 获取客户类型文本
|
||||
const getCustomerTypeText = (value) => {
|
||||
|
|
@ -797,10 +817,10 @@ const selectWorkWechat = (value) => {
|
|||
|
||||
// 确认工作微信
|
||||
const confirmWorkWechat = () => {
|
||||
const selectedWechat = workWechatOptions.find(w => w.value === tempWorkWechat.value);
|
||||
const selectedWechat = workWechatOptions.value.find(w => w.value === tempWorkWechat.value);
|
||||
if (selectedWechat) {
|
||||
formData.value.workWechat = selectedWechat.value;
|
||||
formData.value.workWechatId = selectedWechat.id;
|
||||
formData.value.workWechat = selectedWechat.label; // 显示名称
|
||||
formData.value.workWechatId = selectedWechat.value; // 使用 id 作为值(传递给后端的 workWechatId)
|
||||
}
|
||||
showWorkWechatPicker.value = false;
|
||||
};
|
||||
|
|
@ -853,10 +873,11 @@ const handleCancel = () => {
|
|||
uni.navigateBack();
|
||||
};
|
||||
|
||||
// 组件挂载时加载地区树数据和字典数据
|
||||
// 组件挂载时加载地区树数据、字典数据和微信列表
|
||||
onMounted(() => {
|
||||
loadRegionTree();
|
||||
loadDictData();
|
||||
loadWechatList();
|
||||
});
|
||||
|
||||
// 保存
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user