<template>
	<view class="tranfer_clue">
		<view class="fllow_form">
			<view style="color: #333;font-size: 32rpx;"><text>*</text>接收对象</view>
			<view class="form_right" @click="changeStaff">
				<view>{{staffObj.id ? staffObj.name : '点击选择'}}</view>
				<view class="iconfont icon-arrows_right"></view>
			</view>
		</view>
		<view id="btn" class="btn_g bg-blue button-hover round" @click="Totrans">
			保存
		</view>
		
		<!-- 选择员工 -->
		<select-staff ref="staffChild" @sureStaff="sureSelect" :type="2"></select-staff>
	</view>
</template>

<script>
	import { netTransBusiness } from '@/api/index.js'
	import { BASE_IMG_URL } from '@/util/api.js'
	import selectStaff from '@/components/selectStaff.vue'
	export default {
		components:{
			selectStaff
		},
		data() {
			return {
				id:'',
				staffObj:{},
			}
		},
		onLoad(options) {
			this.id = options.id
		},
		onShow() {
		},
		methods: {
			changeStaff(e) {
				this.$refs.staffChild.init()
			},
			sureSelect(obj) {
				this.staffObj = obj
			},
			Totrans() {
				if(!this.staffObj.id){
					uni.showToast({
						title:'请选择接受对象',
						icon:'none'
					})
					return
				}
				let params = {
					id:this.id,
					owner_staff_id: this.staffObj.id
				}
				netTransBusiness(params).then(res=>{
					uni.showToast({
						title:res.msg,
						icon:'none'
					})
					setTimeout(()=>{
						uni.redirectTo({
							url:"/pagesA/business/index"
						})
					},1000)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
  .fllow_form {
		display: flex;
		justify-content: space-between;
		height: 100rpx;
		line-height: 100rpx;
		background-color: #fff;
		border-bottom: 1rpx solid #EAEAEA;
		padding: 0 30rpx 0 47rpx;
		margin: 0 0 30rpx;
		.form_right {
			display: flex;
			color: #999;
			image {
				width: 40rpx;
				height: 40rpx;
				margin: 28rpx 5rpx 0 0;
			}
		}
		text {
			color: #f00;
			margin-left: 10rpx;
		}
	}
	.fllow_area {
				background-color: #fff;
				margin-bottom: 30rpx;
				padding-bottom: 30rpx;
				color: #999;
				.area_head {
					height: 100rpx;
					line-height: 100rpx;
					font-size: 32rpx;
					padding: 0 70rpx;
					text {
						color: #f00;
					}
				}
				textarea {
					width: 80%;
					height: 300rpx;
					padding: 30rpx;
					background: #f8f8f8;
					margin: 0 auto;
				}
			}
	#btn {
		font-size: 26rpx;
		color: #fff;
		text-align: center;
		line-height: 88rpx;
		width: 500rpx;
		height: 88rpx;
		background: $uni-text-color;
		border-radius: 29rpx;
	}
</style>
