<template>
	<view class="suggestion-unit" >
		<view v-if="item.IMAGELIST_COUNT>0" class="image-box">
			<image mode="aspectFill" :src="imagePath"></image>
			<view class="image-count">{{item.IMAGELIST_COUNT}}</view>
		</view>
		<div class="suggestion-unit-body">
			<div class="suggestion-unit-title jc-between">
				<span class="span-999999">{{item.SUGGESTION_CREATEDATE}}</span>
				<span :class="item.SORTNUM == 1 ? 'span-999999' : 'status-text'">{{item.SORTNUM == 1? stateText[item.SUGGESTION_STATE]:'待我处理'}}</span>
			</div>
			<view v-if="item.IMAGELIST_COUNT>0">
				<p class="suggestion-text">{{item.SUGGESTION_REASON}}</p>
				<div class="suggestion-unit-info">
					<div class="serverpart-name">
						<span>{{item.SERVERPART_NAME}}</span>
					</div>
					<div class="severpart-base-text">

						<span>{{item.SUGGESTION_NAME}}</span>
					</div>
					<div class="severpart-base-text">

						<span>{{item.PHONE_NUMBER}}</span>
					</div>
				</div>
			</view>
			<view v-else>

				<p class="suggestion-text">{{item.SUGGESTION_NAME+'：'+item.SUGGESTION_REASON}}</p>
				<div class="suggestion-unit-info">
					<div class="serverpart-name">
						<span>{{item.SERVERPART_NAME}}</span>
					</div>

					<div class="severpart-base-text">

						<span>{{item.PHONE_NUMBER}}</span>
					</div>
				</div>
			</view>

		</div>

	</view>

</template>

<script>
	export default {
		props: {
			item: {
				type: Object,
				required: true
			},
		},
		data(){
			return {
				stateText: {
					1000: '待处理',
					2000: '待反馈',
					3000: '已处理',
				},
			}
		},
		computed:{
			imagePath() {
				if(this.item.IMAGELIST && this.item.IMAGELIST.length>0) {
					return this.item.IMAGELIST[0].IMAGE_URL
				}
			}
		}
	}
</script>

<style scoped>
	.suggestion-unit-title,
	.suggestion-unit-info,.suggestion-unit-info>div{
		display: flex;
		align-items: center;
	}

	.suggestion-unit {
		border-bottom: 1rpx solid #F0F0F0;
		padding: 28rpx 24rpx;
		display: flex;
		align-items: center;
		background-color: #fff;
	}
	.suggestion-unit image{
		height: 160rpx;
		width: 204rpx;
		border-radius: 8rpx;
		background-color: #f9f9f9;
		margin-right: 16rpx;
	}
	.suggestion-unit-title{
	
		margin-bottom: 10rpx
	}
	.suggestion-unit-title span{
		font-size: 24rpx;
	}
	
	.status-text {
		color: #E4764A;
	}
	.span-999999{
		color: #999999;
		
	}
	.suggestion-unit-body {
		min-width: 480rpx;
		flex: 1;
	}
	.suggestion-text {
		font-size: 30rpx;
		color: #000;
		height: 90rpx;

		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
		line-height: 1.5;

		/* margin: 8rpx 0; */
	}
	.suggestion-unit-info {
		margin-top: 10rpx;
		max-width: 480rpx;
	}
	.suggestion-unit-info .serverpart-name {
		padding: 0 12rpx;
		height: 32rpx;
		color: #0C8EE9;
		border: 1rpx solid #0C8EE9;
		border-radius: 20rpx;
		justify-content: center;
	}
	.suggestion-unit-info>div i{
		margin-right: 8rpx;
		width:24rpx;
		height: 24rpx;
	}
	.suggestion-unit-info>div span{
		/* color: #808080; */
		font-size: 24rpx;
	}
	.severpart-base-text {
		margin-left: 16px;
	}
	.severpart-base-text span {
		color: #666666;
	}
	.image-box {
		position: relative;
		padding-top: 12rpx;
	}
	.image-count {
		color: #fff;
		background-color: rgba(0,0,0,0.40);
		border-radius: 4rpx;
		padding: 0rpx 8rpx;
		position: absolute;
		font-size: 22rpx;
		right: 18rpx;
		bottom: 18rpx;
		line-height: 1.2;
	}
</style>
