<template>
	<view class="page">
		<pyh-nv ref="nv" :config="nvConfig"></pyh-nv>
		<view class="listBox" :style="{'padding-top':(pageTop+'px')}">
			<view class="content" v-if="type == 1">
				<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 class="info-box-overflow">{{info.adminArea?info.adminArea:'-'}}</view>
								<view class="info-box-small">行政区划</view>
							</view>
							<view class="info-box-width">
								<view>{{info.placeNameCategory?info.placeNameCategory:'-'}}</view>
								<view class="info-box-small">地名类别</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.types?info.types:'-'}}</view>
								<view class="info-box-small">类型</view>
							</view>
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.communityName?info.communityName:'-'}}</view>
								<view class="info-box-small">小区名称</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.originalName?info.originalName:'-'}}</view>
								<view class="info-box-small">曾用名称</view>
							</view>
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.historyName?info.historyName:'-'}}</view>
								<view class="info-box-small">历史地名</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.totalArea?info.totalArea:'-'}}</view>
								<view class="info-box-small">总建筑面积</view>
							</view>
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.villageCommunity?info.villageCommunity:'-'}}
								</view>
								<view class="info-box-small">村社区</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.buildingCount?info.buildingCount:'-'}}</view>
								<view class="info-box-small">幢数</view>
							</view>
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.totalUnits?info.totalUnits:'-'}}</view>
								<view class="info-box-small">总户数</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view>{{info.validStartDate?info.validStartDate:'-'}}</view>
								<view class="info-box-small">有效起始时间</view>
							</view>
							<view class="info-box-width">
								<view>{{info.validEndDate?info.validEndDate:'-'}}</view>
								<view class="info-box-small">有效终止日期</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.developer?info.developer:'-'}}</view>
								<view class="info-box-small">开发商</view>
							</view>
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.romanLettersSpell?info.romanLettersSpell:'-'}}
								</view>
								<view class="info-box-small">罗马字母拼写</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view>{{info.establishTime?info.establishTime:'-'}}</view>
								<view class="info-box-small">设立时间</view>
							</view>
							<view class="info-box-width">
								<view>{{info.postalCode?info.postalCode:'-'}}</view>
								<view class="info-box-small">邮政编码</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.address?info.address:'-'}}</view>
								<view class="info-box-small">详细地址</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.administrativeRegion?info.administrativeRegion:'-'}}</view>
								<view class="info-box-small">所在</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.historicalEvolution?info.historicalEvolution:'-'}}</view>
								<view class="info-box-small">历史沿革</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.meaningOfPlaceNames?info.meaningOfPlaceNames:'-'}}</view>
								<view class="info-box-small">地名含义</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.originOfPlaceNames?info.originOfPlaceNames:'-'}}</view>
								<view class="info-box-small">地名来历</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.address?info.address:'-'}}</view>
								<view class="info-box-small">详细地址</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="content" v-else-if="type == 2">
				<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 class="info-box-overflow">{{info.adminArea?info.adminArea:'-'}}</view>
								<view class="info-box-small">行政区划</view>
							</view>
							<view class="info-box-width">
								<view>{{info.standardName?info.standardName:'-'}}</view>
								<view class="info-box-small">名称</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.originalName?info.originalName:'-'}}</view>
								<view class="info-box-small">曾用名称</view>
							</view>
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.streetRegistration?info.streetRegistration:'-'}}
								</view>
								<view class="info-box-small">街道\乡镇</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.length?info.length:'-'}}</view>
								<view class="info-box-small">长度</view>
							</view>
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.width?info.width:'-'}}
								</view>
								<view class="info-box-small">宽度</view>
							</view>
						</view>

						<view class="info-box-list">
							<view class="info-box-width">
								<view>{{info.validStartDate?info.validStartDate:'-'}}</view>
								<view class="info-box-small">有效起始时间</view>
							</view>
							<view class="info-box-width">
								<view>{{info.validEndDate?info.validEndDate:'-'}}</view>
								<view class="info-box-small">有效终止日期</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.nameHistory?info.nameHistory:'-'}}</view>
								<view class="info-box-small">地名历史</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.nameMeaning?info.nameMeaning:'-'}}</view>
								<view class="info-box-small">地名含义</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.startLocation?info.startLocation:'-'}}</view>
								<view class="info-box-small">开始位置</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.endLocation?info.endLocation:'-'}}</view>
								<view class="info-box-small">结束位置</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="content" v-else-if="type == 3">
				<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 class="info-box-overflow">{{info.adminArea?info.adminArea:'-'}}</view>
								<view class="info-box-small">行政区划</view>
							</view>
							<view class="info-box-width">
								<view>{{info.tallBuildName?info.tallBuildName:'-'}}</view>
								<view class="info-box-small">名称</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.originalName?info.originalName:'-'}}</view>
								<view class="info-box-small">曾用名称</view>
							</view>
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.layerNumber?info.layerNumber:'-'}}</view>
								<view class="info-box-small">层数</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.occupiesArea?info.occupiesArea:'-'}}</view>
								<view class="info-box-small">占地面积</view>
							</view>
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.developer?info.developer:'-'}}
								</view>
								<view class="info-box-small">开发商</view>
							</view>
						</view>

						<view class="info-box-list">
							<view class="info-box-width">
								<view>{{info.validStartDate?info.validStartDate:'-'}}</view>
								<view class="info-box-small">有效起始时间</view>
							</view>
							<view class="info-box-width">
								<view>{{info.validEndDate?info.validEndDate:'-'}}</view>
								<view class="info-box-small">有效终止日期</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.locationPoint?info.locationPoint:'-'}}</view>
								<view class="info-box-small">地理位置</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.describeContent?info.describeContent:'-'}}</view>
								<view class="info-box-small">描述</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>资料附件</view>
								<view style="margin-top: 20rpx;">
									<view v-for="(item,index) in info.imageData"
										:key="index"
										style="background-color: #F9FAFF;border: 1px solid #EAEDF5;border-radius: 10rpx;display: flex;justify-content: space-between;padding: 15rpx;margin-bottom: 15rpx;font-size: 25rpx;">
										<view
											style="width:80%;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 1;overflow: hidden;">
											资料附件{{index+1}}</view>
									</view>
						
								</view>
							</view>
						</view>
					</view>
					
				</view>
			</view>
			<view class="content" v-else-if="type == 4">
				<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 class="info-box-overflow">{{info.addressName?info.addressName:'-'}}</view>
								<view class="info-box-small">地名</view>
							</view>
							<view class="info-box-width">
								<view>{{info.applicationName?info.applicationName:'-'}}</view>
								<view class="info-box-small">申请人姓名</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view class="info-box-overflow">{{info.applicationPhone?info.applicationPhone:'-'}}
								</view>
								<view class="info-box-small">申请人电话</view>
							</view>

						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view class="info-box-overflow">{{info.map?info.map:'-'}}</view>
								<view class="info-box-small">经纬度</view>
							</view>

						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.address?info.address:'-'}}</view>
								<view class="info-box-small">详细地址</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view>{{info.remark?info.remark:'-'}}</view>
								<view class="info-box-small">备注</view>
							</view>
						</view>

					</view>
				</view>
			</view>
			<view class="content" v-else-if="type == 5">
				<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 class="info-box-overflow">{{info.communityName?info.communityName:'-'}}</view>
								<view class="info-box-small">小区名称</view>
							</view>
							<view class="info-box-width">
								<view>{{info.formerName?info.formerName:'-'}}</view>
								<view class="info-box-small">曾用名</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view class="info-box-overflow">
									{{info.historicalPlaceNames?info.historicalPlaceNames:'-'}}</view>
								<view class="info-box-small">历史地名</view>
							</view>
							<view class="info-box-width" style="width: 100%;" v-if="info.gridman">
								<view class="info-box-overflow">
									{{info.gridman?info.gridman:'-'}}</view>
								<view class="info-box-small">类型</view>
							</view>
						</view>
						<view class="info-box-list" v-if="info.doorNumberFile">
							<view class="info-box-width" style="width: 100%;">
								<view>门牌文件</view>
								<view style="margin-top: 20rpx;">
									<view v-for="(item,index) in info.doorNumberFile"
										:key="index"
										style="background-color: #F9FAFF;border: 1px solid #EAEDF5;border-radius: 10rpx;display: flex;justify-content: space-between;padding: 15rpx;margin-bottom: 15rpx;font-size: 25rpx;">
										<view
											style="width:80%;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 1;overflow: hidden;">
											门牌文件{{index+1}}</view>
									</view>

								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="content" v-else-if="type == 6">
				<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 class="info-box-overflow">{{info.name?info.name:'-'}}</view>
								<view class="info-box-small">路门牌名称</view>
							</view>
							<view class="info-box-width">
								<view>{{info.reportTime?info.reportTime:'-'}}</view>
								<view class="info-box-small">上报时间</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width">
								<view class="info-box-overflow">{{info.contactName?info.contactName:'-'}}</view>
								<view class="info-box-small">联系姓名</view>
							</view>
							<view class="info-box-width">
								<view>{{info.phone?info.phone:'-'}}</view>
								<view class="info-box-small">联系电话</view>
							</view>
						</view>
						<view class="info-box-list">
							<view class="info-box-width" style="width: 100%;">
								<view class="info-box-overflow">
									{{info.address?info.address:'-'}}</view>
								<view class="info-box-small">详细地址</view>
							</view>
			
						</view>
					</view>
				</view>
			</view>
			<view class="content" v-if="info.approvalOpinions">
				<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" style="width: 100%;">
								<view class="info-box-overflow">
									{{info.approvalOpinions?info.approvalOpinions:'-'}}</view>
							
							</view>
			
						</view>
					</view>
				</view>
			</view>
			<view class="content" v-if="info.handlingOpinions">
				<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" style="width: 100%;">
								<view class="info-box-overflow">
									{{info.handlingOpinions?info.handlingOpinions:'-'}}</view>
							
							</view>
			
						</view>
					</view>
				</view>
			</view>
			<view class="skip-btn" v-if="info.filePath" @click="downfile(info.filePath)">
				<view class="buy-at" >
					<image src="../../static/btn7.png"></image>
					<text>批复文件下载</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import BASE_URL from "@/common/config.js"
	export default {
		data() {
			return {
				type: null,
				BASE_URL,
				info: {},
				nvConfig: {
					title: "HC52454【单立桩】",
					bgColor: "#ffffff",
					color: "#000000",
					fixedAssist: {
						hide: true,
					},
				},
				markers: [],
				address: {
					// 纬度
					latitude: 29.99599,
					// 经度
					longitude: 104.13412
				},
			};
		},
		onPageScroll(e) {
			this.$refs.nv.pageScroll(e)
		},
		computed: {
			pageTop() {
				return parseInt(88 * uni.getSystemInfoSync().windowWidth / 750) + uni.getSystemInfoSync().statusBarHeight
			}
		},
		onLoad(params) {
			this.info = JSON.parse(params.cent)
			this.nvConfig.title = this.info.name
			console.log(params);
			this.type = params.type
			if (this.type == 5) {
				this.info.doorNumberFile = this.info.doorNumberFile.split(',')
			}
			if (this.type == 3) {
				this.info.imageData = this.info.imageData.split(',')
			}
		},
		methods: {
			downfile(e) {
				
				let that = this
				console.log(that.BASE_URL + e)
				let c1 = e.split('.')
				console.log(c1)
				uni.downloadFile({
					url: that.BASE_URL+e,
					header: {
						'content-type': "application/json",
					},
					// filePath: wx.env.USER_DATA_PATH + e,
					success: (res) => {
						console.log(res)
						if (res.statusCode === 200) {
							const savedFilePath = res.tempFilePath
							uni.openDocument({
								filePath: savedFilePath,
								fileType: c1[1], //注意：文件为pdf，类型为pdf
								showMenu: true,
								success: (response) => {
									console.log(response)
								},
								fail: (err) => {
									console.log(err)
									wx.hideLoading()
								}
							})
						} else {
							wx.hideLoading()
						}
					},
					fail: (err) => {
						console.log(err)
						wx.hideLoading()
						
					},
					complete: () => {
						wx.hideLoading()
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.listBox {
		position: relative;
		z-index: 1;
	}

	.content {
		width: 100%;
		// padding-bottom: 120rpx;
	}

	.topimg {
		margin: 25rpx;

		image {
			width: 100%;
			border-radius: 20rpx;
		}
	}

	.titleall-box {
		display: flex;
		justify-content: space-between;
		padding: 40rpx 20rpx 20rpx 0;

		.titleall-left {
			font-size: 32rpx;
			font-weight: bold;
			display: flex;
			align-items: center;

			.titleall-left-line {
				width: 14rpx;
				height: 36rpx;
				border-radius: 0 10rpx 10rpx 0;
				background-color: #667FFF;
				box-shadow: 0 0 10rpx 5rpx #d1d9ff;
				margin-right: 20rpx;
			}
		}
	}

	.message-list {
		background-color: #FFFFFF;
		border-radius: 20rpx;
		font-size: 26rpx;
		margin: 25rpx;

		.info-box {
			padding: 0 40rpx;
			border-radius: 20rpx;
			margin-bottom: 30rpx;

			.info-box-list {
				display: flex;
				align-items: center;
				border-bottom: 2rpx solid #ececec;
				padding-top: 30rpx;
				padding-bottom: 30rpx;

				.width100 {
					width: 100% !important;
				}

				.info-box-width {
					width: 50%;
					font-size: 30rpx;
					font-weight: bold;

					.info-box-overflow {
						width: 95%;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 1;
						overflow: hidden;
					}

					.info-box-small {
						font-size: 26rpx;
						color: #a8a8a8;
						font-weight: 500;
						margin-top: 10rpx;
					}

					.info-box-list-img {
						margin-top: 30rpx;

						image {
							width: 180rpx;
							height: 180rpx;
							border-radius: 20rpx;
						}
					}

					.info-box-list-sm {
						background-color: #F7F7F7;
						border-radius: 20rpx;
						font-size: 28rpx;
						color: #909090;
						font-weight: 500;
						width: 100%;
						padding: 20rpx;
						margin-top: 20rpx;
					}

					.green {
						color: #00D970;
					}
				}

				.serve {
					display: flex;
					justify-content: space-between;
					width: 100%;

					.serve-title {
						font-size: 30rpx;
						font-weight: bold;
					}

					.serve-right {
						font-size: 28rpx;
						text-align: right;
						color: #909090;

						.serve-right-top {
							margin-bottom: 20rpx;
						}
					}
				}
			}

			.info-box-list:last-child {
				border-bottom: 0;
			}
		}
	}

	.skip-btn {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 100rpx;
		
		position: fixed;
		bottom: 30rpx;

		.cart-add {
			display: flex;
			align-items: center;
			justify-content: center;
			width: 38%;

			image {
				width: 253rpx;
				height: 80rpx;
				box-shadow: 5rpx 10rpx 20rpx 0 #efefef;
				border-radius: 100rpx;
			}

			text {
				font-size: 30rpx;
				font-weight: bold;
				color: #262626;
				position: absolute;
				z-index: 1;
			}
		}

		.buy-at {
			display: flex;
			align-items: center;
			justify-content: center;
			width: 58%;

			image {
				width: 415rpx;
				height: 80rpx;
				box-shadow: 5rpx 10rpx 20rpx 0 #b7c8ff;
				border-radius: 100rpx;
			}

			text {
				font-size: 30rpx;
				font-weight: bold;
				color: #FFFFFF;
				position: absolute;
				z-index: 1;
			}
		}
	}
</style>