<template>
	<view class="zd_container">
		<nav-bar 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" :focused="true" @handleChange="handleChange1" 
						/>
					</view>
				</view>
				<view class="filter_item">
					<view class="filter_label_wraper">
						<span class="filter_label">点位</span>
					</view>
					<view class="filter_input_wraper">
						<search-box v-model="val2"  @handleChange="handleChange2" />
					</view>
				</view>
			</view>
		</view>
		<view class="submit-bar">
			<button class="submit-button" :class="{'btn-disabled': !val1 || !val2}" :disabled="disabled1" @tap="_abnormalOut">解锁</button>
		</view>
	</view>
</template>

<script>
	import NavBar from '@/components/NavBar.vue'
	import SearchBox from '@/components/SearchBox.vue'
	import {abnormalOut} from '@/utils/getData1.js'
	export default {
		components: {
			NavBar,
			SearchBox
		},
		data() {
			return {
				val1: '',
				val2: '',
				disabled1: false
			};
		},
		methods: {
			handleChange1 (e) {
			},
			handleChange2 (e) {
			},
			async _abnormalOut () {
				this.disabled1 = true
				if (!this.val1 || !this.val2) {
					this.disabled1 = false
					return
				}
				try {
					let res = await abnormalOut(this.val1, this.val2)
					this.disabled1 = false
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				} catch (e) {
					this.disabled1 = false
				}
			}
		}
	}
</script>

<style lang="stylus">
	.zd_content
		padding-bottom 77rpx
	.slide_new table td:nth-child(1), .slide_new table th:nth-child(1)
		box-shadow 1px 0 2px rgba(0,0,0,.12)
	.bgyellow td
		background-color #E9B451
</style>
