<template>
	<view class="w-h-100">
		<view class="u-page">
			<u-list>
				<u-list-item v-for="(item, index) in truckList" :key="index">
					<u-cell :title="item.truckCode + '-' + item.truckTypeName">
						<u-avatar slot="icon" shape="square" size="35" :src="item.url? item.url: defaultAvatar"
							customStyle="margin: -3px 5px -3px 0"></u-avatar>
					</u-cell>
				</u-list-item>
				<u-list-item :key="10000">
					<u-cell size="large" title="新增车辆" isLink url="/pages/index/addTruck"> </u-cell>
				</u-list-item>
			</u-list>
		</view>
	</view>
</template>

<script>
	import request from '@/common/libs/request.js';
	export default {
		mounted() {
			this.initData()
		},
		data() {
			return {
				defaultAvatar: 'http://dn-dounengyin.qbox.me/Fvz4y4_hhBt0CaY9_8PMm8IeXc8p',
				truckList: [

				]

			}
		},
		methods: {
			initData() {
				let _that = this;
				request.httpPost("/apis/dnyDriver/getTruckInfoList", {}).then(res => {
					if (res.httpCode == 200) {
						_that.truckList = res.data
					} else {
						uni.showToast({
							title: res.msg,
							icon: "error"
						})
					}
				});
			}
		}
	}
</script>

<style>
	.cu-bar {
		padding-left: 60rpx;
		padding-top: 30rpx;
	}

	.avatar-txt span {
		display: block;
		width: 100;
	}

	.list-con {
		margin-top: 50rpx;
	}

	.w-h-100 {
		height: 100%;
		width: 100%;
	}

	.uni-row .flex-item-30 {
		color: #8799a3;
	}

	.flex-item-30 {
		flex-basis: 30%;
	}

	.flex-item-70 {
		flex-basis: 70%;
	}
</style>