<template>
	<view class="address">
		<radio-group @change="changeDefault">
			<view v-for="(item, index) in addressList" :key="index" class="address-item">
				<view class="item-top">
					<view class="user-info">
						<view class="user-name">王先生</view>
						<view class="user-pnone">174****7492</view>
					</view>
					<view class="user-address">山东省临沂市兰山区金雀山街道巴啦啦小区三号楼101室</view>
				</view>
				<view class="item-bottom">
					<view class="item-default">
						<radio :value="item" :checked="index === current" color="#FF770F" class="radio-class" />
						<view :class="[item == current ? 'radio-default' : 'radio-others']">
							{{ item == current ? '已设为默认' : '设为默认' }}
						</view>
					</view>
					<view class="address-operate">
						<view>
							<img src="@/pageE/static/mine/24.png" />
							<view>编辑</view>
						</view>
						<view>
							<img src="@/pageE/static/mine/25.png" />
							<view>删除</view>
						</view>
					</view>
				</view>
			</view>
		</radio-group>
		<view class="address-btn">添加地址</view>
	</view>
</template>
<script>
export default {
	name: 'address-item',
	data() {
		return {
			current: 0
		}
	},
	props: {
		addressList: Array
	},
	onLoad() {
		console.log(22)
	},
	methods: {
		editAddress() {
			uni.navigateTo({
				url: '/pageE/mine/EditAddress'
			});
		},
		changeDefault(event) {
			console.log(event)
			this.current = event.detail.value
		}
	},
}
</script>
<style lang="scss" scoped>
.address {
	padding-top: 1rpx;
	.address-item {
		background-color: #ffffff;
		margin-bottom: 20rpx;
		padding: 30rpx;
		.item-top {
			position: relative;
			padding-bottom: 30rpx;
			&::after {
				content: "";
				position: absolute;
				width: 690rpx;
				height: 2rpx;
				background: rgba(241,241,241,1);
				bottom: 0;
				left: 50%;
    			transform: translate(-50%,0);
			}
			.user-info {
				display: flex;
				align-items: center;
				margin-bottom: 30rpx;
				.user-name {
					font-size: 32rpx;
					font-weight: 500;
					color: rgba(51,51,51,1);
					margin-right: 13rpx;
				}
				.user-pnone {
					font-size: 28rpx;
					color: rgba(51,51,51,1);
				}
			}
			.user-address {
				font-size: 26rpx;
				color: rgba(51,51,51,1);
			}
		}
		.item-bottom {
			padding-top: 30rpx;
			display: flex;
			justify-content: space-between;
			.item-default {
				display: flex;
				align-items: center;
				font-size: 22rpx;
				/deep/ .radio-class {
					.uni-radio-wrapper {
						.uni-radio-input {
							width: 29rpx !important;
							height: 29rpx !important;
						}
					}
				}
				.radio-default {
					color: rgba(255,119,15,1);
				}
				.radio-others {
					color:rgba(153,153,153,1);
				}
			}
			.address-operate {
				display: flex;
				font-size: 24rpx;
				color: rgba(152,152,152,1);
				> view {
					display: flex;
					&:not(:last-child) {
						margin-right: 30rpx;
					}
					> img {
						height: 23rpx;
						margin-right: 15rpx;
					}
				}
			}
		}
	}
	.address-btn {
		margin: 322rpx auto 40rpx;
		width: 690rpx;
		height: 98rpx;
		background: rgba(255,119,15,1);
		border-radius: 49rpx;
		font-size: 36rpx;
		color: rgba(255,255,255,1);
		line-height: 98rpx;
		text-align: center;
	}
}
</style>