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.
80 lines
1.8 KiB
80 lines
1.8 KiB
<template>
|
|
<view class="page">
|
|
<!-- 地址列表 -->
|
|
<view class="address-list">
|
|
<view class="list" v-for="(item,index) in list" :key="index" @click="chooseAddr(item)">
|
|
<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.native.stop="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),
|
|
})
|
|
},
|
|
chooseAddr(item){
|
|
uni.redirectTo({
|
|
url:'/pages/ConfirmOrder/ConfirmOrder?item='+JSON.stringify(item)
|
|
})
|
|
}
|
|
},
|
|
onShow(){
|
|
this.getList()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
@import 'AddressList.scss';
|
|
</style>
|
|
|