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.
146 lines
2.9 KiB
146 lines
2.9 KiB
<template>
|
|
<view class="addressList">
|
|
<view class="item" v-for="(item,index) in addressList" :key="index">
|
|
<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>
|
|
<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 {
|
|
addressList: [],
|
|
defaultId:'',
|
|
};
|
|
},
|
|
onShow() {
|
|
this.getAddressList()
|
|
this.getDefault()
|
|
},
|
|
methods: {
|
|
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)
|
|
})
|
|
},
|
|
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 0 0 50rpx;
|
|
background-color: #FFFFFF;
|
|
overflow: hidden;
|
|
|
|
.item {
|
|
padding: 35rpx 0;
|
|
overflow: hidden;
|
|
border-bottom: 1px solid #EEEEEE;
|
|
|
|
.a {
|
|
font-size: 32rpx;
|
|
font-weight: 500;
|
|
color: #1E1E1E;
|
|
padding-bottom: 20rpx;
|
|
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;
|
|
margin-right: 50rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.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> |