<template>
	<view class="bg">
		<view class="title_wrap"><text class="title">基本信息</text></view>
		<u-form label-width="230" :model="state.form" ref="uForm" :label-style='labelStyle'>
			<u-form-item label="车牌号码" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
				borderBottom>
					<u-input v-model="state.form.vehiclePlateColorStr" input-align='right'disabled/>
			</u-form-item>
			<u-form-item label="车牌颜色" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
				borderBottom>
					<u-input v-model="state.form.vehiclePlateColorStr" input-align='right'disabled/>
			</u-form-item>
			<u-form-item label="ETC卡状态" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
				borderBottom>
				<u-input  v-model="state.form.customerName" inputAlign="right" disabled/>
			</u-form-item>
			<u-form-item label="OBU卡状态" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
				borderBottom>
				<u-input v-model="state.form.customerTel" inputAlign="right" disabled/>
			</u-form-item>
			<u-form-item label="ETC卡状态" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
				borderBottom>
			</u-form-item>
			<view class="card">
				<image :src='`${$imgUrl}issuance/cardPicture.png`' mode=""></image>
				<view class="details">
					<view>储蓄卡</view>
					<view>卡号：100101010101</view>
				</view>
			</view>
			<u-form-item label="OBU卡状态" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
				borderBottom>
			</u-form-item>
			<view class="card">
				<image :src='`${$imgUrl}issuance/obuPicture.png`' mode=""></image>
				<view class="details">
					<view>OBU信息</view>
					<view>序列号：100101010101</view>
				</view>
			</view>
		</u-form>
	</view>
	<view class="bg">
		<view class="title" style="margin-bottom: 30rpx;">请输入需要变更ETC车牌号码</view>
		<car-number-input :defaultStr="state.form.vehiclePlate"></car-number-input>
        <u-form label-width="230" :model="state.form" ref="uForm" :label-style='labelStyle' borderBottom>
			<u-form-item label="车牌颜色" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
				borderBottom>
				<u-input v-model="state.form.vehiclePlateColorStr" type="select" @click="show1 = true" input-align='right'/>
			</u-form-item>
			<u-form-item label="车牌类型" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
				borderBottom>
				<u-input v-model="state.form.vehiclePlateColorStr" type="select" @click="show1 = true" input-align='right'/>
			</u-form-item>
		</u-form>
	</view>
	<view class="tips">
		<view class="hint">
			<image :src="`${$imgUrl}common/icon-hint.png`" class="icon"></image>
			<view>注意事项</view>
		</view>
		<view class="item">1、非蓝牙设备不支持该功能。</view>
		<view class="item">2、单位用户请到线下网点进行办理。</view>
		<view class="item">3、车牌变更成功后需重新绑定票根信息工行。</view>
		<view class="item">4、工行、建行渠道的储值卡不支持该功能。</view>
	</view>
	<view class="action">
		<button type="default" class="ui-btn" @click="savaHandle()">
			提交
		</button>
	</view>
<!-- 选择车牌颜色 -->
	<u-select v-model="show1" :list="state.colorRange" @confirm="changeColor"></u-select>
</template>

<script setup lang="ts">
	import { navTo,uploadFile,strReplace,msg} from "@/utils/utils";
	import { reactive,ref } from "vue";
	import carNumberInput from "@/components/car-number-input/car-number-input.vue";
	import { onLoad } from "@dcloudio/uni-app";
	import { getItem } from "@/utils/storage.ts"
import {selfServiceView,selfServiceUserUpload} from "@/utils/network/api.js";
import {requestNew} from "@/utils/network/request.js";
	const labelStyle = {
		color: "#004576",
		fontSize: "28rpx",
	}
	const leftIcon = {
		height: '100%',
		width: '8rpx',
		display: 'flex',
		'align-items': 'center',
		'margin-right': '4rpx',
	}
	const show1 = ref(false)
	const show2 = ref(false)
	const state = reactive({
		form: {
			customerName: "",
			customerTel: "",
			vehiclePlate: "",
			vehiclePlateColor: "",
			vehiclePlateColorStr:"",//车牌颜色中文
			questionType:"",
			questionTypeStr:"",
			etcUser:"",
			etcUserStr:"",
			eventOccurrenceDate:"",//2016-09-01 00:00:00
			supportingMaterialsUrlShow:[],
			insertTime:"",
		},
		colorRange: [],
		questionTypeRange:[
			{value: 1, label: "工单1"},
			{value: 2, label: "工单2"},
		],
		etcUserRange:[
			{value: 1, label: "是"},
			{value: 0, label: "否"},
		],
	})
	onLoad((option : any) => {
		let getColor = getItem('key')['VEHICLE_COLOR_TYPE'];
		for (var k = 0; k < getColor.length; k++) {
			let obj = {};
			obj['value'] = getColor[k]['code']
			obj['label'] = getColor[k]['name']
			state.colorRange.push(obj)
		}
		console.log("state.colorRange",state.colorRange,option)
	});
	//车牌号输入
	const carNumber = (val : any) => {
		state.form.vehiclePlate = val.trim();
	};
	const savaHandle = () => {
		
	}
   const changeColor = (item) => {
		state.form.vehiclePlateColor = item[0].value
		state.form.vehiclePlateColorStr = item[0].label
		console.log(item)
	}
</script>

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

		.title_wrap {
			display: flex;
			font-weight: 400;
            justify-content: space-between;
			.title {
				font-size: 30rpx;
				color: #01243A;
			}
		}

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

	.action {
		position: absolute;
		left: 0;
		height: 160rpx;
		background-color: #fff;
		border-radius: 30rpx 30rpx 0 0;
		width: 100vw;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		margin-top: 20rpx;
	}
	.card{
		display: flex;
		align-items: center;
		image{
			width: 120rpx;
			height: 120rpx;
			margin-right: 20rpx;
		}
		.details view:first-child{
			margin-bottom: 10rpx;
		}
	}
	.tips{
		width: 90%;
		padding: 20rpx 0;
		box-sizing: border-box;
		margin: 20rpx auto;
		.hint{
			display: flex;
			align-items: center;
			.icon{
				width: 30rpx;
				height: 30rpx;
				margin-right: 10rpx;
			}
		}
		.item{
			margin: 10rpx 0;
			text-indent: 1rem;
		}
	}
</style>