|
|
@@ -58,6 +58,17 @@
|
|
|
v-hasPermi="['live:liveRedConf:edit']"
|
|
|
>修改</el-button>
|
|
|
</el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ icon="el-icon-delete"
|
|
|
+ size="mini"
|
|
|
+ :disabled="multiple"
|
|
|
+ @click="handleDelete"
|
|
|
+ v-hasPermi="['live:liveRedConf:remove']"
|
|
|
+ >删除</el-button>
|
|
|
+ </el-col>
|
|
|
<el-col :span="1.5" v-if="!isPasswordBagMode">
|
|
|
<el-button
|
|
|
type="warning"
|
|
|
@@ -73,7 +84,7 @@
|
|
|
</el-row>
|
|
|
|
|
|
<el-table border v-loading="loading" :data="liveRedConfList" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" align="center" v-if="!isPasswordBagMode" />
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="红包ID" align="center" prop="redId" />
|
|
|
<el-table-column label="红包状态" align="center" prop="redStatus" :formatter="redStatusFormatter"/>
|
|
|
<el-table-column :label="isPasswordBagMode ? '持续时间(分)' : '有效时间 单位:分'" align="center" prop="duration" />
|
|
|
@@ -186,7 +197,7 @@
|
|
|
<el-radio-group v-model="form.distributeType" :disabled="form.redId != null">
|
|
|
<el-radio :label="1">普通均分</el-radio>
|
|
|
<el-radio :label="2">拼手气</el-radio>
|
|
|
- <el-radio :label="3">口令福袋</el-radio>
|
|
|
+<!-- <el-radio :label="3">口令福袋</el-radio>-->
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="口令" prop="passwordCmd" v-if="showPasswordFields">
|
|
|
@@ -324,6 +335,7 @@ export default {
|
|
|
liveId: null,
|
|
|
desc: null,
|
|
|
distributeType: null,
|
|
|
+ excludeDistributeType: null,
|
|
|
createTime: null,
|
|
|
updateTime: null,
|
|
|
},
|
|
|
@@ -378,9 +390,7 @@ export default {
|
|
|
}
|
|
|
this.queryParams.liveId = this.liveId;
|
|
|
this.parentLiveId = this.liveId;
|
|
|
- if (this.isPasswordBagMode) {
|
|
|
- this.queryParams.distributeType = 3
|
|
|
- }
|
|
|
+ this.applyDistributeQueryFilter()
|
|
|
if(this.queryParams.liveId){
|
|
|
this.form.liveId = this.parentLiveId;
|
|
|
//设置查询条件直播间ID不可修改
|
|
|
@@ -396,9 +406,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- if (this.isPasswordBagMode) {
|
|
|
- this.queryParams.distributeType = 3
|
|
|
- }
|
|
|
+ this.applyDistributeQueryFilter()
|
|
|
this.getDicts("sys_live_red_status").then(response => {
|
|
|
this.redStatusOptions = response.data;
|
|
|
});
|
|
|
@@ -457,11 +465,15 @@ export default {
|
|
|
};
|
|
|
updateLiveRedConf(doRedParam).then(response => {
|
|
|
if(response.code === 200){
|
|
|
- const msg = {
|
|
|
- cmd: 'red',
|
|
|
- data: doRedParam
|
|
|
- };
|
|
|
- this.$store.state.liveWs[this.liveId].send(JSON.stringify(msg));
|
|
|
+ // 口令福袋:服务端会推 passwordBag / passwordBagEnd,前端不再发 red
|
|
|
+ const isPasswordBag = this.isPasswordBagMode || String(row.distributeType) === '3'
|
|
|
+ if (!isPasswordBag && this.$store.state.liveWs[this.liveId]) {
|
|
|
+ const msg = {
|
|
|
+ cmd: 'red',
|
|
|
+ data: doRedParam
|
|
|
+ };
|
|
|
+ this.$store.state.liveWs[this.liveId].send(JSON.stringify(msg));
|
|
|
+ }
|
|
|
|
|
|
this.msgSuccess("修改成功");
|
|
|
}else{
|
|
|
@@ -480,12 +492,20 @@ export default {
|
|
|
distributeTypeFormatter(row) {
|
|
|
return this.distributeTypeMap[row.distributeType] || this.distributeTypeMap[1]
|
|
|
},
|
|
|
- /** 查询直播红包记录配置列表 */
|
|
|
- getList() {
|
|
|
- this.loading = true;
|
|
|
+ /** 口令福袋页只查 type=3;红包配置页排除口令福袋 */
|
|
|
+ applyDistributeQueryFilter() {
|
|
|
if (this.isPasswordBagMode) {
|
|
|
this.queryParams.distributeType = 3
|
|
|
+ this.queryParams.excludeDistributeType = null
|
|
|
+ } else {
|
|
|
+ this.queryParams.distributeType = null
|
|
|
+ this.queryParams.excludeDistributeType = 3
|
|
|
}
|
|
|
+ },
|
|
|
+ /** 查询直播红包记录配置列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ this.applyDistributeQueryFilter()
|
|
|
listLiveRedConf(this.queryParams).then(response => {
|
|
|
this.liveRedConfList = response.rows;
|
|
|
this.total = response.total;
|
|
|
@@ -535,9 +555,7 @@ export default {
|
|
|
resetQuery() {
|
|
|
this.resetForm("queryForm");
|
|
|
this.checkParentLiveId();
|
|
|
- if (this.isPasswordBagMode) {
|
|
|
- this.queryParams.distributeType = 3
|
|
|
- }
|
|
|
+ this.applyDistributeQueryFilter()
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
@@ -598,15 +616,22 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- /** 删除按钮操作 */
|
|
|
+ /** 删除按钮操作(单条/批量),仅未发放(redStatus=0)可删 */
|
|
|
handleDelete(row) {
|
|
|
- // 口令福袋允许按状态删除;普通红包仅未发放可删
|
|
|
- if (!this.isPasswordBagMode && row.redStatus+"" !== "0") {
|
|
|
- this.msgError("只能删除未发放的红包");
|
|
|
+ const rows = row && row.redId != null
|
|
|
+ ? [row]
|
|
|
+ : this.liveRedConfList.filter(item => this.ids.indexOf(item.redId) > -1);
|
|
|
+ if (!rows.length) {
|
|
|
+ this.msgError("请选择要删除的数据");
|
|
|
return;
|
|
|
}
|
|
|
- const redIds = row.redId || this.ids;
|
|
|
- this.$confirm('是否确认删除直播红包记录配置编号为"' + redIds + '"的数据项?', "警告", {
|
|
|
+ const invalid = rows.filter(item => String(item.redStatus) !== "0");
|
|
|
+ if (invalid.length) {
|
|
|
+ this.msgError("只能删除未发放的红包,请取消选中进行中/已结束/暂停的项");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const redIds = rows.map(item => item.redId);
|
|
|
+ this.$confirm('是否确认删除直播红包记录配置编号为"' + redIds.join(",") + '"的数据项?', "警告", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
@@ -615,19 +640,22 @@ export default {
|
|
|
}).then(() => {
|
|
|
this.getList();
|
|
|
this.msgSuccess("删除成功");
|
|
|
- if (this.$store.state.liveWs[this.liveId]) {
|
|
|
- const msg = {
|
|
|
- cmd: 'red',
|
|
|
- data: {
|
|
|
- redId: row.redId,
|
|
|
- redStatus: 2,
|
|
|
- totalLots: row.totalLots,
|
|
|
- duration: row.duration,
|
|
|
- distributeType: row.distributeType,
|
|
|
- passwordCmd: row.passwordCmd
|
|
|
- }
|
|
|
- };
|
|
|
- this.$store.state.liveWs[this.liveId].send(JSON.stringify(msg));
|
|
|
+ // 口令福袋不发 red;普通红包通知前端收起
|
|
|
+ if (!this.isPasswordBagMode && this.$store.state.liveWs[this.liveId]) {
|
|
|
+ rows.forEach(item => {
|
|
|
+ const msg = {
|
|
|
+ cmd: 'red',
|
|
|
+ data: {
|
|
|
+ redId: item.redId,
|
|
|
+ redStatus: 2,
|
|
|
+ totalLots: item.totalLots,
|
|
|
+ duration: item.duration,
|
|
|
+ distributeType: item.distributeType,
|
|
|
+ passwordCmd: item.passwordCmd
|
|
|
+ }
|
|
|
+ };
|
|
|
+ this.$store.state.liveWs[this.liveId].send(JSON.stringify(msg));
|
|
|
+ });
|
|
|
}
|
|
|
}).catch(() => {});
|
|
|
},
|