<template>
	<!-- 布局 flex 组件 view -->
	<view class="addDiver_body">
		<!--  卡片  -->
		<view class="addDiver_card">

			<view class="card_title">
				<view class="tiao"></view>
				<view class="card_title_text">车辆信息</view>
			</view>
			<uni-list>
				<uni-list-item>
					<view class="list_header" slot="header">个人车牌</view>
					<view style="padding-right: 16px !important;" slot="body" class="list_right">
						<input v-model="carNumber.plateNumber" placeholder="请输入个人车牌" class="list_right_input" />
					</view>
				</uni-list-item>
				<uni-list-item>
					<view class="list_header" slot="header">企业车牌</view>
					<view style="padding-right: 16px !important;" slot="body" class="list_right">
						<input v-model="carNumber.plateNumberCompany" placeholder="请输入企业车牌" class="list_right_input" />
					</view>
				</uni-list-item>
			</uni-list>
			<view class="footer_text">
				<view style="display: flex;">
					<view style="min-width: 100rpx;">当前企业:</view> {{jsData.companyName?jsData.companyName:'未设置'}}
				</view>
				<view style="display: flex;">
					<view style="min-width: 100rpx;">企业ID:</view> {{jsData.companyId?jsData.companyId:'未设置'}}
				</view>
				 <!-- <text style="min-width: 30rpx;">当前企业:</text> {{jsData.companyName?jsData.companyName:'未设置'}}<br/> -->
				 
			</view>
		</view>
		<!-- 底部按钮 -->
		<view class="list_footer">
			<button @tap="postFn()" class="list_butten ">保存</button>
		</view>
	</view>
</template>

<script>
	import addDirver from '@/api/addDirver'
	export default {
		data() {
			return {
				check:['plateNumber','plateNumberCompany'],
				jsData: null,
				carNumber:{
					plateNumber:' ',
					plateNumberCompany:' ',
					customerId:'',
					updateSource:'OMS-MINIAPP',
					companyId:''
				}
			}
		},
		onLoad(e) {
			if (e.jsData) {
				this.jsData = JSON.parse(e.jsData)
				this.carNumber.plateNumber = this.jsData.plateNumber
				this.carNumber.plateNumberCompany = this.jsData.plateNumberCompany
				this.carNumber.customerId = this.jsData.customerId
				this.carNumber.companyId = this.jsData.companyId?this.jsData.companyId:''
				console.log(this.jsData,this.carNumber,'/*/*/*/*')
			}
		},
		methods: {
			postFn(){
				addDirver.updateCustomerInfo(this.carNumber).then(res=>{
					if(res.code!==20000)return
					uni.$emit('updateDriver',this.jsData.customerId)
					uni.navigateBack()
					console.log(res)
				})
		}
		}
	}
</script>

<style lang="scss">
	@import url("./driver.css");

	.footer_text {
		font-size: 22rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;
		margin-bottom: 39rpx;
		padding-left: 16px;
		margin-top: 13rpx;

	}
</style>
