<template>
	<view class="content">
		
		<view class="mt40">
			
			<view class="re-card-p32" v-for="(ele,idx) in cars">
				<view class="re-empty" v-if="cars.length<1">
					<view>暂无数据</view>
				</view>
				<view class="flex-sb">
					<view>
						<image class="re-from-car" src="/static/icons/icon11.png"></image>
						<span>{{ele.carNo}}</span>
					</view>
					<view class="re-card-show" v-if="ele.status && +ele.status===0">
						<span style="color: limegreen;">系统审核中</span>
					</view>
					<view class="re-card-show" v-if="ele.status && +ele.status===2">
						<span style="color: #F40000;">未通过审核</span>
					</view>
				</view>
				<view class="flex-sb re-card-select mt20">
					<view>种类</view>
					<view class="flex" style="color: #9E9E9E;">
						<span v-if="!ele.type">请选择</span>
						<view style="color: #0d0d0d;" v-if="ele.type">{{ ele.type }}</view>
						<uni-icons v-if="!ele.type" type="down" size="28rpx" color="#9E9E9E"></uni-icons>
					</view>
				</view>
				<view class="flex-sb re-card-select">
					<view>轴数</view>
					<view class="flex" style="color: #9E9E9E;">
						<span v-if="!ele.mi">请选择</span>
						<view style="color: #0d0d0d;" v-if="ele.mi">{{ ele.mi }}</view>
						<uni-icons v-if="!ele.mi" type="down" size="28rpx" color="#9E9E9E"></uni-icons>
					</view>
				</view>
				<view class="flex-sb re-card-select">
					<view>上传证件</view>
					<view class="flex" style="color: #9E9E9E;" v-if="!ele.syximage" >
						<span>未上传</span>
						<uni-icons type="right" size="28rpx" color="#9E9E9E"></uni-icons>
					</view>
					<view class="flex" style="color: #0d0d0d;" v-if="ele.syximage" @click="clickCar(ele.id)">
						<span>查看证件信息</span>
						<uni-icons type="right" size="28rpx" color="#2d2d2d"></uni-icons>
					</view>
				</view>
			</view>
			
			<view class="re-end-pand b-fiexd">
				<button @click="clickA()">新增设备</button>
			</view>
		
		</view>
		
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				//cars: [{carNo: '湘·MUZ887', mi: '56米', info: {}, status: "0"},{carNo: '湘·MUZ888', mi: '42米', info: {}},{carNo: '湘·MUZ889', mi: '52米', info: {}, status: "2"}]
				cars: []
			}
		},
		onShow() {
			this.loadCars()
		},
		methods: {
			clickA(){
				uni.navigateTo({ url: `/pages/staff/car`})
			},
			clickCar(id){
				uni.navigateTo({ url: `/pages/base/showcar?id=${id}`})
			},
			loadCars(){
				this.$httpGet("/api/car/list", {enter_id: uni.getStorageSync("enter_id")}, (res) => {
					console.log('[/car/list]', res);
					if(res.data){
						this.cars = this.$utils.toArray(res.data)
					} 
				})
			},
		}
	}
</script>

<style>
	page {
		background-color: #F5F5F5;
	}
	
	.re-from-car{
		width: 72rpx;
		height: 60rpx;
		margin: 0 16rpx -20rpx 0;
	}
	
	.b-fiexd{
		min-height: 88rpx;
		width: calc(100vw); 
		padding: 30rpx 0;
		position: fixed; 
		left: 0; 
		bottom: 0; 
		box-shadow: -20rpx 10rpx 10rpx #000;
		background-color: #ffffff;
	}
</style>
