From 0cfde7928675b1737359ab9be825d4655524781c Mon Sep 17 00:00:00 2001 From: aihe <961836564@qq.com> Date: Fri, 19 Jul 2024 18:23:50 +0800 Subject: [PATCH] uu --- .../buns-address-sheet/buns-address-sheet.vue | 29 +++++++++---------- pages/address/edit.vue | 5 ++-- pages/service/list.vue | 9 +++--- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/components/buns-address-sheet/buns-address-sheet.vue b/components/buns-address-sheet/buns-address-sheet.vue index 35f6214..416aa7f 100644 --- a/components/buns-address-sheet/buns-address-sheet.vue +++ b/components/buns-address-sheet/buns-address-sheet.vue @@ -154,19 +154,10 @@ } } }, - async addEmptyItem(item) { - const list = await this.getListData({ - regionType: this.curTabIndex + 1, - parentId: item.code - }) - // 选择最后一个tab视图 才做追加 - if (list.length > 0 && this.curTabIndex + 1 == this.submitVals.regIds.length) { - this.submitVals.regIds.push(undefined) - this.submitVals.regNames.push('请选择') - } - if(list.length > 0) { - this.curTabIndex = this.curTabIndex + 1 - } + async addEmptyItem() { + this.submitVals.regIds.push(undefined) + this.submitVals.regNames.push('请选择') + this.curTabIndex = this.curTabIndex + 1 }, async selectItemRegion(item = {}) { this.keywords = '' @@ -177,14 +168,22 @@ this.submitVals.regIds.push(item.code) this.submitVals.regNames.push(item.name) } - // 选中后切换下一层级视图 - this.addEmptyItem(item) + const list = await this.getListData({ + regionType: this.curTabIndex + 1, + parentId: item.code + }) + // 选择最后一个tab视图 才做追加 + if (list.length > 0 && this.curTabIndex + 1 == this.submitVals.regIds.length) { + this.addEmptyItem(item) + } }, handleCloseModal() { this.$emit('update:show', false) }, handleSubmitValue() { const val = this.submitVals + val.regIds = val.regIds.filter(t=> typeof(t) != 'undefined') + val.regNames = val.regNames.filter(t=> t != '请选择') this.$emit('onSure', val) this.$emit('update:value', val) this.handleCloseModal() diff --git a/pages/address/edit.vue b/pages/address/edit.vue index eed5375..33e568d 100644 --- a/pages/address/edit.vue +++ b/pages/address/edit.vue @@ -156,9 +156,8 @@ Object.assign(this.submitParam, data) }, handleAddressChoose(data) { - data.regIds.map((regId, index)=> { - let nameCodeMap = addressNameCodeMap[index] - this.submitParam[nameCodeMap.codeKey] = regId + addressNameCodeMap.map((nameCodeMap, index)=> { + this.submitParam[nameCodeMap.codeKey] = data.regIds[index] this.submitParam[nameCodeMap.nameKey] = data.regNames[index] }) }, diff --git a/pages/service/list.vue b/pages/service/list.vue index 3e4a495..53848b7 100644 --- a/pages/service/list.vue +++ b/pages/service/list.vue @@ -5,7 +5,7 @@ - + @@ -73,6 +73,7 @@ onUnload() { }, methods: { + getAddressDetail, getListFun: apiService.getSendSiteList, initData(){ @@ -85,11 +86,9 @@ this.addressModal.show = true }, handleAddressChoose(data) { - data.regIds.map((regId, index)=> { - let nameCodeMap = addressNameCodeMap[index] - this.searchParam[nameCodeMap.codeKey] = regId + addressNameCodeMap.map((nameCodeMap, index)=> { + this.searchParam[nameCodeMap.codeKey] = data.regIds[index] this.searchParam[nameCodeMap.nameKey] = data.regNames[index] - this.addressText = getAddressDetail(this.searchParam) }) }, }