From 954ef47dd7e21fd8b49597f586ca43ca2895e209 Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Sat, 8 Nov 2025 15:18:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=8C=E4=BB=85=E5=89=A9?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E9=80=89=E6=8B=A9=E6=98=9F=E7=BA=A7bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/customer/edit/index.vue | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pages/customer/edit/index.vue b/pages/customer/edit/index.vue index 430875c..303b2b4 100644 --- a/pages/customer/edit/index.vue +++ b/pages/customer/edit/index.vue @@ -153,13 +153,14 @@ const loadCustomerDetail = async () => { wechat: res.wechat ||'', source: res.source || '', intents: Array.isArray(res.intents) ? res.intents : (res.intents ? res.intents.split(',') : []), - intentLevel: res.intentLevel || res.customerIntentLevel || '', + intentLevel: res.intentLevel || '', customerStatus: res.customerStatus || res.status || '', region: res.region || res.regionName || '', - regionIds: (res.regionIds && Array.isArray(res.regionIds) && res.regionIds.length > 0) ? res.regionIds : (res.regionId ? [res.regionId] : []), + // 从后端返回的 provinceId, cityId, countyId 构建 regionIds 数组(用于前端显示和选择器) + regionIds: [res.provinceId, res.cityId, res.countyId], workWechat: res.wechatId || '', workWechatId: res.workWechatId || null, - rating: res.intentLevel ||'', + rating: res.rating ||'', remark: res.remark || '', concern: res.concern || '', pain: res.pain || '', @@ -322,8 +323,11 @@ const handleSave = async () => { remark: formData.value.remark.trim() || null, type: formData.value.customerType || '2', workWechatId: formData.value.workWechatId || null, - regionIds: regionIdsArray, - + // 将 regionIds 数组转换为三个独立的字段传给后端 + provinceId: (regionIdsArray[0] !== undefined && regionIdsArray[0] !== null) ? regionIdsArray[0] : null, + cityId: (regionIdsArray[1] !== undefined && regionIdsArray[1] !== null) ? regionIdsArray[1] : null, + countyId: (regionIdsArray[2] !== undefined && regionIdsArray[2] !== null) ? regionIdsArray[2] : null, + rating: formData.value.rating || 0, attention: formData.value.attention.trim() || null, concern: formData.value.concern.trim() || null, demand: formData.value.demand.trim() || null, @@ -339,6 +343,14 @@ const handleSave = async () => { customerStatus: formData.value.customerStatus || null }; + console.log('提交的数据:', submitData); + console.log('地区数据:', { + regionIds: regionIdsArray, + provinceId: submitData.provinceId, + cityId: submitData.cityId, + countyId: submitData.countyId + }); + await updateCustomer(submitData); uni.showToast({