<template>
	<view class="container">
		<view class="form-box">
			<view class="item">
				<view class="label">跟进类型</view>
				<view class="input">
					<u-input height="102" @click="typeShow=true" type="text" disabled input-align="right" v-model="form.typeName" placeholder="请选择跟进类型"></u-input>
					<image class="path"  @click="typeShow=true" src="/static/path.png" mode="" />
					<u-select confirm-color="#FF6D25" value-name="code" label-name="text" v-model="typeShow" :list="followTypeList" @confirm="confirmType"></u-select>
				</view>
			</view>
			<view class="last-item">
				<view class="label">跟进内容</view>
					<u-input style="flex:1" input-align="right"  :custom-style="customStyle" v-model="form.mark" :height="60" :auto-height="true" type="textarea" :clearable="false"  placeholder="请输入备注内容"></u-input>
			</view>
		</view>
		<view class="submit-btn" @click="submit">提交</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				typeShow: false,
				form: {
					type: '',
					typeName: '',
					mark: ''//备注
				},
				followTypeList: [],
				customStyle:{
					maxHeight:'200rpx',
					padding: '20rpx',
					fontSize: '30rpx',
					borderBottom:'1px solid #e0e0e0'
				},
			};
		},
		onLoad(options) {
			this.mediacyId = options.mediacyId;
			this.isStore = options.isStore;
			this.getFollowType()
		},
		methods: {
			confirmType(e){
				this.form.type = e[0].value
				this.form.typeName = e[0].label
			},
			// 居间跟进类别
			getFollowType(){
				this.$u.api.getFollowType({body:{}}).then((res)=>{
					this.followTypeList = res.result||[]
				})
			},
			submit() {
				if(this.form.type==''){
					uni.showToast({
						title: '请选择跟进类型',
						icon: 'none'
					})
					return;
				}
				if(this.form.content==''){
					uni.showToast({
						title: '请输入跟进内容',
						icon: 'none'
					})
					return;
				}
				// 跟进
				let params = {
					 "content": this.form.mark,
						"followType": this.form.type,
						"mediacyId": this.mediacyId,
						"isStore":this.isStore
					}
				this.$u.api.intermediaryFollow({body:params}).then((res)=>{
					if(res.ErrNo=='0000'){
						uni.showToast({
							title: res.ErrMsg,
							icon: 'none'
						})
						setTimeout(function(){
							wx.navigateBack()
						},1000)
					}
				})
			},
		},
	};
</script>

<style lang="scss" scoped>
.container {
	width: 750rpx;
	min-height: 100vh;
	background: #F8F8F8;
	padding-top: 20rpx;
	.form-box{
		background: #fff;
		padding: 0 30rpx;
		.item{
			height: 102rpx;
			font-size: 30rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			line-height: 102rpx;
			color: #333333;
			border-bottom: 1px solid #e0e0e0;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.label{
				width: 120rpx;
				margin-right: 20rpx;
			}
			.input{
				width: 380rpx;
				display: flex;
				align-items: center;
				justify-content: flex-end;
				.path{
					width: 14rpx;
					height: 30rpx;
					margin-left: 20rpx;
				}
				.calendar{
					width: 40rpx;
					height: 40rpx;
					margin-left: 20rpx;
				}

			}
		}
		.last-item{
			display: flex;
			.label{
				line-height: 102rpx;
				font-size: 30rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #333333;
				margin-right: 150rpx;
			}

		}
	}
	.submit-btn{
		width: 690rpx;
		height: 88rpx;
		line-height: 88rpx;
		text-align: center;
		background: #FF6D25;
		border-radius: 12rpx;
		margin-left: 30rpx;
		font-size: 32rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		position: fixed;
		bottom: 90rpx;
	}
}
</style>
