<template>
	<view class="wrap">
		<view class="orderMonitor">
			<u-row  class="userinfo-topbox" gutter="16" justify="center">
				<u-col span="6" text-align="center" style="margin: 1px;">
					<view style="color: #CCFFFF;">{{defaultTruckCode}}</view>
				</u-col>
				<u-col span="6" text-align="center" style="margin: 1px;">
					<view style="color: #CCFFFF;"></view>
				</u-col>
			</u-row>
			<u-row style="margin-top: -25rpx;"  class="userinfo-topbox" gutter="16" justify="center">
				<u-col span="6" text-align="center" style="margin: 1px;">
					<view style="color: #CCFFFF;">未配送订单</view>
					<view class="number">50</view>
				</u-col>
				<u-col span="6" text-align="center" style="margin: 1px;">
					<view style="color: #CCFFFF;">已配送订单</view>
					<view class="number">20</view>
				</u-col>
			</u-row>
		</view>
		<view class="workbench-title">常用应用</view>
		<view class="toolbar">
			<u-grid class="grid" :col="4" :border="false">
				<u-grid-item @click="navTo('/pages/feedback/scancodeCar')"  :index="0">
						<view   class="home-icon icon-color02">
							<i class="iconfont icon-cangpeitubiao_huanhuorukutuihuoruku"></i>
						</view>
						<view class="grid-text">扫码装车</view>
				</u-grid-item>
				<u-grid-item @click="navTo('/pages/feedback/print')"  :index="1">
						<view class="home-icon icon-color02">
							<i class="iconfont icon-fahuo"></i>
						</view>
						<view class="grid-text">支线交接</view>
				</u-grid-item>
				<u-grid-item @click="scanFabClick"  :index="2">
						<view class="home-icon icon-color02">
							<i class="iconfont icon-kechengfankui"></i>
						</view>
						<view class="grid-text">扫码签收</view>
				</u-grid-item>
			</u-grid>
		</view>
	</view>
</template>

<script>
	import request from '@/common/libs/request.js';
	export default {

		data() {
			return {
				defaultTruckCode:"",
				orderData:[],
				cardData: "",
				listData: {
					total: 0,
					page: 1,
					pageSize: 20
				},
			}
		},
		onLoad(){

		},
		mounted: function(option) {
			this.initData()
			// this.getCurrentItems();
			//不再这里调用，由主页刷新获取
			// this.getIndexCardPanelData();
		},

		methods: {
			initData() {
				let _that = this;
				request.httpPost("/dnyDriver/getDriverInfo", {}).then(res => {
					if (res.httpCode == 200) {
						uni.setStorageSync("idDefaultTruck", res.data.idDefaultTruck);
						_that.defaultTruckCode =  res.data.defaultTruckCode
					} else {
						uni.showToast({
							title: res.msg,
							icon: "error"
						})
					}
				});
			},
			navTo(url) {
				uni.navigateTo({
					url: url
				});
			},
			scanClickCar(){
				let _that = this;
				console.log("1111")
				uni.reLaunch({
					url: '/pages/feedback/scanOrderCode',
				})
			},
			scanFabClick(e) {
			let _that = this;
			//扫码
			uni.scanCode({
				onlyFromCamera: true,
				scanType: ['barCode', 'qrCode'],
				success: function(res) {
					console.log("121221",res)
					_that.billScanOrderCode(res.result)

				}
			})


		},
		billScanOrderCode(idOrder) {
			let _that = this;
			let dataInfo = {
				"idOrder": idOrder,
			}

			request.httpPost("/dnyDriver/scanOrderCode", dataInfo, true).then(res => {
				if (res.httpCode == 200) {
					console.log("3333",res)
				}
			});
		},
		getCurrentItems(){
			const _that = this;
			var page = {
				pageIndex: _that.listData.page,
				pageSize: _that.listData.pageSize
			}
			var data = {
				"page": JSON.stringify(page)
			}
			request.httpPost("/dnyDriver/showCurrentTransitioningItems", data, false).then(res => {
				if (res.httpCode == 200) {
					console.log("4444",res)
					_that.orderData = res.data
				}else {
					uni.showToast({
						title: res.msg,
						icon: "error"
					})
				}


			})
		},
		}
	}
</script>

<style lang="scss">
	.orderMonitor {
		height: 190upx;
		border-radius: 4upx;
		color: #F0F0F0;
		// background-image: linear-gradient(to right, #ffffff 0%, #ffffff 100%);
		background-image: linear-gradient(to right, #006699 0%, #6699CC 100%);
		border: #ffffff;
		padding: 16upx;
		margin: 16upx;
		box-shadow: 4upx 4upx 6upx rgba(102, 153, 204, 0.4);
	}

.userinfo-topbox{
	padding: 4px 8px;
	color: #000000;
	.number{
		font-size: 14px;
		font-weight: bold;
		color: #FF9900;
	}
}
.userinfo-infobox{
	color: #000000;
	background-image: linear-gradient(to right, #CCCCCC 0%, #CCCCCC 100%);
	.number{
		font-size: 12px;
	}
}

	.wrap {
		background: #FFFFFF;
		.search {
			padding: 20rpx 20rpx 0;
			background: #f8f8f8;
			height: 105rpx;
		}

		.scroll-list {
			height: calc(100vh - var(--window-top) - var(--window-bottom) - 105rpx); // 105rpx 为 .search 的高度
			width: 100%;

			.loadmore {
				padding: 30rpx;
			}
		}

		.box {
			padding-bottom: 10rpx;

			.item {
				margin: 0 20rpx 20rpx;
				padding: 8rpx 20rpx;
				border-radius: 20rpx;
				box-sizing: border-box;
				background-color: #fff;
				font-size: 28rpx;

				.title {
					display: flex;
					justify-content: space-between;
					background-color: #fff;
					padding-left: 15rpx;
					align-items: center;

					.text {
						margin: 0 20rpx;
						font-size: 35rpx;
						font-weight: bold;
					}

				}
			}

		}

		.list {

			.u-cell-item-box {

				.u-swipe-content {
					width: 750rpx;
				}

				.u-cell_title {
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					min-width: 655rpx;
				}

				.u-border-bottom:last-child:after {
					border-bottom: 0;
				}
			}
		}

		.form {
			display: flex;
			flex-direction: column;
			padding: 20rpx 30rpx;

			.u-cell-item-box {
				border-radius: 20rpx;
			}
		}

		.form-footer {
			display: flex;
			margin: 10rpx;
			padding-bottom: 30rpx;

			.btn {
				flex: 1;
				margin: 20rpx;
			}
		}

		.u-cell-box {

			.u-cell {
				font-size: 30rpx;
			}

			.u-cell_title {
				font-size: 30rpx;
			}

			.u-cell__left-icon-wrap {
				margin-right: 18rpx;
			}
		}
	}

	.workbench-title {
		font-size: 32rpx;
		font-weight: bold;
		color: #333333;
		padding: 15px 30rpx;
	}


	.grid {

		.grid-icon {
			color: #666;
		}

		.grid-text {
			font-size: 24rpx;
			padding: 15rpx;
			color: #202328;
		}
	}

	.toolbar {

		background-color: #fff;
	}
</style>
