<script setup lang="ts">
import { ref, unref } from "vue";
import searchConfig from "./config/search.config";
import contentConfig from "./config/content.config";
import PageAuth from "/@/components/PageAuth";
import { PageModal, usePageModal } from "/@/components/PageModal";
import modalConfig from "./config/modal.config";
import { PageContent } from "/@/components/PageContent";
import type { PageContentInstance } from "/@/components/PageContent";
import { PageSearch, usePageSearch } from "/@/components/PageSearch";
import { exportPageContent } from "/@/utils/export";
const pageName = "order";

const { handleResetClick, handleSearchClick } = usePageSearch();
const pageContentRef = ref<PageContentInstance | null>(null);
const { pageModalRef, handleConfrim, defaultInfo } = usePageModal({
  pageContentRef
});

async function handleDetailData(id, type) {
  // actionModalRef.value.onShow("兑换商品库存", type, id);
}
</script>

<template>
  <!-- <PageAuth :pageName="pageName"> -->
  <PageSearch
    :form-config="searchConfig"
    @search-btn-click="handleSearchClick"
    @reset-btn-click="handleResetClick"
  >
    <template #action>
      <!-- v-if="!isSuperUser" @click="onDownloadTemplate" -->
      <el-button
        @click="
          exportPageContent({
            type: 'http',
            url: 'orderExport',
            params: {},
            name: '订单导出'
          })
        "
        >导出订单</el-button
      >
      <!-- v-if="!isSuperUser" -->
      <!-- @click="() => execlUploadRef.onDisplay()" -->
      <el-button type="primary">批量发货 </el-button>
    </template>
  </PageSearch>
  <PageContent
    ref="pageContentRef"
    :content-config="contentConfig"
    @preview-btn-click="({ id }) => handleDetailData(id, 'preview')"
  />
  <PageModal
    ref="pageModalRef"
    :modal-config="modalConfig"
    :default-info="defaultInfo"
    @confirm-btn-click="handleConfrim"
  />
  <!-- </PageAuth> -->
</template>
