<template>
	<view class="result-pages">
		<view class="results" v-if="pageData">
			<view class="results-head">
				<view>{{pageData.name}}-{{pageData.storeName}}-{{pageData.createDate}}</view>
				<view>任务的点检结果</view>
				<view>
					<view class="r-totals">{{pageData.totalTargetCount}}</view>
					<view>点检总数</view>
				</view>
			</view>
			<view class="results-items">
				<view>
					<view class="hg">{{pageData.passTargetCount}}</view>
					<view>合格项数</view>
				</view>
				<view>
					<view class="bhg">{{pageData.notPassTargetCount}}</view>
					<view>不合格项数</view>
				</view>
				<view>
					<view class="bsy">{{pageData.notWorkTargetCount}}</view>
					<view>不适用项数</view>
				</view>
			</view>
		</view>
		<view v-else>
			<view class="loadingStyle">
				<u-loading mode="circle"></u-loading>
				<view>正在加载</view>
			</view>
		</view>
		<view class="result-back">
			<u-button type="primary" @click="goBack">返回任务列表</u-button>
		</view>
	</view>
</template>

<script>
	import { getTaskDetail } from '@/api/task';
	export default {
		data() {
			return {
				pageData: null,
				id: ''
			}
		},
		onLoad(options) {
			this.id = options.id
			this.getDetail()
		},
		methods: {
			goBack(){
				uni.navigateBack()
			},
			getDetail(){
				getTaskDetail({id:this.id}).then(res => {
					this.pageData = res.data || null
				})
			}
		}
	}
</script>

<style lang="scss">
	.result-pages{
		.loadingStyle{
			text-align: center;
			padding: 10vh 0 10vh 0;
		}
		.results{
			padding: 20upx;
			background: #fff;
			margin-bottom: 25upx;
			.results-head{
				text-align: center;
				padding: 20upx 0;
				.r-totals{
					width: 160upx;
					height: 160upx;
					display: inline-block;
					line-height: 160upx;
					background: #ffaa00;
					border-radius: 100%;
					color: #fff;
					font-size: 60upx;
					margin: 20upx 0;
				}
			}
			.results-items{
				display: flex;
				align-items: center;
				border-top: 1px solid #eee;
				border-bottom: 1px solid #eee;
				padding: 20upx 0;
				margin-top: 20upx;
				> view{
					width: 33.3%;
					border-right: 1px solid #eee;
					text-align: center;
					&:last-child{
						border: 0;
					}
					>view{
						&:first-child{
							font-size: 40upx;
							margin-bottom: 10upx;
						}
					}
					.hg{
						color: #55aa00;
					}
					.bhg{
						color: #FF0000;
					}
					.bsy{
						color: #007AFF;
					}
				}
			}
		}
		.result-back{
			padding: 20upx 50upx;
		}
	}
</style>
