<template>
    <div>
        <el-card class="!border-none mb-4" shadow="never">
            <el-form class="mb-[-16px]" :model="queryParams" label-width="80px">
                <el-row>
                    <el-col :span="6">
                        <el-form-item label="商品状态">
                            <el-select class="flex-1" v-model="queryParams.status" clearable placeholder="请选择商品状态">
                                <el-option label="销售中" :value="0" />
                                <el-option label="仓库中" :value="0" />
                                <el-option label="已售罄" :value="0" />
                                <el-option label="库存预警" :value="0" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="商品搜索" prop="nature">
                            <el-input v-model="queryParams.status" clearable placeholder="请输入商品名称" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item>
                            <el-button type="primary" @click="resetPage">查询</el-button>
                            <el-button @click="resetParams">重置</el-button>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
        </el-card>
        <el-card class="!border-none" v-loading="pager.loading" shadow="never">
            <div class="mt-4">
                <el-table :data="pager.lists" @selection-change="handleSelectionChange">
                    <el-table-column label="入账门店" prop="progress" show-overflow-tooltip />
                    <el-table-column label="入账时间" prop="progress" show-overflow-tooltip />
                    <el-table-column label="应入帐金额" prop="progress" show-overflow-tooltip />
                    <el-table-column label="已入账金额" prop="progress" show-overflow-tooltip />
                    <el-table-column label="未入账金额" prop="progress" show-overflow-tooltip />
                    <el-table-column label="操作" width="170" fixed="right">
                        <template #default="{ row }">
                            <el-button type="primary" link @click="handleEdit(row)">
                                编辑
                            </el-button>
                            <el-button type="primary" link @click="handleEdit(row)">
                                起码子
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
            <div class="flex mt-4 justify-end">
                <pagination v-model="pager" @change="getLists" />
            </div>
        </el-card>
        <!-- <detailPopup ref="editRef" /> -->
    </div>
</template>

<script lang="ts" setup name="manageProjectLists">
import { ref, reactive } from "vue"
import { usePaging } from '@/hooks/usePaging'
// import { apiGoodsListLists, apiStatus, apiGoodsTypeLists } from '@/api/goodsList'
// import detailPopup from './detail.vue'

// const editRef = shallowRef<InstanceType<typeof EditPopup>>()
// 是否显示编辑框
// const showDetail = ref(false)


// 查询条件
const queryParams = reactive({
    status: ""
})

// 选中数据
const selectData = ref<any[]>([])

// 表格选择后回调事件
const handleSelectionChange = (val: any[]) => {
    selectData.value = val.map(({ id }) => id)
}


// 分页相关
const { pager, getLists, resetParams, resetPage } = usePaging({
    // fetchFun: apiGoodsListLists,
    params: queryParams
})

// 详情
const handleEdit = async (data: any) => {
    // editRef.value?.open()
}

// getLists()
</script>