<template>
    <ele-page flex-table>
        <ele-card flex-table>
            <div class="common-section mb-4">
                <div class="common-title mb-4">自动初审设置</div>
                <auto-audit-settings :settings="settings" />
            </div>
            <div class="common-section mb-4">
                <div class="common-title mb-4">不支持退回地区</div>
                <not-supported-returned :settings="settings" />
            </div>
            <div class="common-section mb-4">
                <div class="common-title mb-4">不支持下单地区</div>
                <not-supported-area :settings="settings" />
            </div>
            <div class="common-section mb-4">
                <div class="common-title mb-4 flex items-center"
                    >回收预警参数设置
                    <ele-text type="info" class="ml-4"
                        >开启后达到以下条件，在“回收订单预警”页面进行预警，最大输入数值为1000</ele-text
                    >
                </div>
                <recycle-alert-params :settings="settings" />
            </div>
            <div class="common-section mb-4">
                <div class="common-title mb-4">回收订单设置</div>
                <recycle-order-settings :settings="settings" />
            </div>
            <div class="common-section mb-4">
                <div class="common-title mb-4">自动取消订单设置</div>
                <auto-cancel-order :settings="settings" />
            </div>
            <div class="common-section">
                <div class="common-title mb-4">客服申请恢复订单限制</div>
                <restore-order-settings :settings="settings" />
            </div>
        </ele-card>
    </ele-page>
</template>

<script setup>
    import { getCurrentInstance } from 'vue';
    import restoreOrderSettings from '@/views/recycle/orderSetting/components/restore-order-settings.vue';
    import autoCancelOrder from '@/views/recycle/orderSetting/components/auto-cancel-order.vue';
    import recycleOrderSettings from '@/views/recycle/orderSetting/components/recycle-order-settings.vue';
    import recycleAlertParams from '@/views/recycle/orderSetting/components/recycle-alert-params.vue';
    import notSupportedArea from '@/views/recycle/orderSetting/components/not-supported-area.vue';
    import notSupportedReturned from '@/views/recycle/orderSetting/components/not-supported-returned.vue';
    import autoAuditSettings from '@/views/recycle/orderSetting/components/auto-audit-settings.vue';
    let { proxy } = getCurrentInstance();

    defineOptions({ name: 'RecycleOrderSettings' });

    //获取当前设置
    const settings = ref({});
    function getSettings() {
        proxy.$http.get('/recycle/manage/get').then((res) => {
            if (res.data.code === 200) {
                settings.value = res.data.data;
            } else {
                ElMessage.error(res.data.msg);
            }
        });
    }
    getSettings();
</script>
