<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">
						<search-box v-model="val1" @handleChange="handleChange" />
					</view>
				</view>
			</view>
			<view class="zd_wrapper grid-wraper">
				<view class="slide_new">
					<table>
						<thead>
							<tr>
								<th>木箱号</th>
								<th>木箱编码</th>
								<th>点位</th>
								<th>木箱规格</th>
							</tr>
						</thead>
						<tbody>
							<tr v-for="(e, i) in dataList" :key="i">
								<td>{{e.box_no}}</td>
								<td>{{e.material_name}}</td>
								<td>{{e.struct_code}}</td>
								<td>{{e.material_code}}</td>
							</tr>
						</tbody>
					</table>
				</view>
			</view>
			<!-- <uni-load-more color="#007AFF" iconType="circle" :status="status" :icon-size="14" :content-text="contentText" v-if="dataList.length > 0"/> -->
		</view>
		<view class="zd-row submitbar">
			<button class="zd-col-6 btn-submit btn-default letter-30" @tap="clearUp">清空</button>
			<button class="zd-col-15 btn-submit btn-success letter-30" @tap="toSure">查询</button>
		</view>
		<!-- <up-top ref="UT" :scrollTop="top"></up-top> -->
	</view>
</template>

<script>
	import NavBar from '@/components/NavBar.vue'
	import SearchBox from '@/components/SearchBox.vue'
	import UpTop from '@/components/upTop.vue'
	import {woodenBoxPoint} from '@/utils/getData1.js'
	export default {
		components: {
			NavBar,
			SearchBox,
			UpTop
		},
		data() {
			return {
				title: '',
				top: 0,
				val1: '',
				dataList: []
			};
		},
		onLoad (options) {
			this.title = options.title
		},
		methods: {
			handleChange (e) {
				this._woodenBoxPoint(e)
			},
			clearUp () {
				this.val1 = ''
				this.dataList = []
			},
			toSure () {
				this._woodenBoxPoint()
			},
			async _woodenBoxPoint (e) {
				let res = await woodenBoxPoint(this.val1)
				if (res.content.length) {
					this.dataList = [...res.content]
				}
			}
		}
	}
</script>

<style lang="stylus" scoped>
.slide_new table .bgred td:first-child
	background-image linear-gradient(to right,#E9B451,#fff)
.slide_new table .bgyellow td:first-child
	background-image linear-gradient(to right,#c2cde3,#fff)
</style>
