<template>
	<view class="container qualifications" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0' }">
		<tui-skeleton
			v-if="skeletonShow"
			backgroundColor="#fafafa"
			borderRadius="10rpx"
			:isLoading="true"
			:loadingType="5"
		></tui-skeleton>
		<view class="remarks-content" v-else>
			<template v-if="reportParams.clubId && reportParams.clubId > 0">
				<view class="list-view-title">
					<view class="list-view-h1"
						>机构名称:<text>{{ reportParams.clubName }}</text></view
					>
				</view>
				<view class="list-view-title">
					<view class="list-view-h1"
						>联系人:<text>{{ reportParams.linkMan }}</text></view
					>
				</view>
			</template>
			<template v-else>
				<view class="list-view-title">
					<view class="list-view-h1">咨询人：{{ reportParams.questionMan }}</view>
				</view>
			</template>
			<view class="list-view-title">
				<view class="list-view-h1">报备人：{{ reportParams.reportName }}</view>
			</view>
			<view class="list-view-title">
				<view class="list-view-h1">报备时间：{{ reportParams.addTime }}</view>
			</view>
			<view class="list-view-title" v-if="reportParams.productId"> <view class="list-view-h1">报备商品：</view> </view>
			<view class="tui-remarks-content" v-if="reportParams.productId">
				<view class="tui-remarks-goods">
					<view class="goods-image"> <image :src="reportParams.mainImage" mode=""></image> </view>
					<view class="goods-main">
						<view class="name"> {{ reportParams.productName }} </view>
						<view class="shop"> 供应商：{{ reportParams.shopName }} </view>
					</view>
				</view>
			</view>
			<view class="list-view-title">
				<view class="list-view-h1"
					>报备事由：<text>{{ reportParams.reportText }}</text></view
				>
			</view>
		</view>
	</view>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
import authorize from '@/common/config/authorize.js'

var isPreviewImg
export default {
	data() {
		return {
			isIphoneX: this.$store.state.isIphoneX,
			skeletonShow:true,
			productActions: [],
			reportParams: {},
			reportId: 0,
		}
	},
	onLoad(option) {
		console.log(option)
		this.reportId = option.reportId
		if(option.type === '1'){
			this.userReportDetails(this.reportId)
		}else{
			this.userReportVisitorDetails(this.reportId)
		}
		
	},
	methods: {
		...mapMutations(['login']),
		userReportDetails(reportId) {
			//注册机构报备详情
			this.UserService.userReportDetails({
				reportId: reportId
			})
				.then(response => {
					this.reportParams = response.data
					setTimeout(()=>{
						this.skeletonShow = false
					},500)
				})
				.catch(error => {
					this.$util.msg(error.msg, 2000)
				})
		},
		userReportVisitorDetails(reportId) {
			//未注册咨询人报备详情
			this.UserService.userReportVisitorDetails({
				reportId: reportId
			})
				.then(response => {
					this.reportParams = response.data
					setTimeout(()=>{
						this.skeletonShow = false
					},500)
				})
				.catch(error => {
					this.$util.msg(error.msg, 2000)
				})
		}
	},
	onShow() {}
}
</script>

<style lang="scss">
page {
	height: auto;
	background: #ffffff;
}
.remarks-content {
	width: 100%;
	height: auto;
	box-sizing: border-box;
	padding: 0 24rpx;
	padding-bottom: 80rpx;
	.list-view-title {
		width: 100%;
		height: auto;
		margin-bottom: 16rpx;
		margin-top: 40rpx;
		.list-view-h1 {
			line-height: 40rpx;
			font-size: $font-size-30;
			color: #333333;
			text-align: left;
			font-weight: bold;
			text {
				color: #666666;
				font-weight: normal;
			}
		}
	}
	.tui-remarks-content {
		width: 100%;
		height: auto;
		margin-bottom: 24rpx;
		.tui-remarks-goods {
			width: 100%;
			height: 180rpx;
			box-sizing: border-box;
			background-color: #f7f7f7;
			padding: 26rpx;
			border-radius: 6rpx;
			.goods-image {
				width: 128rpx;
				height: 128rpx;
				float: left;
				image {
					width: 128rpx;
					height: 128rpx;
					display: block;
					border-radius: 4rpx;
				}
			}
			.goods-main {
				width: 522rpx;
				height: 128rpx;
				box-sizing: border-box;
				padding: 0 32rpx;
				float: right;
				.name {
					width: 100%;
					height: 60rpx;
					box-sizing: border-box;
					line-height: 60rpx;
					color: #333333;
					text-overflow: ellipsis;
					overflow: hidden;
					display: -webkit-box;
					-webkit-line-clamp: 1;
					line-clamp: 1;
					-webkit-box-orient: vertical;
					font-size: 26rpx;
				}
				.shop {
					line-height: 60rpx;
					color: #999999;
					font-size: 26rpx;
				}
			}
		}
	}
	.list-view {
		width: 100%;
		height: auto;
		margin-top: 20rpx;
		.list-view-text {
			width: 100%;
			float: left;
			.input {
				width: 500rpx;
				height: 50rpx;
				box-sizing: border-box;
				line-height: 50rpx;
				color: #333333;
				text-overflow: ellipsis;
				overflow: hidden;
				display: -webkit-box;
				-webkit-line-clamp: 1;
				line-clamp: 1;
				-webkit-box-orient: vertical;
				float: left;
				font-size: 26rpx;
			}
			.delbtn {
				width: 96rpx;
				height: 44rpx;
				border-radius: 8rpx;
				font-size: $font-size-24;
				color: #FF5B00;
				line-height: 44rpx;
				text-align: center;
				float: left;
				&.down {
					color: #1890f9;
				}
			}
		}
	}
}
</style>
