<template>
	<view class="container">
		<uni-navbar title="记录审批"></uni-navbar>
		<view class="box">
			<view @click="goTo(item)" class="small-box commonBj commonMt commonMb" v-for="item in List" :key="item.id">
				<view class="small-box-top">
					<view class="small-box-top-left">
						<image style="width: 51rpx;height: 51rpx;margin-left: 11rpx;"
							src="../../static/images/city/gongsi.png" mode="widthFix">
						</image>
						<text>{{ item.transportName }}</text>
					</view>
					<view class="small-box-right">
						<text>待审批</text>
					</view>
				</view>
				<view class="small-box-middle mt20">
					<view class="middle-left">
						<view class="circle-green circle-style">
							起
						</view>
						<view class="small-box-middle-line-left">
						</view>
						<view class="circle-red circle-style">
							终
						</view>
					</view>
					<view class="middle-middle">
						<view class="position-start">
							<view class="green bold size24 textStyle">{{item.startName}}</view>
						</view>
						<view class="position-end">
							<text class="red bold size24 textStyle ">{{item.endName}}</text>
						</view>
					</view>
				</view>
				<view class="small-box-date">
					<image style="width: 24rpx;height: 24rpx;margin-left: 10rpx;"
						src="../../static/images/transport/rili.png" mode="widthFix">
					</image>
					<text class="ml19 font-size-style">
						时间： {{item.startTime+' — '+item.endTime}}
					</text>
				</view>
				<view class="small-box-bottom mt23">
					<view class="small-box-bottom-left">
						<image style="width: 25rpx;height: 25rpx;margin-left: 10rpx;"
							src="../../static/images/transport/time.png" mode="widthFix"></image>
						<text class="ml19 font-size-style">车牌号：{{item.carNumber}} </text>
					</view>
					<view class="small-box-bottom-left">
						<image style="width: 25rpx;height: 25rpx;" src="../../static/images/record/duoren.png"
							mode="widthFix">
						</image>
						<text class="mr15 ml19 font-size-style">车辆司机：{{item.driverName}}</text>
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		recordList
	} from "@/api/company/record.js"
	export default {
		data() {
			return {
				List: []
			}
		},
		methods: {
			goTo(item) {
				console.log(item);
				this.$tab.navigateTo(`/pages/cityRecordDetail/index?id=${item.id}`)
			},
			async getRecordList() {
				const res = await recordList(0)
				console.log(res);
				this.List = res.rows
				this.List.forEach(item => {
					item.startTime = item.startTime.replace(/-/g, '/').slice(0, -3)
					item.endTime = item.endTime.replace(/-/g, '/').slice(0, -3)
				})
				console.log(this.List);
			}
		},
		onShow() {
			this.getRecordList()
		}
	}
</script>

<style scoped lang="scss">
	.mt23 {
		margin-top: 23rpx;
	}

	.mr15 {
		margin-right: 15rpx;
	}

	.small-box {
		padding: 22rpx;
		box-sizing: border-box;
		margin-bottom: 31rpx;

		.small-box-top {
			display: flex;
			justify-content: space-between;
			align-items: center;

			.small-box-top-left {
				display: flex;
				align-items: center;

				uni-text {
					font-size: 28rpx;
					font-weight: bold;
					color: #333333;
					margin-left: 18rpx;
				}

			}

			.small-box-right {
				text-align: center;
				width: 103rpx;
				height: 45rpx;
				border-radius: 15rpx;
				font-size: 26rpx;
				font-weight: bold;
				color: #FFFFFF;
				line-height: 45rpx;
				background: linear-gradient(90deg, #F59A02 0%, #FFD334 100%);
			}
		}

		.mt20 {
			margin-top: 20rpx;
		}

		.small-box-date {
			display: flex;
			align-items: center;
			margin-top: 24rpx;
		}

		.small-box-bottom {
			display: flex;
			justify-content: space-between;
			align-items: center;

			.small-box-bottom-left {
				display: flex;
				align-items: center;
			}
		}
	}

	.box-linear {
		background: linear-gradient(90deg, #FF2D04 0%, #FFA53E 100%) !important;
	}

	.start-green {
		width: 34rpx;
		height: 34rpx;
		background: #45AC77;
		border-radius: 50%;
		text-align: center;
		line-height: 34rpx;
		font-size: 20rpx;
		font-weight: bold;
		color: #FFFFFF;
	}

	.bgRed {
		background: #FF6424;
	}

	.red {
		color: #FF6424;
	}

	.green {
		color: #45AC77;
	}

	.ml19 {
		margin-left: 10rpx;
	}

	.font-size-style {
		font-size: 24rpx;
		font-weight: 400;
		color: #485B93;
	}
</style>
