<template>
	<view>
		<u-sticky bgColor="#0122C7" style="width: 100vw">
			<u-tabs :list="tabLists" @change="sectionChange" lineColor="#fff" :scrollable="false" lineWidth="40"
				inactiveStyle="color:#fff" activeStyle="color:#fff"></u-tabs>
		</u-sticky>
		<view class="serch">
			<u-search placeholder="输入车牌号进行搜索" :show-action="true" bg-color="white" v-model="keywords"></u-search>
		</view>


		<view v-if="curNow==0" class="personnel_list">
			<view v-if="dataList.length">
				<view class="cards" v-for="item,index in dataList" :key="index">
					<view class="cards_head">
						<text>XSDSDSD</text>
					</view>
					<view class="cards_content">
						<view class="right">
							<view class="li">
								<text>车牌号: </text>
								<text> { item.name }</text>
							</view>
							<view class="li">
								<text>行驶总里程: </text>
								<text>{ item.phone }</text>
								<view style="float: right;">
									<u-checkbox-group v-model="checked">
										<u-checkbox active-color="#0122C7" :label="item" :name="item" shape="square"
											label=""></u-checkbox>
									</u-checkbox-group>

								</view>
							</view>
							<view class="li">
								<text>本公司签约时间: </text>
								<text> 所属片区 </text>
							</view>
						</view>


					</view>
				</view>
			</view>

			<view v-else>
				<!-- dsdssaddddddddddddddddddddddddddddddddddddddd -->
				<view class="empty">
					<!-- <u-empty></u-empty> -->
					<view>
						当前没有可以签约的的车辆,快去签约新车吧!
					</view>
					<u-button type="primary" class="btn"> 签约新车</u-button>
				</view>
			</view>
		</view>



		<view v-else>
			<view class="personnel_list" @click="toDetail('/subpkg/property/vehicle')">
				<view class="cards">
					<view class="cards_head">
						<text>车牌号</text>

					</view>
					<view class="cards_content">
						<view class="right">
							<view class="li">
								<text>行驶总里程: </text>
								<text> { item.name }</text>
							</view>
							<view class="li">
								<text>本公司签约时间: </text>
								<text>{ item.phone }</text>
							</view>
							<view class="li">
								<text>承租公司: </text>
								<text> 所属片区 </text>
							</view>
							<view class="li">
								<text>负责人: </text>
								<text> 所属片区 </text>
							</view>
							<view class="li">
								<text>联系方式: </text>
								<text> 所属片区 </text>
							</view>
							<view class="li">
								<text>所属区域: </text>
								<text> 所属片区 </text>
							</view>
							<view class="li">
								<text>承租时间: </text>
								<text> 所属片区 </text>
							</view>
						</view>


					</view>
				</view>
			</view>


		</view>


		<mybtn position="position" v-if='!curNow' text="签约" @click="signFn">
			<u-icon name="edit-pen-fill" color="white" size="20"></u-icon>
		</mybtn>
	</view>


</template>

<script>
	import mybtn from "@/components/mybtn/mybtn.vue"
	import {
		Toast
	} from "../../libs/uniApi";
	// Toast("请至少选择一辆车")
	export default {
		components: {
			mybtn
		},
		name: "vehicle",
		data() {
			return {
				dataList: [],
				tabLists: [{
					name: '未出租',
				}, {
					name: '已出租'
				}, ],
				curNow: 0,
				checked: 0,
				keywords: "",


			};
		},
		methods: {
			signFn() {
				console.log(this.checked)
				if (!this.checked.length) Toast("请至少选择一辆车")
				else {
					this.toDetail("/subpkg/property/chosseCompany")
				}
			},

			toDetail(url) {
				uni.navigateTo({
					url
				})
			},
			sectionChange(index) {
				this.curNow = index.index;
				console.log(this.curNow)
				// this.getOrderList()
			},
		}
	}
</script>

<style lang="scss">
	.serch {
		margin: 28rpx 28rpx 0 28rpx;
	}

	.personnel_list {
		padding: 28rpx 0;
		margin-bottom: 130rpx;

		.empty {
			padding-top: 100rpx;
			text-align: center;

			.btn {
				width: 30vw;
				margin-top: 10rpx;

			}

			// height: 80vh;
			// background-color: red;
		}

		.cards {
			margin: 0 auto;
			margin-bottom: 28rpx;
			width: 694rpx;
			background: #ffffff;
			border-radius: 30rpx;
			opacity: 1;
			overflow: hidden;
			// box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);

			.cards_head {
				padding: 28rpx;
				background-color: $theme-oa-color;
				color: white;
				height: 100rpx;
				display: flex;
				justify-content: space-between;
			}

			.cards_content {
				padding: 10rpx 28rpx;
				display: flex;
				justify-content: space-between;

				.left {
					text-align: center;
					// padding: 15rpx 25rpx;
					padding-top: 20rpx;

					width: 160rpx;
					background-color: $theme-oa-color;
					color: white;
					border-radius: 40rpx;

					.cir {
						width: 120rpx;
						height: 120rpx;
						background-color: #ffffff;
						margin-left: 25rpx;
						border-radius: 120rpx;
						position: relative;
					}
				}

				.right {
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.li {
						margin: 10rpx 0;
						width: 85vw;

						.check_box {
							// background-color: #ff0000;
							// color: red;
						}

						// background-color: red;
						text:nth-child(1) {
							margin-right: 20rpx;
						}
					}
				}
			}


		}
	}
</style>