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

const columns = [
    {
        title: '账号ID',
        dataIndex: 'key',
    },
    {
        title: '达人ID',
        dataIndex: 'key',
    },
    {
        title: '渠道',
        dataIndex: 'key',
    },
    {
        title: '主页截图',
        dataIndex: 'image',
        slotName: 'image',
    },
    {
        title: '主页二维码',
        dataIndex: 'image',
        slotName: 'image',
    },
    {
        title: '账号',
        dataIndex: 'key',
    },
    {
        title: '昵称',
        dataIndex: 'key',
    },
    {
        title: '推广账号状态',
        dataIndex: 'status',
        slotName: 'status',
    },
    {
        title: '添加日期',
        dataIndex: 'key',
    },
    {
        title: '操作',
        dataIndex: 'action',
        slotName: 'action',
        width: 160,
    },
];
const FilterConfig = [
    {
        key: 'uuid',
        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({
    wd: null,
});
const vo = reactive({
    page: '',
    rows: [],
    total: 0,
});

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

<template>
    <!-- 推广账号 -->
    <a-card>
        <Filter
            @search="initFetchData"
            v-model:from="po"
            :config="FilterConfig"
            :button-col="false">
        </Filter>

        <a-table
            :data="vo.rows"
            @page-change="(e) => pagination.current = e"
            :pagination="pagination"
            :loading="loading"
            :columns="columns"
            class="flex-grow">
            <template v-slot:status>
                状态
            </template>
            <template v-slot:action>
                <div class="flex gap-[20px]">
                    <a-link :hoverable="false">编辑</a-link>
                    <a-link :hoverable="false" status="success">通过</a-link>
                    <RefuseModal></RefuseModal>
                </div>
            </template>
        </a-table>
    </a-card>
</template>

<style scoped>

</style>
