<template>
	<view class="ruzhuRadio" :style="{marginBottom: value?'0rpx':'20rpx'}">
		<view class="radio-item" v-for="(item,index) in radioList" :key="index">
			<image class="radio-item-round" :src="value==item.value?yesImg:noImg" @click="changeAgree(item.value)"></image>
			<text class="radio-item-name">{{ item.name }}</text>
		</view>
	</view>
</template>

<script>
	export default {
		name: "AgreeRadio",
		props: {
			// 是否显示返回按钮
			value: {
				type: [Number, String],
			},
			disabled: {
				type: Boolean,
				default: false,
			},
		},
		data() {
			return {
				yesImg:"/static/images/agree_y.png",
				noImg:"/static/images/agree_n.png",
				radioList: [{
						name: "到店服务",
						value: 2,
					},
					{
						name: "到家服务",
						value: 1,
					},
				],
			};
		},
		methods: {
			changeAgree(value) {
				if(this.disabled){
					return
				}
				this.$emit('input', value)
				this.$emit('change', value)
			}
		}
	}
</script>

<style lang="less">
	.ruzhuRadio {
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		justify-content: space-between;
		flex-direction: row;
		margin: 0rpx 24rpx 20rpx 24rpx;
		padding: 30rpx 50rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		.radio-item{
			display: flex;
			flex-wrap: nowrap;
			align-items: center;
			flex-direction: row;
			.radio-item-round{
				width: 34rpx;
				height: 34rpx;
				margin-right: 10rpx;
			}
			.radio-item-name{
				font-weight: 400;
				font-size: 30rpx;
				color: #333333;
				line-height: 42rpx;
				text-align: left;
				font-style: normal;
			}
		}
	}


</style>