<template>
	<view class="page">
		<pyh-nv ref="nv" :config="nvConfig"></pyh-nv>
		<view class="listBox" :style="{'padding-top':(pageTop+'px')}">
			<view class="content">

				<view class="message-list">
					<view class="titleall-box">
						<view class="titleall-left">
							<view class="titleall-left-line"></view>任务信息
						</view>
					</view>
					<view class="info-box">
						<view class="info-box-list">
							<view class="info-box-width">
								<view>{{info.taskName}}</view>
								<view class="info-box-small">任务名称</view>
							</view>
							<view class="info-box-width">
								<view>{{info.pileId}}</view>
								<view class="info-box-small">任务目标</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view class="yellow">{{info.taskStatus}}</view>
								<view class="info-box-small">任务状态</view>
							</view>
							<!-- 	<view class="info-box-width">
						<view>{{info.publisher?info.publisher:'-'}}</view>
						<view class="info-box-small">任务负责人</view>
					</view> -->
							<view class="info-box-width">
								<view>日常维护</view>
								<view class="info-box-small">任务类别</view>
							</view>
							<!-- 		<view class="info-box-width">
						<view>{{info.publisher}}</view>
						<view class="info-box-small">任务地点</view>
					</view> -->
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view>{{$u.timeFormat(info.sendTime, 'yyyy-mm-dd')}}</view>
								<view class="info-box-small">发布时间</view>
							</view>

							<view class="info-box-width">
								<view>{{info.taskTime}}</view>
								<view class="info-box-small">任务时间</view>
							</view>
						</view>
						<!-- 				<view class="info-box-list">
					<view class="info-box-width">
						<view>3级</view>
						<view class="info-box-small">任务优先级</view>
					</view>

					<view class="info-box-width">
						<view class="yellow">{{info.taskStatus}}</view>
						<view class="info-box-small">任务状态</view>
					</view>
				</view> -->
						<!-- 				<view class="info-box-list">
					<view class="info-box-width">
						<view>日常维护</view>
						<view class="info-box-small">任务类别</view>
					</view>
				</view> -->
						<view class="info-box-list">
							<view class="info-box-width width100">
								<view class="info-box-small">任务内容</view>
								<view class="info-box-list-sm">
									<rich-text :nodes="info.taskContent"></rich-text>
									<!-- 这里有相关备注这里有相关备注这里有相关备注，这里有相关备注这里有相关备注，这里有相关备注这里有相关备注。 -->
								</view>
							</view>
						</view>
					</view>
				</view>

				<!-- 			<view class="skip-btn">
				<view class="cart-add" @click="maptaskdetailcancel">
					<image src="../../static/btn3.png"></image>
				  <text>任务取消申请</text>
				</view>
				<view class="buy-at" @click="maptaskdetailcomplete">
					<image src="../../static/btn1.png"></image>
				  <text>任务完成情况上报</text>
				</view>
			</view> -->

			</view>
		</view>
		<view class="bottom" v-if="info.taskStatus == '未处理'">
			<view class="bottom-two">
				<view class="bottom-two-list" @click="mapdoorplatesuccess">
					<view class="bottom-two-list-img"><image src="../../static/btn1.png"></image></view>
					<view class="bottom-two-list-text" style="text-align: center;width: 100%;">确认处理</view>
				</view>
				<view class="bottom-two-list" @click="gopath('/pages/declaration/declaration1?id='+ info.pileId)">
					<view class="bottom-two-list-img"><image src="../../static/map2.png"></image></view>
					<view class="bottom-two-list-text">添加巡检记录</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				OrderType: 0,
				nvConfig: {
					title: "任务详情",
					bgColor: "#ffffff",
					color: "#000000",
					fixedAssist: {
						hide: true,
					},
				},
				info: {},
			};
		},
		onPageScroll(e) {
			this.$refs.nv.pageScroll(e)
		},
		computed: {
			pageTop() {
				return parseInt(88 * uni.getSystemInfoSync().windowWidth / 750) + uni.getSystemInfoSync().statusBarHeight
			}
		},
		onLoad(params) {
			// this.OrderType = params.type;

			this.info = JSON.parse(params.info)
			console.log(this.info);
			this.gain(this.info.id)
		},
		methods: {
			gopath(e) {
				uni.navigateTo({
					url: e
				})
			},
			gain(e) {
				this.API.getwdrwlistdetail(e).then(res => {
					console.log(res);
					this.info = res.data

				})
			},
			mapdoorplatesuccess() {
				this.info.taskStatus = '已处理'
				this.API.removewdrwlistdetail(this.info).then(res => {
					console.log(res);
					if (res.code == 200) {
						uni.showToast({
							icon: 'success',
							title: '确认成功'
						})
					} else {
						this.info.taskStatus = '未处理'
					}

				})
			},
			maptaskdetailcancel() {
				uni.navigateTo({
					url: '/pages/maptaskdetailcancel/maptaskdetailcancel',
				})
			},
			maptaskdetailcomplete() {
				uni.navigateTo({
					url: '/pages/maptaskdetailcomplete/maptaskdetailcomplete',
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	@import 'maptaskdetail.scss';
</style>