You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong_qianduan/pages/news/park/addressList.vue

146 lines
3.0 KiB

<template>
<view class="addressList">
<view class="item" v-for="(item,index) in addressList" :key="index" :style="{'border-top':index==0?'none':'1px solid #EEEEEE'}">
10 months ago
<view class="a">{{item.name}} {{item.phone}}<text v-if="item.address_id==defaultId">默认</text></view>
<view class="b">
<view class="d">
{{item.detail}}
</view>
10 months ago
<image src="/static/order/edit.png" @click="editAddress(item)"></image>
</view>
</view>
<view class="footer">
<view class="operaBtn" @click="addAddress">
新增收货地址
</view>
</view>
</view>
</template>
<script>
import * as AddressApi from '@/api/address'
export default {
data() {
return {
10 months ago
addressList: [],
defaultId:'',
};
},
onShow() {
this.getAddressList()
10 months ago
this.getDefault()
},
methods: {
10 months ago
getDefault(){
// 获取默认地址接口
const that = this
return new Promise((resolve, reject) => {
AddressApi.defaultId()
.then(res => {
that.defaultId = res.data.defaultId
})
.catch(reject)
})
},
getAddressList() {
const that = this
return new Promise((resolve, reject) => {
AddressApi.list()
.then(result => {
that.addressList = result.data.list
})
.catch(reject)
})
},
10 months ago
editAddress(item){
// 编辑收货地址
uni.navigateTo({
url:'/pages/news/park/addressEdit?addressDetail=' + JSON.stringify(item)
})
},
addAddress(){
uni.navigateTo({
url:'/pages/news/park/addressEdit'
})
},
}
}
</script>
<style lang="scss" scoped>
.addressList {
padding: 0 45rpx;
background-color: #FFFFFF;
overflow: hidden;
margin-top: 2rpx;
.item {
padding: 30rpx 0;
overflow: hidden;
border-top: 1px solid #EEEEEE;
.a {
font-size: 32rpx;
font-weight: 500;
color: #1E1E1E;
padding-bottom: 25rpx;
display: flex;
align-items: center;
text {
width: 66rpx;
line-height: 34rpx;
background: #F32020;
border-radius: 4rpx;
text-align: center;
display: block;
margin-left: 10rpx;
font-size: 24rpx;
font-weight: 400;
color: #FFFFFF;
border-radius: 5rpx;
}
}
.b {
display: flex;
align-items: flex-start;
justify-content: space-between;
.d {
font-size: 32rpx;
font-weight: 400;
color: #979797;
max-width: 600rpx;
}
image {
width: 36rpx;
height: 36rpx;
}
}
}
}
.footer{
display: flex;
width: 100%;
height: 120rpx;
justify-content: center;
position: fixed;
bottom: 0;
left: 0;
.operaBtn{
width: 686rpx;
height: 92rpx;
background: #F34A40;
border-radius: 8rpx 8rpx 8rpx 8rpx;
opacity: 1;
line-height: 92rpx;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #FFFFFF;
text-align: center;
}
}
</style>