添加客户补充工作微信

This commit is contained in:
WindowBird 2025-11-07 15:25:23 +08:00
parent 1c33bd6c42
commit 3a6d9d1b6b
2 changed files with 45 additions and 12 deletions

View File

@ -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
}
});
};

View File

@ -372,7 +372,8 @@ import {
getCustomerIntentLevelDict, getCustomerIntentLevelDict,
getCustomerSourceDict, getCustomerSourceDict,
getCustomerTypeDict, getCustomerTypeDict,
getCustomerStatusDict getCustomerStatusDict,
getWechatList
} from '@/common/api'; } from '@/common/api';
import { useUserStore } from '@/store/user'; 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 () => { const loadRegionTree = async () => {
try { try {
@ -569,13 +594,8 @@ const handlePickValueDefault = () => {
} }
}; };
// APIID // API
const workWechatOptions = [ const workWechatOptions = ref([]);
{ label: '工作微信1', value: '工作微信1', id: '1' },
{ label: '工作微信2', value: '工作微信2', id: '2' },
{ label: '工作微信3', value: '工作微信3', id: '3' },
{ label: '工作微信4', value: '工作微信4', id: '4' }
];
// //
const getCustomerTypeText = (value) => { const getCustomerTypeText = (value) => {
@ -797,10 +817,10 @@ const selectWorkWechat = (value) => {
// //
const confirmWorkWechat = () => { const confirmWorkWechat = () => {
const selectedWechat = workWechatOptions.find(w => w.value === tempWorkWechat.value); const selectedWechat = workWechatOptions.value.find(w => w.value === tempWorkWechat.value);
if (selectedWechat) { if (selectedWechat) {
formData.value.workWechat = selectedWechat.value; formData.value.workWechat = selectedWechat.label; //
formData.value.workWechatId = selectedWechat.id; formData.value.workWechatId = selectedWechat.value; // 使 id workWechatId
} }
showWorkWechatPicker.value = false; showWorkWechatPicker.value = false;
}; };
@ -853,10 +873,11 @@ const handleCancel = () => {
uni.navigateBack(); uni.navigateBack();
}; };
// //
onMounted(() => { onMounted(() => {
loadRegionTree(); loadRegionTree();
loadDictData(); loadDictData();
loadWechatList();
}); });
// //