<template>
	<view class="zd_container">
		<nav-bar :title="title"></nav-bar>
		<view class="zd_content">
			<view class="zd_wrapper">
				<view class="zd-row border-bottom">
					<view class="zd-col-7">
						<span class="filter_label">点位</span>
					</view>
					<view class="zd-col-24">
						<input type="text" class="filter_input" v-model="code" disabled>
					</view>
				</view>
			</view>
		</view>
		<view class="zd-row submit-bar">
			<button class="zd-col-11 button-default" @click="cancle">取消</button>
			<button class="zd-col-11 button-primary" :disabled="disabled" @tap="_updateTask('1')">允许取放</button>
		</view>
	</view>
</template>

<script>
	import NavBar from '@/components/NavBar.vue'
	import {updateTask} from '@/utils/getData2.js'
	export default {
		components: {
			NavBar
		},
		data() {
			return {
				title: '',
				code: 'QFQ_4',
				disabled: false
			};
		},
		onLoad (options) {
			this.title = options.title
		},
		methods: {
			selectChange (e) {
				this.index = e
				this.disabled = false
			},
			cancle () {
				this.index = ''
			},
			async _updateTask (type) {
				this.disabled = true
				try {
					let res = await updateTask(this.code, type)
					this.cancle()
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				} catch (err) {
					this.disabled = false
				}
			}
		}
	}
</script>

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