Files
peko-admin-web/src/views/guildOperationManagement/cisHomeOwnerDiamond.vue

197 lines
4.9 KiB
Vue

<template>
<div class="box">
<div class="inquire">
<span>房间ID:</span>
<el-input v-model="formData.erbanNo" placeholder="" class="input" />
</div>
<div class="inquire">
<span>国家</span>
<el-select v-model="formData.regionId" placeholder="请选择">
<el-option
v-for="item in adminCountryArr"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</div>
<div class="inquire">
<span>周期</span>
<el-select v-model="formData.cycleDate" placeholder="请选择" clearable>
<el-option
v-for="item in dateCycleArr"
:key="item.cycleDate"
:label="item.intervalFormatter"
:value="item.cycleDate"
>
</el-option>
</el-select>
</div>
<el-button style="" type="primary" @click="getData()">查询</el-button>
<el-button style="" type="primary" @click="confirmExportExcel()"
>导出</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="statDate" align="center" label="日期" />
<el-table-column prop="erbanNo" align="center" label="房间ID" />
<el-table-column prop="nick" align="center" label="房主昵称" />
<el-table-column prop="regionName" align="center" label="国家" />
<el-table-column prop="diamondNum" align="center" label="房间钻石收益" />
<el-table-column prop="extraDiamondNum" 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>
export default {
name: "cisHomeOwnerDiamond",
};
</script>
<script setup>
import { ref, onMounted, reactive, computed } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { formatDate } from "@/utils/relDate";
import { dateFormat } from "@/utils/system-helper";
import { getSovietRoomList, exportSovietRoomList ,getRoomCycleDateList} from "@/api/relAgency/relAgency.js";
import { getlistByPartitionId } from "@/api/BD/IdentitySettings.js";
const formData = reactive({
pageNo: 1,
pageSize: 10,
erbanNo: "",
regionId: 0,
cycleDate:'',
});
const tableData = reactive({
data: [],
total: 0,
loading: false,
});
const dateCycleArr = ref([]);
const adminCountryArr = ref([]);
// 查询
const getData = () => {
tableData.loading = true;
getSovietRoomList(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 confirmExportExcel = async () => {
try {
const res = await exportSovietRoomList(formData)
if (res) {
ElMessage({
message: '导出成功',
type: 'success',
});
let time = formatDate(new Date());
let alink = document.createElement("a");
alink.download = `CIS房主钻石奖励${time}.xls`;
alink.style.display = "none";
const blob = new Blob([res]);
alink.href = URL.createObjectURL(blob);
document.body.appendChild(alink);
alink.click();
URL.revokeObjectURL(alink.href);
}
} catch (error) {
ElMessage({
message: error.message,
type: 'error',
});
}
}
const handleSizeChange = (val) => {
formData.pageSize = val;
getData();
};
const handleCurrentChange = (val) => {
formData.pageNo = val;
getData();
};
onMounted(() => {
getlistByPartitionId({ partitionId: 32, containAll: true }).then((res) => {
if (res.code == 200) {
adminCountryArr.value = res.data;
}
});
getRoomCycleDateList().then((res) => {
dateCycleArr.value = res;
});
});
</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;
}
}
.selectBox {
display: flex;
height: 35px;
line-height: 35px;
margin-bottom: 20px;
}
.selectBoxImg {
height: 150px;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
</style>