职工福利-收货地址(h5手机端):修复提交保存成功后页面一直处于加载中;
This commit is contained in:
@@ -44,6 +44,7 @@ layout("/mobile/platform.html"){
|
|||||||
mixins: [mobileMixins, welfareMixins],
|
mixins: [mobileMixins, welfareMixins],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
projectId: GetQueryString("projectId"),
|
||||||
chosenAddressId: null
|
chosenAddressId: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -56,16 +57,27 @@ layout("/mobile/platform.html"){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onAdd() {
|
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) {
|
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() {
|
async created() {
|
||||||
this.startLoading()
|
this.startLoading()
|
||||||
await this.selectAddressList()
|
try {
|
||||||
this.closeLoading()
|
await this.selectAddressList()
|
||||||
|
} finally {
|
||||||
|
this.closeLoading()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -101,8 +101,12 @@ layout("/mobile/platform.html"){
|
|||||||
duration: 0
|
duration: 0
|
||||||
})
|
})
|
||||||
content.userName = content.name
|
content.userName = content.name
|
||||||
const resp = await $.post("/mobile/welfare/mine/doSaveUserAddress", content)
|
let resp = {}
|
||||||
loading.close()
|
try {
|
||||||
|
resp = await $.post("/mobile/welfare/mine/doSaveUserAddress", content)
|
||||||
|
} finally {
|
||||||
|
this.closeToastLoading(loading)
|
||||||
|
}
|
||||||
if (resp.code === 0) {
|
if (resp.code === 0) {
|
||||||
this.$toast.success(resp.msg)
|
this.$toast.success(resp.msg)
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@@ -117,14 +121,28 @@ layout("/mobile/platform.html"){
|
|||||||
overlay: true,
|
overlay: true,
|
||||||
duration: 0
|
duration: 0
|
||||||
})
|
})
|
||||||
const resp = await $.post("/mobile/welfare/mine/deleteAddress", { id: content.id })
|
let resp = {}
|
||||||
loading.close()
|
try {
|
||||||
|
resp = await $.post("/mobile/welfare/mine/deleteAddress", { id: content.id })
|
||||||
|
} finally {
|
||||||
|
this.closeToastLoading(loading)
|
||||||
|
}
|
||||||
if (resp.code === 0) {
|
if (resp.code === 0) {
|
||||||
this.$toast.success(resp.msg)
|
this.$toast.success(resp.msg)
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.back()
|
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() {
|
async created() {
|
||||||
|
|||||||
@@ -142,24 +142,26 @@ layout("/layouts/platform.html"){
|
|||||||
function ensureAddressDzOption(options, row) {
|
function ensureAddressDzOption(options, row) {
|
||||||
const provinceTemplate = chengShiList.find((c) => c.label === row.province)
|
const provinceTemplate = chengShiList.find((c) => c.label === row.province)
|
||||||
const cityTemplate = provinceTemplate?.children?.find((c) => c.label === row.city)
|
const cityTemplate = provinceTemplate?.children?.find((c) => c.label === row.city)
|
||||||
if (!provinceTemplate || !cityTemplate) {
|
if (!row.province || !row.city) {
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
const nextOptions = JSON.parse(JSON.stringify(options))
|
const nextOptions = JSON.parse(JSON.stringify(options))
|
||||||
let province = nextOptions.find((c) => c.label === row.province)
|
let province = nextOptions.find((c) => c.label === row.province)
|
||||||
if (!province) {
|
if (!province) {
|
||||||
province = {...provinceTemplate, children: []}
|
province = provinceTemplate ? {...provinceTemplate, children: []} : {label: row.province, value: row.province, children: []}
|
||||||
nextOptions.push(province)
|
nextOptions.push(province)
|
||||||
}
|
}
|
||||||
let city = province.children.find((c) => c.label === row.city)
|
let city = province.children.find((c) => c.label === row.city)
|
||||||
if (!city) {
|
if (!city) {
|
||||||
city = {...cityTemplate, children: []}
|
city = cityTemplate ? {...cityTemplate, children: []} : {label: row.city, value: row.city, children: []}
|
||||||
province.children.push(city)
|
province.children.push(city)
|
||||||
}
|
}
|
||||||
if (row.county) {
|
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)) {
|
if (countyTemplate && !city.children.find((c) => c.label === row.county)) {
|
||||||
city.children.push(countyTemplate)
|
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
|
return nextOptions
|
||||||
@@ -209,16 +211,19 @@ layout("/layouts/platform.html"){
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
handleChange(val) {
|
handleChange(val) {
|
||||||
if (val) {
|
if (val && val.length > 0) {
|
||||||
let provinceName = ""
|
let provinceName = ""
|
||||||
let cityName = ""
|
let cityName = ""
|
||||||
let countyName = ""
|
let countyName = ""
|
||||||
const province = this.dzOptions.find((c) => c.value === val[0])
|
const province = this.dzOptions.find((c) => c.value === val[0])
|
||||||
|
if (!province) return
|
||||||
provinceName = province.label
|
provinceName = province.label
|
||||||
const city = province.children.find((p) => p.value === val[1])
|
const city = province.children.find((p) => p.value === val[1])
|
||||||
|
if (!city) return
|
||||||
cityName = city.label
|
cityName = city.label
|
||||||
if (val.length === 3) {
|
if (val.length === 3) {
|
||||||
const county = city.children.find((p) => p.value === val[2])
|
const county = city.children.find((p) => p.value === val[2])
|
||||||
|
if (!county) return
|
||||||
countyName = county.label
|
countyName = county.label
|
||||||
this.$set(this.formData, "areaCode", county.value)
|
this.$set(this.formData, "areaCode", county.value)
|
||||||
} else {
|
} else {
|
||||||
@@ -275,17 +280,23 @@ layout("/layouts/platform.html"){
|
|||||||
},
|
},
|
||||||
openEdit(row) {
|
openEdit(row) {
|
||||||
this.dzOptions = ensureAddressDzOption(getWelfareReceiveDzOptions(), row)
|
this.dzOptions = ensureAddressDzOption(getWelfareReceiveDzOptions(), row)
|
||||||
row.addressList = []
|
const addressList = []
|
||||||
const province = this.dzOptions.find((c) => c.label === row.province)
|
const province = this.dzOptions.find((c) => c.label === row.province)
|
||||||
row.addressList.push(province.value)
|
if (province) {
|
||||||
const city = province.children.find((p) => p.label === row.city)
|
addressList.push(province.value)
|
||||||
row.addressList.push(city.value)
|
}
|
||||||
if (row.county) {
|
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)
|
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.formData.isDefault = this.formData.isDefault ? "1" : "0"
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user