Fix:2391 【商城小程序】购物车选择地址,如没有默认地址,默认显示收货地址列表的第一个

This commit is contained in:
linxi
2024-09-23 11:24:52 +08:00
parent 4f867cb191
commit 15e9ca1687
+19 -14
View File
@@ -303,21 +303,26 @@
/>
<u-popup :show="show " @close="closePopup" closeable>
<view class="v12-secondary-dark-text v12-font-32 v12-text-center v12-py-4">收货地址</view>
<view class="v12-px-3 v12-mb-3 v12-font-32 v12-justify-start v12-align-center">
<view style="opacity: 0; width: 28px">
<image :src="webUrl+'/orderIcon/map.png'" style="width: 30rpx;height: 30rpx" class="v12-mr-1"/>
<view v-if="addressInfo">
<view class="v12-px-3 v12-mb-3 v12-font-32 v12-justify-start v12-align-center">
<view style="opacity: 0; width: 28px">
<image :src="webUrl+'/orderIcon/map.png'" style="width: 30rpx;height: 30rpx" class="v12-mr-1"/>
</view>
<view>收货人:{{ addressInfo.realName }} {{ addressInfo.phone }}</view>
</view>
<view class="v12-px-3 v12-mb-3 v12-font-28 v12-justify-between v12-align-start">
<view style="width: 30px;">
<image :src="webUrl+'/orderIcon/map.png'" style="width: 30rpx;height: 30rpx" class="v12-mr-1"/>
</view>
<view style="margin-bottom: 4px;width: 100%" class="more-t v12-text-left">{{ addressInfo.province }}{{ addressInfo.city }}{{ addressInfo.district }}{{ addressInfo.detail }}</view>
<view style="width: 50px;" @click="editAddress">
<image :src="webUrl+'/orderIcon/编辑.png'" style="width: 30rpx;height: 30rpx" class="v12-mr-1"/>
</view>
</view>
<view>收货人:{{ addressInfo.realName }} {{ addressInfo.phone }}</view>
</view>
<view class="v12-px-3 v12-mb-3 v12-font-28 v12-justify-between v12-align-start">
<view style="width: 30px;">
<image :src="webUrl+'/orderIcon/map.png'" style="width: 30rpx;height: 30rpx" class="v12-mr-1"/>
</view>
<view style="margin-bottom: 4px;width: 100%" class="more-t v12-text-left">{{ addressInfo.province }}{{ addressInfo.city }}{{ addressInfo.district }}{{ addressInfo.detail }}</view>
<view style="width: 50px;" @click="editAddress">
<image :src="webUrl+'/orderIcon/编辑.png'" style="width: 30rpx;height: 30rpx" class="v12-mr-1"/>
</view>
<view v-else>
<view class="v12-font-28 v12-pa-3 v12-secondary-dark-text ">尚未设置收货地址!</view>
</view>
<view class=" v12-px-3 v12-mb-3">
<view class="v12-py-2 v12-primary-text v12-font-28 v12-radius-60 v12-text-center plus-btn" @click="addNewAddress">+ 添加新地址</view>
@@ -439,7 +444,7 @@ export default {
getAddress() {
getAddressList({page: 1, limit: 9999}).then(res => {
this.addressList = res.data
this.addressInfo = res.data.find(e => e.isDefault == 1) || {}
this.addressInfo = res.data.find(e => e.isDefault == 1) || res.data[0] && res.data[0] || null
});
},
clearCart() {