<template>
	<view class="container-body">
		<view class="storebox x-bc">
			<view class="x-f" style="align-items: flex-start;">
				<image class="logo" :src="storeInfo.logoUrl" mode="aspectFill"></image>
				<view class="storebox-r" @click="goStoreDetail">
					<view class="storename ellipsis2">{{storeInfo.storeName}}</view>
					<view class="storedesc">24小时营业  月售{{storeInfo.salesCount|| 0}}</view>
				</view>
			</view>
		</view>
		<view class="storeInfo title">基础信息</view>
		<view class="storeInfo-item x-bc">
			<view class="label">名称</view>
			<view class="val">{{storeInfo.fullName|| ''}}</view>
		</view>
		<view class="storeInfo-item x-bc">
			<view class="label">电话</view>
			<view class="val">{{storeInfo.sendPhone|| ''}}</view>
		</view>
		<view class="storeInfo-item x-bc">
			<view class="label">地址</view>
			<view class="val">{{storeInfo.address|| ''}}</view>
		</view>
		<view class="storeInfo title">资质信息</view>
		<view class="storeInfo-item x-bc">
			<view class="label">营业执照</view>
			<view class="val x-f">
				<u-image
					v-if="storeInfo.businessLicense"
					shape="square" 
					lazyLoad 
					:src="storeInfo.businessLicense" 
					width="100%" 
					mode="widthFix" 
					radius="6"
					@click="previewImage('businessLicense')"
				></u-image>
				<view v-else>暂未上传</view>
			</view>
		</view>
		<view class="storeInfo-item x-bc" v-if="storeInfo.medicalDevice2">
			<view class="label">2类器械生产备案</view>
			<view class="val x-f">
				<u-image
					v-if="storeInfo.medicalDevice2"
					shape="square" 
					lazyLoad 
					:src="storeInfo.medicalDevice2" 
					width="100%" 
					mode="widthFix" 
					radius="6"
					@click="previewImage('medicalDevice2')"
				></u-image>
				<view v-else>暂未上传</view>
			</view>
		</view>
		<view class="storeInfo-item x-bc" v-if="storeInfo.medicalDevice1">
			<view class="label">1类医疗器械备案</view>
			<view class="val x-f">
				<u-image
					v-if="storeInfo.medicalDevice1"
					shape="square" 
					lazyLoad 
					:src="storeInfo.medicalDevice1" 
					width="100%" 
					mode="widthFix" 
					radius="6"
					@click="previewImage('medicalDevice1')"
				></u-image>
				<view v-else>暂未上传</view>
			</view>
		</view>
		<view class="storeInfo-item x-bc" v-if="storeInfo.medicalDevice3">
			<view class="label">3类器械经营许可证</view>
			<view class="val x-f">
				<u-image
					v-if="storeInfo.medicalDevice3"
					shape="square" 
					lazyLoad 
					:src="storeInfo.medicalDevice3" 
					width="100%" 
					mode="widthFix" 
					radius="6"
					@click="previewImage('medicalDevice3')"
				></u-image>
				<view v-else>暂未上传</view>
			</view>
		</view>
		<view class="storeInfo-item x-bc" v-if="storeInfo.foodLicense">
			<view class="label">食品经营许可证</view>
			<view class="val x-f">
				<u-image
					v-if="storeInfo.foodLicense"
					shape="square" 
					lazyLoad 
					:src="storeInfo.foodLicense" 
					width="100%" 
					mode="widthFix" 
					radius="6"
					@click="previewImage('foodLicense')"
				></u-image>
				<view v-else>暂未上传</view>
			</view>
		</view>
		<view class="storeInfo-item x-bc" v-if="storeInfo.medicalLicense">
			<view class="label">医疗机构执业许可证</view>
			<view class="val x-f">
				<u-image
					v-if="storeInfo.medicalLicense"
					shape="square" 
					lazyLoad 
					:src="storeInfo.medicalLicense" 
					width="100%" 
					mode="widthFix" 
					radius="6"
					@click="previewImage('medicalLicense')"
				></u-image>
				<view v-else>暂未上传</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {storeDetail} from '@/api/index.js'
	export default {
		data() {
			return {
				storeId:'',
				storeInfo: {},
			}
		},
		onLoad(option) {
			this.storeId = option.storeId
			this.getStoreInfo()
		},
		methods: {
			getStoreInfo() {
				storeDetail(this.storeId).then(res=>{
					if(res.code==200) {
						this.storeInfo =res.data || {}
					}
				})
			},
			previewImage(type) {
				uni.previewImage({
					current: 0,
					urls: [this.storeInfo[type]]
				});
			},
		}
	}
</script>

<style>
	page {
		background-color: #fff;
	}
</style>
<style scoped lang="scss">
	.container-body {
		padding: 0 32rpx;
		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 {
				color: #222;
			}
		}
	}
	.title {
		font-family: PingFang SC, PingFang SC;
		font-weight: 600;
		font-size: 30rpx;
		color: #222222;
		padding: 24rpx 0;
	}
	.storebox {
		padding: 26rpx 0;
		font-family: PingFang SC, PingFang SC;
		color: #222;
		.logo {
			width: 150rpx;
			height: 150rpx;
			background: #222;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			margin-right: 26rpx;
		}
		.storename {
			font-weight: 500;
			font-size: 32rpx;
		}
		.storedesc {
			margin-top: 12rpx;
			font-weight: 400;
			font-size: 22rpx;
		}
		.storebox-r {
			flex: 1;
			overflow: hidden;
		}
	}
</style>