<template>
	<view class="content">
		
		<view class="mt20">
			
			<view class="re-card-p32">
				<view class="flex-sb">
					<view class="re-from-label">推荐老板</view>
					<view class="re-card-show" @click="clickSwitch">我要推荐司机</view>
				</view>
				<view class="re-card-context">
					感谢您为我们推荐老板，请您填写下述问题以便我们对您推荐的老板有一个整体的了解。
				</view>
			</view>
			
			<view class="re-card-p32">
				<view class="re-from-line">
					<view class="re-from-label">您推荐的老板姓名</view>
					<view class="b-relative">
						<input v-model="form.name" maxlength="8" class="re-from-input" placeholder="请填写真实姓名" />
						<image class="re-from-icon" src="/static/icons/icon01.png"></image>
					</view>
				</view> 
				<view class="re-from-line">
					<view class="re-from-label">您推荐的老板手机号码</view>
					<view class="b-relative">
						<input v-model="form.mobile" type="number" maxlength="11" class="re-from-input" placeholder="请填写TA的常用联系方式" />
						<image class="re-from-icon" src="/static/icons/icon02.png"></image>
					</view>
				</view> 
				<view class="h44"></view>
				<view class="re-from-line">
					<view class="re-from-label">您推荐的老板是否恶意拖欠工资？</view>
					<view class="b-relative">
						<radio-group @change="changeType1">
							<radio class="re-radio re-width2" value="1" :checked="+form.type1===1">是</radio>
							<radio class="re-radio re-width2" value="2" :checked="+form.type1===2">否</radio>
						</radio-group>
					</view>
				</view> 
				<view class="re-from-line">
					<view class="re-from-label">您推荐的老板是否随意苛扣工资？</view>
					<view class="b-relative">
						<radio-group @change="changeType2">
							<radio class="re-radio re-width2" value="1" :checked="+form.type2===1">是</radio>
							<radio class="re-radio re-width2" value="2" :checked="+form.type2===2">否</radio>
						</radio-group>
					</view>
				</view> 
				<view class="re-from-line">
					<view class="re-from-label">您推荐的老板人品如何？</view>
					<view class="b-relative">
						<radio-group @change="changeType3">
							<radio class="re-radio re-width3" style="margin-left:-28rpx" value="1" :checked="+form.type3===1">优</radio>
							<radio class="re-radio re-width3" style="margin-left:-28rpx" value="2" :checked="+form.type3===2">良</radio>
							<radio class="re-radio re-width3" style="margin-left:-28rpx" value="3" :checked="+form.type3===3">差</radio>
						</radio-group>
					</view>
				</view> 
			</view>
			
			
			
			<view class="re-card-p32">
				<view class="re-from-label">您可以在这里进行补充说明（选填）</view>
				<textarea v-model="form.remark" class="re-card-textarea inpit" placeholder="请在此处留言或者备注其他特殊情况。">
				</textarea>
			</view>
			
			<view class="re-card-p32">
				<view class="re-from-label">信息手机说明</view>
				<view class="re-card-context">
					感谢您为我们的平台推荐用户，无论其是否成为我们平台用户我们都将 <span>保证您上传的信息安全</span>。当然您也可以通过线下与其取得联系邀请TA在小程序完成注册。
				</view>
			</view>
			
			<view class="re-end-pand">
				<button @click="submit">提交审核</button>
			</view>
		
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				form: {
					type: "2",
					name:  "",
					mobile:"",
					type1: "",
					type2: "",
					type3: "",
					type4: "",
					type5: "",
					remark:""
				}
			}
		},
		onLoad() {
			
		},
		methods: {
			clickSwitch(){
				uni.navigateTo({ url: `/pages/user/driver`})
			},
			changeType1(event){
				this.form.type1 = event.detail.value
			},
			changeType2(event){
				this.form.type2 = event.detail.value
			},
			changeType3(event){
				this.form.type3 = event.detail.value
			},
			changeType4(event){
				this.form.type4 = event.detail.value
			},
			changeType5(event){
				this.form.type5 = event.detail.value
			},
			submit(){
				if(!this.form.name){
					uni.showToast({ icon: "none", title: "请填写您推荐的老板的姓名" })
					return
				}
				if(!this.form.mobile){
					uni.showToast({ icon: "none", title: "请填写您推荐的老板常用联系手机" })
					return
				}
				if(!this.form.type1 || !this.form.type2 || !this.form.type3 ){
					uni.showToast({ icon: "none", title: "请勾选问题答案" })
					return
				}
				this.doSubmit()
			},
			doSubmit(){
				uni.showLoading({})
				this.form.id = this.$utils.generateUUID()
				this.form.status = 0
				this.form.area = uni.getStorageSync("area")
				this.$httpPost("/api/sells/push", this.form, (res) => {
					console.log('[/sells/push]', res);
					if(res.data || res.data == 1){
						uni.hideLoading({})
						uni.showToast({ icon: "none", title: "提交成功" })
						setTimeout(()=>{
							uni.navigateBack({ delta: -1 })
						}, 1500)
					} 
				})
			}
			
		}
	}
</script>

<style>
	page {
		background-color: #F5F5F5;
	}
	
	/deep/ uni-radio .uni-radio-input{
		background-color: #F40000 !important;
		border-color: #F40000 !important;
	}
	
	/deep/ uni-radio .uni-radio-input:empty{
		background-color: #ffffff !important;
		border-color: #888888 !important;
	}
</style>
