<template>
    <ele-card :body-style="{ paddingBottom: '8px' }">
        <ProSearch :items="formItems" @search="search" />
    </ele-card>
</template>

<script setup>
    import { computed } from 'vue';
    import ProSearch from '@/components/CommonPage/ProSearch2.vue';
    import { useDictData } from '@/utils/use-dict-data';

    const emit = defineEmits(['search']);

    const [complaint_reason] = useDictData(['complaint_reason']);

    const formItems = computed(() => [
        { type: 'input', label: 'ISBN', prop: 'isbn' },
        { type: 'input', label: '图书名称', prop: 'bookName' },
        {
            type: 'select',
            label: '易投诉平台',
            prop: 'platformList',
            options: [
                { label: '拼多多', value: '拼多多' },
                { label: '淘宝', value: '淘宝' },
                { label: '孔网', value: '孔网' },
                { label: '小程序', value: '小程序' }
            ]
        },
        {
            type: 'select',
            label: '投诉原因',
            prop: 'reasonList',
            options: complaint_reason.value.map((item) => ({
                label: item.dictLabel,
                value: item.dictValue
            }))
        }
    ]);

    const search = (data) => emit('search', data);
</script>
