<template>
	<view class="app-container">
		<uni-nav-bar ref="refTitle" dark :fixed="true" shadow background-color="#007AFF" status-bar :title="title" />
		<uni-card is-full :is-shadow="false" v-if="pendingStockMoveCount>0">
			<div class="uni-card-div" @click="navClick('pendingStockMove')" >
				<text class="t-icon iconhuoche"></text>
				<text style="font-size:20px;">司机审核</text>
				<text style="width:50px;text-align:center;font-size:16px;color:red;">
					{{ pendingStockMoveCount }}
				</text>
			</div>
		</uni-card>
		<uni-card is-full :is-shadow="false" v-if="taskStockMoveCount>0">
			<div class="uni-card-div" @click="navClick('taskStockMove')">
				<text class="t-icon icont-icon-svg-09"></text>
				<text style="font-size:20px;">移位任务</text>
				<text style="width:50px;text-align:center;font-size:16px;color:red;">
					{{ taskStockMoveCount }}
				</text>
			</div>
		</uni-card>
		<uni-list>
			<!-- <uni-list :border="true">
				<div style="display: flex;align-items:center;justify-content:space-between;height: 60px;" @click="navClick" v-if="pendingStockMoveCount>0">
					<text class="t-icon iconhuoche" ></text>
					<text style="font-size:20px;">司机审核</text>
					<text style="width:50px;text-align:center;font-size:16px;color:red;">
						{{ pendingStockMoveCount }}
					</text>
				</div>
				<div style="display: flex;align-items:center;justify-content:space-between;height: 60px;" @click="navClick" v-if="pendingStockMoveCount>0">
					<text class="t-icon iconhuoche" ></text>
					<text style="font-size:20px;">移位任务</text>
					<text style="width:50px;text-align:center;font-size:16px;color:red;">
						{{ pendingStockMoveCount }}
					</text>
				</div>
			</uni-list> -->
		</uni-list>
	</view>
</template>

<script>
	import {
		checkListStockMoveCount,
		taskMoveListCount
	} from '@/api/wms/report.js'
	export default {
		data() {
			return {
				pendingStockMoveCount: 0,
				taskStockMoveCount: 0,
				title: "任务",
			};
		},
		created() {
			//在onShow中执行了，所以不需要
			//this.getList()
		},
		onShow() {
			this.getList();
		},
		methods: {
			getList() {
				let that = this;
				let queryParams = {
					status: 1,
				}
				//司机审核
				checkListStockMoveCount(queryParams).then(res => {
					if (res.code === 200) {
						that.pendingStockMoveCount = res.data
					}
				});
				//移位单(发货员)
				taskMoveListCount().then(res => {
					if (res.code === 200) {
						that.taskStockMoveCount = res.data
					}
				});
			},
			navClick(flag) {
				if(flag=='pendingStockMove'){
					uni.navigateTo({
						url: "/pages/menu/stockMove/driverCheck"
					});
				}else if(flag=='taskStockMove'){
					uni.navigateTo({
						url: "/pages/menu/stockMove/taskStockMove"
					});
				}
			},
		},
		onLoad: function(options) {
			this.$nextTick(() => {
				this.title = "任务(" + uni.getStorageSync('name') + ")";
			});
		},
	}
</script>

<style lang="less">
	.t-icon {
		display: inline-block;
		width: 40px;
		height: 40px;
		background-repeat: no-repeat;
		background-position: center;
		background-size: 100%;
	}
	
	.uni-card-div {
		display: flex;
		align-items:center;
		justify-content:space-between;
	}
</style>