diff --git a/src/components/AddressSelect/index.vue b/src/components/AddressSelect/index.vue new file mode 100644 index 0000000..448a345 --- /dev/null +++ b/src/components/AddressSelect/index.vue @@ -0,0 +1,161 @@ + + + + + diff --git a/src/views/applyments/components/selectAddress.vue b/src/views/applyments/components/selectAddress.vue index 651cbdd..310e0f1 100644 --- a/src/views/applyments/components/selectAddress.vue +++ b/src/views/applyments/components/selectAddress.vue @@ -1,13 +1,40 @@ @@ -26,23 +53,31 @@ const provCode = defineModel("provCode", { }); // 监听省份code变化 -watch(provCode, async (n, o) => { - await getRegionAjax() - if (n && n !== undefined) { - provChange(n, true) +watch( + provCode, + async (n, o) => { + await getRegionAjax(); + if (n && n !== undefined) { + provChange(n, true); - // 监听市区code变化 - watch(cityCode, async (n, o) => { - if (n !== undefined && n) { - cityChange(n, true) - } - }, { - immediate: true // 可选:初始化立即执行,验证是否监听到初始值 - }) + // 监听市区code变化 + watch( + cityCode, + async (n, o) => { + if (n !== undefined && n) { + cityChange(n, true); + } + }, + { + immediate: true, // 可选:初始化立即执行,验证是否监听到初始值 + } + ); + } + }, + { + immediate: true, // 可选:初始化立即执行,验证是否监听到初始值 } -}, { - immediate: true // 可选:初始化立即执行,验证是否监听到初始值 -}) +); const cityCode = defineModel("cityCode", { type: String, @@ -69,10 +104,10 @@ const area = defineModel("area", { default: "", }); -const wxProvinceCode = defineModel('wxProvinceCode', { +const wxProvinceCode = defineModel("wxProvinceCode", { type: String, - default: '' -}) + default: "", +}); // 省份变化 e code isEcho是否回显 function provChange(e: string, isEcho: boolean = false) { @@ -100,7 +135,7 @@ function cityChange(e: string, isEcho: boolean = false) { city.value = cityObj ? cityObj.regionName : ""; if (cityObj && cityObj.children) { areaList.value = cityObj.children; - wxProvinceCode.value = cityObj.wxProvinceCode + wxProvinceCode.value = cityObj.wxProvinceCode; } } @@ -116,7 +151,7 @@ async function getRegionAjax() { const res = await getRegion(); provList.value = res; } catch (error) { - console.error('获取省市区数据失败:', error); + console.error("获取省市区数据失败:", error); } } @@ -127,4 +162,4 @@ async function getRegionAjax() { align-items: center; gap: 14px; } - \ No newline at end of file + diff --git a/src/views/shop/list/components/addShop.vue b/src/views/shop/list/components/addShop.vue index e8ae3f5..2da4003 100644 --- a/src/views/shop/list/components/addShop.vue +++ b/src/views/shop/list/components/addShop.vue @@ -1,86 +1,181 @@