template>
	<view class="add">
		<view>
			<view class="form-item"
				v-if="formData.leaveStatus == 1 || formData.leaveStatus == 2 ||formData.leaveStatus == 10">
				<label>审核状态</label>
				<view style="color: red;border-bottom: 1px solid black;"> {{formData.leaveStatus == 1 ? "已提交" 
			: formData.leaveStatus == 2 ? "通过"
			:formData.leaveStatus == 10 ? "打回" :""}}
				</view>
			</view>
			<view class="form-item">
				<label>学生电话</label>
				<input :disabled="formData.leaveStatus == 2" placeholder="请输入" v-model="formData.phone" />
			</view>
			<view class="form-item">
				<label>紧急联系人姓名</label>
				<input :disabled="formData.leaveStatus == 2" placeholder="请输入"
					v-model="formData.emergencyContact" />
			</view>
			<view class="form-item">
				<label>紧急联系人电话</label>
				<input :disabled="formData.leaveStatus == 2" placeholder="请输入"
					v-model="formData.emergencyContactPhone" />
			</view>
			<view class="form-item">
				<label>家长姓名</label>
				<input :disabled="formData.leaveStatus == 2" placeholder="请输入" v-model="formData.famName" />
			</view>
			<view class="form-item">
				<label>家长电话</label>
				<input :disabled="formData.leaveStatus == 2" placeholder="请输入" v-model="formData.famPhone" />
			</view>
			<view v-if="formData.leaveStatus != 2" class="form-item">
				<label>家长是否知晓</label>
				<radio-group :disabled="formData.leaveStatus == 2" @change="radioChange1">
					<label class="uni-list-cell uni-list-cell-pd">
						<view>
							<radio :checked="formData.famKnow=='是'" :value="'是'" />
						</view>
						<view>是</view>
					</label>
					<label style="margin-left: 80rpx;" class="uni-list-cell uni-list-cell-pd">
						<view>
							<radio :checked="formData.famKnow=='否'" :value="'否'" />
						</view>
						<view>否</view>
					</label>
				</radio-group>
			</view>
			<view v-if="formData.leaveStatus == 2" class="form-item">
				<label>家长是否知晓：{{formData.famKnow}}</label>
			</view>
			<view v-if="formData.leaveStatus != 2">
				<view class="form-item">
					<label>是否离校</label>
					<radio-group @change="radioChange3">
						<label class="uni-list-cell uni-list-cell-pd">
							<view>
								<radio :checked="formData.isLeave=='1'" :value="'1'" />
							</view>
							<view>离校</view>
						</label>
						<label style="margin-left: 80rpx;" class="uni-list-cell uni-list-cell-pd">
							<view>
								<radio :checked="formData.isLeave=='0'" :value="'0'" />
							</view>
							<view>留校</view>
						</label>
					</radio-group>
				</view>
			</view>
			<view v-if="formData.leaveStatus == 2" class="form-item">
				<label>是否离校：{{formData.isLeave== "1" ?"是":"否"}}</label>
			</view>
			<view v-if="formData.isLeave == '1'">
				<view class="form-item">
					<label>预计离校时间</label>
					<picker :disabled="formData.leaveStatus == 2" @change="onChangeTime" mode="date"
						:value="formData.willLeaveTime">
						<view class="uni-input">
							<text
								class="val">{{isEmpty(formData.willLeaveTime)?'请选择日期':formData.willLeaveTime}}</text>
							<uni-icons type="calendar" size="25" color="#202020"></uni-icons>
						</view>
					</picker>
				</view>
				<view v-if="formData.leaveStatus == '2' && formData.isLeave == '1'">
					<view class="form-item">
						<label>是否到家 <text style="color: red;">*请在到达目的地后填写</text> </label>
						<radio-group @change="radioChange2">
							<label class="uni-list-cell uni-list-cell-pd">
								<view>
									<radio :checked="formData.isHome=='是'" :value="'是'" />
								</view>
								<view>是</view>
							</label>
							<label style="margin-left: 80rpx;" class="uni-list-cell uni-list-cell-pd">
								<view>
									<radio :checked="formData.isHome=='否'" :value="'否'" />
								</view>
								<view>否</view>
							</label>
						</radio-group>
					</view>
					<view class="form-item">
						<label>到家定位 <text style="color: red;">*请在到达目的地后获取</text> </label>
						<view>
							<button style="display: inline-block;" @click="getLocation">获取定位</button>
							<button type="primary" style="display: inline-block;margin-left: 30rpx;"
								@click="stuHomeUpdate">点我提交</button>
						</view>
					</view>
				</view>
			</view>
		
			<view v-if="formData.isLeave == '0'">
				<view class="form-item">
					<label>预计留校时间 <text style="color: red;">*xxxx年x月x日至xxxx年x月x日</text> </label>
					<input placeholder="请输入xxxx年x月x日至xxxx年x月x日" v-model="formData.willStayTime" />
				</view>
				<view class="form-item">
					<label>留校事由</label>
					<textarea placeholder="请输入留校事由" v-model="formData.stayReason" />
				</view>
			</view>
		
			<view v-if="formData.leaveStatus != '2'" style="text-align: center;">
				<button type="primary" @click="doApply" style="width: 80%;display: inline-block;">
					{{ formData.leaveStatus == 1 || formData.leaveStatus == 10 ? "修改" :"提交" }}
				</button>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getQuestionnaire,
		addAnswer,
		updateAnswer
	} from '@/api/questionnaire/questionnaire.js';
	import {
		toBackPage
	} from "@/utils/toBack.js"
	
	import {
		isEmpty,
		isValidPhone
	} from "@/api/helpFunc/index.js";
	export default {
		data() {
			return {
				isSubmitting: false, //表单提交标志位
				questionnaireDetail: {},
				questionnaireId: "", //问卷id
				targetId: "", //目标id
				navIndex:"",
				formData: {
					willLeaveTime: "",
					isLeave: "1",
					homeGps: ""
				},
			}
		},
		onLoad(option) {

		},
		methods: {
			
		}
	}
</script>

<style  lang="scss" scoped>
	.questionnaire-detail {
		padding: 30rpx 30rpx 95rpx;
	
		&>.title {
			font-weight: bold;
			font-size: 40rpx;
			text-align: center;
			margin-bottom: 35rpx;
		}
	
		.list {
			.item {
				.title {
					font-weight: bold;
				}
	
				/* 选项 */
				.option {
					display: flex;
					justify-content: start;
					gap: 10px;
					margin: 16px 0;
	
					.option_number {
						text-align: center;
						width: 24px;
						height: 24px;
						border-radius: 50%;
						border: 1px solid #E1EAF4;
						line-height: 22px;
						font-size: 14px;
						color: #646873;
						cursor: pointer;
					}
	
					.active {
						background-color: #409EFF;
						border: 1px solid #409EFF;
						color: #fff;
					}
				}
	
				textarea {
					border: 1px solid #d3d3d3;
					margin: 40rpx 0;
					width: 100%;
					border-radius: 16rpx;
					padding: 20rpx;
					color: #202020;
					opacity: 0.7;
					height: 80px;
	
					.textarea-placeholder {
						color: #202020;
						opacity: 0.5;
					}
	
				}
			}
		}
	
		.btns {
			padding: 10px;
			display: flex;
			background: white;
			position: fixed;
			bottom: 0;
			left: 0;
			right: 0;
			z-index: 999;
	
			button {
				flex: 1;
				background-color: #1890FF;
				color: white;
	
				&:first-child {
					margin-right: 10px;
					background-color: white;
					border: 1px solid #1890FF;
					color: #1890FF;
				}
			}
	
		}
	}
</style>