地址和star需要调整

This commit is contained in:
WindowBird 2025-11-08 14:32:51 +08:00
parent cf8af5a1af
commit 937a51626f

View File

@ -58,7 +58,7 @@
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { ref, onMounted, nextTick } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { updateCustomer, getCustomerDetail } from '@/common/api';
import { useUserStore } from '@/store/user';
@ -143,22 +143,23 @@ const loadCustomerDetail = async () => {
try {
const res = await getCustomerDetail(customerId.value);
if (res) {
console.log('客户详情数据:', res);
//
formData.value = {
id: res.id,
customerType: res.type || '',
name: res.name || '',
mobile: res.mobile || '',
wechat: res.wechat || '',
wechat: res.wechat ||'',
source: res.source || '',
intents: Array.isArray(res.intents) ? res.intents : (res.intents ? res.intents.split(',') : []),
intentLevel: res.intentLevel || res.customerIntentLevel || '',
customerStatus: res.customerStatus || res.status || '',
region: res.region || '',
regionIds: res.regionIds || [],
workWechat: res.workWechat || '',
region: res.region || res.regionName || '',
regionIds: (res.regionIds && Array.isArray(res.regionIds) && res.regionIds.length > 0) ? res.regionIds : (res.regionId ? [res.regionId] : []),
workWechat: res.wechatId || '',
workWechatId: res.workWechatId || null,
rating: res.rating || 0,
rating: res.intentLevel ||'',
remark: res.remark || '',
concern: res.concern || '',
pain: res.pain || '',
@ -166,6 +167,12 @@ const loadCustomerDetail = async () => {
demand: res.demand || '',
nextFollowTime: res.nextFollowTime || ''
};
console.log('表单数据:', formData.value);
//
await nextTick();
if (formData.value.regionIds && formData.value.regionIds.length > 0 && pickersRef.value) {
handlePickValueDefault(formData.value, pickersRef.value);
}
}
} catch (error) {
console.error('加载客户详情失败:', error);
@ -178,12 +185,6 @@ const loadCustomerDetail = async () => {
}
};
//
const initRegionData = () => {
if (formData.value.regionIds && formData.value.regionIds.length > 0) {
handlePickValueDefault(formData.value, pickersRef.value);
}
};
//
const handleOpenPicker = (pickerType) => {
@ -264,8 +265,10 @@ onMounted(async () => {
loadDictData(),
loadWechatList()
]);
//
initRegionData();
//
if (formData.value.regionIds && formData.value.regionIds.length > 0 && pickersRef.value) {
handlePickValueDefault(formData.value, pickersRef.value);
}
});
//
@ -312,7 +315,7 @@ const handleSave = async () => {
status: formData.value.customerStatus || null,
intentLevel: formData.value.intentLevel || null,
mobile: formData.value.mobile.trim(),
wechat: formData.value.wechat.trim() || null,
wechat: (formData.value.wechat && formData.value.wechat.trim()) ? formData.value.wechat.trim() : null,
source: formData.value.source || null,
intents: intentsArray,
followId: userId,
@ -320,6 +323,7 @@ const handleSave = async () => {
type: formData.value.customerType || '2',
workWechatId: formData.value.workWechatId || null,
regionIds: regionIdsArray,
attention: formData.value.attention.trim() || null,
concern: formData.value.concern.trim() || null,
demand: formData.value.demand.trim() || null,