Fix:3262 【礼品功能】每次领取礼品时输入新地址,都会把上一次保存的地址覆盖掉,设置新地址也要保留上一次的地址

This commit is contained in:
linxi
2025-02-24 17:01:26 +08:00
parent 37be03f3ee
commit f9a89a7129
2 changed files with 18 additions and 11 deletions
+14 -8
View File
@@ -10,22 +10,25 @@
@open="open"
>
<view class="v12-text-center v12-font-bold v12-mt-3">收货地址</view>
<view class="address-list">
<view class="address-list"
>
<!-- 地址列表 -->
<view
v-for="(item, index) in addressList"
:key="index"
class="address-item"
>
<view class="address-wrap" @click="handleSelect(addressList)">
<view class="address-wrap" @click="handleSelect(item)">
<view class="v12-font-28 v12-font-bold">
收货地址
</view>
<view>
<view class="info">
<text class="v12-font-28 v12-font-bold v12-dark-text">{{ addressList.realName }}</text>
<text class="v12-font-28 v12-font-bold v12-dark-text v12-ml-1">{{ addressList.phone }}</text>
<text class="v12-font-28 v12-font-bold v12-dark-text">{{ item.realName }}</text>
<text class="v12-font-28 v12-font-bold v12-dark-text v12-ml-1">{{ item.phone }}</text>
</view>
<view class="address v12-font-bold v12-font-28 v12-dark-text v12-mt-3 v12-mb-4">
{{ addressList.province + addressList.city + addressList.district + addressList.detail }}
{{ item.province + item.city + item.district + item.detail }}
<view @click.stop="editAddress">
<u-icon :name="webUrl+'/orderIcon/edit02.png'" color="#C52733"></u-icon>
</view>
@@ -45,8 +48,8 @@
export default {
props: {
addressList: {
type: Object,
default: () => {}
type: Array,
default: () => []
}
},
data() {
@@ -106,6 +109,8 @@ export default {
.address-list {
padding: 20rpx;
width: 640rpx;
height: 800rpx;
overflow: auto;
}
.address-item {
@@ -141,6 +146,7 @@ export default {
background-color: #fff;
border: 1rpx solid #ddd;
border-radius: 100rpx;
position: sticky;
bottom: 0;
}
</style>
+4 -3
View File
@@ -76,7 +76,7 @@ export default {
// 组件数据
giftNotice: '',
isReceive: false,
address: {},
address: [],
order: ''
}
},
@@ -84,7 +84,8 @@ export default {
addr: {
handler(newVal, oldVal) {
if (newVal && newVal.id) {
this.address = newVal
// this.address = newVal
this.setAddress()
}
},
deep: true
@@ -132,7 +133,7 @@ export default {
if (res.data.length === 0) {
this.$refs.addressDialog.open()
} else {
this.address = res.data.filter(item => item.isDefault === 1).length === 0 ? res.data[0] : res.data.filter(item => item.isDefault === 1)[0]
this.address = res.data
this.$refs.AddressList.open()
}
})