<template>
	<view class='center'>
		<view style="background: linear-gradient( 180deg, #1FCA7C 0%, #F2F2F2 100%);">
			<u-navbar :autoBack="true" :title="data.type==1?'投诉详情':'表扬详情'" placeholder="true" bgColor="transparent"
				leftIconColor="#FFF" :title-style="{color: '#FFF'}">
			</u-navbar>
			<view class="h-300 flex flex-row-between v-center  ml-60 mr-35">
				<view class="flex-column" style="color: #1BB871;">
					<text class="fs-52">{{data.type==1?'今日投诉':'今日表扬'}}</text>
					<text class="fs-30">{{data.type==1?'投诉详情我知道':'表扬详情我知道'}}</text>
				</view>
				<image class="h-225 w-225" src="/pagesMain/static/icon_bxxq.png"></image>
			</view>
		</view>

		<view class="overflow-y"
			style="background: white;border-top-left-radius: 20rpx;border-top-right-radius: 20rpx;margin-top: -20rpx;">
			<scroll-view scroll-y style="height: 100%;">
				<view class="mar-20">
					<view class="flex-column-center">
						<image class="w-40 h-40 mr-10" src="/static/icon_gd.png"></image>
						<text style="flex: 1;text-align: left;"
							class="fs-32 fw-700">{{data.type==1?'我要投诉':'我要表扬'}}</text>
						<text
							style="font-size: 24rpx;color: #EEA616;">{{data.state==1?'待处理':data.state==2?'已完成':data.state==3?'已关闭':''}}</text>
					</view>
					<view class="flex-column br-12 fs-28 mt-30" style="background: #EBF5F0;">
						<view class="flex pad-30">
							<text class="fw-700 w-200" style="text-align: left;">业主姓名：</text>
							<text>{{$wskj.isNullStr(userinfo.name)}}</text>
						</view>
						<view class="flex pad-30">
							<text class="fw-700 w-200" style="text-align: left;">业主房间号</text>
							<text>{{$wskj.isNullStr(userinfo.room)}}</text>
						</view>
						<view class="flex pad-30">
							<text class="fw-700 w-200" style="text-align: left;">业主手机号</text>
							<text>{{userinfo.mobile}}</text>
						</view>
					</view>
					<view class="flex-column-center fs-32 fw-700  mt-30">
						<image class="w-10 h-40 mr-15" style="background-color: #1FCA7C;"></image>
						<text>{{data.type==1?'投诉信息':'表扬信息'}}</text>
					</view>
					<view class="flex-column br-12 fs-28 mtb-30 pad-30" style="background: #EBF5F0;">
						<text style="text-align: left;">{{data.commentDescription}}</text>
					</view>
					<scroll-view scroll-x="true" scroll-with-animation="true">
						<view class="flex">
							<view class="w-140 h-140 mr-15"
								v-for="(itemImg, index2) in $wskj.splitList(data.commentImg)" :key="index2">
								<image class="w-140 h-140" :src="itemImg"></image>
							</view>
						</view>
					</scroll-view>
					<view class="flex mt-20 fs-28 h-40 lh-40">
						<text class="fw-700">{{data.type==1?'投诉时间:':'表扬时间:'}}</text>
						<text>{{data.createTime}}</text>
					</view>
					<view v-if="data.state==3" class="flex pad-30 br-12 mt-30" style="background: #EBF5F0;">
						<text class="fw-700 w-200" style="text-align: left;">关闭时间：</text>
						<text>{{data.closeTime}}</text>
					</view>
				</view>
			</scroll-view>
		</view>
		<view class="h-140 pt-20">
			<view @click="onCz('关闭报修')" class="full-btn" style="color: #FF682D;" v-if="data.state==1">
				{{data.type==1?'关闭投诉':'关闭表扬'}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: 0,
				reason: '',
				submitShow: false,
				images: '',
				id: '',
				data: {},
				userinfo: '',
			};
		},
		onLoad(e) {
			this.id = e.id
			this.userinfo = uni.getStorageSync("userInfo")
			this.getData()
		},
		methods: {
			getData() {
				const params = {
					url: '/api/comment/' + this.id,
					method: 'GET',
				}
				this.$request(params).then(res => {
					this.data = res.data
				})
			},
			gb() {
				const params = {
					url: '/api/comment/cancel/' + this.id,
					method: 'PUT',
				}
				this.$request(params).then(res => {
					this.$wskj.toast('关闭成功')
					setTimeout(() => {
						this.$wskj.goBack(1)
					}, 600)
				})
			},
			onCz(e) {
				if (e == "关闭报修") {
					this.gb();
					return
				}
			},
		},
	};
</script>

<style scoped>
	.center {
		height: 100vh;
		display: flex;
		flex-direction: column;
		background: white;
	}
</style>