<template>
    <order-page
        ref="pageRef"
        :pageConfig="pageConfig"
        permissionKey="awaitReview"
    >
        <template #toolbar>
            <el-button
                type="warning"
                plain
                class="ele-btn-icon"
                v-permission="'recycleOrder:awaitReview:batchAudit'"
                @click="handleBatchAudit"
            >
                批量初审
            </el-button>
            <el-button
                type="success"
                plain
                class="ele-btn-icon"
                :icon="DownloadOutlined"
                v-permission="'recycleOrder:awaitReview:export'"
                @click="exportData"
            >
                导出订单明细
            </el-button>

            <el-radio-group
                v-model="status"
                @change="handleExpressTypeChange"
                style="position: relative; top: -3px; margin-left: 20px"
            >
                <el-radio-button label="全部" value="" />
                <el-radio-button label="普通上门取件" value="1" />
            </el-radio-group>
        </template>
    </order-page>
</template>

<script setup>
    import { ref, reactive } from 'vue';
    import { ElMessageBox } from 'element-plus/es';
    import { DownloadOutlined } from '@/components/icons';
    import OrderPage from '@/views/recycleOrder/components/order-page-all.vue';
    import { useRouter } from 'vue-router';

    defineOptions({ name: 'RecycleOrderAwaitReview' });

    let router = useRouter();
    /** 页面组件实例 */
    const pageRef = ref(null);
    const status = ref('');

    const pageConfig = reactive({
        pageUrl: '/order/orderInfo/firstCheck/pageList',
        exportUrl: '/order/orderInfo/firstCheck/export',
        fileName: '待初审订单',
        cacheKey: 'awaitReviewTable',
        where: {
            expressType: ''
        }
    });

    function handleExpressTypeChange(val) {
        pageConfig.where.expressType = val;
        pageRef.value?.reload({ expressType: val });
    }

    //批量初审
    function handleBatchAudit() {
        pageRef.value?.handleFirstCheck(null);
    }

    //导出数据
    function exportData() {
        pageRef.value?.exportData('待初审订单');
    }
</script>
