<template>
	<view>
		<view class="content">
			<view class="content1-top">
				<view class="top2">
					<view class="left">
						<view @click='tabcarchange(0)' class='line' :class='searchType==0?"active":""'>全部</view>
						<view @click='tabcarchange(1)' class='line' :class='searchType==1?"active":""'>未完成</view>
						<view @click='tabcarchange(3)' class='line' :class='searchType==3?"active":""'>已完成</view>
					</view>
					<view class="right uni-button">
						<button style="line-height: 28px;" class="right-contrent1" @click="trackAddition">添加</button>
					</view>
				</view>
			</view>
		</view>
		<view v-for="(item,index) in fuelFilling" :key="index" @click="getInfo(item)">
			<view class="good-list">
				<view style="padding: 0 35rpx 20rpx 35rpx;position: relative;">
					<view class="flex top">
						<view class="flex left">
							<view class="item1">
								<view class="ssx">{{$helper.getProvinceAbbreviation(item.originProvince)}}</view>
								<view class="level2-title" style="font-size: 14px;">
									{{$helper.filterUrban(item.originCity)}}
									{{$helper.filterArea(item.originArea)}}
								</view>
							</view>
							<image class="jt-icon item2" src="@/static/images/fuel/jt.png" mode='widthFix'>
							</image>
							<view class="item3">
								<view class="ssx">{{$helper.getProvinceAbbreviation(item.destinationProvince)}}</view>
								<view class="level2-title">{{$helper.filterUrban(item.destinationCity)}}
									{{$helper.filterArea(item.destinationArea)}}
								</view>
							</view>
						</view>
						<view class="flex">
							<view class="audit1" v-if="item.travelStatus == '已开始'">已开始</view>
							<view class="audit2" v-if="item.travelStatus == '已结束'">已结束</view>
							<view class="audit3" v-if="item.travelStatus == '已报销'">已报销</view>
						</view>
					</view>
					<view class="car-info">
						<view class="car-num">车牌号 : {{item.carNo}}</view>
						<view class="car-date">{{item.createDate.split(" ")[0]}}</view>
					</view>
					<view class="car-yh">
						<view class="row">
							总油耗
							<view class="text">
								{{item.tfc}}L
							</view>
						</view>
						<view class="row">
							总价
							<view class="text">
								{{item.totalCost}}元
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				searchType: 0,
				pageSize: 10,
				currentPage: 1,
				fuelFilling: [{
					destinationProvince: "辽宁省",
					destinationCity: "营口市",
					destinationArea: "鲅鱼圈区",
					destinationAddress: '鲅鱼圈5号门',
					carNo: "辽H11111",
					originProvince: "辽宁省",
					originCity: "营口",
					originArea: "鲅鱼圈区",
					originAddress: '中天昊元',
					createDate: "2022-01-01 15:30:20",
					travelStatus: "已开始",
					totalCost: "233.20",
					tfc: "60L"
				}],
			}
		},
		onShow() {
			// this.getList()
		},
		methods: {
			tabcarchange(searchType) {
				this.searchType = searchType
				this.pageSize = 10
				this.getList()
			},
			trackAddition() {
				uni.navigateTo({
					url: '/pages/fuelfilling/track_addition'
				})
			},
			getList() {
				this.$api.doRequest('get', '/fuelFillingInfo/selectFilling', {
					pageSize: this.pageSize,
					currentPage: this.currentPage,
					// pcFlag: 0,
					searchType: this.searchType,
					compId: uni.getStorageSync('pcUserInfo').compId,
					commonId: uni.getStorageSync('pcUserInfo').userId,
				}).then(res => {
					debugger
					if (res.data.code == 200) {
						this.fuelFilling = res.data.data.records

					}
				})
			},
			getInfo(item) {
				if (item.travelStatus == '已报销') {
					return
				} else {
					uni.navigateTo({
						url: '/pages/fuelfilling/track_addition?id=' + item.id
					})
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		padding-bottom: 50rpx;
	}

	.tag {
		background: #F5F6F9;
		padding: 5px;
		color: #333333;
		display: inline-flex;
		font-size: 22rpx;
		border-radius: 3px;
		margin: 3px;
	}

	.introduce-section .title {
		justify-content: space-between;
		align-items: flex-start;
	}

	.introduce-section .title text {
		font-size: 28rpx;
	}

	.introduce-section .title .title-tip {
		flex: 1;
		font-size: 28rpx;
		color: #FE6430;
		font-weight: 500;
		height: 50px;
		line-height: 50px;
		border-bottom: 1px solid #EEEEEE;

	}

	.introduce-section .title .title-tip-a {
		flex: 1;
		font-size: 15px;
		color: #AFB3BF;
		font-weight: 500;
		height: 50px;
		line-height: 50px;
		border-bottom: 1px solid #EEEEEE;
	}

	.line {
		display: inline-block;
		padding: 5px;
		position: relative;
		font-size: 17px;
	}

	.line.active {
		font-size: 19px;
		font-weight: 900;
	}

	.line.active:after {
		content: '';
		display: block;
		position: absolute;
		width: 18px;
		left: 50%;
		transform: translateX(-50%);
		bottom: 0;
		border-bottom: 3px solid #22C572;
	}

	/deep/.u-action-active {
		margin-right: 6px;
	}

	.content1-top {
		background: white;
		padding: 10px 16px 0 10px;
		border-radius: 0 0 15px 15px;
		padding-bottom: 10px;
	}

	.top2 {
		display: flex;
		align-items: center;
		justify-content: space-between;

		.right.uni-button {
			display: flex;
			align-items: center;
			font-weight: normal;

			.right-contrent1 {
				background: #22C572;
				height: 25px;
				font-size: 14px;
				color: #fff;

			}

		}
	}

	.good-list {
		background-color: white;
		margin: -10px 10px 20px 10px;
		padding: 20px 0px 8px 0px;
		border-radius: 30rpx;
		box-shadow: 0px 5rpx 20rpx #E3E3E3;

		.item1,
		.item3 {
			// width: 40%;
			display: flex;

			.text {
				text-overflow: ellipsis;
				overflow: hidden;
				white-space: nowrap;
			}

		}

		.item1 .text {
			text-align: left;
		}

		.item3 .text {
			text-align: right;
		}
	}

	.xf-iamge {
		width: 74rpx;
		height: 43rpx;
		position: absolute;
		top: -20rpx;
		right: 0;
	}

	.level2-title {
		font-size: 28rpx;
	}

	.jt-icon {
		position: relative;
		top: 6rpx;
		width: 60rpx;
		margin: 0 20rpx;

	}

	.ssx {
		width: 20px;
		height: 20px;
		background: linear-gradient(180deg, #C8D7E5 0%, #AFC1D6 100%);
		font-size: 13px;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-right: 5px;
	}

	.level2-title {
		font-weight: 700;
		color: #000000;
	}

	.wenzi {
		text-align: right;
		border-radius: 10rpx;
		// margin-right: 30rpx;
		height: 10rpx;
		padding: 10px 0px 5px 128px;
	}

	.audit1 {
		color: #22C572;
	}

	.audit2 {
		color: #22C572;
	}

	.audit3 {
		color: #AFB3BF;
	}

	.top {
		justify-content: space-between;
		align-items: center;

		.left {
			align-items: center;
		}
	}

	.car-info {
		background: #F9F9FA;
		padding: 20rpx;
		display: flex;
		border-radius: 20rpx;
		flex-direction: column;

		.car-num {
			font-size: 26rpx;
			font-weight: 700;
		}

		.car-date {
			margin-top: 10rpx;
			color: #878C9C;
		}
	}

	.car-yh {
		display: flex;
		justify-content: flex-end;
		margin-top: 20rpx;

		.row {
			display: flex;
			align-items: center;

			.text {
				font-weight: 700;
				margin: 0 20rpx;
			}
		}

	}
</style>
