<template>
	<view class="">
		<view class="fllow_form">
			<view><text>*</text>负责人</view>
			<view class="form_right" @click="toSelect">
				<view :class="staffobj.id ? 'valueActive' : '' ">{{staffobj.name ? staffobj.name : '点击选择负责人'}}</view>
				<view class="iconfont icon-arrows_right"></view>
			</view>
		</view>
		
		<view id="btn" class="btn_g bg-blue button-hover round" @click="$noMultipleClicks(sureSubmit)">
			保存
		</view>
		
		<select-staff ref="staffChild" @sureStaff="sureStaff" :type="2"></select-staff>
	</view>
</template>

<script>
	import selectStaff from '@/components/selectStaff.vue'
	import { netCluesTrans } from '@/api/index.js'
	
	export default{
		components:{
			selectStaff
		},
		data() {
			return{
				noClick: true, //防止  重复点击
				id:'',
				staffobj:{}
			}
		},
		onLoad(options) {
			this.id = options.id
		},
		methods:{
			toSelect() {
				this.$refs.staffChild.init()
			},
			sureStaff(obj) {
				this.staffobj = obj
			},
			sureSubmit() {
				if(!this.staffobj.id){
					uni.showToast({
						title:'请选择负责人',
						icon:'none'
					})
					return
				}
				let params = {
					id:this.id,
					staff_id:this.staffobj.id
				}
				netCluesTrans(params).then(res=>{
					uni.showToast({
						title:res.msg,
						icon:'none'
					})
					setTimeout(()=>{
						uni.navigateBack({
							delta:1
						})
					},2000)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.fllow_form {
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 100rpx;
		line-height: 100rpx;
		background-color: #fff;
		border-bottom: 1rpx solid #EAEAEA;
		padding: 0 30rpx;
		color: #999;
		font-size: 32rpx;
	
		.form_right {
			display: flex;
			color: #999;
	
			image {
				width: 40rpx;
				height: 40rpx;
				margin: 28rpx 5rpx 0 0;
			}
		}
	
		text {
			color: #f00;
			margin-left: 10rpx;
		}
	
		.form_input {
			input {
				height: 100%;
				text-align: right;
			}
		}
	
		.fllow_button {
			margin-top: 15rpx;
		}
	}
</style>