deming/pageE/more/Address.vue

76 lines
1.6 KiB
Vue
Raw Normal View History

2020-06-02 11:42:13 +08:00
<template>
<view class="address">
2020-06-22 17:45:17 +08:00
<u-radio-group v-model="current" @change="changeDefault" size="29" active-color="#FF780F">
<view v-for="(item, index) in addressList" :key="index" class="address-item">
<AddressItem :item="item" :current='current'></AddressItem>
</view>
</u-radio-group>
<view class="address-btn" @click="addAddress">添加地址</view>
2020-06-02 11:42:13 +08:00
</view>
</template>
<script>
import AddressItem from '@/components/mine/address-block/address-item'
export default {
data() {
return {
2020-06-22 17:45:17 +08:00
current: 0,
addressList: []
2020-06-02 11:42:13 +08:00
}
},
2020-06-02 15:35:19 +08:00
components: {
2020-06-02 11:42:13 +08:00
AddressItem
},
2020-06-22 17:45:17 +08:00
onLoad() {
this.getAddressList();
},
methods: {
getAddressList() {
this.$u.api.getAddressList().then((res)=>{
if (res.errCode == 0) {
this.addressList = res.data.addressList;
let defaultAddress = this.addressList.filter(item => {
return item.address_is_default == '1';
})
this.current = defaultAddress[0].address_id;
}
})
},
addAddress() {
uni.navigateTo({
url: '/pageE/more/AddAddress'
});
},
changeDefault(event) {
console.log(event)
// this.current = event
},
},
2020-06-02 11:42:13 +08:00
}
</script>
<style lang="scss" scoped>
.address {
2020-06-04 08:21:34 +08:00
min-height: calc(100vh - var(--window-top));
2020-06-02 11:42:13 +08:00
background-color: #ECECEC;
2020-06-22 17:45:17 +08:00
padding: 1rpx 0 40rpx;
box-sizing: border-box;
.u-radio-group {
display: block;
.address-item {
background-color: #ffffff;
margin-bottom: 20rpx;
padding: 30rpx;
}
}
.address-btn {
margin: 322rpx auto 0;
width: 690rpx;
height: 98rpx;
background: rgba(255,119,15,1);
border-radius: 49rpx;
font-size: 36rpx;
color: rgba(255,255,255,1);
line-height: 98rpx;
text-align: center;
}
2020-06-02 11:42:13 +08:00
}
</style>