Ver Fonte

优惠券功能

yuhongqi há 18 horas atrás
pai
commit
60616e81fd

+ 9 - 0
src/api/live/liveCoupon.js

@@ -125,3 +125,12 @@ export function updateLiveCouponBind(data) {
   })
 }
 
+// 查询直播抽奖配置列表  未开启
+export function listLiveCouponOn(query) {
+  return request({
+    url: '/live/coupon/listOn',
+    method: 'get',
+    params: query
+  })
+}
+

+ 1 - 0
src/components/VideoUpload/index.vue

@@ -225,6 +225,7 @@ export default {
         videoType: -1,
         sort: null,
         remark: null,
+        finishStatus:1
       },
       liveQueryParams: {
         pageNum: 1,

+ 57 - 2
src/views/live/liveConfig/task.vue

@@ -195,6 +195,21 @@
             </div>
           </el-select>
         </el-form-item>
+        <el-form-item label="优惠券" prop="content" v-if="form.taskType == 5">
+          <el-select v-model="form.content" placeholder="请选择优惠券" ref="selectCoupon" >
+            <el-option v-for="i in couponOptions" :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"
@@ -237,6 +252,7 @@ import { listTask, getTask, delTask, addTask, updateTask, exportTask } from "@/a
 import {listLiveGoods} from "@/api/live/liveGoods";
 import {listLiveRedConfOn} from "@/api/live/liveRedConf";
 import {listLiveLotteryConfOn} from "@/api/live/liveLotteryConf";
+import {listLiveCouponOn} from "@/api/live/liveCoupon";
 
 export default {
   props:{
@@ -260,6 +276,10 @@ export default {
         {
           value: 4,
           label: "定时抽奖"
+        },
+        {
+          value: 5,
+          label: "定时优惠券"
         }
       ],
       statusOptions:[{
@@ -275,10 +295,12 @@ export default {
       haveData:{
         goods:false,
         red:false,
-        lottery:false
+        lottery:false,
+        coupon:false
       },
       redOptions:[],
       lotteryOptions:[],
+      couponOptions:[],
       // 遮罩层
       loading: true,
       // 导出遮罩层
@@ -410,6 +432,8 @@ export default {
           return "定时发送红包";
         case 4:
           return "定时抽奖";
+        case 5:
+          return "定时优惠券";
         default:
           return "--";
       }
@@ -480,6 +504,8 @@ export default {
           await this.addRedList();
         }else if (this.form.taskType == 4) {
           await this.addLotteryList();
+        }else if(this.form.taskType == 5){
+          await this.addCouponList();
         }
       }catch ( err){
         console.error('加载数据失败:', err);
@@ -553,7 +579,7 @@ export default {
           // 判断是否还有更多数据
           this.hasMore = this.lotteryOptions.length < res.total;
           if (this.hasMore) {
-            this.addRedList();
+            this.addLotteryList();
           } else {
             this.haveData.lottery = true
           }
@@ -563,6 +589,31 @@ export default {
         }
       });
     },
+    addCouponList() {
+      if(this.haveData.coupon) return
+      listLiveCouponOn(this.listParams).then(res => {
+        if(res.rows.length > 0) {
+          res.rows.forEach(item => {
+            // 根据productName和goodsId组装成为label和value
+            this.couponOptions.push({
+              value: item.couponId,
+              label: item.title
+            })
+          })
+          this.listParams.pageNum++;
+          // 判断是否还有更多数据
+          this.hasMore = this.couponOptions.length < res.total;
+          if (this.hasMore) {
+            this.addCouponList();
+          } else {
+            this.haveData.coupon = true
+          }
+        } else {
+          this.haveData.coupon = true
+          this.hasMore = false;
+        }
+      });
+    },
     /** 查询直播间自动化任务配置列表 */
     getList() {
       if(this.liveId == null) {
@@ -636,6 +687,8 @@ export default {
         await this.addRedList();
       }else if(row.taskType == 4){
         await this.addLotteryList();
+      }else if(row.taskType == 5) {
+        await this.addCouponList();
       }
       const id = row.id || this.ids
       getTask(id).then(response => {
@@ -647,6 +700,8 @@ export default {
           this.form.content = content.desc;
         }else if (this.form.taskType == 4) {
           this.form.content = content.desc;
+        }else if(this.form.taskType == 5){
+          this.form.content = content.couponId;
         }
         this.open = true;
         this.title = "修改直播间自动化任务配置";

+ 7 - 0
src/views/live/liveVideo/index.vue

@@ -42,6 +42,13 @@
         </template>
       </el-table-column>
       <el-table-column label="时长" align="center" prop="duration" :formatter="formatDuration"/>
+      <el-table-column label="转码状态" align="center" prop="finishStatus">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.finishStatus == 1">转码成功</el-tag>
+          <el-tag v-else-if="scope.row.finishStatus == 0">转码中</el-tag>
+          <el-tag v-else>---</el-tag>
+        </template>
+      </el-table-column>
     </el-table>
 
     <pagination