优化代码

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
destroy-on-close
class="pub"
v-model="controlsDialog"
:title="controlsTitle"
@@ -424,7 +425,13 @@
</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>
<template #footer>
<span class="dialog-footer">
@@ -435,7 +442,13 @@
</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">
<span

View File

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

View File

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