<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: '动账日期',
        dataIndex: 'key',
    },
    {
        title: '动账时间',
        dataIndex: 'key',
    },
    {
        title: '交易流水号',
        dataIndex: 'key',
    },
    {
        title: '动账渠道',
        dataIndex: 'key',
    },
    {
        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: '子任务ID',
        dataIndex: 'key',
    },
    {
        title: '达人iD',
        dataIndex: 'key',
    },
    {
        title: '推广账号iD',
        dataIndex: 'key',
    },
    {
        title: '推广账号',
        dataIndex: 'key',
    },
    {
        title: '关联活动ID',
        dataIndex: 'key',
    },
];
const FilterConfig = [
    {
        key: 'u_uid',
        type: 'input',
        label: '达人ID',
        placeholder: '请输入达人ID',
    },
    {
        key: 'mt_code',
        type: 'input',
        label: '关联任务ID',
        placeholder: '请输入关联任务ID',
    },
    {
        key: 'tc_code',
        type: 'input',
        label: '子任务ID',
        placeholder: '请输入子任务ID',
    },
    {
        key: 'platform',
        type: 'select',
        label: '动账渠道',
        placeholder: '请选择动账渠道',
        api: async () => Api.admin.getUsermoneylogPlatform()
    },
    {
        key: 'purpose',
        type: 'select',
        label: '动账用途',
        placeholder: '请选择动账用途',
        api: async () => Api.admin.getUsermoneylogPurpose()
    },
    {
        key: 'wd',
        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.getUsermoneylogList,
    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">
        </a-table>
    </a-card>
</template>

<style scoped>

</style>
