<template>
	<view class="zd_container">
		<nav-bar :title="title"></nav-bar>
		<view class="zd_content">
			<view class="zd_wrapper">
				<view class="zd-row mgb20 border-bottom">
					<uni-icons type="arrow-up" size="18" color="#ff6a00"></uni-icons>
					<view class="zd-col-6 filter_label">{{$t('call.sp')}}</view>
					<view class="zd-col-18 relative">
						<input type="text" class="filter_input" v-model="sCode" disabled>
					</view>
				</view>
				<view class="zd-row">
					<uni-icons type="arrow-down" size="18" color="#ff6a00"></uni-icons>
					<view class="zd-col-6 filter_label">{{$t('call.ep')}}</view>
					<view class="zd-col-18 relative">
						<input type="text" class="filter_input" v-model="nCode" disabled>
					</view>
				</view>
			</view>
		</view>
		<view class="zd-row submit-bar">
			<button class="zd-col-11 button-primary" :disabled="disabled" @tap="_updateTask('1')">{{$t('take-and-place')}}</button>
			<button class="zd-col-11 button-primary" :disabled="disabled" @tap="_updateTask('2')">{{$t('allow-to-leave')}}</button>
		</view>
	</view>
</template>

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

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