<template>
	<view class="zd_container">
		<!-- <nav-bar title="空木箱库存"></nav-bar> -->
		<nav-bar :title="title"></nav-bar>
		<view class="zd_content">
			<view class="zd_wrapper">
				<view class="filter_item">
					<view class="filter_label_wraper">
						<span class="filter_label">木箱料号</span>
					</view>
					<view class="filter_input_wraper">
						<input type="text" class="filter_input" v-model="val1">
					</view>
				</view>
				<view class="filter_item">
					<view class="filter_label">{{$t('filter.wooden-box-description')}}</view>
					<view class="filter_input_wraper">
						<input type="text" class="filter_input" v-model="val2">
					</view>
				</view>
				<view class="filter_item">
					<view class="filter_label_wraper">
						<span class="filter_label">{{$t('filter.box-no')}}</span>
					</view>
					<view class="filter_input_wraper">
						<input type="text" class="filter_input" v-model="val3">
					</view>
				</view>
			</view>
			<view class="zd_wrapper grid-wraper">
				<view class="slide_new">
					<table>
						<thead>
							<tr>
								<th>{{$t('filter.box-no')}}</th>
								<th>木箱料号</th>
								<th>{{$t('filter.wooden-box-description')}}</th>
								<th>{{$t('filter.max-sub-num')}}</th>
								<th>{{$t('grid.wooden-box-length')}}</th>
								<th>{{$t('grid.wooden-box-width')}}</th>
								<th>{{$t('grid.wooden-box-height')}}</th>
								<th>{{$t('filter.vehicle-type')}}</th>
								<th>{{$t('grid.wooden-box-weight')}}</th>
								<th>{{$t('filter.storage-location')}}</th>
							</tr>
						</thead>
						<tbody>
							<tr v-for="(e, i) in dataList" :key="i">
								<td>{{e.box_no}}</td>
								<td>{{e.material_code}}</td>
								<td>{{e.material_name}}</td>
								<td>{{e.num}}</td>
								<td>{{e.box_length}}</td>
								<td>{{e.box_width}}</td>
								<td>{{e.box_high}}</td>
								<td>{{e.vehicle_type}}</td>
								<td>{{e.box_weight}}</td>
								<td>{{e.struct_code}}</td>
							</tr>
						</tbody>
					</table>
				</view>
			</view>
		</view>
		<view class="zd-row submitbar">
			<button class="zd-col-6 btn-submit btn-default" @tap="clearUp">{{$t('button.clear')}}</button>
			<button class="zd-col-15 btn-submit btn-success" @tap="_queryBoxIvt">{{$t('button.search')}}</button>
		</view>
		<up-top ref="UT" :scrollTop="top"></up-top>
	</view>
</template>

<script>
	import NavBar from '@/components/NavBar.vue'
	import UpTop from '@/components/upTop.vue'
	import {queryBoxIvt} from '@/utils/getData3.js'
	export default {
		components: {
			NavBar,
			UpTop
		},
		data() {
			return {
				title: '',
				top: 0,
				val1: '',
				val2: '',
				val3: '',
				dataList: []
			};
		},
		onPageScroll(e) {
			this.$refs.UT.topData(e.scrollTop)
		},
		onLoad (options) {
			this.title = options.title
		},
		methods: {
			selectChange (e) {
				this.index = e
			},
			async _queryBoxIvt () {
				try {
					let res = await queryBoxIvt(this.val1, this.val2, this.val3)
					this.dataList = [...res.data]
				} catch (e) {
					console.log(e)
				}
			},
			clearUp () {
				this.val1 = ''
				this.val3 = ''
				this.val2 = ''
				this.dataList = []
			}
		}
	}
</script>