feat(活动管理页): 修改排行榜选项的显示权限

This commit is contained in:
hzj 2025-12-23 14:16:05 +08:00
parent b6c5c4d082
commit 9b606356a9

View File

@ -1,7 +1,9 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="table"> <div class="table">
<!-- 搜索栏 -->
<div class="filter-container"> <div class="filter-container">
<!-- 系统 -->
<el-select <el-select
v-model="listQuery.sysOrigin" v-model="listQuery.sysOrigin"
placeholder="系统" placeholder="系统"
@ -15,10 +17,14 @@
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
> >
<span style="float: left;"> <sys-origin-icon :icon="item.value" :desc="item.value" /></span> <span style="float: left;">
<sys-origin-icon :icon="item.value" :desc="item.value"
/></span>
<span style="float: left;margin-left:10px">{{ item.label }}</span> <span style="float: left;margin-left:10px">{{ item.label }}</span>
</el-option> </el-option>
</el-select> </el-select>
<!-- 状态 -->
<el-select <el-select
v-model="listQuery.showcase" v-model="listQuery.showcase"
placeholder="状态" placeholder="状态"
@ -27,20 +33,17 @@
clearable clearable
@change="handleSearch" @change="handleSearch"
> >
<el-option-group label="运行状态">
<el-option-group
label="运行状态"
>
<el-option label="已开始" :value="1" /> <el-option label="已开始" :value="1" />
<el-option label="已结束" :value="2" /> <el-option label="已结束" :value="2" />
</el-option-group> </el-option-group>
<el-option-group <el-option-group label="管理状态">
label="管理状态"
>
<el-option label="上架" :value="3" /> <el-option label="上架" :value="3" />
<el-option label="下架" :value="4" /> <el-option label="下架" :value="4" />
</el-option-group> </el-option-group>
</el-select> </el-select>
<!-- 活动ID -->
<el-input <el-input
v-model.trim="listQuery.id" v-model.trim="listQuery.id"
v-number v-number
@ -48,6 +51,8 @@
style="width: 200px;" style="width: 200px;"
class="filter-item" class="filter-item"
/> />
<!-- 模版ID -->
<el-input <el-input
v-model.trim="listQuery.templateId" v-model.trim="listQuery.templateId"
v-number v-number
@ -55,6 +60,8 @@
style="width: 200px;" style="width: 200px;"
class="filter-item" class="filter-item"
/> />
<!-- 搜索按钮 -->
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
@ -63,6 +70,8 @@
> >
搜索 搜索
</el-button> </el-button>
<!-- 新增按钮 -->
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
@ -71,10 +80,9 @@
> >
新增 新增
</el-button> </el-button>
<el-popover
title="操作手册" <!-- 帮助按钮 -->
trigger="hover" <el-popover title="操作手册" trigger="hover">
>
<div class="content"> <div class="content">
<div class="help"> <div class="help">
<strong>怎么创建一个活动?</strong> <strong>怎么创建一个活动?</strong>
@ -84,18 +92,32 @@
<p>4. Banner 配置活动地址</p> <p>4. Banner 配置活动地址</p>
<strong>活动排行榜计算规则?</strong> <strong>活动排行榜计算规则?</strong>
<p>1.活动处于上架状态</p> <p>1.活动处于上架状态</p>
<p>2.活动进行中: 系统当前时间 >= 开始时间 并且 系统当前时间 &lt;= 结束时间</p> <p>
2.活动进行中: 系统当前时间 >= 开始时间 并且 系统当前时间 &lt;=
结束时间
</p>
<p>3.活动中包含礼物</p> <p>3.活动中包含礼物</p>
<p>满足上面条件的情况下, 用户发送礼物触发</p> <p>满足上面条件的情况下, 用户发送礼物触发</p>
<strong>注意事项</strong> <strong>注意事项</strong>
<p>1.活动结束后不可用在次编辑, 如果需要重写激活请使用 复制活动 重写创建一个新的活动</p> <p>
<p>2.排行榜只能在活动进行中可查看, 活动结束后通过系统 发送奖品 系统将缓存TOP20 通过 奖品发送记录 查看</p> 1.活动结束后不可用在次编辑, 如果需要重写激活请使用 复制活动
<p>3.一个 活动模版 如果被多个活动关联, 修改模版所有关联活动将全部会改变</p> 重写创建一个新的活动
</p>
<p>
2.排行榜只能在活动进行中可查看, 活动结束后通过系统 发送奖品
系统将缓存TOP20 通过 奖品发送记录 查看
</p>
<p>
3.一个 活动模版 如果被多个活动关联,
修改模版所有关联活动将全部会改变
</p>
</div> </div>
</div> </div>
<span slot="reference"><i class="el-icon-info" />帮助</span> <span slot="reference"><i class="el-icon-info" />帮助</span>
</el-popover> </el-popover>
</div> </div>
<!-- 列表 -->
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
:data="list" :data="list"
@ -103,37 +125,81 @@
fit fit
highlight-current-row highlight-current-row
> >
<!-- 关联模版 -->
<el-table-column
label="关联模版"
prop="templateName"
align="center"
min-width="200"
/>
<el-table-column label="关联模版" prop="templateName" align="center" min-width="200" /> <!-- 备注 -->
<el-table-column label="备注" prop="config.remark" align="center" min-width="200" /> <el-table-column
<el-table-column label="状态" prop="config.startTime" align="center" min-width="200"> label="备注"
prop="config.remark"
align="center"
min-width="200"
/>
<!-- 状态 -->
<el-table-column
label="状态"
prop="config.startTime"
align="center"
min-width="200"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="scope.row.config.showcase === true ? 'primary': 'danger'"> <el-tag
{{ scope.row.config.showcase === true ? '上架':'下架' }} :type="scope.row.config.showcase === true ? 'primary' : 'danger'"
>
{{ scope.row.config.showcase === true ? "上架" : "下架" }}
</el-tag> </el-tag>
<el-tag v-if="scope.row.status === 0" type="info">未开始</el-tag> <el-tag v-if="scope.row.status === 0" type="info">未开始</el-tag>
<el-tag v-if="scope.row.status === 1" type="success">已开始</el-tag> <el-tag v-if="scope.row.status === 1" type="success">已开始</el-tag>
<el-tag v-if="scope.row.status === 2" type="warning">已结束</el-tag> <el-tag v-if="scope.row.status === 2" type="warning">已结束</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="活动时间" prop="config.startTime" align="center" min-width="200">
<!-- 活动时间 -->
<el-table-column
label="活动时间"
prop="config.startTime"
align="center"
min-width="200"
>
<template slot-scope="scope"> <template slot-scope="scope">
<div>开始: {{ scope.row.config.startTime | dateFormat }}</div> <div>开始: {{ scope.row.config.startTime | dateFormat }}</div>
<div>结束: {{ scope.row.config.endTime | dateFormat }}</div> <div>结束: {{ scope.row.config.endTime | dateFormat }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="修改/创建人" prop="config.createTime" align="center" min-width="200">
<!-- 修改/创建人 -->
<el-table-column
label="修改/创建人"
prop="config.createTime"
align="center"
min-width="200"
>
<template slot-scope="scope"> <template slot-scope="scope">
<div>修改: {{ scope.row.updateUserName }}</div> <div>修改: {{ scope.row.updateUserName }}</div>
<div>创建: {{ scope.row.createUserName }}</div> <div>创建: {{ scope.row.createUserName }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="修改/创建时间" prop="config.createTime" align="center" min-width="200">
<!-- 修改/创建时间 -->
<el-table-column
label="修改/创建时间"
prop="config.createTime"
align="center"
min-width="200"
>
<template slot-scope="scope"> <template slot-scope="scope">
<div>修改: {{ scope.row.config.updateTime | dateFormat }}</div> <div>修改: {{ scope.row.config.updateTime | dateFormat }}</div>
<div>创建: {{ scope.row.config.createTime | dateFormat }}</div> <div>创建: {{ scope.row.config.createTime | dateFormat }}</div>
</template> </template>
</el-table-column> </el-table-column>
<!-- 操作栏 -->
<el-table-column fixed="right" label="操作" align="center" width="80"> <el-table-column fixed="right" label="操作" align="center" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown> <el-dropdown>
@ -141,23 +207,81 @@
<i class="el-icon-more" /> <i class="el-icon-more" />
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="clickEdit(scope.row)"> {{ scope.row.status !== 2 ?'编辑': '查看' }}</el-dropdown-item> <!-- 未开始/已开始:编辑,已结束:查看 -->
<el-dropdown-item v-if="scope.row.status === 1" @click.native="clickRank(scope.row)">排行榜</el-dropdown-item> <el-dropdown-item @click.native="clickEdit(scope.row)">
<el-dropdown-item v-if="scope.row.status !== 2" @click.native="clickEditTemplate(scope.row)">编辑模版</el-dropdown-item> {{
<el-dropdown-item @click.native="clickCopyActivity(scope.row)">复制活动</el-dropdown-item> scope.row.status !== 2 ? "编辑" : "查看"
<el-dropdown-item v-if="scope.row.status === 2" @click.native="clickSendReward(scope.row)">{{ scope.row.config.awardStatus === true ? '奖品发送记录' : '发送奖品' }}</el-dropdown-item> }}</el-dropdown-item
<el-dropdown-item @click.native="copyContent(scope.row.config.id)">复制活动ID</el-dropdown-item> >
<el-dropdown-item @click.native="copyContent(scope.row.config.templateId)">复制模版ID</el-dropdown-item>
<el-dropdown-item @click.native="clickActivityLink(scope.row)">复制活动链接</el-dropdown-item> <!-- 已开始/已结束:排行榜 -->
<el-dropdown-item
v-if="scope.row.status !== 0"
@click.native="clickRank(scope.row)"
>
排行榜
</el-dropdown-item>
<!-- 未开始/已开始:编辑模版 -->
<el-dropdown-item
v-if="scope.row.status !== 2"
@click.native="clickEditTemplate(scope.row)"
>
编辑模版
</el-dropdown-item>
<!-- 复制活动 -->
<el-dropdown-item @click.native="clickCopyActivity(scope.row)">
复制活动
</el-dropdown-item>
<!-- 已结束:发送奖品 -->
<el-dropdown-item
v-if="scope.row.status === 2"
@click.native="clickSendReward(scope.row)"
>
{{
scope.row.config.awardStatus === true
? "奖品发送记录"
: "发送奖品"
}}
</el-dropdown-item>
<!-- 复制活动ID -->
<el-dropdown-item
@click.native="copyContent(scope.row.config.id)"
>
复制活动ID
</el-dropdown-item>
<!-- 复制模版ID -->
<el-dropdown-item
@click.native="copyContent(scope.row.config.templateId)"
>
复制模版ID
</el-dropdown-item>
<!-- 复制活动链接 -->
<el-dropdown-item @click.native="clickActivityLink(scope.row)">
复制活动链接
</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 加载模块 -->
<div v-if="listQuery.lastId" class="load-more"> <div v-if="listQuery.lastId" class="load-more">
<span v-if="notData">已加载全部</span> <span v-if="notData">已加载全部</span>
<el-button v-else size="mini" :disabled="loadMoreLoading" :loading="loadMoreLoading" @click="clickLoadMore">加载更多</el-button> <el-button
v-else
size="mini"
:disabled="loadMoreLoading"
:loading="loadMoreLoading"
@click="clickLoadMore"
>加载更多</el-button
>
</div> </div>
<form-edit <form-edit
@ -184,12 +308,15 @@
</template> </template>
<script> <script>
import { listActivityConf } from '@/api/sys' import { mapGetters } from "vuex";
import FormEdit from './form-edit' import { copyText, deepClone } from "@/utils";
import ActivityRankReward from './activity-rank-reward'
import ActivityRank from './activity-rank' import { listActivityConf } from "@/api/sys";
import { mapGetters } from 'vuex'
import { copyText, deepClone } from '@/utils' import FormEdit from "./form-edit";
import ActivityRankReward from "./activity-rank-reward";
import ActivityRank from "./activity-rank";
export default { export default {
components: { FormEdit, ActivityRankReward, ActivityRank }, components: { FormEdit, ActivityRankReward, ActivityRank },
data() { data() {
@ -198,145 +325,173 @@ export default {
activityRankRewardVisible: false, activityRankRewardVisible: false,
list: [], list: [],
listLoading: true, listLoading: true,
templatId: '', templatId: "",
formEditVisible: false, formEditVisible: false,
thatRow: {}, thatRow: {},
notData: false, notData: false,
loadMoreLoading: false, loadMoreLoading: false,
txtVal: 0, txtVal: 0,
activeGiftId: '', activeGiftId: "",
pushTextHistoryLoading: false, pushTextHistoryLoading: false,
pushTextHistoryVisible: false, pushTextHistoryVisible: false,
pushTextHistory: [], pushTextHistory: [],
delarr: [], delarr: [],
listQuery: { listQuery: {
limit: 20, limit: 20,
lastId: '', lastId: "",
id: '', id: "",
sysOrigin: '', sysOrigin: "",
showcase: 1, showcase: 1,
templateId: '' templateId: ""
}, },
textOptTitle: '' textOptTitle: ""
} };
}, },
computed: { computed: {
...mapGetters(['permissionsSysOriginPlatforms']) ...mapGetters(["permissionsSysOriginPlatforms"])
}, },
created() { created() {
const that = this const that = this;
const querySystem = this.permissionsSysOriginPlatforms[0] const querySystem = this.permissionsSysOriginPlatforms[0];
if (!querySystem) { if (!querySystem) {
return return;
} }
that.listQuery.sysOrigin = querySystem.value that.listQuery.sysOrigin = querySystem.value;
that.renderData(true) that.renderData(true);
}, },
methods: { methods: {
renderData(isClean) { renderData(isClean) {
const that = this const that = this;
if (isClean === true) { if (isClean === true) {
this.listQuery.lastId = '' this.listQuery.lastId = "";
this.list = [] this.list = [];
} }
that.listLoading = true that.listLoading = true;
listActivityConf(that.listQuery).then(res => { listActivityConf(that.listQuery)
that.listLoading = false .then(res => {
that.loadMoreLoading = false that.listLoading = false;
// , clean,concat that.loadMoreLoading = false;
if (isClean === true) { // , clean,concat
this.listQuery.lastId = '' if (isClean === true) {
this.list = [] this.listQuery.lastId = "";
} this.list = [];
const { body } = res }
const list = body || [] const { body } = res;
that.notData = list.length < that.listQuery.limit const list = body || [];
if (list && list.length > 0) { that.notData = list.length < that.listQuery.limit;
that.list = that.list.concat(list) if (list && list.length > 0) {
that.listQuery.lastId = that.list[that.list.length - 1].config.id that.list = that.list.concat(list);
} that.listQuery.lastId = that.list[that.list.length - 1].config.id;
}).catch(er => { }
console.error(er) })
that.listLoading = false .catch(er => {
that.loadMoreLoading = false console.error(er);
}) that.listLoading = false;
that.loadMoreLoading = false;
});
}, },
handleSearch() { handleSearch() {
this.renderData(true) this.renderData(true);
}, },
clickCreate() { clickCreate() {
this.thatRow = null this.thatRow = null;
this.formEditVisible = true this.formEditVisible = true;
}, },
copyContent(text) { copyContent(text) {
copyText(text).then(() => { copyText(text)
this.$opsMessage.success() .then(() => {
}).catch(er => { this.$opsMessage.success();
this.$opsMessage.fail() })
}) .catch(er => {
this.$opsMessage.fail();
});
}, },
clickActivityLink(row) { clickActivityLink(row) {
this.copyContent(`${process.env.VUE_APP_H5_BASE_URL}/#/activity/${row.config.id}`) this.copyContent(
`${process.env.VUE_APP_H5_BASE_URL}/#/activity/${row.config.id}`
);
}, },
clickCopyActivity(row) { clickCopyActivity(row) {
this.thatRow = deepClone(row) this.thatRow = deepClone(row);
this.thatRow.config.id = null this.thatRow.config.id = null;
this.thatRow.status = 0 this.thatRow.status = 0;
this.thatRow.config.awardStatus = false this.thatRow.config.awardStatus = false;
if (this.thatRow.config.butOneRewards) { if (this.thatRow.config.butOneRewards) {
this.thatRow.config.butOneRewards.forEach(element => { this.thatRow.config.butOneRewards.forEach(element => {
element.rankUsers = [] element.rankUsers = [];
element.status = false element.status = false;
}) });
} }
if (this.thatRow.config.butTwoRewards) { if (this.thatRow.config.butTwoRewards) {
this.thatRow.config.butTwoRewards.forEach(element => { this.thatRow.config.butTwoRewards.forEach(element => {
element.rankUsers = [] element.rankUsers = [];
element.status = false element.status = false;
}) });
} }
this.formEditVisible = true this.formEditVisible = true;
}, },
clickSendReward(row) { clickSendReward(row) {
this.thatRow = row this.thatRow = row;
this.activityRankRewardVisible = true this.activityRankRewardVisible = true;
}, },
clickRank(row) { clickRank(row) {
this.thatRow = row this.thatRow = row;
this.activityRankVisible = true this.activityRankVisible = true;
}, },
clickEditTemplate(row) { clickEditTemplate(row) {
const that = this const that = this;
that.$confirm('注意: 模版发生改变后相关引用都会同步发生变化, 是否继续?', '提示', { that
confirmButtonText: '确定', .$confirm(
cancelButtonText: '取消', "注意: 模版发生改变后相关引用都会同步发生变化, 是否继续?",
type: 'warning' "提示",
}).then(() => { {
that.$router.push('/activity/template?id=' + row.config.templateId) confirmButtonText: "确定",
}).catch(() => { cancelButtonText: "取消",
}) type: "warning"
}
)
.then(() => {
that.$router.push("/activity/template?id=" + row.config.templateId);
})
.catch(() => {});
}, },
clickEdit(row) { clickEdit(row) {
this.thatRow = row this.thatRow = row;
this.formEditVisible = true this.formEditVisible = true;
}, },
formEditSuccess() { formEditSuccess() {
this.formEditVisible = false this.formEditVisible = false;
this.renderData(true) this.renderData(true);
}, },
clickLoadMore() { clickLoadMore() {
const that = this const that = this;
that.loadMoreLoading = true that.loadMoreLoading = true;
that.renderData() that.renderData();
} }
} }
} };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.popover-content { .popover-content {
max-width: 300px; max-width: 300px;
line-height: 20px; line-height: 20px;
} }
.load-more { .load-more {
padding: 20px; padding: 20px;
text-align: center; text-align: center;