添加客户页面添加默认值

This commit is contained in:
WindowBird 2025-11-11 16:28:22 +08:00
parent 0cbd130078
commit 0e2b3864a8
2 changed files with 49 additions and 6 deletions

View File

@ -192,11 +192,54 @@ const handleCancel = () => {
uni.navigateBack(); uni.navigateBack();
}; };
// //
onMounted(() => { onMounted(async () => {
loadRegionTree(); await Promise.all([
loadDictData(); loadRegionTree(),
loadWechatList(); loadDictData(),
loadWechatList()
]);
// =label=value=label=value
try {
// 使 label
const defaultIntentLabel = '电动车';
if (!formData.value.intents || formData.value.intents.length === 0) {
const existsIntent = intentOptions.value.some(opt => opt.label === defaultIntentLabel);
if (existsIntent) {
formData.value.intents = [defaultIntentLabel];
}
}
// 使 value
const defaultIntentLevelLabel = '中';
if (!formData.value.intentLevel) {
const level = intentLevelOptions.value.find(opt => opt.label === defaultIntentLevelLabel);
if (level) {
formData.value.intentLevel = level.value;
}
}
// 使 label
const defaultSourceLabel = '抖音';
if (!formData.value.source) {
const existsSource = sourceOptions.value.some(opt => opt.label === defaultSourceLabel);
if (existsSource) {
formData.value.source = defaultSourceLabel;
}
}
// 使 value
const defaultStatusLabel = '意向';
if (!formData.value.customerStatus) {
const status = customerStatusOptions.value.find(opt => opt.label === defaultStatusLabel);
if (status) {
formData.value.customerStatus = status.value;
}
}
} catch (e) {
console.warn('设置默认字典值失败:', e);
}
}); });
// //

View File

@ -329,7 +329,7 @@ const handleCall = () => {
// //
const handleMore = () => { const handleMore = () => {
uni.showActionSheet({ uni.showActionSheet({
itemList: ['编辑客户', '删除客户', '分享客户'], itemList: ['编辑客户', '删除客户'],
success: (res) => { success: (res) => {
if (res.tapIndex === 0) { if (res.tapIndex === 0) {
// //