<template>
    <ele-modal v-model="visible" title="操作记录" :width="800" :footer="null">
        <common-table
            ref="tableRef"
            :columns="columns"
            :page-config="pageConfig"
            :bodyStyle="{ padding: 0 }"
        />
    </ele-modal>
</template>

<script setup>
    import { ref, reactive } from 'vue';
    import { EleMessage } from 'ele-admin-plus/es';
    import CommonTable from '@/components/CommonPage/CommonTable.vue';
    import request from '@/utils/request';

    const visible = ref(false);
    const redPacketId = ref('');
    const tableRef = ref(null);

    const columns = ref([
        { label: '操作账号', prop: 'createName', minWidth: 120 },
        { label: '操作时间', prop: 'createTime', minWidth: 160 },
        {
            label: '操作内容',
            prop: 'content',
            minWidth: 200,
            showOverflowTooltip: true
        }
    ]);

    const pageConfig = reactive({
        rowKey: 'id',
        tool: false,
        pageUrl: '/shop/couponInfo/getUpdateLogPagelist',
        params: { couponId: '' }
    });

    const open = (id) => {
        redPacketId.value = id;
        visible.value = true;
        if (id) {
            pageConfig.params.couponId = id;
            tableRef.value?.reload();
        }
    };

    defineExpose({ open });
</script>
