<template>
	<view class="container-body">
		<view class="box">
			<view class="storeInfo title">基础信息</view>
			<view class="storeInfo-item x-start">
				<view class="label" style="width: 4rem;">公司全称</view>
				<view class="val">{{storeInfo.fullName|| ''}}</view>
			</view>
			<view class="storeInfo-item x-start">
				<view class="label" style="width: 4rem;">联系电话</view>
				<view class="val">{{storeInfo.sendPhone|| ''}}</view>
			</view>
			<view class="storeInfo-item x-start">
				<view class="label" style="width: 4rem;">详细地址</view>
				<view class="val">{{storeInfo.address|| ''}}{{storeInfo.enterpriseAddress||''}}</view>
			</view>
			<view class="storeInfo-item x-start">
				<view class="label" style="width: 4rem;">经营范围</view>
				<view id="descbox-desc" :class="showDes|| !showExpandText? 'opacity descbox-desc':'descbox-desc' " :style="{height: isExpand ? 'auto': '84rpx'}">
					{{storeInfo.businessScope|| ''}}
					<!-- <view class="expand x-ac">
						{{!isExpand&&showExpandText ? '展开':'收起'}}
						<u-icon name="arrow-down" color="#333" size="14"></u-icon>
						<u-icon name="arrow-up" color="#333" size="14"></u-icon>
					</view> -->
				</view>
			</view>
		</view>
		<view class="box mb20">
			<view class="storeInfo title">资质信息</view>
			<view class="storeInfo-item mb20">
				<view class="label mb20">营业执照</view>
				<view class="val x-f">
					<u-image
						v-if="storeInfo.businessLicense"
						shape="square" 
						lazyLoad 
						:src="storeInfo.businessLicense" 
						width="600rpx"
						height="auto"
						mode="widthFix" 
						radius="6"
						@click="previewImage('businessLicense')"
					></u-image>
					<view v-else>暂未上传</view>
				</view>
			</view>
			<view class="storeInfo-item mb20" v-if="storeInfo.medicalDevice2">
				<view class="label" mb20>2类器械生产备案</view>
				<view class="val x-f">
					<u-image
						v-if="storeInfo.medicalDevice2"
						shape="square" 
						lazyLoad 
						:src="storeInfo.medicalDevice2" 
						width="600rpx"
						height="auto"
						mode="widthFix" 
						radius="6"
						@click="previewImage('medicalDevice2')"
					></u-image>
					<view v-else>暂未上传</view>
				</view>
			</view>
			<view class="storeInfo-item mb20" v-if="storeInfo.medicalDevice1">
				<view class="label mb20">1类医疗器械备案</view>
				<view class="val x-start">
					<u-image
						v-if="storeInfo.medicalDevice1"
						shape="square" 
						lazyLoad 
						:src="storeInfo.medicalDevice1" 
						width="600rpx"
						height="auto"
						mode="widthFix" 
						radius="6"
						@click="previewImage('medicalDevice1')"
					></u-image>
					<view v-else>暂未上传</view>
				</view>
			</view>
			<view class="storeInfo-item mb20" v-if="storeInfo.medicalDevice3">
				<view class="label mb20">3类器械经营许可证</view>
				<view class="val x-f">
					<u-image
						v-if="storeInfo.medicalDevice3"
						shape="square" 
						lazyLoad 
						:src="storeInfo.medicalDevice3" 
						width="600rpx"
						height="auto"
						mode="widthFix" 
						radius="6"
						@click="previewImage('medicalDevice3')"
					></u-image>
					<view v-else>暂未上传</view>
				</view>
			</view>
			<view class="storeInfo-item mb20" v-if="storeInfo.foodLicense">
				<view class="label mb20">食品经营许可证</view>
				<view class="val x-f">
					<u-image
						v-if="storeInfo.foodLicense"
						shape="square" 
						lazyLoad 
						:src="storeInfo.foodLicense" 
						width="600rpx"
						height="auto"
						mode="widthFix" 
						radius="6"
						@click="previewImage('foodLicense')"
					></u-image>
					<view v-else>暂未上传</view>
				</view>
			</view>
			<view class="storeInfo-item mb20" v-if="storeInfo.medicalLicense">
				<view class="label mb20">医疗机构执业许可证</view>
				<view class="val x-f">
					<u-image
						v-if="storeInfo.medicalLicense"
						shape="square" 
						lazyLoad 
						:src="storeInfo.medicalLicense" 
						width="600rpx"
						height="auto"
						mode="widthFix" 
						radius="6"
						@click="previewImage('medicalLicense')"
					></u-image>
					<view v-else>暂未上传</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:['storeInfo','source'],
		data() {
			return {
				showDes: false,
				showExpandText: false,
				isExpand: true,
				textHeight: 0, //文本高度
			}
		},
		methods: {
			previewImage(type) {
				uni.previewImage({
					current: 0,
					urls: [this.storeInfo[type]]
				});
			},
			getDescHeight() {
				return
				this.$nextTick(() => {
					const query = uni.createSelectorQuery().in(this);
					query
						.select("#descbox-desc")
						.boundingClientRect((data) => {
							this.textHeight = data.height
							this.isExpand = this.textHeight > uni.upx2px(84) ? false : true
							this.showExpandText = this.textHeight >= uni.upx2px(84) ? true : false
							this.showDes = true
						})
						.exec();
				})
			},
		}
	}
</script>


<style scoped lang="scss">
	.mb20 {
		margin-bottom: 20rpx;
	}
	.box {
		padding: 0 32rpx 26rpx 32rpx;
		background-color: #fff;
	}
	.opacity {
		position: relative !important;
		opacity: 1 !important;
		z-index: 1 !important;
	}
	.descbox-desc {
		color: #222;
		font-weight: 400;
		font-size: 28rpx;
		color: #222222;
		word-break: break-all;
		overflow: hidden;
		line-height: 42rpx;
		position: absolute;
		opacity: 0;
		z-index: -1;
	}
	.container-body {
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 28rpx;
		color: #939599;
	}
	.businessLicense {
		height: 80rpx;
		width: 80rpx;
		border-radius: 8rpx;
	}
	.storeInfo {
		&-item {
			padding: 6rpx 0;
			.label {
				flex-shrink: 0;
			}
			.val {
				color: #222;
			}
		}
	}
	.title {
		font-family: PingFang SC, PingFang SC;
		font-weight: 600;
		font-size: 30rpx;
		color: #222222;
		padding: 24rpx 0;
	}
</style>