<template>
	<view class="suggestion-unit" >
	
		<div class="suggestion-unit-body">
			<div class="suggestion-unit-title">
				<span class="span-999999">{{item.SUGGESTION_CREATEDATE}}</span>
				<span :class="item.SORTNUM == 1 ? 'span-999999' : 'span-df7f42'">{{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 v-if="item.IMAGELIST_COUNT>0" class="image-box">
			<image mode="aspectFill" :src="imagePath"></image>
			<view class="image-count">{{item.IMAGELIST_COUNT}}</view>
		</view>
	</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;
	}
	.img-lxfs {
		background: url('../../../static/images/mbwa/lxfs.png') no-repeat center;
		background-size: contain;
	}
	
	.img-tsr {
		background: url('../../../static/images/mbwa/tsr.png') no-repeat center right;
		background-size: contain;
	}
	
	.suggestion-unit {
		border-bottom: 1upx solid #F0F0F0;
		padding: 20upx 24upx;
		display: flex;
		align-items: center;
		background-color: #fff;
	}
	.suggestion-unit image{
		height: 160upx;
		width: 204upx;
		border-radius: 8upx;
		background-color: #f9f9f9;
		margin-left: 16upx;
	}
	.suggestion-unit-title{
		justify-content: space-between;
	}
	
	.span-df7f42{
		color: #E4764A;
		font-size: 24upx;
	}
	.span-999999{
		color: #999999;
		font-size: 24upx;
	}
	.suggestion-unit-body {
		min-width: 480upx;
		flex: 1;
	}
	.suggestion-text {
		font-size: 30upx;
		color: #000;
		height: 96upx;
		
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
		line-height: 1.5;
		
		/* margin: 8upx 0; */
	}
	.suggestion-unit-info {
		/* justify-content: space-between; */
		max-width: 480upx;
	}
	.suggestion-unit-info .serverpart-name {
		padding: 0 12upx;
		height: 32upx;
		color: #0C8EE9;
		border: 1upx solid #0C8EE9;
		border-radius: 20upx;
		justify-content: center;
	}
	.suggestion-unit-info>div i{
		margin-right: 8upx;
		width:24rpx;
		height: 24rpx;
	}
	.suggestion-unit-info>div span{
		/* color: #808080; */
		font-size: 24upx;
	}
	.severpart-base-text {
		margin-left: 16px;
	}
	.severpart-base-text span { 
		color: #666666;
	}
	.image-box {
		position: relative;
	}
	.image-count {
		color: #fff;
		background-color: rgba(0,0,0,0.40);
		border-radius: 4upx;
		padding: 0upx 4upx;
		position: absolute;
		font-size: 22upx;
		right: 12upx;
		bottom: 20upx;
		line-height: 1.2;
	}
</style>
