<template>
	<view class="cv-container">
		<!-- 可滚动内容区 -->
		<view class="cv-scroll-content">
			<!-- 访客信息 -->
			<view class="info">
				<view class="cv-section-title">访客信息</view>
				<input class="cv-input-name" placeholder="请输入姓名" v-model="form.visitorName" />
				<input class="cv-input-phone" placeholder="请输入11位手机号码" v-model="form.visitorPhone" />
			</view>

			<!-- 邀约详情 -->
			<view class="info">
				<view class="cv-section-title">邀约详情</view>
				<input class="cv-input-reason" placeholder="请输入来访事由（6字以内）" v-model="form.visitingReason" />
				<input class="cv-input-unit" placeholder="请输入拜访单位" v-model="form.visitingUnit" />
				<view class="cv-time-picker">
					<picker mode="datetime" :value="form.startTime" @change="startTimeChange">
						<view class="cv-input-time">{{ form.startTime || '请选择开始时间' }}</view>
					</picker>
					<text>至</text>
					<picker mode="datetime" :value="form.endTime" @change="endTimeChange">
						<view class="cv-input-time">{{ form.endTime || '请选择结束时间' }}</view>
					</picker>
				</view>
			</view>

			<!-- 提交按钮 -->
			<button class="cv-submit-btn" @click="submit">提交</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					visitorName: '',
					visitorPhone: '',
					visitingReason: '',
					visitingUnit: '',
					startTime: '',
					endTime: ''
				}
			}
		},
		methods: {
			startTimeChange(e) {
				this.form.startTime = e.detail.value;
			},
			endTimeChange(e) {
				this.form.endTime = e.detail.value;
			},
			submit() {
				// 提交逻辑
			}
		}
	}
</script>

<style scoped>
	.cv-container {
		background: #fff;
		height: 100vh;
		display: flex;
		flex-direction: column;
	}

	.cv-back {
		position: absolute;
		left: 37rpx;
		width: 15rpx;
		height: 33rpx;
	}

	.cv-title {
		font-size: 36rpx;
		color: #000;
	}

	.cv-scroll-content {
		flex: 1;
		overflow-y: auto;
		padding-bottom: 120rpx;
	}

	.cv-section {
		margin: 36rpx 56rpx 0 56rpx;
	}

	.info {
		margin: 36rpx 56rpx 0 56rpx;
	}

	.cv-section-title {
		font-size: 32rpx;
		color: #000;
		font-weight: 600;
	}


	.cv-inputs {
		flex: 1;
		display: flex;
		flex-direction: column;
		gap: 18rpx;
	}

	.cv-input-name {
		width: 233rpx;
		height: 73rpx;
		background: #F7F7F7;
		border-radius: 10rpx;
		font-size: 24rpx;
		color: #222;
		padding: 0 24rpx;
		margin-bottom: 29rpx;
		margin-top: 23rpx;
		border: none;
		outline: none;
	}

	.cv-input-phone {
		width: 363rpx;
		height: 73rpx;
		background: #F7F7F7;
		border-radius: 10rpx;
		font-size: 24rpx;
		color: #222;
		padding: 0 24rpx;
		margin-bottom: 29rpx;
		border: none;
		outline: none;
	}

	.cv-input {
		width: 435rpx;
		height: 73rpx;
		background: #F7F7F7;
		border-radius: 10rpx;
		font-size: 24rpx;
		color: #222;
		padding: 0 24rpx;
		margin-bottom: 29rpx;
		border: none;
		outline: none;
	}

	.cv-avatar-upload {
		position: absolute;
		width: 163rpx;
		height: 183rpx;
		top: 50rpx;
		right: 0rpx;
		background: #F7F8FA;
		border-radius: 12rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-left: 24rpx;
	}

	.cv-avatar-placeholder {
		color: #bbb;
		font-size: 24rpx;
		text-align: center;
	}

	.cv-avatar-img {
		width: 163rpx;
		height: 183rpx;
		border-radius: 12rpx;
	}

	.cv-purpose-list {
		display: flex;
		flex-wrap: wrap;
		margin-top: 36rpx;
		/* 不设置gap的列间距，水平方向用margin控制 */
	}

	.cv-purpose-btn {
		width: calc((100% - 58rpx) / 3);
		margin-right: 29rpx;
		margin-bottom: 29rpx;
		box-sizing: border-box;
		padding: 18rpx 0;
		text-align: center;
		background: #EBF5FF;
		border-radius: 10rpx;
		font-size: 24rpx;
		color: #0B0B0B;
	}

	.cv-purpose-btn:nth-child(3n) {
		margin-right: 0;
	}

	.cv-purpose-btn.active {
		background: #007CFF;
		color: #fff;
	}

	.cv-room-select {
		width: 435rpx;
		height: 73rpx;
		background: #F7F7F7;
		border-radius: 10rpx;
		font-size: 24rpx;
		color: #808080;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 24rpx;
		margin-top: 12rpx;
	}

	.cv-arrow {
		width: 11rpx;
		height: 21rpx;
	}

	.cv-time-list {
		display: flex;
		flex-direction: column;
		gap: 23rpx;
		margin-top: 32rpx;
	}

	.cv-time-btn {
		width: 302rpx;
		height: 73rpx;
		text-align: center;
		background: #EBF5FF;
		border-radius: 12rpx;
		font-size: 24rpx;
		color: #0B0B0B;
		display: flex;
		/* 新增 */
		align-items: center;
		/* 垂直居中 */
		justify-content: center;
	}

	.cv-time-btn.active {
		background: #007CFF;
		color: #fff;
	}

	.cv-parking-row {
		display: flex;
		align-items: center;
		gap: 24rpx;
		margin-bottom: 18rpx;
	}

	.cv-radio-label {
		font-size: 24rpx;
		color: #0B0B0B;
		display: flex;
		align-items: center;
		margin-left: 30rpx;
		cursor: pointer;
	}

	.cv-radio-label2 {
		font-size: 24rpx;
		color: #0B0B0B;
		display: flex;
		align-items: center;
		margin-left: 30rpx;
		cursor: pointer;
	}

	.cv-radio-custom {
		width: 22rpx;
		height: 22rpx;
		border-radius: 50%;
		border: 1rpx solid #007CFF;
		background: #fff;
		margin-right: 12rpx;
		box-sizing: border-box;
		transition: background 0.2s, border 0.2s;
	}

	.cv-radio-custom.checked {
		background: #007CFF;
		border: 1rpx solid #007CFF;
	}

	.cv-parking-count {
		margin-left: 24rpx;
		font-size: 24rpx;
		background: #EBF5FF;
		border-radius: 8rpx;
		padding: 0 18rpx;
		height: 54rpx;
		display: flex;
		align-items: center;
	}

	.cv-parking-num {
		color: #007CFF;
	}

	.cv-parking-total {
		color: #0B0B0B;
	}

	.cv-input-reason, .cv-input-unit {
		width: 435rpx;
		height: 73rpx;
		background: #F7F7F7;
		border-radius: 10rpx;
		font-size: 24rpx;
		color: #222;
		padding: 0 24rpx;
		margin-bottom: 29rpx;
		border: none;
		outline: none;
	}

	.cv-time-picker {
		display: flex;
		align-items: center;
		margin-bottom: 29rpx;
	}

	.cv-input-time {
		width: 200rpx;
		height: 73rpx;
		background: #F7F7F7;
		border-radius: 10rpx;
		font-size: 24rpx;
		color: #808080;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-right: 20rpx;
	}

	.cv-submit-btn {
		width: 90vw;
		height: 90rpx;
		background: #0090FF;
		color: #fff;
		font-size: 36rpx;
		border: none;
		border-radius: 45rpx;
		margin: 80rpx auto 0 auto;
		display: block;
		font-weight: bold;
		box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.18);
	}
</style>