添加客户页面添加默认值
This commit is contained in:
parent
0cbd130078
commit
0e2b3864a8
|
|
@ -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);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 保存
|
// 保存
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
// 编辑客户
|
// 编辑客户
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user