<template>
	<view>
		<view class="bg-white rounded-lg mb-2 p-3" v-for="(item,index) in resdata" :key="index" @click="toShow(item)">
			<view class="border-dotted-bottom pb-3">
				<view class="flex align-center font32">
					<text>{{item.user_name}}</text>
					<text class="ml-3">{{item.user_phone}}</text>
				</view>
				<view class="mt-1 font30 line15">{{item.region_prov}}{{item.region_city}}{{item.region_area}}{{item.region_addr}}</view>
			</view>
			<view class="flex align-center justify-between pt-3" @click.stop>
				<view class="flex align-center justify-end">
					<uni-icons @click="toEdit(item)" type="compose" size="20" color="#999999" class="mr-3"></uni-icons>
					<uni-icons @click="toDelete(item)" type="trash" size="20" color="#999999"></uni-icons>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"i-address-list",
		props:{
			resdata:{
				type:Array,
				default() {
				  return [];
				},
			}
		},
		methods:{
			toShow(item){
				this.$emit('click',item)
			},
			toEdit(item) {
				uni.navigateTo({
					url: "/pages/user/address_edit?id="+item.id
				})
			},
			toDelete(item) {
				uni.showModal({
					title: '提示',
					content: '确定要删除吗？',
					success: (res) => {
						if (res.confirm) {
							console.log('用户点击确定');
							this.$emit('delete',item)
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					},
					fail: () => {
						console.log('取消删除');
					},
				})
			}
		}
	}
</script>

<style>

</style>