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.
75 lines
1.7 KiB
75 lines
1.7 KiB
<template>
|
|
<view class="page">
|
|
<!-- 地址列表 -->
|
|
<view class="address-list">
|
|
<view class="list" v-for="(item,index) in list" :key="index">
|
|
<view class="name-phone">
|
|
<view class="name">
|
|
<text class="one-omit">{{item.consignee}}</text>
|
|
</view>
|
|
<view class="phone">
|
|
<text>{{item.mobile}}</text>
|
|
<text class="tag" v-show="item.is_default">默认</text>
|
|
</view>
|
|
</view>
|
|
<view class="address-edit">
|
|
<view class="address">
|
|
<text>{{item.province_name+item.city_name+item.district_name+item.address}}</text>
|
|
</view>
|
|
<view class="edit" @click.stop="onAddressEdit(1,item)">
|
|
<text class="iconfont icon-edit1"></text>
|
|
</view>
|
|
<view class="edit" @click.stop="deleteAddrHandle(item)">
|
|
<u-icon name="trash" color="#ff0000" size="24"></u-icon>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- 添加地址 -->
|
|
<view class="add-address">
|
|
<view class="btn" @click="onAddressEdit(2,null)">
|
|
<text>新建收货地址</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {getAddrList,deleteAddr} from '@/common/api.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
list:[]
|
|
};
|
|
},
|
|
methods:{
|
|
deleteAddrHandle(item){
|
|
deleteAddr({id:item.id}).then(res=>{
|
|
if(res.code==1){
|
|
this.getList()
|
|
}
|
|
})
|
|
},
|
|
getList(){
|
|
getAddrList().then(res=>{
|
|
this.list = res.data
|
|
})
|
|
},
|
|
/**
|
|
* 编辑地址点击
|
|
*/
|
|
onAddressEdit(type,item){
|
|
uni.navigateTo({
|
|
url: '/pages/AddressEdit/AddressEdit?type=' + type+'&item='+JSON.stringify(item),
|
|
})
|
|
}
|
|
},
|
|
onShow(){
|
|
this.getList()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
@import 'AddressList.scss';
|
|
</style>
|
|
|