<template>
    <div class="box">
        <div class="inquire">
            <span>分区</span>
            <partition-select v-model:partition-id="formData.partitionId" />
        </div>
        <div class="inquire">
            <span>房间ID:</span>
            <el-input v-model="formData.roomErbanNo" placeholder="" class="input"></el-input>
        </div>
        <div class="inquire">
            <div class="block">
                <span class="demonstration">开始时间</span>
                <el-date-picker v-model="formData.startTime" type="datetime" placeholder="开始时间">
                </el-date-picker>
            </div>
        </div>
        <el-button style="" type="primary" @click="getData()">查询</el-button>
        <!-- 表格数据 -->
        <el-table v-loading="tableData.loading" :data="tableData.data" ref="multipleTable"
            @selection-change="handleSelectionChange" border style="width: 100%; margin-top: 25px">
            <el-table-column prop="id" align="center" label="id" />
            <el-table-column prop="roomErbanNo" align="center" label="房间ID" />
            <el-table-column prop="erbanNo" align="center" label="举办人ID" />
            <el-table-column prop="nick" align="center" label="举办人昵称" />
            <el-table-column prop="partitionDesc" align="center" label="分区" />
            <el-table-column prop="eventStartTimeStr" align="center" label="开始时间" />
            <el-table-column prop="eventDuration" align="center" label="活动时长（分钟）" />
            <el-table-column prop="diamondNum" align="center" label="房间钻石流水" />
            <el-table-column prop="goldNum" align="center" label="房间金币流水" />
        </el-table>
        <!-- 分页 -->
        <el-pagination style="margin-top: 10px" class="paginationClass" :current-page="formData.pageNo"
            :page-size="formData.pageSize" :page-sizes="[10, 20, 50, 100, 200]" layout="sizes, prev, pager, next"
            :total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
    </div>
</template>

<script>
import { ref, onMounted, reactive } from 'vue'
import PartitionSelect from "../common/partitionSelect.vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { getUserEventDataList } from "@/api/boom/roomActivityApplication";
export default {
    name: "roomActivityDataStatistics",
    components: { PartitionSelect },
    setup() {
        const formData = reactive({
            partitionId: undefined,
            roomErbanNo: '',
            startTime: '',
            pageNo:1,
            pageSize:10,
        });
        const tableData = reactive({
            data: [],
            total: 0,
            loading: false,
        })
        const getData = () => {
            tableData.loading = true;
            getUserEventDataList(formData).then(res => {
                if (res.code == 200) {
                    tableData.data = res.data.rows
                    tableData.loading = false;
                    tableData.total = res.data.total

                } else {
                    tableData.loading = false;
                    ElMessage.error(res.message);
                }
            })
        };
        const handleSizeChange = (val) => {
            formData.pageSize = val;
            getData();
        };
        const handleCurrentChange = (val) => {
            formData.pageNo = val;
            getData();
        };
        return {
            formData,
            getData,
            tableData,
            handleSizeChange,
            handleCurrentChange
        }
    }
}
</script>

<style lang="less" scoped>
.box {
    padding-top: 20px;
    background: #ecf0f5;

    .inquire {
        display: inline-block;
        margin-right: 20px;

        span {
            margin-right: 10px;
        }

        .input {
            width: 180px;
            margin-right: 10px;
        }
    }

    .dialogTableVisibleBut {
        display: block;
        margin: 30px 0 0 830px;
    }

    .paginationClass {
        margin: 15px 0 5px 0px;
    }
}
</style>