<template>
	<ComponentLoading class="outer form-body" :loading="loading">
		<view class="card">
			<view class="form-item view" v-for="(item) in formList" :key="item.label">
				<view class="label">{{item.label}}</view>
				<view class="value">{{ formData[item.value] }}</view>
			</view>
		</view>
		<Collapse title="受理条件">
			<view>{{ formData.sltj }}</view>
		</Collapse>
		<Collapse title="设定依据">
			<view>{{ formData.sdyj }}</view>
		</Collapse>
		<view class="card">
			<view class="form-item view">
				<view class="label">是否收费</view>
				<view class="value">{{ formData.sfsf }}</view>
			</view>
			<view class="form-item view">
				<view class="label">收费标准</view>
				<view class="value">{{ formData.sfbz }}</view>
			</view>
		</view>
		<Collapse title="收费依据">
			<view>{{ formData.sfyj }}</view>
		</Collapse>
		<Collapse title="申请材料">
			<view>{{ formData.sqcl }}</view>
		</Collapse>
		<view class="btn btn-one" @click="show">点击查看办理流程</view>
		<liucheng ref="liucheng" :liucheng="formData.bllc"></liucheng>
	</ComponentLoading>
</template>
<script>
	import {
		detailById
	} from '@/api/wjxxy.js'
	import ComponentLoading from '@/components/component-loading/index'
	import Collapse from '@/components/collapse/index.vue'
	import liucheng from '@/components/hz/liucheng.vue'
	export default {
		components: {
			ComponentLoading,
			Collapse,
			liucheng
		},
		data() {
			return {
				loading: false,
				formList: [{
						label: '事项类型',
						value: 'sxlx',
						type: 'text'
					}, {
						label: '行政层级',
						value: 'xzcj',
						type: 'text'
					}, {
						label: '法定时限',
						value: 'fdsx',
						type: 'text'
					}, {
						label: '承诺时限',
						value: 'cnsx',
						type: 'text'
					},
					// {
					// 	label: '受理机构',
					// 	value: '办事网点查询',
					// 	type: 'text'
					// }, 
					{
						label: '办件类型',
						value: 'bjlx',
						type: 'text'
					}, {
						label: '审批结果类型',
						value: 'spjglx',
						type: 'text'
					}, {
						label: '审批结果名称',
						value: 'spjgmc',
						type: 'text'
					},
				],
				formData: {},

			}
		},
		onLoad(option) {
			const param = JSON.parse(option.param)
			console.log('param param param', param)
			if (param.dictValue) {
				uni.setNavigationBarTitle({
					title: param.dictValue
				})
				this.loading = true
				detailById(param.id).then(res => {
					console.log('detailById detailById detailById', res)
					let data = JSON.parse(res.data.dataList[0].fieldValues[0].value)
					this.formData = data.data
					// this.formData = res.data
				}).finally(() => {
					this.loading = false
				})
			} else {
				uni.setNavigationBarTitle({
					title: param.label
				})
				this.loading = true
				detailById(param.value).then(res => {
					console.log('detailById detailById detailById', res)
					let data = JSON.parse(res.data.dataList[0].fieldValues[0].value)
					this.formData = data.data
					// this.formData = res.data
				}).finally(() => {
					this.loading = false
				})
			}

		},
		methods: {
			show() {
				this.$refs.liucheng.show()
			}
		}
	}
</script>
<style lang="scss" scoped>
	@import '@/static/style/page-form.scss';
</style>