<!--申请详情-->
<template>
    <view id="transportPerson">
		<view class="title">
			<viwe class="title_l">申请时间：</viwe>
			<viwe class="title_r">{{createTime}}</viwe>
		</view>
		<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" v-for="(item,index) in dataList">
					<view class="list_li_l" >
						<view class="list_li_l_t">{{item.airName}}-{{item.configName}}</view>
						<view class="list_li_l_b">
							<img  src="@/pages_student/images/icon_14.png">
							<text>{{item.companyName}}</text>
						</view>
						<view v-if="pageType==2 || pageType==3" class="list_li_l_b">
							<img  src="@/pages_student/images/icon_aqbj_sj.png">
							<text v-if="pageType==2">入库时间：{{item.createTime}}</text>
							<text v-if="pageType==3">拒收时间：{{item.rejectionApplyTime}}</text>
						</view>
						<view  v-if="pageType==3" class="list_li_l_b">
							<img  src="@/pages_student/images/Version3.0/icon_sqxq_jsyy.png">
							<view class="cause"><text>拒收原因：</text><text>{{item.rejectionApplyRemark}}</text></view>
						</view>
					</view>
					<view v-if="pageType==0" class="list_li_r" @click="enterStockFun(item)">入库</view>
				</view>
			</view>
		</scroll-view>
		<view class="empty" v-if="pageType==4">
			<img class="for-back-img" src="@/pages_student/images/Version3.0/img_ysrygl_zwsj.png">
			<view>暂无数据</view>
		</view>
	</view>
</template>

<script>
	import { gasApplyDetailDrk,gasApplyDetailWps,gasApplyDetailYrk,gasApplyDetailYjs} from '@/api/index.js'
    export default {

        name: "transportPerson",
        data() {
            return {

				pageType:0,
				//列表请求参数
				getData:{
				    pageNum:1,
					pageSize:20,
				},
				userType:uni.getStorageSync('userType'),
				pageType:0,
				curTab:0,
				tabText:['待入库','未派送','已入库','已拒收'],
                dataList:[],
				status:null,//0添加1编辑
				id:null,
				createTime:'',
            }
        },
        onLoad(option) {
			let item=JSON.parse(decodeURIComponent(option.item));
			this.createTime=item.createTime;
			this.id=item.id;
        },
        onShow() {

        },
		mounted(){
		  this.getList()
		},
        methods: {
			//顶部tab点击
			tabClick(index) {
				this.curTab = index;
				this.pageType=index;
				this.dataList=[];
				if(this.pageType==0){
					this.getList()
				}else if(this.pageType==1){
					this.getList2()
				}else if(this.pageType==2){
					this.getList3()
				}else if(this.pageType==3){
					this.getList4()

				}

			},
			//待审核入库按钮
			enterStockFun(d){
				uni.redirectTo({
				    url:'/pages_student/gasApply/awaitStorage?item='+encodeURIComponent(JSON.stringify(d))
				});
			},
			//滚动加载事件
			scrollGet(){

			},
			//待入库
			async getList(){
				let _this = this;
				const {data} = await gasApplyDetailDrk({id:_this.id});
				if(data.code==200){
					if(data.code==200){
						let res = data.data.list;
						_this.dataList=res
					}
				}
			},
			//未派送
			async getList2(){
				let _this = this;
				const {data} = await gasApplyDetailWps({id:_this.id});
				if(data.code==200){
					if(data.code==200){
						let res = data.data.list;
						_this.dataList=res
					}
				}
			},
			//已入库
			async getList3(){
				let _this = this;
				const {data} = await gasApplyDetailYrk({id:_this.id});
				if(data.code==200){
					if(data.code==200){
						let res = data.rows;
						_this.dataList=res
					}
				}
			},
			//已拒收
			async getList4(){
				let _this = this;
				const {data} = await gasApplyDetailYjs({id:_this.id});
				if(data.code==200){
					if(data.code==200){
						let res = data.rows;
						_this.dataList=res
					}
				}
			},

        }
    }
</script>

<style lang="stylus" scoped>
    #transportPerson {
        height: 100%;
        width: 100%;
		flex :1;
        display flex;
        flex-direction column
        overflow hidden;
		.title{
			width: 750rpx;
			height: 118rpx;
			background: #FFFFFF;
			padding: 0 40rpx;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			.title_l{
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #999999;
				line-height: 118rpx;
			}
			.title_r{
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #333333;
				line-height: 118rpx;
			}
		}
		.tabTitle{
			display flex;
			width:100%;
			height: 100rpx;
			.tabTitle_li{
				width:146rpx;
				text-align center;
				.tabTitle_text{
					display: inline-block;
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
					line-height: 70rpx;
					&.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{
					 display: flex;
					 justify-content: space-between;
					 padding: 44rpx 0 28rpx 0;
					 box-sizing: border-box;
					 border-bottom:1px solid #f5f5f5;
					 .list_li_l{
						 flex: 1;
						 .list_li_l_t{
							 font-size: 28rpx;
							 font-family: PingFang SC;
							 font-weight: 500;
							 color: #333333;
							 line-height: 28rpx;

						 }
						 .list_li_l_b{
							 display: flex;
							 justify-content: flex-start;
							 margin-top:38rpx;
							 >img{
								 width: 28rpx;
								 height: 30rpx;
								 margin-right: 18rpx;
							 }
							 >text{
								font-size: 24rpx;
								font-family: PingFang SC;
								font-weight: 400;
								color: #666666;
								line-height: 30rpx;
							 }
							 .cause{
								 display: flex;
								 flex: 1;
								 >text{
									font-size: 24rpx;
									font-family: PingFang SC;
									font-weight: 400;
									color: #666666;
									line-height: 30rpx;
								 }
								 >text:nth-of-type(1){
								   width: 200rpx;
								 }
								 >text:nth-of-type(2){
									display: block;
								 }
							 }
						 }
					 }
					 .list_li_r{
						 font-size: 28rpx;
						 font-family: PingFang SC;
						 font-weight: 500;
						 color: #0183FA;
						 line-height: 28rpx;
						 margin-top: 26rpx;
					 }
				 }
			 }
     }
		.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;
			}
		}

	}
</style>
