<template>
	<u-popup :show="show" @close="show=false" bgColor="#F8F6F6" mode="right" safeAreaInsetTop>
		<view class="selectPopup">
			<div class="content">
				<div class="radio-item" v-for="(item,index) in valueList" :key="index" @click="position(index,item)">
					<div>{{item.name}}</div>
					<image :src="$util.img(`/upload/weapp/user/gou.png`)" v-if="index==isRadio"></image>
					<image :src="$util.img(`/upload/weapp/user/un_gou.png`)" v-else></image>
				</div>
			</div>
			<div class="btns"> 
				<div class="btn1" @click="show=false">返回</div>
				<div class="btn2" @click="btn">确定</div>
			</div>
			
			
			
		</view>
	</u-popup>
</template>

<script>
	export default {
		data() {
			return {
				isRadio:0,
				value: '业务员',
				show: false,
				valueList:[],
				item:[],
				itemes:[]
			};
		},
		created() {
			this.$api.sendRequest({
					url: '/api/salasman/departlists',
					data:{},
					// async:false,
					success:(res)=>{
					this.valueList=res.data
					this.itemes=res.data[0]
				},
			})
		},
		methods: {
			start() {
				this.show = true
			},
			position(index,item){
				this.isRadio=index
				this.item=item
			},
			btn(){
				if(this.item.id){
					this.show=false
					setTimeout(()=>{
						uni.$emit('department',this.item)
					},500)
				}else{
					this.show=false
					setTimeout(()=>{
						uni.$emit('department',this.itemes)
					},500)
				}
				
				
			}
		}
	}
</script>

<style lang="scss">
	::v-deep{
		.u-popup__content{
			// background-color: rgb(85, 0, 0 , 46%);
			background-color: rgba(0,0,0,0.0) !important;
		}
	}
	.selectPopup {
		width: 70vw;
		position: relative;
		height: 89vh;
		background-color: #fff;
		margin-top: 6vh;
		.content {
			padding: 32rpx;
			.radio-item{
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 28rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: bold;
				color: #000;
				margin: 10rpx 0;
				image{
					width: 32rpx;
					height: 32rpx;
				}
			}
			::v-deep{
				.u-radio{
					margin-bottom: 32rpx;
				}
				.u-radio__text{
					font-size: 28rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: bold;
					color: #222222;
				}
			}
		}

		.btns {
			width: 100%;
			position: absolute;
			bottom: 0;
			display: flex;
			align-items: center;

			.btn1 {
				text-align: center;
				line-height: 88rpx;
				min-width: 172rpx;
				height: 88rpx;
				background: #DDDDDD;
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #585858;
				border-radius: 0;
			}

			.btn2 {
				text-align: center;
				line-height: 88rpx;
				width: 100%;
				height: 88rpx;
				background: #21BBF3;
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #fff;
			}
		}



	}
</style>
