<template>
	<view class="have-bottom">
		
		<view class="bg">
			<view class="title">提交信息</view>
			<view class="detail-option">
				<view class="detail-option-item">
					<view class="label">提交日期</view>
					<view class="value">{{ state.detail.applyTime }}</view>
				</view>
				<view class="detail-option-item">
					<view class="label">审核状态</view>
					<view
						class="value"
						:class="{
							statusdsh: state.detail.orderStep === 'WAITING_AUDIT',
							statusbtg: state.detail.orderStep === 'AUDIT_FAIL',
							statusywc: state.detail.orderStep === 'COMPLETED',
						}"
					>{{ getCodeName('ASS_ORDER_STEP', state.detail.orderStep) }}</view>
				</view>
			</view>
		</view>
		
		<view class="bg">
			<view class="title">身份证信息</view>
			<view class="detail-option">
				<view class="detail-option-item">
					<view class="label">姓名</view>
					<view class="value">{{ state.applyInfo.name }}</view>
				</view>
				<view class="detail-option-item">
					<view class="label">身份证照片</view>
				</view>
				
				<view class="detail-option-item">
					<image class="car-photo" :src="state.applyInfo.userPosImagesUrl" mode="aspectFill"></image>
					<image class="car-photo" :src="state.applyInfo.userNegImagesUrl" mode="aspectFill"></image>
				</view>
				<view class="detail-option-item">
					<view class="label">手机号</view>
					<view class="value">{{ state.applyInfo.mobile }}</view>
				</view>
			</view>
		</view>
		
		<view class="bg">
			<view class="title">车辆信息</view>
			<view class="detail-option">
				<view class="detail-option-item">
					<view class="label">车牌号</view>
					<view class="value">{{ state.drivingInfo.plateNum }}</view>
				</view>
				<view class="detail-option-item">
					<view class="label">车辆颜色</view>
					<view class="value">{{ getVehiclePlateColor(state.drivingInfo.plateColor) }}</view>
				</view>
				<view class="detail-option-item">
					<view class="label">车主姓名</view>
					<view class="value">{{ state.drivingInfo.vehicleOwnerName }}</view>
				</view>
				<view class="detail-option-item">
					<view class="label">驾驶证信息</view>
				</view>
				<view class="detail-option-item">
					<image class="car-photo" :src="state.drivingInfo.vehPosImgUrl" mode="aspectFill"></image>
					<image class="car-photo" :src="state.drivingInfo.vehNegImgUrl" mode="aspectFill"></image>
				</view>
			</view>
		</view>
			
		<view class="bg" v-if="state.ownerInfo && state.ownerInfo.ownerName">
			<view class="title">车主信息</view>
			<view class="detail-option">
				<view class="detail-option-item">
					<view class="label">车主姓名</view>
					<view class="value">{{ state.ownerInfo.ownerName }}</view>
				</view>
				<view class="detail-option-item">
					<view class="label">车主身份证号</view>
					<view class="value">{{ state.ownerInfo.ownerIdNum }}</view>
				</view>
				<view class="detail-option-item">
					<view class="label">车主身份证</view>
				</view>
				<view class="detail-option-item">
					<image class="car-photo" :src="state.ownerInfo.ownerPosImgUrl" mode="aspectFill"></image>
					<image class="car-photo" :src="state.ownerInfo.ownerNegImgUrl" mode="aspectFill"></image>
				</view>
				<view class="detail-option-item">
					<view class="label">授权书</view>
				</view>
				<view class="detail-option-item">
					<image class="proxy-url" :src="state.ownerInfo.proxyUrl" mode="aspectFill"></image>
				</view>
			</view>
		</view>
		
	</view>
	
</template>

<script setup lang="ts">
	import { reactive} from "vue";
	import {releasePlateaView} from "@/utils/network/api.js";
	import {requestNew} from "@/utils/network/request.js";
	import { onLoad } from "@dcloudio/uni-app";
	import { getVehiclePlateColor } from "@/datas/vehiclePlateColor.js"
	import { getCodeName } from '@/datas/queryKey.js'

   const leftIcon = {
   	height: '100%',
   	width: '8rpx',
   	display: 'flex',
   	'align-items': 'center',
   	'margin-right': '4rpx',
   }
const labelStyle = {
		color: "#004576",
		fontSize: "28rpx",
	}
	const state = reactive({
		detail: {
			plateNum: '',
			plateColor: '',
			vehicleOwnerName: '',
			applyTime: '',
			auditStatus: '',
			orderStep: ''
		},
		drivingInfo: {
			plateColor: "",
			plateNum: "",
			vehNegImgUrl: "",
			vehPosImgUrl: "",
			vehicleOwnerName: "",
		},
		applyInfo: {
			mobile: '',
			name: '',
			userNegImagesUrl: '',
			userPosImagesUrl: ''
		},
		ownerInfo: {
			ownerName: '',
			ownerIdNum: '',
			ownerNegImgUrl: '',
			ownerPosImgUrl: '',
			proxyUrl: ''
		}
	})
	onLoad((option) => {
		if (option.orderNo) {
			getDetail(option.orderNo)
		} else {
			uni.navigateBack()
		}
	});
	const getDetail = (orderNo: string) => {
		const options = {
			type: 2,
			data: {
				orderNo
			},
			method: "POST",
			showLoading: true,
		};
		requestNew(releasePlateaView, options).then((res) => {
			state.detail = res
			state.drivingInfo = res.drivingInfo
			state.applyInfo = res.applyInfo
			state.ownerInfo = res.ownerInfo
		});
	};
</script>

<style lang="scss" scoped>
	.bg {
		background-color: white;
		margin: 0 32rpx;
		margin-top: 20rpx;
		border-radius: 12px;
		border: 1px solid #FFFFFF;
		padding: 20rpx;
		overflow: hidden;

		.title {
			font-weight: bold;
			font-size: 30rpx;
			color: #000000;
		}

		.dot_wrap {
			display: flex;
			margin: 30rpx 0;

			.dot_wrap_left {
				display: flex;
				flex-direction: column;
				align-items: center;
				margin-right: 20rpx;
				margin-top: 20rpx;

				.dot {
					width: 24rpx;
					height: 24rpx;
					background: #01243A;
					border-radius: 50%;
				}

				.line {
					height: 126rpx;
					background-color: transparent;
					border-left: 2rpx dashed #01243A;
				}
			}

			.dot_wrap_right {
				.item {
					background: #F7F7F7;
					border-radius: 12rpx;
					height: 120rpx;
					display: flex;
					padding: 10rpx 20rpx;
					box-sizing: border-box;
					width: 600rpx;
					margin-bottom: 30rpx;

					.destion {
						margin: 0 60rpx 0 20rpx;
						font-weight: 400;

						.destion1 {
							font-size: 28rpx;
							color: #01243A;
						}

						.destion2 {
							font-size: 22rpx;
							color: #999999;
							line-height: 50rpx;
						}
					}

					image {
						width: 46rpx;
						height: 47rpx;
					}
				}
			}
		}

		.des {
			font-weight: 400;
			font-size: 28rpx;
			color: #01243A;
			line-height: 56rpx;
			margin-top: 10rpx;
			text-indent: 1rem;
		}

		.cailiao {
			width: 100%;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;

			.list {
				width: 48%;
				margin-top: 30rpx;

				view {
					text-align: center;
					margin-bottom: 15rpx;
					font-size: 28rpx;
					color: #01243A;
				}

				.icon {
					width: 100%;
					height: 190rpx;
					background-image: var(--bgimg);
					background-size: 100% 100%;
					background-repeat: no-repeat;
				}
			}
		}
	}

	.action {
		position: absolute;
		left: 0;
		height: 270rpx;
		background-color: #fff;
		border-radius: 30rpx 30rpx 0 0;
		width: 100vw;
		display: flex;
		align-items: center;
		justify-content: space-evenly;
		flex-direction: column;
		margin-top: 20rpx;
	}
	.detail-option{
		.detail-option-item{
			display: flex;
			padding: 20rpx 0;
			min-height: 70rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 28rpx;
			.label{
				color: #004576;
				width: 150rpx;
				flex-shrink: 0;
				flex-grow: 0;
			}
			// 待审核
			.statusdsh{
				font-size: 24rpx;
				color: #1458E5;
			}
			// 不通过
			.statusbtg{
				font-size: 24rpx;
				color: #C2A760;
			}
			// 已完成
			.statusywc{
				font-size: 24rpx;
				color: #42D175;
			}
		}
	}
	.car-photo{
		width: 280rpx;
		height: 175rpx;
	}
	.have-bottom{
		padding-bottom: 100rpx;
	}
	.proxy-url{
		width: 560rpx;
		height: 250rpx;
	}
</style>