<template>
	<view id="warp">
		<view class="warp_input_list mar_bot">
			<view class="t_login_passList bor_bot">
				<view class="input_icon">设备名称</view>
				<input
					class="input_css"
					v-model="formData.vehicleCode"
					maxlength="6"
					border="none"
					disabled
					placeholder="暂无设备名称"
				></input>
			</view>
			<view class="t_login_passList bor_bot">
				<view class="input_icon">车牌号</view>
				<input
					class="input_css"
					v-model="formData.vehiclePlate"
					maxlength="8"
					border="none"
					disabled
					placeholder="暂无车牌号"
				></input>
			</view>
			<!-- <view class="t_login_passList bor_bot">
				<view class="input_icon">IMEI号</view>
				<input class="input_css2" v-model="formData.imeiNo" border="none" disabled></input>
				<view class="code">
					<image @tap="onCopy(formData.imeiNo)" src="../../static/images/common/copy.png"></image>
				</view>
			</view> -->
			<view class="t_login_passList">
				<view class="input_icon">最后定位时间</view>
				<input class="input_css" v-model="formData.recTime" disabled border="none"></input>
			</view>
		</view>
		<view class="warp_input_list mar_bot">
			<!-- <view class="t_login_passList bor_bot">
				<view class="input_icon">设备类型</view>
				<input class="input_css" v-model="formData.terminalTypeName" disabled border="none"></input>
			</view> -->
			<view class="t_login_passList bor_bot">
				<view class="input_icon">开通时间</view>
				<input class="input_css" v-model="formData.openTime" disabled border="none"></input>
			</view>
			<view class="t_login_passList">
				<view class="input_icon">到期时间</view>
				<input class="input_css" v-model="formData.expireTime" disabled border="none"></input>
			</view>
		</view>
		<view class="warp_input_list">
			<view class="t_login_passList bor_bot">
				<view class="input_icon">联系人</view>
				<input
					class="input_css"
					v-model="formData.contactPerson"
					border="none"
					disabled
					placeholder="暂无联系人"
				></input>
			</view>
			<view class="t_login_passList">
				<view class="input_icon">联系电话</view>
				<input
					class="input_css"
					v-model="formData.contactPhone"
					border="none"
					disabled
					placeholder="暂无联系电话"
				></input>
			</view>
		</view>
		<!-- <view class="btn_css">
			<button class="btn" @tap="nextHandle">保存</button>
		</view> -->
	</view>
</template>

<script>
	const {urlList,https} = require('@/static/api');
	export default {
		data() {
			return {
				id:'',
				formData:{}
			};
		},
		onLoad(options) {
			uni.showNavigationBarLoading();
			// console.log(options)
			this.id = options.id;
			https(urlList.getCarInfo+'/'+options.id,'GET','','').then(data => {
				// console.log('车辆详情',data)
				this.formData = data.data
			}).catch(err => {
				uni.showToast({
					title:err,
					icon:'none',
					duration:1500
				})
			})
			uni.hideNavigationBarLoading();
		},
		methods:{
			onCopy(data){
				uni.setClipboardData({
				    data: data,
				    success: function () {
				        uni.showToast({
				        	title:'复制成功',
				        	icon:'none',
				        	duration:1000
				        })
				    }
				});
			},
			nextHandle(){
				const { id, vehiclePlate, vehicleCode, contactPerson, contactPhone } = this.formData;
				let postData = {
					id, 
					vehiclePlate, 
					vehicleCode, 
					contactPerson, 
					contactPhone
				};
				https(urlList.putCarInfo,'PUT',postData,'正在保存...').then(data => {
					uni.showToast({
						title:'保存成功',
						duration:1500,
					});
					setTimeout(()=>{
						uni.navigateBack();
					},1500)
				}).catch(err => {
					uni.showToast({
						title:err,
						icon:'none',
						duration:1500
					})
				})
				
			}
		},
	}
</script>
<style>
	page {
		background-color: #F3F4F6;
	}
</style>
<style lang="scss" scoped>
.mar_bot{
	margin-bottom: 20rpx;
}
.bor_bot{
	border-bottom: 1rpx solid #e6e6e6;
}
#warp{
	width: 100%;
	.btn_css{
		width: 700rpx;
		position: fixed;
		bottom: 10rpx;
		left: 25rpx;
		display: block;
		.btn{
			background-color:#1B64F8FF;
			color: white;
		}
	}
	.warp_input_list{
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		background-color: white;
		.t_login_passList{
			width:700rpx;
			padding: 20rpx 0rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			.input_icon{
				width: 200rpx;
				display: flex;
				align-items: center;
			}
			.input_css{
				width:500rpx;
				height: 70rpx;
				text-align: right;
				display: inline-block;
			}
			.input_css2{
				width: 440rpx;
				height: 70rpx;
				text-align: right;
				display: inline-block;
			}
			.code{
				width: 50rpx;
				margin-left: 9rpx;
				display: flex;
				justify-content: flex-end;
				border-left: 1rpx solid #e6e6e6;
				font-size: 31rpx;
				image{
					height: 34rpx;
					width: 34rpx;
				}
			}
		}
	}
}
</style>
