<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" @handleChange="handleChange1"/>
					</view>
				</view>
			</view>
		</view>
		<view class="submit-bar">
			<button class="submit-button" :class="{'btn-disabled': !val1}" :disabled="disabled1" @tap="toSure">确认</button>
			<button class="submit-button" @tap="toCancle">取消</button>
		</view>
	</view>
</template>

<script>
	import NavBar from '@/components/NavBar.vue'
	import SearchBox from '@/components/SearchBox.vue'
	import {cleanVehicle} from '@/utils/getData1.js'
	export default {
		components: {
			NavBar,
			SearchBox
		},
		data() {
			return {
				val1: '',
				disabled1: false
			};
		},
		created () {
		},
		methods: {
			/** 选择器1 */
			inputChange1 (e) {
				// console.log('inputChange1:' + e)
			},
			/** 确定 */
			async toSure () {
				this.disabled1 = true
				if (!this.val1) {
					uni.showToast({
						title: '载具编码不能为空',
						icon: 'none'
					})
					this.disabled1 = false
					return
				}
				try {
					let res = await cleanVehicle(this.val1)
					this.disabled1 = false
					this.toCancle()
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				} catch (e) {
					this.disabled1 = false
				}
			},
			toCancle () {
				this.disabled1 = false
				this.val1 = ''
			}
		}
	}
</script>

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