<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">子托盘号</view>
					<view class="filter_input_wraper">
						<search-box
						v-model="val1"
						/>
					</view>
				</view>
				<view class="filter_item">
					<view class="filter_label">母托盘号</view>
					<view class="filter_input_wraper">
						<search-box
						v-model="val2"
						/>
					</view>
				</view>
			</view>
		</view>
		<view class="zd-row submit-bar_new">
			<button class="zd-col-5 submit-button_c" @tap="toClear">清空</button>
			<button class="zd-col-13 submit-button_new" :class="{'btn-disabled': !val1 || !val2}" :disabled="disabled" @tap="_zpjb">确认</button>
		</view>
	</view>
</template>

<script>
	import NavBar from '@/components/NavBar.vue'
	import SearchBox from '@/components/SearchBox.vue'
	import {zpjb} from '@/utils/getData1.js'
	export default {
		components: {
			NavBar,
			SearchBox
		},
		data() {
			return {
				dataList: [],
				disabled: false,
				val1: '',
				val2: '',
			};
		},
		methods: {
			textState (e) {
				switch (e) {
					case '1':
						return '创建'
						break
					case '2':
						return '创建完成'
						break
					case '3':
						return '下发'
						break
					case '4':
						return '执行中'
						break
					default:
						return ''
						break
				}
			},
			toClear () {
				this.val1 = ''
				this.val2 = ''
			},
			async _zpjb () {
				this.disabled = true
				if (!this.val1 || !this.val2) {
					this.disabled = false
					return
				}
				try {
					let res = await zpjb(this.val1, this.val2)
					this.disabled = false
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
					this.toClear()
				} catch (e) {
					this.disabled = false
				}
			}
		}
	}
</script>

<style lang="stylus">
</style>
