<template>
	<view class="main">
		<template v-if="fleetVehicleList.length">

			<u-list :pagingEnabled="true">
				<u-list-item v-for="(item, index) in fleetVehicleList" :key="index">
					<u-cell :title="item.vehicle">
						<u-avatar slot="icon" shape="square" size="30" icon="car"></u-avatar>
					</u-cell>
				</u-list-item>
			</u-list>
		</template>
		<template v-else>
			<u-empty mode="history" text="车队没有车辆信息" icon="https://cdn.uviewui.com/uview/empty/list.png">
			</u-empty>
		</template>
	</view>
</template>

<script>
	import {
		getVehicleListByFleet
	} from '../../api/driver'
	export default {
		data() {
			return {
				fleetVehicleList: [],
				fleet: "",
			}
		},
		onLoad(options) {
			console.log("获取到订单信息、", options)
			this.fleet = options ? options.fleet : ''
			this.bindFleetVehicle()
		},
		methods: {
			
			bindFleetVehicle() {
				if (!this.fleet) {
					uni.showToast({
						title: this.$t('base.common.placeholderI') + this.$t('driver.fleet'),
						icon: "none",
						duration: 2500,
					})
					return;
				}

				let data = {
					"fleet": this.fleet
				}
				getVehicleListByFleet(data).then(res => {
					if (res.statusCode == 200 && res.data.code == 0) {
						this.fleetVehicleList = res.data.data
						this.isShowVehicleList = true
					}
				})
			},


		},
	}
</script>
<style>
	/* #ifndef H5 */
	page {
		/* height: 100%; */
		background-color: #f2f2f2;
	}

	/* #endif */
</style>
<style lang="scss" scoped>
	@import '../../common/css/public.scss';

	/deep/ .uni-date-x {
		padding: 0;
	}
</style>