<template>
	<view class="solid-bottom  content" @tap="virtualScan(driver.driverId)">
		<view class="text-xl">
			<text class="cuIcon-deliver text-red padding-sm padding-bottom-0">
			</text>
			<text class="text-df text-black padding-top-sm">
				{{driver.plateNumber?driver.plateNumber:'暂无车牌号'}}
			</text>
		</view>
		<view class="padding-left padding-bottom margin-left">
			<view class="bg-white padding-left-xs">
				<text class="padding-right-lg text-df">{{driver.userName}} ({{driver.driverId}})</text>{{driver.phone|phoneFilter}}
			</view>
		</view>
	</view>
</template>

<script>
	import partnerApi from '@/api/partner.js'
	export default {
		props: {
			driver: {
				type: Object,
				default () {}
			}
		},
		data() {
			return {
				mainURL: this.global.mainURL,
				loginUser: uni.getStorageSync('loginUser'),
			};
		},
		methods: {
			virtualScan(id) {
				partnerApi.getQrCode(id).then(res=>{
					if(res.code==20000){
						uni.setStorageSync('qrCode', res.data)
						uni.navigateTo({
							url:`/pages/stationDetail/stationDetail`
						})
					}
				})
			}
		},
		filters: {
			phoneFilter(value) {
				if (value) {
					return value.substring(0, 3) + ' ' + ' **** ' + ' ' + value.substring(7, 11)
				} else {
					return '暂无手机号'
				}

			}
		}


	}
</script>

<style scoped>
	.cu-tag {
		border-radius: 100upx 0 0 100upx;
		position: absolute;
		right: 0;
		top: 30rpx;
	}
</style>
