<template>
	<view class="content">
		<view class="one">
			业务详情
		</view>
		<view class="two">
			1
		</view>
	</view>
</template>

<script setup lang="ts">
	import { getCurrentInstance, ref } from 'vue';
	//该依赖已内置不需要单独安装
	import { onLoad } from "@dcloudio/uni-app";
	// 请求接口
	const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
	// 基本信息
	const config = ref({ logo: [], file: [] });
	const id = ref('');
	const info = ref({});
	// 字典表
	const businessList = ref([]);
	onLoad(async (options) => {
		id.value = options && options.id
		uni.setNavigationBarTitle({
			title: options && options.name || '公证详情'
		});
		await searchConfig();
		await searchOther();
		await search();
	})
	// config信息
	const searchConfig = async () => {
		config.value = uni.getStorageSync('config');
	};
	// 其他查询信息
	const searchOther = async () => {
		let res;
		// 业务类型
		res = await $api(`dictData`, 'GET', { code: 'business', is_use: '0' });
		if (res.errcode === 0) businessList.value = res.data;
	};
	// 查询
	const search = async () => {
		if (id.value) {
			const res = await $api(`business/${id.value}`, 'GET', {});
			if (res.errcode === 0) {
				info.value = res.data
			} else {
				uni.showToast({
					title: res.errmsg || '',
					icon: 'error',
				});
			}
		}
	};
	// 数据处理
	const getDict = (data, model) => {
		let list;
		switch (model) {
			case 'business':
				list = businessList.value;
				break;
			default:
				break;
		}
		if (!list) return;
		const res = list.find((f) => f.value == data);
		return res?.label || '暂无';
	};
</script>
<style lang="scss" scoped>
	.content {
		display: flex;
		flex-direction: column;

		.one {
			display: flex;
			justify-content: center;
			margin: 2vw;
		}

		.two {
			padding: 2vw;

			.name {
				margin: 2vw 0;
				font-size: var(--font16Size);
			}

			.other {
				margin: 2vw 0;
				font-size: var(--font14Size);

				text {
					color: var(--f85Color);
				}
			}

			.list {
				text {
					margin: 2vw 0;
					font-size: var(--font14Size);
				}

				.list_1 {
					display: flex;
					font-size: var(--font12Size);
					color: var(--f85Color);
					margin: 1vw;
				}

				.content {
					margin: 1vw;
					font-size: var(--font14Size);
				}
			}
		}
	}
</style>