<template>
	<view class="container">
		<!-- 搜索框区域 -->
		<view class="search">
			<img src="../../static/images/repairsImg/search.png" />

			<input type="text" placeholder="请输入搜索内容" />
		</view>

		<view class="title">外部维修成员（{{ list.length }}）</view>

		<!-- 每一个外部维修成员区域 -->
		<view class="box" v-for="item in list" :key="item.id" @click="handleEdit(item)">
			<img src="../../static/images/repairsImg/photo.png" />
			<view class="item_info">
				<view class="info_msg">
					{{ item.name }}
					<view class="msg_work">{{ item.work }}</view>
				</view>
				<view class="info_phone">{{ item.phone }}</view>
			</view>
			<view class="item_type color_type" v-if="item.type === 1">接单中</view>
			<view class="item_type color_type2" v-if="item.type === 2">订单饱和</view>
			<view class="item_type color_type3" v-if="item.type === 3">停止接单</view>
		</view>

		<view class="title">内部维修成员（{{ list2.length }}）</view>
		<!-- 每一个内部维修成员区域 -->
		<view class="box" v-for="item in list2" :key="item.id" @click="handleEdit(item)">
			<img src="../../static/images/repairsImg/photo.png" />
			<view class="item_info">
				<view class="info_msg">
					{{ item.name }}
					<view class="msg_work">{{ item.work }}</view>
				</view>
				<view class="info_phone">{{ item.phone }}</view>
			</view>
			<view class="item_type color_type" v-if="item.type === 1">接单中</view>
			<view class="item_type color_type2" v-if="item.type === 2">订单饱和</view>
			<view class="item_type color_type3" v-if="item.type === 3">停止接单</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: [
				{
					id: 1,
					name: '张三',
					phone: '13659856958',
					type: 1,
					work: '电工'
				},
				{
					id: 2,
					name: '李四',
					phone: '13659856958',
					type: 2,
					work: '电工'
				},
				{
					id: 3,
					name: '张三',
					phone: '13659856958',
					type: 3,
					work: '电工'
				},
				{
					id: 4,
					name: '张三',
					phone: '13659856958',
					type: 1,
					work: '电工'
				},
				{
					id: 5,
					name: '李四',
					phone: '13659856958',
					type: 1,
					work: '电工'
				},
				{
					id: 6,
					name: '张三',
					phone: '13659856958',
					type: 1,
					work: '电工'
				}
			],
			list2: [
				{
					id: 1,
					name: '张三',
					phone: '13659856958',
					type: 1,
					work: '电工'
				},
				{
					id: 2,
					name: '李四',
					phone: '13659856958',
					type: 3,
					work: '电工'
				},
				{
					id: 3,
					name: '张三',
					phone: '13659856958',
					type: 2,
					work: '电工'
				},
				{
					id: 4,
					name: '张三',
					phone: '13659856958',
					type: 1,
					work: '电工'
				}
			]
		}
	},
	methods: {
		handleEdit(item) {
			// console.log(item.id)
			uni.showActionSheet({
				itemList: ['编辑', '删除'],
				success: (res) => {
					if (res.tapIndex === 0) {
						uni.navigateTo({
							url: '/pagesRepairs/edit/edit'
						})
					} else if (res.tapIndex === 1) {
						console.log('删除')
					}
				},
				fail: (res) => {}
			})
		}
	}
}
</script>

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

	.search {
		display: flex;
		align-items: center;
		margin: 30rpx auto 30rpx;
		width: 690rpx;
		height: 80rpx;
		border-radius: 4rpx;
		background-color: #f2f2f2;

		img {
			margin: 0 20rpx;
			width: 40rpx;
			height: 40rpx;
		}

		input {
			flex: 1;
			padding: 10rpx;
		}
	}

	.title {
		display: flex;
		align-items: flex-end;
		box-sizing: border-box;
		padding: 0 30rpx;
		height: 80rpx;
		font-size: 36rpx;
		font-weight: bold;
		border-top: 1rpx solid #e5e5e5;
	}

	.box {
		display: flex;
		align-items: center;
		padding-right: 30rpx;
		height: 160rpx;
		border-bottom: 1rpx solid #e5e5e5;

		img {
			margin: 0 24rpx 0 27rpx;
			width: 82rpx;
			height: 82rpx;
			border-radius: 50%;
		}

		.item_info {
			display: flex;
			flex-direction: column;

			.info_msg {
				display: flex;
				align-items: center;
				font-size: 32rpx;
				font-weight: bold;

				.msg_work {
					display: flex;
					justify-content: center;
					align-items: center;
					margin-left: 13rpx;
					padding: 0 10rpx;
					height: 32rpx;
					color: #6fb6b8;
					font-size: 24rpx;
					font-weight: 400;
					border-radius: 7rpx;
					border: 1rpx solid #6fb6b8;
				}
			}

			.info_phone {
				margin-top: 10rpx;
				color: #808080;
				font-size: 28rpx;
			}
		}

		.item_type {
			margin-left: auto;
			font-size: 24rpx;
		}

		.color_type {
			color: #6fb6b8;
		}
		.color_type2 {
			color: #1e7dfb;
		}
		.color_type3 {
			color: #ff5733;
		}
	}
}
</style>