<template>
    <el-drawer v-model="showDialog" title="订单详情" :size="1000">
        <div class="flex items-center justify-between">
            <div>订单编号：{{ formData.order_id }}</div>
            <div>创建时间</div>
            <div>{{ formData.create_time }}</div>
        </div>
        <div class="flex items-center justify-between">
            <div>转出方：{{ formData.one_name }}</div>
            <div>方式:{{ formData.type_name }}</div>
            <div>转入方：{{ formData.two_name }}</div>
        </div>

        <!-- <el-tabs v-model="activeName" class="demo-tabs" type="border-card" @tab-click="handleClick">
            <el-tab-pane label="订单信息" name="first">
                <orderInfo :datas="formData" ref="productRef"></orderInfo>
            </el-tab-pane>
        </el-tabs> -->
        <el-table :data="formData.product_list">
            <el-table-column label="商品" prop="store_name" show-overflow-tooltip />
            <el-table-column label="数量" prop="nums" show-overflow-tooltip />
        </el-table>
    </el-drawer>
</template>

<script lang="ts" setup name="storeOrderDETAILS">
import Popup from '@/components/popup/index.vue'
import { apiInventoryTransferOrderDetail } from '@/api/inventory_transfer_order'
import type { PropType } from 'vue'
import orderInfo from './components/orderInfo.vue'

const emit = defineEmits(['success', 'close'])
const showDialog = ref(false)
const productRef = ref(false)
const activeName = ref('first')

// 表单数据
const formData = ref({
    id: ''
})

// 获取详情
const setFormData = async (data: Record<any, any>) => {
    formData.value = { ...data }
}
const handleClick = (tab: any) => {
    productRef.value?.getList({ oid: formData.value.id })
}
const getDetail = async (row: Record<string, any>) => {
    formData.value.id = row.id
    const data = await apiInventoryTransferOrderDetail({
        id: row.id
    })
    setFormData(data)
}

//打开弹窗
const open = () => {
    showDialog.value = true
}

defineExpose({
    open,
    setFormData,
    getDetail
})
</script>
