<template>
	<div>
		<common ref="common" @asynCallBack="asynCallBack"></common>
		<top-header :pageTitle="pageTitle"></top-header>

		<div class="mui-content margin60">
			<div class="mui-content-padded vongi-qingjiadt">
				<form class="mui-input-group">
					<div class="mui-input-row">
						<label>报修人</label>
						<span v-text="detail.name"></span>
					</div>
					<div class="mui-input-row">
						<label>联系电话</label>
						<span class="color4fc5f7" v-text="detail.phone"></span>
					</div>
					<div class="mui-input-row">
						<label>房号</label>
						<span v-text="detail.community"></span>
					</div>
					<div class="mui-input-row">
						<label>报修时间</label>
						<span v-text="detail.createTime"></span>
					</div>
				</form>
			</div>
			<div class="mui-content-padded  vongi-qingjiadt vongi-hdsq">
				<form class="mui-input-group vongi-wybx">
					<div class="mui-input-row padd10">
						<label>报修内容</label>
						<span class="vongi-span vongi-meform-pho" v-text="detail.content"></span>
						<span class="vongi-span vongi-wordcard vongi-meform-pho">
							<div v-if="detail.img" class="fyy-upphoto flew">
								<div v-for="(item,index) in detail.img.split(',')" class="mui-col-xs-3">
									<img :src="item" />
								</div>
							</div>
						</span>
					</div>
				</form>
			</div>
			<div v-if="detail.status!='0'" class="mui-content-padded vongi-qingjiadt">
				<form class="mui-input-group">
					<div class="mui-input-row">
						<label>报修状态</label>
						<span v-if="['1','2'].indexOf(detail.status)>-1" class="color55f868" v-text="detail.statusN"></span>
						<span v-else class="colorfe616c" v-text="detail.statusN"></span>
					</div>
					<div class="mui-input-row">
						<label>解决方案</label>
						<span class="vongi-span" v-text="detail.returnContent"></span>
					</div>
					<div class="mui-input-row">
						<label>回复时间</label>
						<span v-text="detail.returnTime"></span>
					</div>
					<!-- <div class="mui-input-row">
						<label>关闭时间</label>
						<span>2020-10-10 10:00:00</span>
					</div> -->
				</form>
			</div>

		</div>
		<div class="fyy-footer" v-if="detail.status=='0'">
			<div class="bindfyy-btn"><button type="submit" class="mui-btn mui-btn-primary" @click="openFormShow=true">回 复</button></div>
		</div>
		<!--弹窗-->
		<div v-show="openFormShow" class="mui-popup mui-popup-in vongi-mui-pop">
			<div class="mui-popup-inner vongi-pop-inner">
				<div class="mui-popup-title">解决方案</div>
				<div class="mui-popup-input">
					<textarea v-model="subForm.content" rows="3" placeholder="请输入解决方案"></textarea>
				</div>
			</div>
			<div class="mui-popup-buttons">
				<span class="mui-popup-button" @click="openFormShow=false">取消</span>
				<span @click="submit" class="mui-popup-button mui-popup-button-bold">确定</span>
			</div>
		</div>
		<div v-show="openFormShow" class="mui-popup-backdrop mui-active" @click="openFormShow=false"></div>

		<loading :visible="isLoading"></loading>
	</div>
</template>

<script>
	import * as API_Property from '@/apis/Master/property'
	import Common from '$project/components/Common.vue'
	import Loading from '$project/components/Loading.vue'
	import TopHeader from '$project/components/TopHeader.vue'
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	export default {
		name: 'MasterPropertyRepairVerifyInfo',
		components: {
			Common,
			Loading,
			TopHeader
		},
		data() {
			return {
				pageTitle: '报修详情',

				isLoading: false,

				id: this.$route.query.id,
				detail: [],

				openFormShow: false,
				subForm: {
					id: this.$route.query.id,
					content: ''
				}
			}
		},
		created() {},
		methods: {
			//获取详情
			getDetail(id) {
				this.id = id || this.id;
				this.isLoading = true;
				API_Property.getRepairAndComplaintInfo(this.id).then(response => {

					this.detail = response;

					this.isLoading = false;
				}).catch(error => {
					this.isLoading = false;
					mui.toast(error);
				})
			},
			//检测
			checkForm() {
				if (!this.subForm.content) {
					mui.toast('请输入解决方案');
					return false;
				} else {
					return true;
				}
			},
			//提交
			submit() {
				if (this.checkForm()) {
					this.isLoading = true;
					API_Property.propertyReback(this.subForm).then(response => {
						this.isLoading = false;
						this.openFormShow = false;

						mui.toast('处理成功');
						this.$router.go(-1);

					}).catch(error => {
						this.isLoading = false;
						mui.toast(error);
					})
				}
			},
			asynCallBack() {

			},
		},
		mounted() {
			//获取详情
			this.getDetail();
		},
		computed: {
			...mapGetters({
				openId: 'wx_openid',
				token: 'token',
			})
		},
	}
</script>

<style scoped src="$project/assets/css/xpwyfyy.css"></style>
<style src="$project/assets/css/iconfont.css"></style>
<style>
</style>
