优化代码

This commit is contained in:
dragon
2024-07-05 15:47:55 +08:00
parent 62155cbc96
commit 2210a40f67
3 changed files with 103 additions and 69 deletions

View File

@@ -169,6 +169,7 @@
<!-- 新增&编辑弹窗 --> <!-- 新增&编辑弹窗 -->
<el-dialog <el-dialog
destroy-on-close
class="pub" class="pub"
v-model="controlsDialog" v-model="controlsDialog"
:title="controlsTitle" :title="controlsTitle"
@@ -424,7 +425,13 @@
</el-dialog> </el-dialog>
<!-- 二次确认弹窗 --> <!-- 二次确认弹窗 -->
<el-dialog v-model="delDialog" title="提示" width="30%" center> <el-dialog
destroy-on-close
v-model="delDialog"
title="提示"
width="30%"
center
>
<span> 确定要进行该操作吗?</span> <span> 确定要进行该操作吗?</span>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
@@ -435,7 +442,13 @@
</el-dialog> </el-dialog>
<!-- 导出弹窗 --> <!-- 导出弹窗 -->
<el-dialog v-model="deriveDialog" title="导出" width="28%" center> <el-dialog
destroy-on-close
v-model="deriveDialog"
title="导出"
width="28%"
center
>
<!-- 榜单数据 --> <!-- 榜单数据 -->
<div style="margin-bottom: 25px; margin-top: 10px"> <div style="margin-bottom: 25px; margin-top: 10px">
<span <span

View File

@@ -11,8 +11,7 @@
range-separator="" range-separator=""
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
> ></el-date-picker>
</el-date-picker>
</div> </div>
<div class="block"> <div class="block">
<span class="demonstration">周期</span> <span class="demonstration">周期</span>
@@ -26,8 +25,7 @@
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
> ></el-option>
</el-option>
</el-select> </el-select>
</div> </div>
<div class="block"> <div class="block">
@@ -42,8 +40,7 @@
:key="item.id" :key="item.id"
:label="item.desc" :label="item.desc"
:value="item.id" :value="item.id"
> ></el-option>
</el-option>
</el-select> </el-select>
</div> </div>
</div> </div>
@@ -53,7 +50,7 @@
>查询</el-button >查询</el-button
> >
<!-- 导出按钮 --> <!-- 导出按钮 -->
<el-button class="primary" type="primary" @click="this.deriveDialog = true" <el-button class="primary" type="primary" @click="deriveDialog = true"
>导出</el-button >导出</el-button
> >
</div> </div>
@@ -73,20 +70,11 @@
align="center" align="center"
label="实力代言值" label="实力代言值"
/> />
<el-table-column <el-table-column prop="totalPlatformValue" align="center" label="人气代言值" />
prop="totalPlatformValue"
align="center"
label="人气代言值"
/>
<el-table-column align="center" label="操作" width="300"> <el-table-column align="center" label="操作" width="300">
<template v-slot="scope"> <template v-slot="scope">
<el-button <el-button
@click=" @click="showDetailDialog(scope.row)"
this.detialDialog = true;
this.detialNewObj = scope.row;
this.detialObj.tableData = [];
this.detialObj.value = '';
"
class="primary" class="primary"
type="primary" type="primary"
size="default" size="default"
@@ -124,8 +112,7 @@
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
> ></el-option>
</el-option>
</el-select> </el-select>
</div> </div>
<!-- 选择时间 --> <!-- 选择时间 -->
@@ -143,8 +130,7 @@
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
style="width: 60%" style="width: 60%"
> ></el-date-picker>
</el-date-picker>
</div> </div>
</div> </div>
<!-- 弹窗按钮 --> <!-- 弹窗按钮 -->
@@ -175,9 +161,9 @@
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
> ></el-option>
</el-option> </el-select </el-select>
><el-button <el-button
@click="detialQuery()" @click="detialQuery()"
class="primary" class="primary"
type="primary" type="primary"
@@ -192,7 +178,7 @@
<el-table-column property="total" label="值" /> <el-table-column property="total" label="值" />
</el-table> </el-table>
<el-button <el-button
class="dialogTabl eVisibleBut" class="dialogTableVisibleBut"
type="primary" type="primary"
@click="detialDialogClick()" @click="detialDialogClick()"
style="margin-top: 20px" style="margin-top: 20px"
@@ -212,6 +198,7 @@
/> />
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { import {
luckyBagWeekRankList, luckyBagWeekRankList,
@@ -224,6 +211,7 @@ import {
import { dateFormat } from "@/utils/system-helper"; import { dateFormat } from "@/utils/system-helper";
// @ts-ignore // @ts-ignore
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
export default { export default {
name: "luckyTycoonListStatistics", name: "luckyTycoonListStatistics",
data() { data() {
@@ -231,7 +219,7 @@ export default {
inquire: { inquire: {
giftId: "", giftId: "",
userId: "", userId: "",
time: "", time: [], // 添加time属性并初始化为空数组
rankDateType: "", rankDateType: "",
options: [ options: [
{ {
@@ -260,7 +248,7 @@ export default {
deriveDialog: false, deriveDialog: false,
deriveObj: { deriveObj: {
value: "", value: "",
time: "", time: "", // 添加time属性
options: [ options: [
{ {
value: "2", value: "2",
@@ -293,7 +281,7 @@ export default {
}, },
created() { created() {
listPartitionInfo().then((res) => { listPartitionInfo().then((res) => {
if (res.code == 200) { if (res.code === 200) {
this.inquire.options2 = res.data; this.inquire.options2 = res.data;
} }
}); });
@@ -313,7 +301,7 @@ export default {
rankDateType: this.inquire.rankDateType, rankDateType: this.inquire.rankDateType,
partitionId: this.inquire.partitionId, partitionId: this.inquire.partitionId,
}).then((res) => { }).then((res) => {
if (res.code == 200) { if (res.code === 200) {
this.tableData = res.data; this.tableData = res.data;
this.loading = false; this.loading = false;
} else { } else {
@@ -341,7 +329,7 @@ export default {
}; };
console.log(obj); console.log(obj);
exportList(obj).then((res) => { exportList(obj).then((res) => {
if (res.code == 200) { if (res.code === 200) {
this.deriveDialog = false; this.deriveDialog = false;
} else { } else {
ElMessage({ ElMessage({
@@ -362,8 +350,7 @@ export default {
pageSize: this.pageSize2, pageSize: this.pageSize2,
page: this.currentPage2, page: this.currentPage2,
}).then((res) => { }).then((res) => {
if (res.code == 200) { if (res.code === 200) {
this.deriveDialog = false;
var arr = []; var arr = [];
arr = res.data.rows; arr = res.data.rows;
res.data.rows.forEach((res, i) => { res.data.rows.forEach((res, i) => {
@@ -388,7 +375,7 @@ export default {
partitionId: this.inquire.partitionId, partitionId: this.inquire.partitionId,
}; };
exportRank(obj).then((res) => { exportRank(obj).then((res) => {
if (res.code == 200) { if (res.code === 200) {
this.detialDialog = false; this.detialDialog = false;
} else { } else {
ElMessage({ ElMessage({
@@ -407,14 +394,21 @@ export default {
this.getData(); this.getData();
}, },
handleSizeChange2() { handleSizeChange2() {
this.getData(); this.detialQuery();
}, },
handleCurrentChange2() { handleCurrentChange2() {
this.getData(); this.detialQuery();
},
showDetailDialog(row) {
this.detialNewObj = row;
this.detialObj.tableData = [];
this.detialObj.value = '';
this.detialDialog = true;
}, },
}, },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.box { .box {
padding-top: 20px; padding-top: 20px;

View File

@@ -27,8 +27,7 @@
range-separator="" range-separator=""
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
> ></el-date-picker>
</el-date-picker>
</div> </div>
</div> </div>
@@ -56,18 +55,20 @@
<el-table-column prop="luckyBagName" align="center" label="福袋昵称" /> <el-table-column prop="luckyBagName" align="center" label="福袋昵称" />
<el-table-column prop="destGiftName" align="center" label="礼物名称" /> <el-table-column prop="destGiftName" align="center" label="礼物名称" />
<el-table-column prop="luckyBagPrice" align="center" label="福袋流水" /> <el-table-column prop="luckyBagPrice" align="center" label="福袋流水" />
<!-- <el-table-column prop="x" align="center" label="该用户是否中奖">
<template v-slot="scope">{{ scope.row.x ? "是" : "否" }}</template>
</el-table-column> -->
<el-table-column prop="rewardGiftName" align="center" label="奖励名称"> <el-table-column prop="rewardGiftName" align="center" label="奖励名称">
<template v-slot="scope">{{ <template #default="{ row }">
scope.row.rewardGiftName ? scope.row.rewardGiftName : "/" {{ row.rewardGiftName || "/" }}
}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="rewardGiftPrice" align="center" label="奖励价值"> <el-table-column prop="rewardGiftPrice" align="center" label="奖励价值">
<template v-slot="scope">{{ <template #default="{ row }">
scope.row.rewardGiftPrice ? scope.row.rewardGiftPrice : "/" {{ row.rewardGiftPrice || "/" }}
}}</template> </template>
</el-table-column>
<el-table-column prop="x" align="center" label="该用户是否中奖">
<template #default="{ row }">
{{ row.x ? "是" : "否" }}
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -84,12 +85,12 @@
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
/> />
</template> </template>
<script> <script>
import { getRecordPage, exportForReward } from "@/api/luckyTycoon/luckyTycoon"; import { getRecordPage, exportForReward } from "@/api/luckyTycoon/luckyTycoon";
// @ts-ignore
import { dateFormat } from "@/utils/system-helper"; import { dateFormat } from "@/utils/system-helper";
// @ts-ignore
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
export default { export default {
name: "luckyTycoonUserWinningRecord", name: "luckyTycoonUserWinningRecord",
data() { data() {
@@ -120,7 +121,6 @@ export default {
startTime = dateFormat(this.inquire.time[0], "yyyy-MM-dd hh:mm:ss"); startTime = dateFormat(this.inquire.time[0], "yyyy-MM-dd hh:mm:ss");
endTime = dateFormat(this.inquire.time[1], "yyyy-MM-dd hh:mm:ss"); endTime = dateFormat(this.inquire.time[1], "yyyy-MM-dd hh:mm:ss");
} }
this.loading = true;
getRecordPage({ getRecordPage({
page: this.currentPage, page: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
@@ -128,20 +128,29 @@ export default {
erBanNo: this.inquire.userId, erBanNo: this.inquire.userId,
startTime, startTime,
endTime, endTime,
}).then((res) => { })
if (res.code == 200) { .then((res) => {
this.tableData = res.data.records; if (res.code === 200) {
this.total = res.data.total; this.tableData = res.data.records;
this.total = res.data.total;
} else {
ElMessage({
showClose: true,
message: res.message || "获取数据失败",
type: "error",
});
}
this.loading = false; this.loading = false;
} else { })
.catch((error) => {
console.error("请求出错:", error);
ElMessage({ ElMessage({
showClose: true, showClose: true,
message: res.message, message: "请求出错,请稍后重试",
type: "error", type: "error",
}); });
} this.loading = false;
this.loading = false; });
});
}, },
derive() { derive() {
let startTime = ""; let startTime = "";
@@ -155,18 +164,40 @@ export default {
erBanNo: this.inquire.userId, erBanNo: this.inquire.userId,
startTime, startTime,
endTime, endTime,
}).then((res) => {}); })
.then((res) => {
if (res.code === 200) {
// 可以添加导出成功的提示信息
} else {
ElMessage({
showClose: true,
message: res.message || "导出失败",
type: "error",
});
}
})
.catch((error) => {
console.error("导出请求出错:", error);
ElMessage({
showClose: true,
message: "导出请求出错,请稍后重试",
type: "error",
});
});
}, },
// 分页导航 // 分页导航
handleSizeChange() { handleSizeChange(size) {
this.pageSize = size;
this.getData(); this.getData();
}, },
handleCurrentChange() { handleCurrentChange(page) {
this.currentPage = page;
this.getData(); this.getData();
}, },
}, },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.box { .box {
padding-top: 20px; padding-top: 20px;
@@ -182,12 +213,8 @@ export default {
margin-right: 10px; margin-right: 10px;
} }
} }
.dialogTableVisibleBut {
display: block;
margin: 30px 0 0 830px;
}
.paginationClass { .paginationClass {
margin: 15px 0 5px 0px; margin: 15px 0 5px 0px;
} }
} }
</style> </style>