<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="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="nums" show-overflow-tooltip />
            <el-table-column label="退供应商价" prop="price" show-overflow-tooltip />
            <el-table-column label="退供应商总价" prop="total_price" show-overflow-tooltip />
            <el-table-column label="备注" prop="mark" 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 { apiWarehouseProductReturnLists } from '@/api/warehouse_product_return'

const queryParams = reactive({
    bhoid: '',
    return_type: 2
})
// 分页相关
const { pager, getLists, resetParams, resetPage } = usePaging({
    fetchFun: apiWarehouseProductReturnLists,
    params: queryParams
})
function getList(order) {
    queryParams.bhoid = order.id
    getLists()
}
defineExpose({
    getList
})
</script>
