<template>
	<u-loadmore v-if="flag" status="loading" :load-text="loadText" color="#C4CCD8" font-size="24" />
	<view v-else class="container-main">
		<view class="data-main">
			<view class="data-rows" style="padding-top: 0">
				<view class="data-lable">主体名称:</view>
				<view class="data-value">{{list.enterpriseName}}</view>
			</view>
			<view class="data-rows">
				<view class="data-lable">信用代码:</view>
				<view class="data-value">{{list.code}}</view>
			</view>
			<view class="data-rows">
				<view class="data-lable">经营性质:</view>
				<view class="data-value">{{list.manageproperty}}</view>
			</view>
			<view class="data-rows">
				<view class="data-lable">经营类型:</view>
				<view class="data-value">{{list.manageType}}</view>
			</view>
			<view class="data-rows">
				<view class="data-lable">产品名称:</view>
				<view class="data-value">{{list.productName}}</view>
			</view>
			<view class="data-rows">
				<view class="data-lable">保费合计</view>
				<view class="data-value data-value-color">{{list.totalPremium}}</view>
			</view>
			<view class="data-rows">
				<view class="data-lable">投保状态</view>
				<view class="data-value">{{list.status}}</view>
			</view>
			<view class="data-rows" style="align-items: flex-start">
				<view class="data-lable">保险期间</view>
				<view class="data-value">
					{{ list.insurancePeriod}}至{{ list.insurancePeriodEnd}}
				</view>
			</view>
			<view class="data-rows"
				style="flex-direction: column; align-items: flex-start;border: 0; padding-bottom: 0;">
				<view class="data-lable" style="margin-bottom: 20rpx">投保附件</view>
				<view class="data-value data-img">
					<view class="u-line-1" style="color: rgb(41, 121, 255);font-size: 24rpx" @click="showFile(item)"
						v-for="(item,index) in list.appendix" :key="index">
						{{item}}
					</view>
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	import {
		getInsure
	} from '@/api/shianliaoning/insure.js'
	import config from '@/config.js'
	export default {
		data() {
			return {
				list: {
					enterpriseName: null
				},
				baseUrl: config.baseUrl,
				form: {},
				flag: true,
				loadText: {
					nomore: '已经到底了~',
					loading: '努力加载中'
				},
			};
		},
		//详情进入的请求
		onLoad(option) {
			this.getInfo(option.id)
		},
		methods: {
			showFile(url) {
				uni.setClipboardData({
					data: url,
					showToast: false,
					success: () => {
						uni.showToast({
							title: '已复制，请前往浏览器打开。',
							icon: 'none'
						})
					}
				})
				// uni.navigateTo({
				// 	url: `/sub-enterprise/toubao-xiangqing/toubao-file?url=${url}`
				// })
			},
			//预览图片
			viewIamge(url, index) {
				uni.previewImage({
					current: index,
					urls: url.split(','),
				})
			},
			//详情
			getInfo(id) {
				getInsure(id).then(res => {
					this.list = res.data
					this.list.appendix = this.list.appendix.split(',')
					this.flag = false
				})
			},
		}
	};
</script>

<style lang="scss" scoped>
	.container-main {
		box-sizing: border-box;
		padding: 20rpx;

		.data-main {
			min-height: 900rpx;
			border-radius: 16rpx;
			background: #fff;
			box-sizing: border-box;
			padding: 30rpx;
		}

		.data-rows {
			display: flex;
			align-items: center;
			border-bottom: 1rpx solid #ecf1f7;
			box-sizing: border-box;
			padding: 30rpx 0;

			.data-lable {
				width: 150rpx;
				font-size: 30rpx;
				font-weight: 400;
				color: #34373B;
			}

			.data-value {
				flex: 1;
				font-size: 30rpx;
				font-weight: 400;
				color: #616367;
			}

			.data-value-color {
				color: #86cd78;
			}

			.data-img {
				width: 100%;

			}
		}
	}
</style>