|
|
@@ -30,11 +30,11 @@
|
|
|
<!-- <el-option v-for="i in triggerTypeOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>-->
|
|
|
<!-- </el-select>-->
|
|
|
<!-- </el-form-item>-->
|
|
|
-<!-- <el-form-item label="状态" prop="status">-->
|
|
|
-<!-- <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">-->
|
|
|
-<!-- <el-option v-for="i in statusOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>-->
|
|
|
-<!-- </el-select>-->
|
|
|
-<!-- </el-form-item>-->
|
|
|
+ <el-form-item label="状态" prop="status">
|
|
|
+ <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
|
|
|
+ <el-option v-for="i in statusOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
@@ -97,7 +97,7 @@
|
|
|
<el-table-column label="触发时间" align="center" prop="triggerValue" :formatter="triggerValueFormatter" />
|
|
|
<el-table-column label="产品名称" align="center" prop="productName" :formatter="productNameFormatter" />
|
|
|
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormatter" />
|
|
|
- <el-table-column label="完成状态" align="center" prop="finishStatus" :formatter="finishStatusFormatter" />
|
|
|
+<!-- <el-table-column label="完成状态" align="center" prop="finishStatus" :formatter="finishStatusFormatter" />-->
|
|
|
<el-table-column label="更新时间" align="center" prop="updatedTime" width="180">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
|
|
|
@@ -160,6 +160,36 @@
|
|
|
</div>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="红包选择" prop="content" v-if="form.taskType == 2">
|
|
|
+ <el-select v-model="form.content" placeholder="请选择红包" ref="selectRef" >
|
|
|
+ <el-option v-for="i in redOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
|
+ <!-- 加载载中状态 -->
|
|
|
+ <div v-if="isLoading" class="loading-indicator">
|
|
|
+ <i class="el-icon-loading"></i>
|
|
|
+ <span>加载中...</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 没有更多数据 -->
|
|
|
+ <div v-if="!hasMore && !isLoading" class="no-more">
|
|
|
+ 没有更多数据了
|
|
|
+ </div>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="抽奖选择" prop="content" v-if="form.taskType == 4">
|
|
|
+ <el-select v-model="form.content" placeholder="请选择抽奖" ref="selectRef" >
|
|
|
+ <el-option v-for="i in lotteryOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
|
+ <!-- 加载载中状态 -->
|
|
|
+ <div v-if="isLoading" class="loading-indicator">
|
|
|
+ <i class="el-icon-loading"></i>
|
|
|
+ <span>加载中...</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 没有更多数据 -->
|
|
|
+ <div v-if="!hasMore && !isLoading" class="no-more">
|
|
|
+ 没有更多数据了
|
|
|
+ </div>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="触发时间" prop="content">
|
|
|
<el-time-picker
|
|
|
default-value="2025-01-01 00:00:00"
|
|
|
@@ -200,6 +230,8 @@
|
|
|
<script>
|
|
|
import { listTask, getTask, delTask, addTask, updateTask, exportTask } from "@/api/live/task";
|
|
|
import {listLiveGoods} from "@/api/live/liveGoods";
|
|
|
+import {listLiveRedConfOn} from "@/api/live/liveRedConf";
|
|
|
+import {listLiveLotteryConfOn} from "@/api/live/liveLotteryConf";
|
|
|
|
|
|
export default {
|
|
|
name: "Task",
|
|
|
@@ -210,25 +242,15 @@ export default {
|
|
|
value: 1,
|
|
|
label: "定时卡片推荐商品"
|
|
|
},
|
|
|
- // {
|
|
|
- // value: "1",
|
|
|
- // label: "请选择字典生成"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // value: "1",
|
|
|
- // label: "请选择字典生成"
|
|
|
- // }
|
|
|
+ {
|
|
|
+ value: 2,
|
|
|
+ label: "定时红包发送"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 4,
|
|
|
+ label: "定时抽奖"
|
|
|
+ }
|
|
|
],
|
|
|
- // triggerTypeOptions:[
|
|
|
- // {
|
|
|
- // value: "1",
|
|
|
- // label: "请选择字典生成"
|
|
|
- // },
|
|
|
- // {
|
|
|
- // value: "1",
|
|
|
- // label: "请选择字典生成"
|
|
|
- // }
|
|
|
- // ],
|
|
|
statusOptions:[{
|
|
|
value: "0",
|
|
|
label: "禁用"
|
|
|
@@ -239,6 +261,13 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
productOptions:[],
|
|
|
+ haveData:{
|
|
|
+ goods:false,
|
|
|
+ red:false,
|
|
|
+ lottery:false
|
|
|
+ },
|
|
|
+ redOptions:[],
|
|
|
+ lotteryOptions:[],
|
|
|
// 遮罩层
|
|
|
loading: true,
|
|
|
// 导出遮罩层
|
|
|
@@ -304,7 +333,7 @@ export default {
|
|
|
]
|
|
|
},
|
|
|
liveId: null,
|
|
|
- goodsParams: {
|
|
|
+ listParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
liveId: null
|
|
|
@@ -336,7 +365,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
-
|
|
|
this.socket = this.$store.state.liveWs[this.liveId]
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -369,6 +397,8 @@ export default {
|
|
|
return "定时推送卡片商品";
|
|
|
case 2:
|
|
|
return "定时发送红包";
|
|
|
+ case 4:
|
|
|
+ return "定时抽奖";
|
|
|
default:
|
|
|
return "--";
|
|
|
}
|
|
|
@@ -418,21 +448,38 @@ export default {
|
|
|
return `${hours}:${minutes}:${seconds}`;
|
|
|
},
|
|
|
async updateTaskType(){
|
|
|
- if (this.form.taskType == 1) {
|
|
|
- if (this.isLoading || !this.hasMore) return;
|
|
|
- this.isLoading = true;
|
|
|
- this.goodsParams.liveId = this.liveId;
|
|
|
- try{
|
|
|
+ this.hasMore = true;
|
|
|
+ this.listParams = {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ liveId: null
|
|
|
+ }
|
|
|
+ if (this.isLoading || !this.hasMore) return;
|
|
|
+ this.isLoading = true;
|
|
|
+ this.listParams.liveId = this.liveId;
|
|
|
+ if(this.listParams.liveId == null) {
|
|
|
+ this.$message.error("页面错误,请联系管理员");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ try{
|
|
|
+ if (this.form.taskType == 1) {
|
|
|
await this.addGoodsList();
|
|
|
- }catch ( err){
|
|
|
- console.error('加载数据失败:', err);
|
|
|
- }finally {
|
|
|
- this.isLoading = false;
|
|
|
+ }else if (this.form.taskType == 2) {
|
|
|
+ await this.addRedList();
|
|
|
+ }else if (this.form.taskType == 4) {
|
|
|
+ await this.addLotteryList();
|
|
|
}
|
|
|
+ }catch ( err){
|
|
|
+ console.error('加载数据失败:', err);
|
|
|
+ }finally {
|
|
|
+ this.isLoading = false;
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
addGoodsList() {
|
|
|
- listLiveGoods(this.goodsParams).then(res => {
|
|
|
+ if(this.haveData.goods) return
|
|
|
+ listLiveGoods(this.listParams).then(res => {
|
|
|
if(res.rows.length > 0) {
|
|
|
res.rows.forEach(item => {
|
|
|
// 根据productName和goodsId组装成为label和value
|
|
|
@@ -441,13 +488,66 @@ export default {
|
|
|
label: item.productName
|
|
|
})
|
|
|
})
|
|
|
- this.goodsParams.pageNum++;
|
|
|
+ this.listParams.pageNum++;
|
|
|
// 判断是否还有更多数据
|
|
|
this.hasMore = this.productOptions.length < res.total;
|
|
|
- if(this.hasMore) {
|
|
|
+ if (this.hasMore) {
|
|
|
this.addGoodsList();
|
|
|
+ } else {
|
|
|
+ this.haveData.goods = true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.hasMore = false;
|
|
|
+ this.haveData.goods = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addRedList() {
|
|
|
+ if(this.haveData.red) return
|
|
|
+ listLiveRedConfOn(this.listParams).then(res => {
|
|
|
+ if(res.rows.length > 0) {
|
|
|
+ res.rows.forEach(item => {
|
|
|
+ // 根据productName和goodsId组装成为label和value
|
|
|
+ this.redOptions.push({
|
|
|
+ value: item.redId,
|
|
|
+ label: item.desc
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.listParams.pageNum++;
|
|
|
+ // 判断是否还有更多数据
|
|
|
+ this.hasMore = this.redOptions.length < res.total;
|
|
|
+ if (this.hasMore) {
|
|
|
+ this.addRedList();
|
|
|
+ } else {
|
|
|
+ this.haveData.red = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.haveData.red = true
|
|
|
+ this.hasMore = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addLotteryList() {
|
|
|
+ if(this.haveData.lottery) return
|
|
|
+ listLiveLotteryConfOn(this.listParams).then(res => {
|
|
|
+ if(res.rows.length > 0) {
|
|
|
+ res.rows.forEach(item => {
|
|
|
+ // 根据productName和goodsId组装成为label和value
|
|
|
+ this.lotteryOptions.push({
|
|
|
+ value: item.lotteryId,
|
|
|
+ label: item.desc
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.listParams.pageNum++;
|
|
|
+ // 判断是否还有更多数据
|
|
|
+ this.hasMore = this.lotteryOptions.length < res.total;
|
|
|
+ if (this.hasMore) {
|
|
|
+ this.addRedList();
|
|
|
+ } else {
|
|
|
+ this.haveData.lottery = true
|
|
|
}
|
|
|
} else {
|
|
|
+ this.haveData.lottery = true
|
|
|
this.hasMore = false;
|
|
|
}
|
|
|
});
|
|
|
@@ -486,7 +586,7 @@ export default {
|
|
|
createdTime: null,
|
|
|
updatedTime: null
|
|
|
};
|
|
|
- this.goodsParams={
|
|
|
+ this.listParams={
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
liveId: this.liveId
|
|
|
@@ -522,13 +622,21 @@ export default {
|
|
|
this.reset();
|
|
|
if(row.taskType == 1){
|
|
|
await this.addGoodsList();
|
|
|
+ }else if(row.taskType == 2){
|
|
|
+ await this.addRedList();
|
|
|
+ }else if(row.taskType == 4){
|
|
|
+ await this.addLotteryList();
|
|
|
}
|
|
|
const id = row.id || this.ids
|
|
|
getTask(id).then(response => {
|
|
|
this.form = response.data;
|
|
|
+ let content = JSON.parse( response.data.content)
|
|
|
if (this.form.taskType == 1) {
|
|
|
- let content = JSON.parse( response.data.content)
|
|
|
this.form.content = content.goodsId;
|
|
|
+ }else if (this.form.taskType == 2) {
|
|
|
+ this.form.content = content.desc;
|
|
|
+ }else if (this.form.taskType == 4) {
|
|
|
+ this.form.content = content.desc;
|
|
|
}
|
|
|
this.open = true;
|
|
|
this.title = "修改直播间自动化任务配置";
|