<!-- 驳回 -->
<template>
	<view class="reject">
		<!-- <navbar title="驳回" :leftClick="leftClick"></navbar> -->

		<uv-form labelPosition="left" :model="form" :rules="rules" errorType="toast" ref="form" labelWidth="0">
			<uv-form-item label="" prop="returnValue">
				<uv-textarea v-model="form.returnValue" :maxlength="200" :height="120" count
					placeholder="请输入驳回原因"></uv-textarea>
			</uv-form-item>

			<uv-button type="primary" text="驳回" shape="circle" customStyle="margin-top: 10px"
				@click="submit"></uv-button>
		</uv-form>
	</view>
</template>

<script>
	import navbar from '../../components/base/navbar.vue'

	export default {
		name: 'Reject',
		components: {
			navbar
		},
		data() {
			return {
				form: {
					returnValue: ''
				},
				rules: {
					'returnValue': {
						type: 'string',
						required: true,
						message: '请填写驳回原因',
						trigger: ['blur', 'change']
					}
				},
			}
		},
		onLoad: function(options) {
			this.form.id = options.orderId || ''
		},
		methods: {
			//驳回
			submit() {
				this.$refs.form.validate().then(res => {

				}).catch(errors => {
					uni.showToast({
						icon: 'none',
						title: '请填写驳回原因'
					})
				})
				this.$api('editSchoolOrderError', this.form, res => {
					if (res.code == 200) {
						console.log(res);
					}
				})
			},

			//返回
			leftClick() {
				uni.switchTab({
					url: '/pages/repairList/repairList'
				})
			}
		}
	}
</script>

<style scoped>
	.reject {
		width: 96%;
		margin: 0rpx auto;
	}
</style>