<template>
	<view class="center">
		<view class="">
			<text>请假原因</text>
			<input type="text" v-model="reason" />
		</view>
		<view class="buttom" @click="submit('/pages/course/success')">
			立即提交
		</view>
		<view class="" @click="nav('/pages/leave/details')">
			申请记录
		</view>
	</view>
</template>

<script>
import { setLeave} from '@/api/course.js'
export default {
	data(){
		return{
			id: '',
			ifyid: '',
			grade_id: '',
			subject_id: '',
			manage_admin: '',
			reason: ''
		}
	},
	onLoad(option) {
		this.id = option.id;
		this.ifyid = option.ifyid;
		this.grade_id = option.grade_id;
		this.subject_id = option.subject_id
	},
	methods: {
		submit(url){
			setLeave({
				timetable_id: this.id,
				ifyid: this.ifyid,
				grade_id: this.grade_id,
				subject_id: this.subject_id,
				reason: this.reason,
				manage_admin:this.manage_admin
			}).then(() =>{
				uni.navigateTo({
					url: url
				})
			}).catch(err =>{
				console.log(err);
			})
		},
		nav(url){
			uni.navigateTo({
				url: url
			})
		}
	}
}
</script>

<style>
</style>
