<template>
	<view class="w-h-100">
		<view class="cu-bar">
			<u-row gutter="20">
				<u-col span="4">
					<view><u-avatar :src="src"></u-avatar></view>
				</u-col>
				<u-col span="8">
					<view class="avatar-txt">
						<span>{{driverInfo.driverName}}(<b
								style="color: #e4493c;">{{driverInfo.driverState == 1? '已审核' : '未审核'}}</b>)</span>
						<span>{{driverInfo.defaultTruckCode}}</span>
					</view>
				</u-col>
			</u-row>
		</view>
		<view class="list-con">
			<u-cell-group>
				<u-cell :isLink="true" title="我的资料" icon="account"></u-cell>
				<u-cell :isLink="true" title="我的车辆" icon="car" url="/pages/index/myTruckList"></u-cell>
				<u-cell :isLink="true" title="已配送订单(当月)" icon="order"></u-cell>
			</u-cell-group>
		</view>

		<view class="padding-lr padding-tb-xs">
			<button class="cu-btn block shadow bg-white margin text-red" @tap="logout">退出登录</button>
		</view>
	</view>
</template>

<script>
	import request from '@/common/libs/request.js';
	export default {
		mounted() {
			this.initData()
		},
		data() {
			return {
				src: 'http://dn-dounengyin.qbox.me/Fvz4y4_hhBt0CaY9_8PMm8IeXc8p',
				driverInfo: {
					driverName: '',
					driverState: 0,
					defaultTruckCode: ''
				}

			}
		},
		methods: {
			initData() {
				let _that = this;
				request.httpPost("/dnyDriver/getDriverInfo", {}).then(res => {
					if (res.httpCode == 200) {
						console.log("3333", res.data)
						_that.driverInfo = res.data
					} else {
						uni.showToast({
							title: res.msg,
							icon: "error"
						})
					}
				});
			},
			logout() {
				uni.removeStorageSync('erpToken');
				uni.reLaunch({
					url: '/pages/login/login'
				});
			}
		}
	}
</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>
