<!-- @format -->

<template>
	<view class="">
		<view class="app-container">
			<view style="background-color: #fff;padding:20rpx;border-radius: 10rpx;" class="">
				<view style="height: 350rpx" class="content-header">
					<u-checkbox-group style="margin-top: 20rpx" v-model="checkboxValue1" placement="column"
						@change="checkboxChange">
						<u-checkbox style="color: red" v-for="item in checkBoxList" :key="item" :label="item.name"
							:name="item.label">
						</u-checkbox>
					</u-checkbox-group>
				</view>
				<span style="color:red;margin-left: 40rpx;font-size: 32rpx;">提交前，请认真阅读理解自我承诺内容后勾选</span>

			</view>

		</view>
		<view class="submitBtn" style="display: flex;">
			<u-button @click="backPage" style="width: 45%; margin: 0 auto" type="success">上一步</u-button>
			<u-button @click="submitBeian" style="width: 45%; " type="primary">提交</u-button>
		</view>
	</view>

</template>

<script>
	import {
		addMiAuditOrder
	} from "@/api/assay.js";
	export default {
		data() {
			return {
				checkboxValue1: [],
				assList: [],
				ids: '',
				checkBoxList: [{
					name: "我单位承诺，本次提交备案的计量器具的相关信息均真实准确，经过自我严格审核，均符合《市场监管总局关于调整实施强制管理的计量器具目录的公告》（国家市场监督管理总局公告2020年第42号)中《实施强制管理的计量器具目录》的规定。",
					label: false,
				}, ],
			}
		},
		onLoad(options) {
			this.ids = options.ids
		},
		methods: {
			backPage() {
				uni.navigateBack({
					delta: 1
				})
			},
			submitBeian() {
				if (this.checkboxValue1.length == 0) {
					this.$modal.showToast("提交前，请认真阅读理解自我承诺内容后勾选");
				} else {
					// let ids = this.assList.map((item) => item.id).join(",");
					// console.log("ids", ids);
					addMiAuditOrder({
						instrumentIds: this.ids,
					}).then((res) => {
						console.log("res", res);
						uni.showToast({
							title: "新增成功",
							icon: "none",
							duration: 2000,
						});

						setTimeout(() => {
							this.assList = [];
							this.checkboxValue1 = [];
							uni.$emit("query", {
								a: "one",
							});
							uni.navigateTo({
								url: "/pages/assay/index",
							})
						}, 500);
					});
				}
			},
		}
	};
</script>

<style lang="scss" scoped>
	::v-deep .u-checkbox {
		display: flex;
		flex-direction: row;
		/* overflow: hidden; */
		flex-direction: row;
		align-items: flex-start;
	}

	::v-deep uni-text[data-v-c4a74aee] span {
		font-size: 30rpx;
		// color: red;
		line-height: 50rpx;
	}

	.app-container {
		height: 100vh;
		background: rgb(243, 244, 249);
		padding: 20rpx
	}

	.submitBtn {
		width: 100%;
		background: #fff;
		padding: 15rpx 0;
		position: fixed;
		bottom: 0;
		z-index: 9999;
	}
</style>