|
@@ -208,14 +208,11 @@
|
|
|
<view v-if="selectedAddress" style="margin-left: 8px; flex: 1">
|
|
|
<view class="address-display">
|
|
|
<text class="address-line">
|
|
|
- {{ selectedAddress.provinceName }}{{ selectedAddress.cityName
|
|
|
- }}{{ selectedAddress.districtName }}
|
|
|
+ {{ selectedAddress.provinceName }}{{ selectedAddress.cityName }}{{ selectedAddress.districtName }}
|
|
|
</text>
|
|
|
<view class="contact-info">
|
|
|
<text class="contact-name">{{ selectedAddress.name }}</text>
|
|
|
- <text class="contact-phone">{{
|
|
|
- selectedAddress.telephone
|
|
|
- }}</text>
|
|
|
+ <text class="contact-phone">{{ selectedAddress.telephone }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -298,8 +295,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { onLoad } from '@dcloudio/uni-app'
|
|
|
-import { onMounted, ref, reactive, computed, nextTick } from 'vue'
|
|
|
+import { onLoad, onShow } from '@dcloudio/uni-app'
|
|
|
+import { onMounted, ref, reactive, computed, nextTick, onUnmounted } from 'vue'
|
|
|
import {
|
|
|
getDetailsvolunteerId,
|
|
|
volunteerwork,
|
|
@@ -312,6 +309,7 @@ import itsCalendar from '@/components/its-calendar/its-calendar.vue'
|
|
|
import uniDatetimePickerMy from '@/uni_modules/lic-uni-datetime-picker/components/lic-uni-datetime-picker/lic-uni-datetime-picker.vue'
|
|
|
import addressComponent from '@/pages_home/components/volunteerData/adresss.vue'
|
|
|
import Detiles from './detiles.vue'
|
|
|
+import store from '@/store'
|
|
|
|
|
|
// const src = ref(
|
|
|
// 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg'
|
|
@@ -427,13 +425,11 @@ const handlCancel = () => {
|
|
|
totalTimes.value = 0 // 重置点击次数
|
|
|
}
|
|
|
|
|
|
-const jumpToAddressSelect = () => {
|
|
|
- addressFlag.value = true
|
|
|
-}
|
|
|
-
|
|
|
// 新增:处理子组件传回的地址数据
|
|
|
const handleAddressUpdate = (newAddress) => {
|
|
|
selectedAddress.value = newAddress
|
|
|
+ // 保存到store中
|
|
|
+ store.dispatch('SetTempAddress', newAddress)
|
|
|
addressFlag.value = false // 关闭选择器
|
|
|
}
|
|
|
// 详情底部底部数据
|
|
@@ -845,11 +841,40 @@ const firstVolunteerPicture = computed(() => {
|
|
|
return pictures[0];
|
|
|
});
|
|
|
|
|
|
+// 添加 onShow 生命周期钩子
|
|
|
+onShow(() => {
|
|
|
+ // 从 store 获取临时地址
|
|
|
+ const tempAddress = store.state.user.tempSelectedAddress
|
|
|
+ if (tempAddress) {
|
|
|
+ selectedAddress.value = tempAddress
|
|
|
+ console.log('地址已更新:', selectedAddress.value)
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+// 修改地址显示部分
|
|
|
+const jumpToAddressSelect = () => {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages_mine/pages/selectAddress/index'
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
await getListTime()
|
|
|
+ // 检查store中是否有临时地址
|
|
|
+ const tempAddress = store.state.user.tempSelectedAddress
|
|
|
+ if (tempAddress) {
|
|
|
+ selectedAddress.value = tempAddress
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+// 在页面卸载时清除临时地址
|
|
|
+onUnmounted(() => {
|
|
|
+ store.dispatch('ClearTempAddress')
|
|
|
})
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
@import '../../styles/goodsDetails.scss';
|
|
|
+
|
|
|
+
|
|
|
</style>
|