<template>
	<view class="consultItem">
		<view class="top_row">
			<view class="tag">咨询</view>
			<view class="status">{{dealStatus[item.complainDO.dealStatus]}}</view>
		</view>
		<view class="content">
			<view class="lab">问题描述</view>
			<view class="text">{{ item.complainDO.content }}</view>
		</view>
		<view class="border_bottom">
			<view class="dateBox">
				<view class="date" v-if="item.complainDO&&item.complainDO.createTime">创建时间：{{ $u.date(item.complainDO.createTime, 'yyyy-mm-dd')}}</view>
				<!-- <view class="date">处理时间：{{item.complainDO.createTime}}</view> -->
			</view>
			<view class="close_btn" v-if="item.complainDO.dealStatus==1" @click="closeFn">关闭</view>
		</view>
	</view>
</template>


<script>
	import { consultationClosed } from '@/config/api.js'
	export default {
		props: ['item'],
		data() {
			return {
				dealStatus: ['','未处理', '已处理', '已关闭' ],//处理状态：1、未处理，2已处理，3已关闭
			}
		},
		methods: {
			closeFn() {
				uni.showModal({
					content:'确定要关闭吗？',
					success: async (res)=> {
						if (res.confirm) {
							const result = await consultationClosed({id: this.item.complainDO.id})
							this.$u.toast('关闭成功')
							this.item.complainDO.dealStatus = 3
							this.$emit('closeFn')
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})
				
			}
		}
	}
</script>
<style lang="scss" scoped>
	.consultItem {
		width: 100%;
	  .top_row {
		  display: flex;
		  width: 100%;
		  height: 116rpx;
		  border-bottom: 2rpx dashed #E8E9EC;
		  justify-content: space-between;
		  align-items: center;
	    .tag {
			width: 120rpx;
			height: 60rpx;
			background: rgba(250,149,25,0.1);
			border-radius: 8rpx;
			text-align: center;
			line-height: 60rpx;
			font-size: 28rpx;
			color: #FA7919;
	    }
	
	    .status {
			font-size: 28rpx;
			color: $themC;
	    }
	  }
	
	  .content {
		  padding: 24rpx 0 50rpx 0;
		  font-size: 28rpx;
	    .lab {
			color: #ADADAD;
			margin-bottom: 4rpx;
	    }
	
	    .text {
	
	    }
	  }
	
	  .border_bottom {
		  border-top: 2rpx dashed #E8E9EC;
		  display: flex;
		  align-items: center;
		  justify-content: space-between;
		  padding: 30rpx 0 10rpx 0;
	    .dateBox {
	      .date {
			font-size: 28rpx;
			color: #ADADAD;
			margin-bottom: 16rpx;
	      }
	    }
	
	    .close_btn {
			width: 140rpx;
			height: 60rpx;
			background: #FFFFFF;
			border-radius: 8rpx;
			border: 2rpx solid #E8E9EC;
			text-align: center;
			line-height: 60rpx;
			color: #ADADAD;
			font-size: 28rpx;
	    }
	  }
	}
</style>