<template>
	<view class="inventory-wrap">
		<view class="ground-title-picking">
			<csr-tab :value.sync="index" :tabList="tabList" style="{position: 'relative';z-index: 51;}"></csr-tab>
			<view class="ground-icon"></view>
			<renTime :filterData='filterData' :defaultIndex='defaultIndex' @ed='ed'
				:stylesData="{padding:'0 0 0 540rpx'}"></renTime>
		</view>
		<z-paging ref="paging" @query="queryList" v-model="dataList" :use-page-scroll="true">
			<view class="list-item" v-for="(item,index) in dataList" :key="index" @click="itemDetails(item)">
				<view class="list-data">
					<text class="text-label">盘点单号：</text>
					<text class="text-cont">{{item.code}}</text>
				</view>
				<view class="list-data">
					<text class="text-label">任务名称：</text>
					<text class="text-cont">{{item.hispName}}</text>
				</view>
				<view class="list-data">
					<text class="text-label">目标仓库：</text>
					<text class="text-cont">{{item.cangku}}</text>
				</view>
				<view class="list-data">
					<text class="text-label">盘点品种：</text>
					<text class="text-cont">{{item.pandpz}}</text>

					<text class="text-label" style="{display: inline-block;margin-left: 50rpx;}">盘点总数：</text>
					<text class="text-cont">{{item.panzStal}}</text>
				</view>
				<view class="list-data">
					<text class="text-label">盘点金额：</text>
					<text class="text-cont">{{item.pandjine}}</text>
				</view>
				<view class="list-data">
					<text class="text-label">盘点时间：</text>
					<text class="text-cont">{{item.pandianTime}}</text>
				</view>
				<view class="invent-btn">
					<button type="primary" size="mini" v-if="item.status" @click.stop="inventResult()">盘点结果</button>
					<button type="primary" size="mini" v-else>进入盘点</button>
				</view>
				<view class="status-text">待盘点</view>
			</view>
		</z-paging>
		<uni-fab ref="fab"  :horizontal="horizontal" :vertical="vertical"
			:direction="direction" @trigger="trigger" @fabClick="fabClick" />
	</view>
</template>

<script>
	import renTime from '@/components/ren-time/ren-time.vue';
	import {
		listData
	} from "./list.js";
	import ZPMixin from '@/uni_modules/z-paging/components/z-paging/js/z-paging-mixin.js'
	export default {
		mixins: [ZPMixin],
		components: {
			renTime,
		},
		data() {
			return {
				index: 0,
				tabList: ['全部', '待盘点', '已盘点'],
				filterData: [],
				defaultIndex: [0],
				listData: listData,
				dataList: []
			}
		},
		methods: {
			queryList(pageNo, pageSize) {
				this.$refs.paging.complete(this.listData);
			},
			//跳转上架详情	 
			itemDetails(item) {
				uni.navigateTo({
					url: '/pages/inventoryCont/outbound',
					success: function(res) {}
				});
			},
			// 进入盘点结果
			inventResult() {
				uni.navigateTo({
					url: '/pages/result/result',
					success: function(res) {}
				});
			},
			// 新建盘点
			fabClick(){
				uni.navigateTo({
					url: '/pages/formview/formview',
					success: function(res) {}
				}); 
			}
		}
	}
</script>

<style lang="scss">
	.inventory-wrap {
		width: 100%;
		height: 100%;
		box-sizing: border-box;
		background-color: #F1F1F1;

		.ground-title-picking {
			width: 100%;
			height: 100rpx;
			border-bottom: 2rpx solid #ccc;
			display: flex;
			align-items: center;
			box-sizing: border-box;
			position: relative;
			margin-bottom: 10rpx;
		}

		.list-item {
			width: 100%;
			height: 440rpx;
			margin-top: 10rpx;
			border: 2rpx solid #BDBDBD;
			padding: 20rpx 20rpx 20rpx 50rpx;
			box-sizing: border-box;
			position: relative;
			background-color: #fff;
			border-radius: 20rpx;

			.list-data {
				width: 70%;
				height: 40rpx;
				line-height: 40rpx;
				margin-top: 10rpx;

				.text-label {
					color: rgba(16, 16, 16, 1);
					font-size: 28rpx;
					font-family: PingFangSC-medium;
				}

				.text-cont {
					color: rgba(16, 16, 16, 1);
					font-size: 28rpx;
					font-family: PingFangSC-regular;
				}
			}

			.status-text {
				width: 100rpx;
				height: 40rpx;
				position: absolute;
				right: 20rpx;
				top: 30rpx;
				font-family: PingFangSC-semiBold;
				font-size: 28rpx;
				color: rgba(71, 73, 161, 0.86);
			}

			.invent-btn {
				width: 100%;
				height: 100rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				border-top: 2rpx solid #ccc;
				margin-top: 10rpx;
			}

			.time-text {
				width: 100rpx;
				height: 40rpx;
				position: absolute;
				right: 20rpx;
				bottom: 25rpx;
				font-family: PingFangSC-semiBold;
				font-size: 28rpx;
				color: rgba(71, 73, 161, 0.86);
			}
		}
	}
</style>