<!--运输车辆管理-->
<template>
    <view id="transportPerson">
		<view class="tabTitle">
			<view class="tabTitle_li" @tap="tabClick(index)"  :key="index" v-for="(item,index) in tabText">
				<view :class="{on:curTab==index}" class="tabTitle_text">{{item}}</view>
			    <view :class="{on:curTab==index}" class="tabTitle_across"></view>
			</view>
		</view>
		<scroll-view scroll-y @scrolltolower="scrollGet" class="scroll-box">
		    <view class="list" >
				<view class="list_li" @click="detailClick(item)" v-for="(item,index) in dataList">
					<!-- <img class="for-back-img" src="@/images/Version3.0/icon_ysry_ry.png"> -->
					<text class="list_li_text">{{item.carCode}}</text>
					<text class="list_li_text2"></text>
					<text class="list_li_text3" v-if="item.pastDue==1">证照过期</text>
				</view>
			</view>
		</scroll-view>
		<view class="empty" v-if="pageType==2">
			<img class="for-back-img" src="@/pages_supplier/images/Version3.0/img_ysrygl_zwsj.png">
			<view>暂无数据</view>
		</view>
		<view class="sub_btn" @click="addBtn()">新增运输车辆</view>
	</view>
</template>

<script>
	import { transportCarList } from '@/api/index.js'
    export default {
        name: "transportPerson",
        data() {
            return {

				pageType:1,
				//列表请求参数
				params:{
				   isAudit:1,//是否已经审核（0=未审核,1=已经审核,2=审核未通过
				},
				userType:uni.getStorageSync('userType'),
				curTab:0,
				tabText:['已通过','待审核','未通过'],
                dataList:[],
            }
        },
        onLoad() {

        },
        onShow() {

        },
		mounted(){
			 this.getList();
		},
        methods: {
			//顶部tab点击
			tabClick(index) {
				this.curTab = index;
				if(index==0){
					this.params.isAudit=1
				}else if(index==1){
					this.params.isAudit=0
				}else if(index==2){
					this.params.isAudit=2
				}

			    this.getList();
			},
			//滚动加载事件
			scrollGet(){
			    if(this.getData.getType){
			        this.getData.pageNum += 1;
			        this.getList();
			    }
			},
			addBtn(){
				uni.redirectTo({
				    url:'/pages_supplier/transportCar/transportCarAdd?status=0'
				});
			},
			detailClick(d){
				let id=d.id;
				uni.redirectTo({
				    url:'/pages_supplier/transportCar/transportCarDetail?id='+id
				});
			},
			//获取列表数据
			async getList(){
			    let _this = this;
				_this.dataList=[];
			    const {data} = await transportCarList(_this.params)
			    if(data.code==200){
					let res=data.data;
					if(res.length>0){
						this.dataList=res
						this.pageType=1
					}else{
						this.pageType=2
					}

			    }
			},

        }
    }
</script>

<style lang="stylus" scoped>
    #transportPerson {
        height: 100%;
        width: 100%;
		flex :1;
        display flex;
        flex-direction column
        overflow hidden
		.tabTitle{
			display flex;
			width:100%;
			height: 100rpx;
			background: #fff;
			margin-bottom 16rpx;

			.tabTitle_li{
				width:146rpx;
				text-align center;
				margin-top: 16rpx;
				.tabTitle_text{
					display: inline-block;
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
					line-height: 64rpx;
					&.on{
						color:#0183FA;
					}
				}
				.tabTitle_across{
					width: 50rpx;
					height: 6rpx;
					background: #0183FA;
					border-radius: 3rpx;
					margin-left 50rpx;
					display none;
					&.on{
						display block;
					}
				}

			}


		}
        .scroll-box{
        // flex:1;
         overflow-y scroll;
		 .list{
			 background: #FFFFFF;
			 border-radius: 20rpx;
			 margin: 0 20rpx;
			 padding: 0 20rpx;
			 box-sizing: border-box;
			 .list_li{
				 height: 110rpx;
				 display: flex;
				 align-items: center;
				 border-bottom:1px solid #f5f5f5;
				 >img{
					 width: 60rpx;
					 height: 60rpx;
				 }
				 >text{
					 font-size: 28rpx;
					 font-family: PingFang SC;
					 font-weight: 500;
					 color: #333333;
					 line-height: 28rpx;
					 display: inline-block;

				 }
				 .list_li_text{
					 margin-left: 30rpx;
					 width: 146rpx;
				 }
				 .list_li_text2{
					 margin-left: 30rpx;
					 width: 322rpx;
				 }
				 .list_li_text3{
					 font-size: 24rpx;
					 font-family: PingFang SC;
					 font-weight: 500;
					 color: #FF3131;
					 line-height: 24rpx;
				 }
			 }
		 }
     }
		.empty{
			text-align: center;
			margin-top: 316rpx;
			>img{
				width: 336rpx;
				height: 222rpx;
				margin-left: 208rpx;
			}
			>view{
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #E0E0E0;
				line-height: 30rpx;
				margin-top: 48rpx;
			}
		}
		/* 按钮 */
		.sub_btn{
			width: 650rpx;
			height: 100rpx;
			background: #0183FA;
			border-radius: 20rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			line-height: 100rpx;
			text-align: center;
			margin-left: 50rpx;
			position: fixed;
			bottom:30rpx;
			z-index: 1000;
		}
	}
</style>
