<script setup>
import Filter from "../../../../components/Filter/index.vue";
import {reactive} from "vue";
import useTableQuery from "../../../../hooks/useTableQuery.js";
import Api from "../../../../api/index.js";

const columns = [
    {
        title: '商家ID',
        dataIndex: 'key',
    },
    {
        title: '渠道',
        dataIndex: 'key',
    },
    {
        title: '达人ID',
        dataIndex: 'key',
    },
    {
        title: '推广账号ID',
        dataIndex: 'image',
        slotName: 'image',
    },
    {
        title: '推广账号',
        dataIndex: 'image',
        slotName: 'image',
    },
    {
        title: '拉黑原因',
        dataIndex: 'key',
    },
    {
        title: '拉黑效果',
        dataIndex: 'key',
    },
    {
        title: '开始日期',
        dataIndex: 'key',
    },
    {
        title: '结束日期',
        dataIndex: 'key',
    },
    {
        title: '关联任务ID',
        dataIndex: 'key',
    },
    {
        title: '关联子任务ID',
        dataIndex: 'key',
    },
    {
        title: '操作',
        dataIndex: 'action',
        slotName: 'action',
        width: 90,
    },
];
const FilterConfig = [
    {
        key: 'b_uid',
        type: 'input',
        label: '商家ID',
        placeholder: '请输入商家ID',
    },
    {
        key: 'u_uid',
        type: 'input',
        label: '达人ID',
        placeholder: '请输入达人ID',
    },
    {
        key: 'account',
        type: 'input',
        label: '推广账号',
        placeholder: '请输入推广账号',
    },
    {
        key: 'rangeTime',
        start: 'start_time',
        end: 'end_time',
        type: 'datetime',
        label: '推广日期',
    },
];

const po = reactive({});
const vo = reactive({
    page: '',
    rows: [],
    total: 0,
});

const {loading, pagination, initFetchData} = useTableQuery({
    parameter: po,
    api: Api.admin.getTaskblockList,
    callback: (data) => {
        Object.assign(vo, data);
    }
});
</script>

<template>
    <!-- 拉黑记录 -->
    <a-card>
        <Filter
            @search="initFetchData"
            v-model:from="po"
            :config="FilterConfig">
        </Filter>

        <a-table
            :data="vo.rows"
            @page-change="(e) => pagination.current = e"
            :pagination="pagination"
            :loading="loading"
            :columns="columns"
            class="flex-grow">
            <template v-slot:action>
                <div class="flex gap-[20px]">
                    <a-link :hoverable="false">取消拉黑</a-link>
                </div>
            </template>
        </a-table>
    </a-card>
</template>

<style scoped>

</style>
