<template>
    <div>
        <el-table :data="pager.lists" border style="width: 100%; margin-top: 10px">
            <el-table-column prop="id" label="ID" width="60" />
            <el-table-column label="供应商" prop="supplier_name" show-overflow-tooltip />
            <el-table-column label="商品图片" prop="image" width="120">
                <template #default="{ row }">
                    <el-image
                        style="width: 50px; height: 50px"
                        :src="row.image"
                        :preview-teleported="true"
                    />
                </template>
            </el-table-column>
            <el-table-column label="商品名称" prop="store_name" show-overflow-tooltip />
            <el-table-column label="单位" prop="unit_name" show-overflow-tooltip />

            <!-- <el-table-column label="采购人员" prop="buyer_name" show-overflow-tooltip width="100" /> -->
            <el-table-column label="入库数量" prop="nums" show-overflow-tooltip />
            <el-table-column label="采购价" prop="purchase" show-overflow-tooltip />
            <el-table-column label="总价" prop="total_price" show-overflow-tooltip />
        </el-table>
        <div class="flex mt-4 justify-end">
            <pagination v-if="pager.lists" v-model="pager" @change="getLists" />
        </div>
    </div>
</template>

<script lang="ts" setup name="subOrder">
import { usePaging } from '@/hooks/usePaging'
import { apiBeforehandOrderWarehousingLists } from '@/api/beforehand_order'

const props = defineProps(['order_id'])

const queryParams = reactive({
    id: props.order_id
})
// 分页相关
const { pager, getLists, resetParams, resetPage } = usePaging({
    fetchFun: apiBeforehandOrderWarehousingLists,
    params: queryParams
})
defineExpose({
    getLists
})
</script>
