<template>
	<view class="container">
		<view class="card">
			<app-hidden-view :hidden-id="hiddenId" />
			<view class="card">
				<u-form
					ref="formRef"
					label-position="left"
					:model="form"
					:rules="rules"
					label-width="auto"
				>
					<u-form-item label="是否通过" prop="POSTPONE_AUDIT" required>
						<u-radio-group v-model="form.POSTPONE_AUDIT" direction="horizontal">
							<u-radio name="1" label="通过" />
							<u-radio name="2" label="不通过" />
						</u-radio-group>
					</u-form-item>
					<u-line />
					<view class="mt-10">
						<u-button
							type="primary"
							shape="circle"
							text="提交"
							:throttle-time="1000"
							@click="fnSubmit"
						/>
					</view>
				</u-form>
			</view>
		</view>
	</view>
</template>

<script>
import AppHiddenView from "@/components/hiddenView/index.vue";
import useFormValidate from "@/utils/useFormValidate";
import { setHiddenDelayReviewSubmit } from "../../api";

export default {
	components: { AppHiddenView },

	onLoad(query) {
		this.hiddenId = query.HIDDEN_ID;
		this.hiddenExamineId = query.HIDDENEXAMINE_ID;
	},

	data() {
		return {
			store: this.$store,
			hiddenId: "",
			hiddenExamineId: "",
			form: {
				POSTPONE_AUDIT: "", // 延期审核
			},
			rules: {
				POSTPONE_AUDIT: {
					type: "string",
					required: true,
					message: "请选择延期审核是否通过",
					trigger: ["blur", "change"],
				},
			},
		};
	},

	methods: {
		async fnSubmit() {
			await useFormValidate(this.$refs.formRef);
			await setHiddenDelayReviewSubmit({
				STATE: form.value.POSTPONE_AUDIT,
				HIDDENEXAMINE_ID: hiddenExamineId.value,
				loginUserId: userInfo.USER_ID,
				USERNAME: userInfo.NAME,
			});
			uni.showToast({
				icon: "none",
				title: "提交成功",
			});
			setTimeout(() => {
				uni.navigateBack();
			}, 1000);
		},
	},
};
</script>

<style scoped lang="scss"></style>
