地址和star需要调整
This commit is contained in:
parent
cf8af5a1af
commit
937a51626f
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user