<!--
 * @Title: 
 * @Description: 人工关闭工单
 * @Author: swp
 * @Date: 2022-08-24 10:49:21
 * @LastEditors: 
 * @LastEditTime: 2022-08-24 10:49:21
-->
<template>
	<view class="wrap">
		<uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
			@clickLeft="toBack">
			<view style="width: 100%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
				<text style="color: white;font-size: 1rem;">{{title}}</text>
			</view>
		</uni-nav-bar>
		<view class="container">
			<uni-section title="关闭任务说明" type="circle">
				<view style="margin-top: 20px;margin-bottom: 40px;;padding-left: 10px;padding-right: 10px;">
					<uni-easyinput :styles="inputStyles" prefixIcon="search" v-model="orderDesc" placeholder="请输入处理意见">
					</uni-easyinput>
				</view>
			</uni-section>
			<view style="margin-top: 10px;margin-bottom: 10px;padding-left: 10px;padding-right: 10px;">
				<button style="background-color: lightcoral;" type="default"
					@click="onCheckOrderSubmitClick()">提交任务</button>
			</view>
		</view>
	</view>
</template>

<script>
	import http from '@/http/api.js';

	export default {
		components: {

		},
		onLoad(option) {
			this.id = option.id;
		},
		data() {
			return {
				id: '',
				orderDesc: '',
				title: '人工关闭维修任务',
				inputStyles: {
					color: '#808080',
					borderColor: '#d3d3d3'
				},
				checkOrderForm: {
					id: '',
					rtuName: '',
					rtuCode: '',
					orderDesc: '',
				},
				query: {}
			}
		},
		computed: {

		},
		onShow() {

		},
		created() {

		},
		methods: {
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			onCheckOrderSubmitClick() {
				let that = this;
				this.checkOrderForm['id'] = this.id;
				this.checkOrderForm['orderDesc'] = this.orderDesc;
				let postData = Object.assign(this.checkOrderForm, this.query);
				http.request({
					url: '/galaxy-business/rtu/check/order/close',
					method: 'POST',
					params: postData
				}).then(res => {
					if (res.success) {
						uni.showModal({
							content: '人工关闭维修任务操作成功!',
							showCancel: true,
							success(res) {
								if (res.confirm) {
									that.toBack();
								}
							}
						});
					} else {
						uni.showModal({
							content: '人工关闭维修任务操作失败!',
							showCancel: true,
							success(res) {

							}
						});
					}
				}).catch(err => {
					console.log(err)
				})
			},
		}
	}
</script>

<style>
	/* page {
		background-color: rgb(240, 242, 244);
	} */
</style>

<style lang="scss" scoped>
	.container {
		padding: 0 0 150rpx;
	}
</style>
