<template>
	<view class="container">
		<view class="top_bg" @click="permission = !permission"></view>
		<view class="body">
			<!-- 每一个订单区域 -->
			<view class="body_item" v-for="item in dataList" :key="item.id">
				<!-- 工单编号 -->
				<view class="item_title">
					<img src="../../static/images/repairsImg/order.png" />
					<view class="title_info">工单编号：{{ item.order }}</view>
				</view>
				<!-- 报修时间 -->
				<view class="item_time">
					<view class="time_msg">
						报修时间：
						<text>{{ item.time }}</text>
					</view>
					<view class="time_type">待接单</view>
				</view>

				<!-- 报修姓名 -->
				<view class="item_box">
					<view class="box_key">报修姓名：</view>
					<view class="box_value">{{ item.name }}</view>
				</view>

				<!-- 报修电话 -->
				<view class="item_box">
					<view class="box_key">报修电话：</view>
					<view class="box_value phone">
						{{ item.phone }}
						<img src="../../static/images/repairsImg/phone.png" />
					</view>
				</view>

				<!-- 报修区域 -->
				<view class="item_box">
					<view class="box_key">报修区域：</view>
					<view class="box_value">{{ item.area }}</view>
				</view>

				<!-- 详细地址 -->
				<view class="item_box">
					<view class="box_key">详细地址：</view>
					<view class="box_value">{{ item.address }}</view>
				</view>

				<!-- 报修物品 -->
				<view class="item_box">
					<view class="box_key">报修物品：</view>
					<view class="box_value">{{ item.goods }}</view>
				</view>

				<!-- 故障描述 -->
				<view class="item_box">
					<view class="box_key">故障描述：</view>
					<view class="box_value">{{ item.description }}</view>
				</view>

				<!-- 上传图片 -->
				<view class="item_img">
					<view class="img_key">上传图片：</view>
					<view class="img_value"></view>
				</view>

				<!-- 按钮区域 -->
				<view class="item_btn">
					<img src="../../static/images/repairsImg/close.png" @click="handleClose" />
					<view class="btn_box type" v-if="permission">延时</view>
					<view class="btn_box type">接单</view>
					<view class="btn_box type2" v-if="permission">派单</view>
				</view>

				<!-- 关闭按钮弹窗 -->
				<uni-popup ref="popup_close" :is-mask-click="false">
					<view class="popup_close">
						<view :class="{ active: activeIndex === 1 }" class="close_box radius" @click="handleChangeItem(1)">重复报单</view>
						<view :class="{ active: activeIndex === 2 }" class="close_box" @click="handleChangeItem(2)">不属于维修范围</view>
						<view :class="{ active: activeIndex === 3 }" class="close_box" @click="handleChangeItem(3)">已维修完成</view>
						<view class="close_btn">
							<view class="btn_box cancel" @click="$refs.popup_close[0].close()">取消</view>
							<view class="btn_box confirm" @click="$refs.popup_close[0].close()">确定</view>
						</view>
					</view>
				</uni-popup>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			permission: true,
			activeIndex: 1,
			dataList: [
				{
					id: 1,
					order: '656262219626262',
					overtime: true,
					time: '2023.07.05  09:25:26',
					type: 1,
					name: '张三',
					phone: '13659585689',
					area: '行政楼',
					address: '3楼309',
					goods: '电脑',
					description: '水龙头坏了',
					img: ''
				},
				{
					id: 2,
					order: '956262219626262',
					overtime: false,
					time: '2023.07.05  09:25:26',
					type: 2,
					name: '李四',
					phone: '13659585689',
					area: '行政楼',
					address: '3楼309',
					goods: '电脑',
					description: '电脑坏了',
					img: '',
					workerName: '老张',
					workerPhone: '13659585689'
				},
				{
					id: 3,
					order: '956262219626262',
					overtime: false,
					time: '2023.07.05  09:25:26',
					type: 3,
					name: '李四',
					phone: '13659585689',
					area: '行政楼',
					address: '3楼309',
					goods: '电脑',
					description: '电脑坏了',
					img: '',
					workerName: '老张',
					workerPhone: '13659585689',
					money: 50
				}
			]
		}
	},
	methods: {
		handleClose() {
			this.$refs.popup_close[0].open('center')
		},
		handleChangeItem(val) {
			this.activeIndex = val
		}
	}
}
</script>

<style lang="scss" scoped>
.container {
	width: 100vw;
	height: calc(100vh - 102rpx);

	.top_bg {
		height: 165rpx;
		background-color: #6fb6b8;
	}

	.body {
		box-sizing: border-box;
		margin: auto;
		margin-top: -100rpx;
		padding: 2rpx;
		width: 690rpx;
		height: calc(100vh - 170rpx);
		border-radius: 11rpx 11rpx 0 0;
		background-color: #fff;
		overflow-y: auto;

		.body_item {
			margin-bottom: 20rpx;
			border-radius: 11rpx;
			box-shadow: 0 0 8rpx #d9d9d9;

			.item_title {
				display: flex;
				align-items: center;
				padding: 0 30rpx;
				height: 87rpx;
				border-bottom: 1rpx solid #e6e6e6;

				img {
					width: 30rpx;
					height: 30rpx;
				}

				.title_info {
					margin: 0 21rpx 0 13rpx;
					font-size: 28rpx;
				}
			}

			.item_time {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 0 30rpx;
				height: 79rpx;

				.time_msg {
					font-size: 28rpx;
					color: #808080;

					text {
						color: #000000;
					}
				}

				.time_type {
					font-size: 32rpx;
					color: #ff5733;
				}
			}

			.item_box {
				display: flex;
				padding: 0 30rpx;
				height: 60rpx;
				font-size: 28rpx;

				.box_key {
					color: #808080;
				}

				.box_value {
					display: flex;

					img {
						margin-top: 5rpx;
						margin-left: 10rpx;
						width: 28rpx;
						height: 28rpx;
					}
				}

				.phone {
					color: #6fb6b8;
				}
			}

			.item_img {
				display: flex;
				align-items: center;
				padding: 0 30rpx;
				height: 120rpx;
				color: #808080;
				font-size: 28rpx;

				.img_key {
				}

				.img_value {
					width: 120rpx;
					height: 120rpx;
					border-radius: 14rpx;
					background-color: salmon;
				}
			}

			.item_btn {
				display: flex;
				align-items: center;
				justify-content: flex-end;
				padding: 0 30rpx;
				height: 153rpx;

				img {
					margin-right: auto;
					width: 56rpx;
					height: 56rpx;
				}

				.btn_box {
					display: flex;
					justify-content: center;
					align-items: center;
					margin-left: 16rpx;
					width: 174rpx;
					height: 68rpx;
					font-size: 28rpx;
					border-radius: 11rpx;
				}

				.type {
					color: #fff;
					background-color: #6fb6b8;
				}

				.type2 {
					color: #6fb6b8;
					background-color: #fff;
					border: 1rpx solid #6fb6b8;
				}
			}

			.popup_close {
				width: 690rpx;
				border-radius: 19rpx;
				background-color: #fff;

				.close_box {
					height: 100rpx;
					line-height: 100rpx;
					text-align: center;
					font-size: 32rpx;
					border: 1rpx solid #e6e6e6;
				}

				.radius {
					border-radius: 19rpx 19rpx 0 0;
				}

				.active {
					color: #fff;
					background-color: #6fb6b8;
				}

				.close_btn {
					display: flex;
					align-items: center;
					justify-content: space-evenly;
					margin-top: 100rpx;
					height: 121rpx;

					.btn_box {
						display: flex;
						justify-content: center;
						align-items: center;
						width: 203rpx;
						height: 72rpx;
						border-radius: 9rpx;
						font-size: 32rpx;
					}

					.cancel {
						background-color: #e5e5e5;
						color: #6fb6b8;
					}

					.confirm {
						background-color: #6fb6b8;
						color: #fff;
					}
				}
			}
		}
	}
}
</style>
