<template>
	<view class="app-content">
		<view class="header">
			<view class="log" @tap="fall"></view>{{ navname }}
		</view>
		<view class="nav">
			<view :class="action === index ? 'nav_lists': 'nav_list'" v-for="(item, index) in list" :key="index"
				@tap="lop(index)">{{item.name}}</view>
		</view>
		<view class="content">
			<view class="content_bootom" style="top:0">
				<scroll-view scroll-y="true" class="scroll-Y">
					<view class="up" v-for="(item, index) in listdata" :key="index">
						<view class="list"  @tap="toDetail(item.luggageNum)">
							<p>{{ item.luggageNum }}</p>
						</view>
						<view class="normal">
							{{item.carrierFlightsDate!=null?item.carrierFlightsDate:"-"}}
						</view>
						<view class="normal">
							{{item.carrierFlights!=null?item.carrierFlights:"-"}}
						</view>
						
					</view>
				</scroll-view>
			</view>
		</view>
	</view>
</template>
<script>
	import Nav from '../../components/header/nav.vue'
	export default {
		data() {
			return {
				navname: '我的记录',
				action: 0,
				list: [{
					name: '分拣',
					type: 'SORT'
				}, {
					name: '装车',
					type: 'LOAD'
				}, {
					name: '装机',
					type: 'INFL'
				}, {
					name: '卸机',
					type: 'UNLOAD'
				}, {
					name: '到达',
					type: 'ARRIVED'
				}, {
					name: '提取',
					type: 'extract'
				}],
				listdata: [],
				nodeCode:null
			}
		},
		created(option) {},
		onLoad(option) {
			if(option.nodeCode){
				this.list.map((item,index) =>{
					if(item.type==option.nodeCode){
						this.action = index
					}
				})
				this.nodeCode = option.nodeCode
				this.getList()
			}
			else{
				this.nodeCode = this.list[this.action].type
				this.getList()
			}
		},
		onUnload() {},
		onShow() {
			if(this.nodeCode){
				this.getList()
			}
		},
		mounted() {},
		components: {
			Nav
		},
		methods: {
			uplist() {
				uni.redirectTo({
					url: "/pages/loadingdetails/index"
				})
			},
			lop(index) {
				this.action = index
				this.nodeCode = this.list[index].type
				this.getList()
			},
			async getList() {
				let data = {
					"serviceId": 3008,
					"page": 1,
					"pageSize": 9999,
					"dataContent": [{
						"agentNumber": this.$storage.getJson("users").user_name,
						"nodeCode": this.nodeCode
					}]
				}
				await this.$http.httpPost('/openApi/query', data).then(res => {
					if (res.code == "0") {
						this.listdata = res.returnData
					} else {
						uni.showToast({
							icon: 'none',
							title: "查询信息失败",
							duration: 5000
						});
					}
				})
			},
			toDetail(luggageNum){
				uni.navigateTo({
					url: "/pages/detail/index?luggageNum="+luggageNum
				})
			},
			fall() {
				uni.navigateBack({
					delta:1
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.app-content {
		height: 100vh;
		overflow: hidden;
		>.header {
			width: 100%;
			height: 4.375rem;
			display: flex;
			justify-content: center;
			align-items: center;
			// background: rgba(49,85,99,1);
			color: rgb(16, 17, 22);
			font-family: Noto Sans SC;
			font-size: 1rem;
			position: relative;

			>.log {
				width: .375rem;
				height: .75rem;
				font-size: .75rem;
				position: absolute;
				left: 1.5rem;
				background: url('../../static/ico@1x.png') no-repeat;
				background-size: 100% 100%;
			}

			>.up {
				width: .8456rem;
				height: .8456rem;
				position: absolute;
				right: 1.5rem;
				background: url('../../static/search.png') no-repeat;
				background-size: 100% 100%;
				// color: rgb(37, 121, 160);
				// font-family: Noto Sans SC;
				// font-size: .875rem;
				// font-weight: 500;
			}
		}

		>.nav {
			height: 2rem;
			display: flex;
			align-items: center;
			padding: 0 .75rem 0 .75rem;

			>.nav_list {
				margin: 0 .75rem 0 .75rem;
				color: rgb(16, 17, 22);
				font-family: Noto Sans SC;
				font-size: 14px;
				height: 100%;
			}

			>.nav_lists {
				margin: 0 .75rem 0 .75rem;
				color: rgb(37, 121, 160);
				font-family: Noto Sans SC;
				font-size: 14px;
				font-size: 14px;
				height: 100%;
				border-bottom: 2px solid rgb(37, 121, 160);
			}
		}

		>.content {
			width: 100%;
			height: calc(100vh - 3.5rem);
			position: relative;
			// margin-top: 2.5rem;
			// overflow: hidden;
			// background: rgb(49, 85, 99);
			>.content_top {
				width: 100%;
				// background: rgb(49, 85, 99);
				padding-bottom: 1.3125rem;

				>.craid {
					// width: 100%;
					height: 5.625rem;
					padding: 0 2.5625rem 0 2.5625rem;
					display: flex;
					justify-content: space-between;
					flex-wrap: wrap;
					align-items: center;

					>.craid_data {
						display: flex;
						flex-direction: column;
						justify-content: center;
						align-items: start;

						>p {
							color: rgb(255, 255, 255);
							font-family: Noto Sans SC;
							font-size: 18px;
							font-weight: 700;
						}

						>span {
							color: rgb(255, 255, 255);
							font-family: Noto Sans SC;
							font-size: 13px;
							font-weight: 500;
						}
					}

					>.aircraft {
						width: 1.75rem;
						height: 1.75rem;
						background: url('../../static/hang.png') no-repeat;
						background-size: 100% 100%;
					}
				}
			}

			>.content_bootom {
				width: 100%;
				// height: calc(100vh - 20.9375rem - 4.375rem);
				padding-bottom: 0;
				position: absolute;
				bottom: 0;
				top: 20.75rem;
				// border-radius: 6px 6px 0px 0px;
				overflow: hidden;
				background: rgb(255, 255, 255);
				padding: 0 10px;
				box-sizing: border-box;
				padding-left: 1rem;
				.up {
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: space-between;
					border-bottom: 1px solid rgb(238, 238, 238);
					box-sizing: border-box;
					// transform: all 3s;
					>.down_up {
						width: .875rem;
						height: .875rem;
						background: url('../../static/xia.png') no-repeat;
						background-size: 100% 100%;
					}
					
					>.error{
						color:red
					}
					>.normal{
						color:#4682b4 
					}
					>.list {
						position: relative;
						height: 3rem;
						display: flex;
						align-items: center;
						transform: all 3s;
						right: 0;
						color: rgb(0, 0, 0);
						font-family: Noto Sans SC;
						font-size: 16px;
						font-weight: 500;
					}
				
					>.delete {
						width: 3.75rem;
						height: 3.75rem;
						background: rgb(237, 101, 101);
						display: flex;
						align-items: center;
						justify-content: center;
						position: relative;
						right: -3.75rem;
						transform: all 3s;
				
						>.log {
							width: .875rem;
							height: .875rem;
							background: url('../../static/vector@1x.png') no-repeat;
							background-size: 100% 100%;
						}
					}
				}
				
				.scroll-Y {
					// height: calc(100% - 2.5rem - 2.75rem - 2.25rem - 2.25rem);
					height: calc(100% - 2.5rem - 2.75rem);
				}

				.but {
					width: 20.5625rem;
					height: 2.5rem;
					background: linear-gradient(179.10deg, rgba(51, 161, 165, 1.00) 11.326%, rgba(59, 111, 142, 1.00) 119.032%, rgba(59, 111, 142, 1.00) 119.032%, rgba(59, 111, 142, 1.00) 119.032%);
					border-radius: .25rem;
					color: rgb(255, 255, 255);
					font-family: Noto Sans SC;
					font-size: 1rem;
					margin: 0 auto;
					display: flex;
					align-items: center;
					justify-content: center;
					margin-top: 0.25rem;
					margin-bottom: 2.25rem;
				}
			}
		}
	}
</style>