<template>
	<view class="container club-info">
		<tui-skeleton
			v-if="skeletonShow"
			backgroundColor="#fafafa"
			borderRadius="10rpx"
			:isLoading="true"
			:loadingType="5"
		></tui-skeleton>
		<template v-else>
			<view class="info-header clearfix" v-if="clubInfo.describe">
				<view class="pp"
					>描述：<text>{{ clubInfo.describe }}</text></view
				>
			</view>
			<view class="info-content clearfix">
				<view class="info-title">
					<view class="info-title-left">
						<view
							>机构资料：<text>{{ clubInfo.userIdentity === 2 ? '资质机构' : '普通机构' }}</text></view
						>
					</view>
					<view class="info-title-right">
						<view v-if="clubInfo.spType === 0">待分配销售</view>
						<view v-else>已分配销售：{{ saleName }}</view>
					</view>
				</view>
				<view class="info-main">
					<view class="info-h1">注册信息</view>
					<view class="info-p"
						>联系人：<text>{{ clubInfo.linkMan }}</text></view
					>
					<view class="info-p"
						>手机号：<text>{{ clubInfo.contractMobile }}</text></view
					>
				</view>
				<view class="info-main" v-if="clubInfo.userIdentity === 2">
					<view class="info-h1">升级信息</view>
					<view class="info-p"
						>机构名称：<text>{{ clubInfo.name }}</text></view
					>
					<view class="info-p"
						>机构简称：<text>{{ clubInfo.shortName }}</text></view
					>
					<view class="info-p"
						>邮箱：<text>{{ clubInfo.contractEmail }}</text></view
					>
					<view class="info-p"
						>联系地址：<text>{{ clubInfo.provincialAddress }}{{ clubInfo.address }}</text></view
					>
					<view class="info-p"
						>营业执照编号：<text>{{ clubInfo.socialCreditCode }}</text></view
					>
					<view class="info-p">营业执照:</view>
					<view class="info-img"><image :src="clubInfo.businessLicense" alt=""/></view>
					<view class="info-p">门头照:</view>
					<view class="info-img"><image :src="clubInfo.shopPhoto" alt=""/></view>
					<view class="info-p"
						>机构类型：<text>{{ clubInfo.firstClubType | FirstFormat }}</text></view
					>
					<view class="info-p">医疗许可证：</view>
					<view class="info-img"><image :src="clubInfo.medicalPracticeLicense" alt=""/></view>
					<view class="info-p"
						>科室：<text>{{ clubInfo.secondClubType | TwoFormat }}</text></view
					>
					<view class="info-p"
						>主营内容：<text>{{ clubInfo.mainProduct }}</text></view
					>
				</view>
				<view class="info-main">
					<view class="info-h1">其他信息</view>
					<view class="info-p"
						>固定电话：<text>{{ clubInfo.contractPhone ? clubInfo.contractPhone : '无' }}</text></view
					>
					<view class="info-p"
						>传真：<text>{{ clubInfo.fax ? clubInfo.fax : '无' }}</text></view
					>
					<view class="info-p"
						>公司介绍：<text>{{ clubInfo.profile ? clubInfo.profile : '无' }}</text></view
					>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
export default {
	data() {
		return {
			skeletonShow: true,
			clubId: 0,
			saleName: '',
			clubInfo:{}
		}
	},
	filters: {},
	onLoad(option) {
		this.clubId = option.clubId
		this.userClubRecordLinkage(this.clubId)
	},
	filters: {
		FirstFormat: function(type) {
			//处理金额
			let name = ''
			switch (type) {
				case 1:
					name = '医美'
					break
				case 2:
					name = '生美'
					break
				case 3:
					name = '项目公司'
					break
				case 4:
					name = '个人'
					break
				case 5:
					name = '其他'
					break
			}
			return name
		},
		TwoFormat: function(type) {
			//处理金额
			let text = ''
			switch (type) {
				case 1:
					text = '诊所'
					break
				case 2:
					text = '门诊'
					break
				case 3:
					text = '医院'
					break
			}
			return text
		}
	},
	methods: {
		userClubRecordLinkage() {
			//查询机构信息
			console.log('=========<查询机构信息>===========')
			this.SellerService.userClubRecordLinkage({ clubId: this.clubId })
				.then(response => {
					this.clubInfo = response.data.club
					this.saleName = response.data.saleName
					setTimeout(() => {
						this.skeletonShow = false
					}, 1000)
				})
				.catch(error => {
					this.isInvalid = true
				})
		}
	},
	onShow() {}
}
</script>

<style lang="scss">
page {
	height: auto;
}
.club-info {
	width: 100%;
	.info-header {
		width: 100%;
		height: auto;
		padding: 24rpx;
		float: left;
		box-sizing: border-box;
		background-color: #ffffff;
		.pp {
			width: 100%;
			font-size: 26rpx;
			line-height: 44rpx;
			font-weight: bold;
			color: #333333;
			text {
				font-size: 26rpx;
				color: #666666;
				font-weight: normal;
				line-height: 66rpx;
			}
		}
	}
	.info-content {
		width: 100%;
		height: auto;
		float: left;
		box-sizing: border-box;
		padding: 0 24rpx;
		background-color: #ffffff;
		.info-title {
			width: 100%;
			height: 68rpx;
			border-bottom: 1px solid #f0f0f0;
			.info-title-left {
				width: 50%;
				height: 68rpx;
				font-size: 30rpx;
				font-weight: bold;
				color: #333333;
				float: left;
				line-height: 68rpx;
				text {
					display: inline-block;
					padding: 0 16rpx;
					line-height: 40rpx;
					background-color: #fff2d5;
					font-size: 24rpx;
					border-radius: 20rpx;
					color: #e4aa43;
					text-align: center;
					margin-left: 16rpx;
					font-weight: normal;
				}
			}
			.info-title-right {
				width: 50%;
				height: 68rpx;
				float: right;
				line-height: 68rpx;
				font-size: 24rpx;
				color: #999999;
				text-align: right;
			}
		}
		.info-main {
			width: 100%;
			height: auto;
			.info-h1 {
				width: 100%;
				box-sizing: border-box;
				padding: 0 24rpx;
				position: relative;
				line-height: 80rpx;
				font-size: 30rpx;
				color: #333333;
				&:before {
					content: '';
					width: 6rpx;
					height: 24rpx;
					background-color: #e15616;
					position: absolute;
					left: 0;
					top: 30rpx;
				}
			}
			.info-p {
				width: 100%;
				box-sizing: border-box;
				padding: 0 24rpx;
				position: relative;
				line-height: 66rpx;
				font-size: 30rpx;
				color: #999999;
				text {
					color: #333333;
				}
			}
			.info-img {
				width: 200rpx;
				height: 200rpx;
				image {
					width: 200rpx;
					height: 200rpx;
					display: block;
					margin-left: 24rpx;
					border: 1px dashed #e2e2e2;
				}
			}
		}
	}
}
</style>
