<template>
	<view>
		<!-- 模态框 -->
		<view class="cu-modal" :class="show?'show':''">
			<view class="cu-dialog">
				<view class="padding-xl" style="text-align: left;">
					<view class="text-bold text-lg margin-bottom-sm">绑定本帐号保险人员信息</view>
					<view class="text-red" style="padding-bottom: 10rpx;">请绑定本帐号操作者身份信息，用于含保险订单的保单投保 (自动实时投保)!
					</view>
					<view class="oneStaff solid-top">
						<view>
							<text>您的姓名:</text>
							<view style="margin-top: 10rpx">
								<input class="radius-input inline-input" type="text" placeholder="输入真实姓名"
									v-model="oneData.certName">
							</view>
						</view>
						<view style="padding-top: 10rpx;">
							<text>身份证号码:</text>
							<view style="margin-top: 10rpx">
								<input class="radius-input inline-input" type="text" placeholder="请输入身份证号码并反复确认无误"
									v-model="oneData.certNo">
							</view>
						</view>
					</view>
					<view style="padding-top: 20rpx;">
						<checkbox style="transform:scale(0.6)" class="main-color" :checked="true" disabled>
						</checkbox>
						<text class="margin-left-xs">
							<text class="text-red">各自在自己账号上绑定即可，在参与上门服务或客户作业服务过程中，操作订单时会自动对接保险系统!</text>
						</text>
					</view>
				</view>

				<view class="cu-bar bg-white solid-top">
					<view class="action margin-0 flex-sub text-main-color"
						data-modal="showAcceptOrderNoticeModal" @click="submitAdd">确认资料</view>
					<!-- <view v-else class="action margin-0 flex-sub text-main-color"
						data-modal="showAcceptOrderNoticeModal" @click="hideModal">我已知晓</view> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import validRule from '@/common/js/validate.js'
	export default {
		name: 'acceptOrderNotice',
		emits: ['close', 'success'],
		props: {
			show: {
				type: Boolean,
				default: false
			},
			data: {
				type: Object,
				default: () => {}
			}
		},
		data() {
			return {
				oneData: {
					certName: "",
					certNo: ""
				}
			}
		},
		methods: {
			hideModal() {
				this.$emit('close');
			},
			async submitAdd() {
				if (!this.oneData.certName) {
					uni.showToast({
						title: '请输入姓名',
						icon: 'none',
						duration: 2000
					})
					return
				}
				if (!validRule.validIdCard(this.oneData.certNo)) {
					uni.showToast({
						title: '请输入正确的身份证号码',
						icon: 'none',
						duration: 2000
					})
					return
				}
				this.$emit('success', this.oneData)
			}
		}
	}
</script>

<style scoped>
	.oneStaff {
		padding: 20rpx 0;
	}

	.oneLine {
		display: flex;
		flex-direction: row;
		gap: 10px;
	}

	.oneLine>view {
		flex: 1;
	}

	.oneLine text {
		padding-bottom: 10rpx;
	}
</style>