diff --git a/components/screen/screenWork.vue b/components/screen/screenWork.vue
index 2d8d8fd..0ea6115 100644
--- a/components/screen/screenWork.vue
+++ b/components/screen/screenWork.vue
@@ -41,9 +41,6 @@
@clickItem="clickItem"
@popupChange="change">
-
-
-
+
+
+
@@ -162,7 +172,8 @@
index : 0,
type : 'areaId',
},
- ]
+ ],
+ popupSelectedAddress: '', // 弹窗中选中的地址
}
},
computed : {
@@ -305,6 +316,7 @@
this.result = this.result.filter(item => this.defaultValue.indexOf(item.value) == -1);
+ console.log('this.result', this.result);
this.$emit('clickItem', this.result)
},
@@ -313,12 +325,22 @@
this.result = []
this.list.forEach(n => {
- let t = n.tag[n.index]
- this.result.push({
- name: n.type,
- label : t.label,
- value : t.value
- })
+ // 地址选择使用AddressPicker的结果
+ if(n.type === 'areaId' && this.popupSelectedAddress) {
+ this.result.push({
+ name: n.type,
+ label: this.popupSelectedAddress,
+ value: this.popupSelectedAddress
+ })
+ } else {
+ // 其他选项使用tag选择
+ let t = n.tag[n.index]
+ this.result.push({
+ name: n.type,
+ label : t.label,
+ value : t.value
+ })
+ }
})
this.result = this.result.filter(item => this.defaultValue.indexOf(item.value) == -1);
@@ -327,17 +349,30 @@
this.$refs.popup.close()
},
+ // 弹窗中打开地址选择器
+ openAddressPickerInPopup() {
+ this.$refs.addressPicker.open()
+ },
+
// 地址选择确认回调
onAddressConfirm(addressResult) {
+ // 更新弹窗中的地址显示
+ this.popupSelectedAddress = addressResult.fullAddress
+
// 更新areaId的状态
this.areaId.label = addressResult.fullAddress
- this.areaId.value = addressResult.selectedAddress.selectedAddress
+ this.areaId.value = addressResult.selectedAddress.adress
+
+ console.log('addressResult', addressResult);
// 调用clickItem来更新result数组并触发父组件事件
this.clickItem({
label: addressResult.fullAddress,
- value: addressResult.selectedAddress.selectedAddress
+ value: addressResult.selectedAddress.adress,
})
+
+ // 关闭下拉菜单
+ this.$refs.dropDown.close()
},
}
}
@@ -371,6 +406,26 @@
background: $uni-color;
}
}
+
+ .address-selector {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ background: rgba($uni-color, 0.1);
+ padding: 10rpx 20rpx;
+ margin: 10rpx;
+ border-radius: 10rpx;
+ font-size: 26rpx;
+
+ .selected-address {
+ flex: 1;
+ color: #333;
+ }
+
+ .arrow {
+ margin-left: 10rpx;
+ }
+ }
}
}
.btn {
diff --git a/pages/index/index.vue b/pages/index/index.vue
index e3376f4..5c38803 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -137,7 +137,7 @@
this.$store.commit('getBanner')
},
onLoad(){
- uni.on('initConfig', (e) => {
+ uni.$on('initConfig', (e) => {
this.config_other_job = e.config_other_job
})
},
diff --git a/store/store.js b/store/store.js
index 6fab708..c8d8b47 100644
--- a/store/store.js
+++ b/store/store.js
@@ -33,7 +33,7 @@ const store = new Vuex.Store({
// state.configList[n.keyName + '_keyValue'] = n.keyValue
})
- uni.emit('initConfig', state.configList)
+ uni.$emit('initConfig', state.configList)
}
})