<template>
	<view class="min-page bg-gray">
		<template v-if="page.list.length">
			<view class="u-m-b-28 " v-for="(item,index) in page.list" :key="index">
				<list-item @more="moreShow"></list-item>
			</view>
			<uni-load-more :status="page.status" />
		</template>
		<template v-else>
			<view class="" style="margin-top: 150rpx;">
				<my-empty tips="暂无出库记录"></my-empty>
			</view>
		</template>
	</view>
	<view class="u-fix bottom">
		<my-button shape="circle" type="primary" @tap="toAddCategory">添加类别</my-button>
	</view>
	<my-action-sheet @itemClick="sheetClick" ref="refMoreSheet" :list="actionSheet.list"></my-action-sheet>
</template>

<script setup>
	import go from '@/commons/utils/go.js'
	import myButton from '@/components/my-components/my-button';
	import myActionSheet from '@/components/my-components/my-action-sheet';
	import myEmpty from '../components/empty.vue';
	import {
		reactive,
		ref
	} from 'vue';
	import listItem from './components/list-item';
	const page = reactive({
		list: [1, 2],
		status: 'noMore'
	})
	let refMoreSheet = ref(null)
	const actionSheet = reactive({
		list: ['编辑', '删除']
	})

	function moreShow() {
		refMoreSheet.value.open()
	}

	function toAddCategory() {
		go.to('PAGES_CATEGORY_CONTROL_EDIT')
	}

	function sheetClick(e) {
		if (e === 0) {
			return go.to('PAGES_CATEGORY_CONTROL_EDIT', {
				title: '分类：测试分类',
				type:'edit',
				id: 1
			})
		}
	}
</script>

<style lang="scss" scoped>
	.min-page {
		padding: 32rpx 28rpx;
	}

	.bottom {
		bottom: calc(env(safe-area-inset-bottom) + 84rpx);
		left: 110rpx;
		right: 110rpx;
	}
</style>