<template>
	<view class="contentV">
		<customNav :shownav="true" :title="$t('index.shouhuodz')" titledetl=""></customNav>
		<view class="contentColumn" style="margin-bottom: 120rpx;">
			<view class="" v-for="item in addrList">
				<view class="itemView">
					<uni-icons  custom-prefix="custom-icon" color="slateblue" type="compose" size="28" @click="editdizhi(item.id)"></uni-icons>
					<view class="textView" @click="addrSelect(item)">
						<text class="addrV">{{item.address}}</text>
						<text class="addrcity">{{item.area}}</text>
						<text class="nameph">{{item.name}}: {{item.phone}}</text>
					</view>
				</view>
			</view>
		</view>
		<view style="height: 10rpx;"></view>
		<view class="addbtV">
			<view class="addbt" @click="newdizhi">{{$t('index.xinzengshdz')}}</view>
		</view>
	</view>
</template>

<script>
	import api from "@/pages/api/api.js"
		export default {
		data() {
			return {
				addrList:[],
			}
		},
		onShow() {
			this.getaddressList();
		},
		methods: {
			newdizhi(){
				uni.navigateTo({
					url:'/pages/UserCenter/dizhi/newdizhi?id=-1'
				})
			},
			addrSelect(obj){
				uni.setStorageSync("peisongdizhi",obj);
				uni.navigateBack();
			},
			editdizhi(id){
				uni.navigateTo({
					url:'/pages/UserCenter/dizhi/newdizhi?id='+id
				})
			},
			getaddressList(){
				api('getaddressList',{
				},r=>{
					this.addrList=r.data.data;
				},failc=>{
					//console.log('getadvertis----',failc)
				})
			},
			
		}
	}
</script>

<style>
.contentV{
	width: 100%;
	position: relative;
	height: 90vh;
}
.slot-image {
	margin-right: 20rpx;
	margin-left: 20rpx;
	width: 30px;

}

.itemView{
	margin: 30rpx;
	padding-top: 20rpx;
	padding-bottom: 20rpx;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content:flex-start;
	border-bottom-width: 2rpx;
	border-bottom-style:outset;
	border-bottom-color:lightgray;
}

.textView{
	display: flex;
	flex-direction: column;
	width: 88%;
	margin-left: 20rpx;
}

.addrV{
	font-size: 30rpx;
	color: black;
}
.addrcity{
	font-size: 26rpx;
	color: darkgray;
}

.nameph{
	font-size: 28rpx;
	color: darkslategray;
}
	
.addbtV{
	position: fixed;
	width: 100%;
	height: 120rpx;
	bottom: 0rpx;
	left: 0;
	background-color: whitesmoke;
}

.addbt{
	margin-left: 10%;
	margin-top: 20rpx;
	text-align: center;
	font-size: 36rpx;
	width: 80%;
	height: 80rpx;
	line-height: 80rpx;
	background-color: #40AE36;
	color: white;
	box-shadow: 0rpx 0rpx 10rpx 0rpx #40AE36;
	border-radius: 10rpx;
}
</style>
