<template>
	<view class="lists">
		<StickyNavBar>
			<NavBar title="库存盘点"></NavBar>
			<view class="selectSheet">
				<u-tabs :list="list" :is-scroll="false" :current="current" @change="changeTab"></u-tabs>
			</view>
		</StickyNavBar>
			<waitInventoried v-if="current === 0" />
			<inventoryForm v-else />
		<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle" v-if="current === 0"></BottomBtn>
	</view>
</template>

<script>
import StickyNavBar from '@/components/StickyNavBar/index.vue';
import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue';
import BottomBtn from '@/components/BottomBtn/index.vue';
import waitInventoried from './waitInventoried.vue';
import inventoryForm from './inventoryForm.vue';

export default {
	components: {
		StickyNavBar,
		ContentLoadingMore,
		BottomBtn,
		waitInventoried,
		inventoryForm
	},
	data() {
		return {
			value: '',
			type: 'select',
			show: false,
			border: true,
			list: [
				{
					name: '待盘点'
				},
				{
					name: '盘点调整单'
				}
			],
			current: 0,
			status: 'loadmore',
			btnArr: [
				{
					style: '',
					type: 'warning',
					text: '返回',
					way: 'goBack'
				}
			]
		};
	},
	methods: {
		// 加载更多
		onReachBottom() {
			console.log('加载更多inventoryCounting');
		},
		getBtnHandle(row) {
			console.log('getBtnHandle', row);
			this[row.way]();
		},
		goBack() {
			console.log('返回了');
			uni.navigateBack();
		},
		changeTab(index) {
			this.current = index;
		}
	}
};
</script>

<style lang="scss">
.selectSheet {
	border-bottom: 1px solid #ccc;
}
/deep/ .u-sticky {
	top: 0 !important;
	background: #fff;
}
.contentMore {
	margin: 20rpx;
}
page {
	background: #f8f8f8;
}
</style>
