<template>
	<view class='center'>
		<view style="background: linear-gradient( 180deg, #1FCA7C 0%, #F2F2F2 100%);">
			<u-navbar :autoBack="true" title="报修详情" 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">今日报修</text>
					<text class="fs-30">报修详情我知道</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?'已完成':data.state==4?'已取消':''}}</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(data.proprietorName)}}</text>
						</view>
						<view class="flex pad-30">
							<text class="fw-700 w-200" style="text-align: left;">业主房间号</text>
							<text>{{data.room}}</text>
						</view>
						<view class="flex pad-30">
							<text class="fw-700 w-200" style="text-align: left;">业主手机号</text>
							<text>{{data.proprietorPhone}}</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>报修信息</text>
					</view>
					<view class="flex-column br-12 fs-28 mtb-30 pad-30" style="background: #EBF5F0;">
						<text style="text-align: left;">{{data.repairsDescription}}</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.repairsImg)" :key="index2">
								<image class="w-140 h-140" :src="itemImg"></image>
							</view>
						</view>
					</scroll-view>
					<view class="flex mt-20 h-40 lh-40">
						<text class="fw-700 fs-28">报修时间:</text>
						<text class="fs-24 ml-10">{{data.repairsTime}}</text>
						<text class="fs-24 ml-10" style="flex: 1;"></text>
						<text @click="onCz('关闭报修')" v-if="data.state==2" class="fs-24 mr-10" style="color: #23BBEE;">
							关闭报修</text>
					</view>
					<view v-if="data.state==2||data.state==3" 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>{{data.accountName}}</text>
						</view>
						<view class="flex pad-30">
							<text class="fw-700 w-200" style="text-align: left;">手机号：</text>
							<text>{{data.accountMobile}}</text>
						</view>
						<view class="flex pad-30">
							<text class="fw-700 w-200" style="text-align: left;">完成时间：</text>
							<text>{{data.completeTime}}</text>
						</view>
					</view>
					<view v-if="data.state==4" 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 class="full-btn" v-if="data.state==2">
				去支付
			</view>
			<view @click="onCz('关闭报修')" class="full-btn" style="color: #FF682D;" v-if="data.state==1">
				取消报修
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: 0,
				reason: '',
				submitShow: false,
				images: '',
				id: '',
				data: {},
			};
		},
		onLoad(e) {
			this.id = e.id
			this.getData()
		},
		methods: {
			getData() {
				const params = {
					url: '/api/repairs/' + this.id,
					method: 'GET',
				}
				this.$request(params).then(res => {
					this.data = res.data
				})
			},
			gb() {
				const params = {
					url: '/api/repairs/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
				}
				if (e == "去支付") {

					return
				}
			},
		},
	};
</script>

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