<template>
	<view class="wrapper">
		<!-- 背景颜色充满屏 -->
		<view class="bg-color"></view>
		<!-- 补卡额订单列表-->
		<view class="search-box">
			<image :src="`${$imgUrl}service/icon-search.png`" class="icon"></image>
			<input class="search" placeholder="请输入充车牌/流水编号/出入站名/ETC卡号" />
		</view>
		<view class="search-time">
			<view class="search-time-box" @click="showCalender">
				<u-calendar 
					v-model="show" 
					mode="range" 
					@change="changeHandle" 
					max-date="2100-01-01"
					range-bg-color="#00B38B"
					active-bg-color="#00B38B"
					range-color="#fff"
					
				></u-calendar>
				<view class="show-info">
					
					<view class="show-text" v-if="dataTime.startDate">
						<text class="date-text text-val">{{dataTime.startDate}}</text>
						<text class="line"></text>
						<text class="date-text text-val">{{dataTime.endDate}}</text>
					</view>
					<view class="show-text" v-else>
						<text class="date-text">开始时间</text>
						<text class="line"></text>
						<text class="date-text">结束时间</text>
					</view>
					<u-icon name="calendar" :custom-style="{color:'#999999', size: '28rpx'}"></u-icon>
				</view>
			</view>
			<view class="time-btn">查询</view>
		</view>
		<view class="total-num">金额合计：XXXXXX</view>
		<view class="list-wrap">
			<view class="card-info" v-for="item in listData" :key="item.id">
				<view class="info-wrap">
					<view class="info-left">
						<view class="info-left-text">
							<text class="label">流水单号：</text>
							<text class="val">MA89200010</text>
						</view>
						<view>
							<text class="label">ETC卡号：</text>
							<text class="val">0110200001</text>
						</view>
					</view>
					<view class="info-right">
						<view class="price-label">
							交易金额
						</view>
						<view class="price-val">
							<u-icon name="rmb"></u-icon>
							<text class="price-val-text">104.00</text>
						</view>
					</view>
				</view>
				<view class="card-text-wrap">
					<view class="text-box">
						<text class="name-text">贵阳西</text>
						<text class="time-text">12:09</text>
						<text class="date-text">2023-01-08</text>
					</view>
					<view class="arrow-wrap">
						<text class="arrow-text">粤A12345</text>
						<image class="d-img" :src="`${$imgUrl}order/arrowCard.png`"></image>
					</view>
					<view class="text-box">
						<text class="name-text">XXXXX</text>
						<text class="time-text">18:52</text>
						<text class="date-text">2023-01-08</text>
					</view>
				</view>
				<view class="btn-wrap">
					<view>
						<text v-if="item.status === 2" class="status-wrap">审核进度：<text class="status-text">审核中</text></text>
						<text v-if="item.status === 3" class="status-wrap">审核进度：<text>已完成</text></text>
					</view>
					<view class="btn-1 btn" v-if="item.status === 1" @click="toApply(item)">补卡额申请</view>
					<view class="btn-1 btn" v-if="item.status === 2" @click="toView(item)">查看进度</view>
					<view class="btn-1 btn" v-if="item.status === 3" @click="toEvaluate(item)">去评价</view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script lang="ts" setup>
	import {
		reactive,
		ref
	} from "vue";
	const show = ref(false);
	const dataTime = reactive({
		startDate: "",
		endDate: ""
	})
	const listData = reactive([
		{
			id: 1,
			status: 1 // 补卡
		},
		{
			id: 2,
			status: 2 // 查看进度
		},
		{
			id: 3,
			status: 3 // 去评价
		},
	])
	// 日期修改
	function changeHandle(e) {
		dataTime.startDate = e.startDate;
		dataTime.endDate = e.endDate;
		
	}
	// 展示日历
	function showCalender() {
		show.value = true
	}
	// 补卡申请
	function toApply(item) {
		uni.navigateTo({
			url: `/orders/cardAmount?id=${item.id}`
		});
	}
	// 去评价
	function toEvaluate(item) {
		uni.navigateTo({
			url: `/orders/order-evaluate?id=${item.id}`
		});
	}
	// 查看进度
	function toView(item) {
		uni.navigateTo({
			url: `/orders/cardAmountDetail?id=${item.id}`
		});
	}
</script>

<style lang="scss" scoped>
	.bg-color {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: #EEF7F7;
		z-index: -1;
	}
	.search-box {
		margin: 30rpx 30rpx 20rpx 30rpx;
		height: 72rpx;
		height: 81rpx;
		background: #FFFFFF;
		border: 1px solid #DCDCDC;
		border-radius: 40rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		box-sizing: border-box;
	}

	.search-box .icon {
		width: 48rpx;
		height: 48rpx;
		margin: 0 20rpx;
	}

	.search-box .search {
		flex: 1;
		margin-right: 20rpx;
		height: 100%;
		padding: 0 10rpx;
		font-size: 28rpx;
		color: #00b38b;
	}

	.scroll-view {
		white-space: nowrap;
		position: sticky;
		top: 0;
		background: #ffffff;
		box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
	}
	.search-time {
		// width: 100%;
		display: flex;
		padding: 10rpx 30rpx 30rpx;
		.search-time-box{
			flex: 1;
		}
		.time-btn {
			width: 130rpx;
			height: 80rpx;
			background: #00B38B;
			border-radius: 40rpx;
			color: #FFFFFF;
			font-size: 32rpx;
			line-height: 80rpx;
			text-align: center;
			margin-left: 20rpx;
		}
		.show-info {
			// width: 541rpx;
			width: 85%;
			height: 81rpx;
			padding: 0 31rpx;
			background: #FFFFFF;
			border: 1px solid #DCDCDC;
			border-radius: 40rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.show-text {
				display: flex;
				align-items: center;
			}
			.date-text {
				color: #999999;
				font-size: 28rpx;
			}
			.text-val {
				color: #333
			}
			.line {
				width: 25rpx;
				height: 1rpx;
				background: #999999;
				margin: 0 24rpx;
			}
		}
	}
	.total-num {
		font-size: 28rpx;
		color: #999999;
		margin-left: 30rpx;
	}
	.list-wrap {
		margin: 30rpx;
		padding-bottom: 20rpx;
	}
	.card-info {
		background: #FFFFFF;
		box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
		border-radius: 20rpx;
		margin-bottom: 30rpx;
		padding: 30rpx 30px 13rpx 30rpx;
		.info-wrap {
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-bottom: 1px solid #dcdcdc;
			padding-bottom: 30rpx;
			.info-left-text {
				margin-bottom: 39rpx;
			}
			.label {
				color: #999999;
				font-size: 26rpx;
				font-weight: 400;
			}
	
			.val {
				color: #333333;
				font-size: 26rpx;
				font-weight: 400;
			}
	
			.price-label {
				color: #999999;
				font-size: 24rpx;
				font-weight: 400;
				margin-bottom: 22rpx;
				text-align: center;
			}
	
			.price-val-text {
				font-size: 36rpx;
				font-weight: 700;
				color: #333333;
				margin-left: 9rpx;
			}
	
			.price-val {
				font-size: 26rpx;
				color: #333333;
			}
	
		}
	
		.card-text-wrap {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin: 38rpx 0 46rpx 0;
			.text-box {
				display: flex;
				flex-direction: column;
				align-items: center;
				.name-text {
					font-size: 30rpx;
					font-weight: 400;
					color: #333333;
				}
	
				.time-text {
					font-size: 30rpx;
					color: #333333;
					font-weight: 400;
					margin-top: 8rpx;
				}
	
				.date-text {
					font-size: 24rpx;
					color: #999999;
					font-weight: 400;
					margin-top: 8rpx;
				}
			}
	
			.arrow-wrap {
				display: flex;
				flex-direction: column;
				align-items: center;
	
				.d-img {
					width: 186rpx;
					height: 12rpx;
				}
	
				.arrow-text {
					color: #666666;
					font-size: 26rpx;
				}
			}
		}
		.btn-wrap {
			margin-top: 30rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.status-wrap {
				color: #999999;
				font-size: 26rpx;
				margin-right: 23rpx;
			}
			.status-text {
				color: #00B38B;
			}
			.btn{
				background: #FFFFFF;
				border: 1px solid #00B38B;
				border-radius: 30rpx;
				line-height: 61rpx;
				text-align: center;
				color: #00B38B;
				font-size: 26rpx;
			}
			.btn-1 {
				width: 171rpx;
				height: 61rpx;
			}
			.btn-2 {
				width: 141rpx;
				height: 61rpx;
			}
			.btn-3 {
				width: 121rpx;
				height: 61rpx;
			}
		}
	}
</style>
