<template>
    <div>
        <div>
            <el-table :data="pager.lists" v-loading="pager.loading">
                <el-table-column
                    label="商品信息"
                    prop="store_name"
                    show-overflow-tooltip
                    width="400"
                >
                    <template #default="{ row }">
                        <div class="flex items-center">
                            <el-image
                                :src="row.image"
                                class="w-16 h-16 mr-2"
                                :preview-teleported="true"
                            ></el-image>
                            <div>{{ row.store_name }}</div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="规格" prop="sku_name" show-overflow-tooltip />
                <el-table-column label="数量" prop="cart_num" show-overflow-tooltip />
            </el-table>
        </div>
        <div class="flex mt-4 justify-end" v-if="pager.lists.length < pager.count">
            <pagination v-model="pager" @change="getLists" />
        </div>
    </div>
</template>

<script lang="ts" setup name="orderInfo">
import type { PropType } from 'vue'
import { apiInventoryTransferOrderLists } from '@/api/inventory_transfer_order'
import { usePaging } from '@/hooks/usePaging'

const queryParams = reactive({
    oid: ''
})

// 分页相关
const { pager, getLists, resetParams, resetPage } = usePaging({
    fetchFun: apiInventoryTransferOrderLists,
    params: queryParams
})
const getList = (e: any) => {
    queryParams.oid = e.oid
    getLists()
}
defineExpose({
    getList,
    getLists
})
const route = useRoute()
onMounted(() => {
    queryParams.oid = route.query.id
    getLists()
})
</script>
