From 3f1a9d9b4c70094788afde54da50b7fad39b6cc1 Mon Sep 17 00:00:00 2001 From: dd3s_206 Date: Wed, 17 Jun 2026 09:45:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=8C=E5=B7=A5=E7=A6=8F=E5=88=A9-=E6=94=B6?= =?UTF-8?q?=E8=B4=A7=E5=9C=B0=E5=9D=80=EF=BC=88h5=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E7=AB=AF=EF=BC=89=EF=BC=9A=E4=BF=AE=E5=A4=8D=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=88=90=E5=8A=9F=E5=90=8E=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=B8=80=E7=9B=B4=E5=A4=84=E4=BA=8E=E5=8A=A0=E8=BD=BD=E4=B8=AD?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/mobile/welfare/mine/address.html | 20 ++++++++--- .../mobile/welfare/mine/address_edit.html | 26 +++++++++++--- .../views/platform/welfare/addressManage.html | 35 ++++++++++++------- 3 files changed, 61 insertions(+), 20 deletions(-) diff --git a/src/main/resources/views/mobile/welfare/mine/address.html b/src/main/resources/views/mobile/welfare/mine/address.html index 3d03a5a..99c5a99 100644 --- a/src/main/resources/views/mobile/welfare/mine/address.html +++ b/src/main/resources/views/mobile/welfare/mine/address.html @@ -44,6 +44,7 @@ layout("/mobile/platform.html"){ mixins: [mobileMixins, welfareMixins], data() { return { + projectId: GetQueryString("projectId"), chosenAddressId: null } }, @@ -56,16 +57,27 @@ layout("/mobile/platform.html"){ } }, onAdd() { - pjaxReplace("/mobile/welfare/mine/addressEdit") + if (this.projectId) { + pjaxReplace("/mobile/welfare/mine/addressEdit?projectId=" + this.projectId) + } else { + pjaxReplace("/mobile/welfare/mine/addressEdit") + } }, onEdit(item, index) { - pjaxReplace("/mobile/welfare/mine/addressEdit?id=" + item.id) + if (this.projectId) { + pjaxReplace("/mobile/welfare/mine/addressEdit?id=" + item.id + "&projectId=" + this.projectId) + } else { + pjaxReplace("/mobile/welfare/mine/addressEdit?id=" + item.id) + } } }, async created() { this.startLoading() - await this.selectAddressList() - this.closeLoading() + try { + await this.selectAddressList() + } finally { + this.closeLoading() + } } }) diff --git a/src/main/resources/views/mobile/welfare/mine/address_edit.html b/src/main/resources/views/mobile/welfare/mine/address_edit.html index fd2fef0..790170a 100644 --- a/src/main/resources/views/mobile/welfare/mine/address_edit.html +++ b/src/main/resources/views/mobile/welfare/mine/address_edit.html @@ -101,8 +101,12 @@ layout("/mobile/platform.html"){ duration: 0 }) content.userName = content.name - const resp = await $.post("/mobile/welfare/mine/doSaveUserAddress", content) - loading.close() + let resp = {} + try { + resp = await $.post("/mobile/welfare/mine/doSaveUserAddress", content) + } finally { + this.closeToastLoading(loading) + } if (resp.code === 0) { this.$toast.success(resp.msg) this.$nextTick(() => { @@ -117,14 +121,28 @@ layout("/mobile/platform.html"){ overlay: true, duration: 0 }) - const resp = await $.post("/mobile/welfare/mine/deleteAddress", { id: content.id }) - loading.close() + let resp = {} + try { + resp = await $.post("/mobile/welfare/mine/deleteAddress", { id: content.id }) + } finally { + this.closeToastLoading(loading) + } if (resp.code === 0) { this.$toast.success(resp.msg) this.$nextTick(() => { this.back() }) } + }, + closeToastLoading(loading) { + if (loading && typeof loading.clear === "function") { + loading.clear() + } else if (loading && typeof loading.close === "function") { + loading.close() + } + if (this.$toast && typeof this.$toast.clear === "function") { + this.$toast.clear() + } } }, async created() { diff --git a/src/main/resources/views/platform/welfare/addressManage.html b/src/main/resources/views/platform/welfare/addressManage.html index bca3b68..056046c 100644 --- a/src/main/resources/views/platform/welfare/addressManage.html +++ b/src/main/resources/views/platform/welfare/addressManage.html @@ -142,24 +142,26 @@ layout("/layouts/platform.html"){ function ensureAddressDzOption(options, row) { const provinceTemplate = chengShiList.find((c) => c.label === row.province) const cityTemplate = provinceTemplate?.children?.find((c) => c.label === row.city) - if (!provinceTemplate || !cityTemplate) { + if (!row.province || !row.city) { return options } const nextOptions = JSON.parse(JSON.stringify(options)) let province = nextOptions.find((c) => c.label === row.province) if (!province) { - province = {...provinceTemplate, children: []} + province = provinceTemplate ? {...provinceTemplate, children: []} : {label: row.province, value: row.province, children: []} nextOptions.push(province) } let city = province.children.find((c) => c.label === row.city) if (!city) { - city = {...cityTemplate, children: []} + city = cityTemplate ? {...cityTemplate, children: []} : {label: row.city, value: row.city, children: []} province.children.push(city) } if (row.county) { - const countyTemplate = cityTemplate.children?.find((c) => c.label === row.county) + const countyTemplate = cityTemplate?.children?.find((c) => c.label === row.county) if (countyTemplate && !city.children.find((c) => c.label === row.county)) { city.children.push(countyTemplate) + } else if (!countyTemplate && !city.children.find((c) => c.label === row.county)) { + city.children.push({label: row.county, value: row.areaCode || row.county}) } } return nextOptions @@ -209,16 +211,19 @@ layout("/layouts/platform.html"){ ) }, handleChange(val) { - if (val) { + if (val && val.length > 0) { let provinceName = "" let cityName = "" let countyName = "" const province = this.dzOptions.find((c) => c.value === val[0]) + if (!province) return provinceName = province.label const city = province.children.find((p) => p.value === val[1]) + if (!city) return cityName = city.label if (val.length === 3) { const county = city.children.find((p) => p.value === val[2]) + if (!county) return countyName = county.label this.$set(this.formData, "areaCode", county.value) } else { @@ -275,17 +280,23 @@ layout("/layouts/platform.html"){ }, openEdit(row) { this.dzOptions = ensureAddressDzOption(getWelfareReceiveDzOptions(), row) - row.addressList = [] + const addressList = [] const province = this.dzOptions.find((c) => c.label === row.province) - row.addressList.push(province.value) - const city = province.children.find((p) => p.label === row.city) - row.addressList.push(city.value) - if (row.county) { + if (province) { + addressList.push(province.value) + } + const city = province?.children?.find((p) => p.label === row.city) + if (city) { + addressList.push(city.value) + } + if (row.county && city) { const county = city.children.find((p) => p.label === row.county) - row.addressList.push(county.value) + if (county) { + addressList.push(county.value) + } } - this.formData = { ...row } + this.formData = { ...row, addressList } this.formData.isDefault = this.formData.isDefault ? "1" : "0" this.dialogVisible = true },