<template>
	<view>
		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="受理保养工单" @clickLeft="back"></uni-nav-bar>
		<view class="page-bottom-padding">

			<template v-if="worksheetInfo">
				<CellTip title="基本信息"> </CellTip>
				<DetailMain :detailsInfo="tourTallyDetailFn(worksheetInfo)"></DetailMain>
			</template>
		</view>
		<button class="btn-submit" @click="bindSubmit" :loading="loading">
			受理
		</button>
		<!-- <view class="btn-submit" @click="bindSubmit">
			受 理
		</view> -->
	</view>
</template>

<script>
	import {
		get,
		postJ
	} from "@/utils/api.js"
	import {
		tourTallyDetailFn
	} from '@/utils/common.js'
	import DetailMain from '@/components/DetailMain.vue'
	import TurnSendList from '@/components/TurnSendList.vue'
	import CellTip from '@/components/CellTip.vue'
	import CellInfo from '@/components/CellInfo.vue'
	export default {
		components: {
			DetailMain,
			TurnSendList,
			CellTip,
			CellInfo
		},
		data() {
			return {
				pageId: '',
				loading: false,
				worksheetInfo: null,
				tourTallyDetailFn,
				executorInfo: null,
				redeployCause: ''
			}
		},
		onLoad(options) {
			this.pageId = options.id;
			this.getInfo();
		},

		methods: {
			getInfo() {
				get(this.apiUrl + "/maintain/order/getDetail/" + this.pageId).then(res => {

					this.worksheetInfo = res.data;
				})
			},
			bindSubmit() {
				this.loading = true
				get(this.apiUrl + "/maintain/order/receiveOrder/" + this.pageId).then(res => {

					uni.showToast({
						title: "受理成功",
						icon: "none"
					})
					setTimeout(() => {
						this.loading = false
						uni.redirectTo({
							url: "../order/order"
						})
					}, 2000)
				})
				
			},

		}
	}
</script>

<style lang="scss" scoped>
	input {
		text-align: right;
		color: $uni-text-color-grey;
		font-size: $uni-font-size-base;
	}
</style>
