Преглед изворни кода

消息置顶和自动化任务添加

yuhongqi пре 2 недеља
родитељ
комит
c4e9b94af9

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

@@ -134,3 +134,12 @@ export function listLiveCouponOn(query) {
   })
 }
 
+// 查询上架商品列表
+export function listOnSaleProducts(query) {
+  return request({
+    url: '/live/coupon/listOnSaleProducts',
+    method: 'get',
+    params: query
+  })
+}
+

+ 11 - 0
src/api/live/liveProfit.js

@@ -7,4 +7,15 @@ export function liveProfitList(data) {
   })
 }
 
+export function liveProfitDetail(liveId, companyUserId) {
+  return request({
+    url: '/live/liveProfit/detail',
+    method: 'get',
+    params: {
+      liveId: liveId,
+      companyUserId: companyUserId
+    }
+  })
+}
+
 

+ 29 - 3
src/views/live/liveConfig/liveCoupon.vue

@@ -115,9 +115,24 @@
           <el-input
             v-model="searchTitle"
             placeholder="请输入优惠券名称"
-            style="width: 300px;"
+            style="width: 200px; margin-right: 10px;"
             @input="handleCouponSearch"
           ></el-input>
+<!--          <el-select-->
+<!--            v-model="queryCouponParams.productId"-->
+<!--            placeholder="请选择商品"-->
+<!--            clearable-->
+<!--            filterable-->
+<!--            style="width: 200px;"-->
+<!--            @change="handleCouponSearch"-->
+<!--          >-->
+<!--            <el-option-->
+<!--              v-for="product in productOptions"-->
+<!--              :key="product.productId"-->
+<!--              :label="product.productName"-->
+<!--              :value="product.productId"-->
+<!--            ></el-option>-->
+<!--          </el-select>-->
         </div>
 
         <el-table
@@ -219,7 +234,8 @@ import {
   handleDeleteSelected,
   delLiveCoupon,
   updateLiveCouponBind,
-  listCoupon
+  listCoupon,
+  listOnSaleProducts
 } from "@/api/live/liveCoupon";
 import { listLiveGoods} from "@/api/live/liveGoods";
 
@@ -241,7 +257,9 @@ export default {
         pageSize: 10,
         couponName: '',
         liveId: null,
+        productId: null,
       },
+      productOptions: [],
       couponLiveList: [],
       couponLiveTotal: 0,
       couponParams: {
@@ -466,7 +484,15 @@ export default {
     },
     handleAddLiveCoupon(){
       this.couponDialogVisible = true;
-      this.getCouponLists()
+      this.getCouponLists();
+      // this.getProductOptions();
+    },
+    getProductOptions() {
+      listOnSaleProducts({ pageNum: 1, pageSize: 1000 }).then(response => {
+        if (response.code === 200) {
+          this.productOptions = response.rows || [];
+        }
+      });
     },
     handleCouponSearch(){
       this.queryCouponParams.pageNum = 1

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

@@ -633,7 +633,7 @@ export default {
           res.rows.forEach(item => {
             // 根据productName和goodsId组装成为label和value
             this.couponOptions.push({
-              value: item.couponId,
+              value: item.id,
               label: item.title
             })
           })
@@ -742,7 +742,7 @@ export default {
         }else if (this.form.taskType == 4) {
           this.form.content = content.lotteryId;
         }else if(this.form.taskType == 5){
-          this.form.content = content.couponId;
+          this.form.content = content.id;
         }else if(this.form.taskType == 6){
           this.form.goodsId = content.goodsId;
           this.form.goodsStatus = content.status;

+ 39 - 1
src/views/live/liveConsole/index.vue

@@ -15,6 +15,8 @@
                    <a style="cursor: pointer;color: #13C2C2;font-size: 14px;" @click="changeUserState(m)">{{ m.msgStatus === 1 ? '解禁' : '禁言' }}</a>
                    <span style="color:#13C2C2;">|</span>
                    <a style="cursor: pointer;color: #13C2C2;font-size: 14px;" @click="blockUser(m)">拉黑</a>
+                   <span style="color:#13C2C2;">|</span>
+                   <a style="cursor: pointer;color: #ff0000;padding: 8px 8px 0 0;font-size: 12px;" @click="deleteMsg(m)">删除</a>
                  </div>
                 </el-col>
             </el-row>
@@ -308,7 +310,7 @@ import {blockUser, changeUserStatus, getLiveUserTotals, watchUserList} from '@/a
 import { getLiveVideoByLiveId } from '@/api/live/liveVideo'
 import {getLivingUrl, getLive, delLive} from '@/api/live/live'
 import { getLiveOrderTimeGranularity } from '@/api/live/liveOrder'
-import { listLiveMsg } from '@/api/live/liveMsg'
+import { listLiveMsg,delLiveMsg } from '@/api/live/liveMsg'
 import Hls from 'hls.js';
 import {onBeforeUnmount} from 'vue';
 import LiveLotteryConf from '@/views/live/liveConfig/liveLotteryConf.vue'
@@ -500,6 +502,42 @@ export default {
     })
   },
   methods: {
+    deleteMsg(m){
+      // 1. 弹出确认对话框
+      this.$confirm('此操作将永久删除该消息, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        delLiveMsg(m.msgId).then(res => {
+          if (res.code === 200) {
+            const index = this.msgList.findIndex(item => item.msgId === m.msgId);
+            if (index !== -1) {
+              this.msgList.splice(index, 1);
+              console.log(`消息 ${m.msgId} 已在本地删除。`);
+            }
+            let msg = {
+              liveId: this.liveId,
+              userId: m.userId,
+              msg: m.msgId, // 关键:将消息ID发送给后台
+              cmd: 'deleteMsg',
+            };
+            this.socket.send(JSON.stringify(msg));
+            // 可以在这里给用户一个删除成功的提示
+            this.$message({
+              type: 'success',
+              message: '消息删除成功!'
+            });
+          }
+        })
+      }).catch(() => {
+        // 3. 用户点击“取消”或关闭对话框后的回调
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
+    },
     // 显示顶部消息对话框
     showTopMsgDialog() {
       this.topMsgForm.msg = '';

+ 203 - 76
src/views/live/liveProfit/index.vue

@@ -2,25 +2,43 @@
   <div class="app-container">
   <div class="el-container-md">
 
-    <el-form :model="queryParams" class="live-goods-css" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="商品名称" prop="keywords" >
+    <el-form :model="queryParams" class="live-goods-css" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
+      <el-form-item label="直播名称" prop="liveName">
         <el-input
-          v-model="queryParams.keywords"
-          placeholder="请输入商品名称"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="上下架" prop="status" >
-        <el-input
-          v-model="queryParams.status"
-          placeholder="请输入直播间状态"
+          v-model="queryParams.liveName"
+          placeholder="请输入直播名称"
           clearable
           size="small"
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
+<!--      <el-form-item label="用户名称" prop="userName">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.userName"-->
+<!--          placeholder="请输入用户名称"-->
+<!--          clearable-->
+<!--          size="small"-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </el-form-item>-->
+<!--      <el-form-item label="销售名称" prop="companyUserName">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.companyUserName"-->
+<!--          placeholder="请输入销售名称"-->
+<!--          clearable-->
+<!--          size="small"-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </el-form-item>-->
+<!--      <el-form-item label="公司名称" prop="companyName">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.companyName"-->
+<!--          placeholder="请输入公司名称"-->
+<!--          clearable-->
+<!--          size="small"-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </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>
@@ -44,73 +62,95 @@
     >
       <!-- 题干列:显示试题的主要内容 -->
       <el-table-column
-        prop="orderId"
-        label="订单id"
+        prop="liveId"
+        label="直播ID"
         show-overflow-tooltip
       ></el-table-column>
 
       <el-table-column
-        prop="orderCode"
-        label="订单号"
+        prop="liveName"
+        label="直播名称"
       >
       </el-table-column>
 
       <el-table-column
-        prop="userName"
-        label="用户名称"
+        prop="companyName"
+        label="公司名称"
       ></el-table-column>
 
+<!--      <el-table-column-->
+<!--        prop="companyId"-->
+<!--        label="公司ID"-->
+<!--      ></el-table-column>-->
+
       <el-table-column
-        prop="userPhone"
-        label="用户电话"
+        prop="companyUserId"
+        label="销售ID"
       ></el-table-column>
-
       <el-table-column
-        prop="totalPrice"
-        label="总价格"
+        prop="companyUserName"
+        label="销售名称"
       ></el-table-column>
-
       <el-table-column
-        prop="payPrice"
-        label="支付价格"
+        prop="liveNum"
+        label="邀请人数"
       ></el-table-column>
 
       <el-table-column
-        prop="isPay"
-        label="是否支付"
-      >
-        <template slot-scope="scope">
-          <el-tag type="success" v-if="scope.row.isPay == 1">已支付</el-tag>
-          <el-tag type="info" v-if="scope.row.isPay == 0">未支付</el-tag>
-        </template>
-      </el-table-column>
-      <el-table-column
-        prop="status"
-        label="订单状态"
+        label="操作"
+        width="120"
+        align="center"
       >
         <template slot-scope="scope">
-          <el-tag v-if="scope.row.status == -1">申请退款</el-tag>
-          <el-tag v-if="scope.row.status == -2">退货成功</el-tag>
-          <el-tag v-if="scope.row.status == 0">已取消</el-tag>
-          <el-tag v-if="scope.row.status == 1">待支付</el-tag>
-          <el-tag v-if="scope.row.status == 2">代发货</el-tag>
-          <el-tag v-if="scope.row.status == 3">待收货</el-tag>
-          <el-tag v-if="scope.row.status == 4">待评价</el-tag>
-          <el-tag v-if="scope.row.status == 5">已完成</el-tag>
+          <el-button
+            type="text"
+            size="mini"
+            @click="handleDetail(scope.row)"
+          >查看详情</el-button>
         </template>
       </el-table-column>
-      <el-table-column
-        prop="companyUserId"
-        label="销售id"
-      ></el-table-column>
-      <el-table-column
-        prop="companyUserName"
-        label="销售名称"
-      ></el-table-column>
-      <el-table-column
-        prop="companyName"
-        label="公司名称"
-      ></el-table-column>
+
+<!--      <el-table-column-->
+<!--        prop="payPrice"-->
+<!--        label="支付价格"-->
+<!--      ></el-table-column>-->
+
+<!--      <el-table-column-->
+<!--        prop="isPay"-->
+<!--        label="是否支付"-->
+<!--      >-->
+<!--        <template slot-scope="scope">-->
+<!--          <el-tag type="success" v-if="scope.row.isPay == 1">已支付</el-tag>-->
+<!--          <el-tag type="info" v-if="scope.row.isPay == 0">未支付</el-tag>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+<!--      <el-table-column-->
+<!--        prop="status"-->
+<!--        label="订单状态"-->
+<!--      >-->
+<!--        <template slot-scope="scope">-->
+<!--          <el-tag v-if="scope.row.status == -1">申请退款</el-tag>-->
+<!--          <el-tag v-if="scope.row.status == -2">退货成功</el-tag>-->
+<!--          <el-tag v-if="scope.row.status == 0">已取消</el-tag>-->
+<!--          <el-tag v-if="scope.row.status == 1">待支付</el-tag>-->
+<!--          <el-tag v-if="scope.row.status == 2">代发货</el-tag>-->
+<!--          <el-tag v-if="scope.row.status == 3">待收货</el-tag>-->
+<!--          <el-tag v-if="scope.row.status == 4">待评价</el-tag>-->
+<!--          <el-tag v-if="scope.row.status == 5">已完成</el-tag>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+<!--      <el-table-column-->
+<!--        prop="companyUserId"-->
+<!--        label="销售id"-->
+<!--      ></el-table-column>-->
+<!--      <el-table-column-->
+<!--        prop="companyUserName"-->
+<!--        label="销售名称"-->
+<!--      ></el-table-column>-->
+<!--      <el-table-column-->
+<!--        prop="companyName"-->
+<!--        label="公司名称"-->
+<!--      ></el-table-column>-->
 
 
 
@@ -126,13 +166,57 @@
       style="margin-top: 20px;"
     />
 
+    <!-- 详情抽屉 -->
+    <el-drawer
+      title="直播间用户详情"
+      :visible.sync="drawerVisible"
+      direction="rtl"
+      size="50%"
+    >
+      <div v-if="detailInfo" style="padding: 20px;">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="直播间ID">{{ detailInfo.liveId }}</el-descriptions-item>
+          <el-descriptions-item label="直播间名称">{{ detailInfo.liveName }}</el-descriptions-item>
+          <el-descriptions-item label="销售ID">{{ detailInfo.companyUserId }}</el-descriptions-item>
+          <el-descriptions-item label="销售名称">{{ detailInfo.companyUserName }}</el-descriptions-item>
+          <el-descriptions-item label="进入用户数" :span="2">{{ detailList.length }} 人</el-descriptions-item>
+        </el-descriptions>
+
+        <el-divider></el-divider>
+
+        <el-table
+          :data="detailList"
+          style="width: 100%"
+          v-loading="detailLoading"
+        >
+          <el-table-column
+            prop="userId"
+            label="用户ID"
+            width="100"
+          ></el-table-column>
+          <el-table-column
+            prop="userName"
+            label="用户名称"
+          ></el-table-column>
+          <el-table-column
+            prop="firstEntryTime"
+            label="进入时间"
+            width="180"
+          >
+            <template slot-scope="scope">
+              {{ formatDateTime(scope.row.firstEntryTime) }}
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+    </el-drawer>
 
   </div>
   </div>
 </template>
 
 <script>
-import {liveProfitList} from '@/api/live/liveProfit';
+import {liveProfitList, liveProfitDetail} from '@/api/live/liveProfit';
 export default {
   data() {
     return {
@@ -141,46 +225,89 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        keywords: null,
-        status: null,
-        liveId: null,
-        desc: null,
-        createTime: null,
-        updateTime: null,
+        orderCode: null,
+        userName: null,
+        companyUserName: null,
+        companyName: null,
       },
       // 数据列表
       dataList:[],
       total:0,
       // 显示搜索条件
       showSearch: true,
+      // 抽屉相关
+      drawerVisible: false,
+      detailLoading: false,
+      detailInfo: null,
+      detailList: [],
     }
   },
   created(){
     this.getList();
   },
-  mounted() {
-    this.loading = false;
-  },
   methods: {
     getList(){
+      this.loading = true;
       liveProfitList(this.queryParams).then(res=>{
         this.dataList = res.rows;
         this.total = res.total;
-      })
+        this.loading = false;
+      }).catch(() => {
+        this.loading = false;
+      });
     },
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
-      this.loading = true
-      // listLiveGoods(this.queryParams).then(response => {
-      //   this.goodsLiveList = response.rows
-      //   this.goodsLiveTotal = response.total
-      //   this.loading = false
-      // })
+      this.getList();
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.$refs.queryForm.resetFields();
+      this.queryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        orderCode: null,
+        userName: null,
+        companyUserName: null,
+        companyName: null,
+      };
+      this.handleQuery();
+    },
+    /** 查看详情 */
+    handleDetail(row) {
+      this.drawerVisible = true;
+      this.detailLoading = true;
+      this.detailInfo = {
+        liveId: row.liveId,
+        liveName: row.liveName,
+        companyUserId: row.companyUserId,
+        companyUserName: row.companyUserName
+      };
+      this.detailList = [];
+      
+      liveProfitDetail(row.liveId, row.companyUserId).then(res => {
+        if (res.code === 200) {
+          this.detailList = res.data || [];
+        } else {
+          this.$modal.msgError(res.msg || '获取详情失败');
+        }
+        this.detailLoading = false;
+      }).catch(() => {
+        this.detailLoading = false;
+        this.$modal.msgError('获取详情失败');
+      });
+    },
+    /** 格式化日期时间 */
+    formatDateTime(dateTime) {
+      if (!dateTime) return '';
+      const date = new Date(dateTime);
+      const year = date.getFullYear();
+      const month = String(date.getMonth() + 1).padStart(2, '0');
+      const day = String(date.getDate()).padStart(2, '0');
+      const hours = String(date.getHours()).padStart(2, '0');
+      const minutes = String(date.getMinutes()).padStart(2, '0');
+      const seconds = String(date.getSeconds()).padStart(2, '0');
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
     },
   },
 }