<template>
	<view  class="cxd-login">
		<car-common   ref="common"  ></car-common>
		<u-navbar   title="扫码打卡" :is-back="false" >
				<view class="slot-wrap"></view>	
		</u-navbar>
		<view class="text-center" style="    padding: 1rem 0 1.5rem;" >
			<image v-if="result=='2'" src="/static/img/scanok.png"
			
			style="
			    width: 202px;
			    height: 172px;
			"
			
			></image>
			<u-cell-group v-if="result=='2'" :border="false" >
					<u-cell-item :border-bottom="false" :title-style="{fontSize:'14px'}"  :value-style="{textAlign:'left',color:'#000',paddingLeft:'10px',fontSize:'14px'}"  title="打卡人 : " :arrow="false" :value="obj.driverName"></u-cell-item>
					<u-cell-item :border-bottom="false" :title-style="{fontSize:'14px'}" :value-style="{textAlign:'left',color:'#000',paddingLeft:'10px',fontSize:'14px'}"  title="车牌号 : " :arrow="false"  :value="obj.licensePlateNumber" ></u-cell-item>
					<u-cell-item :border-bottom="false" :title-style="{fontSize:'14px'}" :value-style="{textAlign:'left',color:'#000',paddingLeft:'10px',fontSize:'11px'}"  title="打卡点 : "  :arrow="false" :value="obj.place" ></u-cell-item>
					
			</u-cell-group>
			
			<h1 v-if="result=='3'">打卡失败</h1>
			
		</view>
	</view>
</template>

<script>
	import * as API_user from '@/apis/user'
	
	export default {
		data() {
			return {
				id:'',
				obj:{},
				result:"1",
			}
		},
		methods: {
			getDriverAttendance(){
				API_user.driverAttendance({
					carNum:this.id
				}).then(response => {
					 if(response.result){
						 this.obj=response.data;
						 this.$refs.common.showLoading(false,"打卡成功");
						 this.result="2";
					 }else{
						 this.result="3";
						 this.$refs.common.showLoading(false,response.message);
						 
					 }	
				}).catch(error => {					
					this.$refs.common.showLoading(false,error);	
				})
			}
		},
		onLoad(temp) {
			 
			this.id=temp.carNum;
			
			
				
		},onReady(){
			this.$refs.common.showLoading()
			if(this.carhelp.getOpenId()){
				this.getDriverAttendance();
			}	
		}
	}
</script>

<style>

</style>
