Browse Source

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

yuhongqi 2 weeks ago
parent
commit
46c04c5224

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

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

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

@@ -0,0 +1,11 @@
+import request from '@/utils/request'
+
+// 查询销售端直播数据列表
+export function liveProfitList(data) {
+  return request({
+    url: '/live/liveProfit/list',
+    method: 'get',
+    params: data
+  })
+}
+

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

@@ -112,9 +112,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
@@ -216,7 +231,8 @@ import {
   handleDeleteSelected,
   delLiveCoupon,
   updateLiveCouponBind,
-  listCoupon
+  listCoupon,
+  listOnSaleProducts
 } from "@/api/live/liveCoupon";
 import { listLiveGoods} from "@/api/live/liveGoods";
 
@@ -233,7 +249,9 @@ export default {
         pageSize: 10,
         couponName: '',
         liveId: null,
+        productId: null,
       },
+      productOptions: [],
       couponLiveList: [],
       couponLiveTotal: 0,
       couponParams: {
@@ -457,7 +475,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

+ 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>
@@ -298,7 +300,7 @@ import { blockUser,changeUserStatus,getLiveUserTotals, watchUserList } from '@/a
 import { getLiveVideoByLiveId } from '@/api/live/liveVideo'
 import {getLive, getLivingUrl} 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 LiveLotteryConf from '@/views/live/liveConfig/liveLotteryConf.vue'
 import LiveRedConf from '@/views/live/liveConfig/liveRedConf.vue'
@@ -484,6 +486,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 = '';

+ 18 - 2
src/views/live/liveCoupon/index.vue

@@ -102,6 +102,8 @@
               <el-tag prop="status" v-for="(item, index) in statusOptions"    v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
           </template>
       </el-table-column>
+<!--      <el-table-column label="绑定商品" align="center" prop="productName" />-->
+      <el-table-column label="单场直播优惠券数量" align="center" prop="liveLimitNum" />
       <el-table-column label="创建时间" align="center" prop="createTime" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -156,6 +158,9 @@
         <el-form-item label="排序" prop="sort">
           <el-input-number v-model="form.sort"  :min="0" placeholder="请输入排序" />
         </el-form-item>
+        <el-form-item label="单场直播优惠券数量" prop="sort">
+          <el-input-number v-model="form.liveLimitNum"  :min="0" placeholder="请输入单场直播优惠券数量" />
+        </el-form-item>
         <el-form-item label="类型" prop="type">
             <el-radio-group v-model="form.type">
               <el-radio :label="item.dictValue" v-for="item in couponTypeOptions" >{{item.dictLabel}}</el-radio>
@@ -225,7 +230,7 @@
 </template>
 
 <script>
-import { publishCoupon,listStoreCoupon, getStoreCoupon, delStoreCoupon, addStoreCoupon, updateStoreCoupon, exportStoreCoupon } from "@/api/live/liveCoupon";
+import { publishCoupon,listStoreCoupon, getStoreCoupon, delStoreCoupon, addStoreCoupon, updateStoreCoupon, exportStoreCoupon, listOnSaleProducts } from "@/api/live/liveCoupon";
 import addBatchPublish from "../components/addBatchPublish.vue";
 export default {
   name: "StoreCoupon",
@@ -234,6 +239,7 @@ export default {
     return {
       cateOptions:[],
       couponTypeOptions:[],
+      productOptions: [],
       publish:{
         title:"发布",
         open:false,
@@ -347,7 +353,7 @@ export default {
     this.getDicts("store_coupon_type").then((response) => {
       this.couponTypeOptions = response.data;
     });
-
+    this.getProductOptions();
     this.getList();
   },
   methods: {
@@ -378,6 +384,8 @@ export default {
         status: "0",
         type: "0",
         productIds: null,
+        productId: null,
+        liveLimitNum:null,
         packageCateIds:[],
         createTime: null,
         updateTime: null,
@@ -385,6 +393,14 @@ export default {
       };
       this.resetForm("form");
     },
+    /** 获取商品选项 */
+    getProductOptions() {
+      listOnSaleProducts({ pageNum: 1, pageSize: 1000 }).then(response => {
+        if (response.code === 200) {
+          this.productOptions = response.rows || [];
+        }
+      });
+    },
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;

+ 148 - 0
src/views/live/liveProfit/index.vue

@@ -0,0 +1,148 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
+      <el-form-item label="订单号" prop="orderCode">
+        <el-input
+          v-model="queryParams.orderCode"
+          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>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="dataList">
+      <el-table-column label="订单ID" align="center" prop="orderId" />
+      <el-table-column label="订单号" align="center" prop="orderCode" />
+      <el-table-column label="用户名称" align="center" prop="userName" />
+      <el-table-column label="用户电话" align="center" prop="userPhone" />
+      <el-table-column label="总价格" align="center" prop="totalPrice" />
+      <el-table-column label="支付价格" align="center" prop="payPrice" />
+      <el-table-column label="是否支付" align="center" prop="isPay">
+        <template slot-scope="scope">
+          <el-tag type="success" v-if="scope.row.isPay == 1">已支付</el-tag>
+          <el-tag type="info" v-else>未支付</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="订单状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.status == -1">申请退款</el-tag>
+          <el-tag v-else-if="scope.row.status == -2">退货成功</el-tag>
+          <el-tag v-else-if="scope.row.status == 0">已取消</el-tag>
+          <el-tag v-else-if="scope.row.status == 1">待支付</el-tag>
+          <el-tag v-else-if="scope.row.status == 2">待发货</el-tag>
+          <el-tag v-else-if="scope.row.status == 3">待收货</el-tag>
+          <el-tag v-else-if="scope.row.status == 4">待评价</el-tag>
+          <el-tag v-else-if="scope.row.status == 5">已完成</el-tag>
+          <el-tag v-else>---</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="销售ID" align="center" prop="companyUserId" />
+      <el-table-column label="销售名称" align="center" prop="companyUserName" />
+      <el-table-column label="公司名称" align="center" prop="companyName" />
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { liveProfitList } from '@/api/live/liveProfit'
+
+export default {
+  name: "LiveProfit",
+  data() {
+    return {
+      loading: true,
+      showSearch: true,
+      total: 0,
+      dataList: [],
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        orderCode: null,
+        userName: null,
+        companyUserName: null,
+        companyName: null,
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    /** 查询销售端直播数据列表 */
+    getList() {
+      this.loading = true
+      liveProfitList(this.queryParams).then(response => {
+        this.dataList = response.rows
+        this.total = response.total
+        this.loading = false
+      })
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.queryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        orderCode: null,
+        userName: null,
+        companyUserName: null,
+        companyName: null,
+      }
+      this.handleQuery()
+    }
+  }
+}
+</script>
+
+<style scoped>
+</style>
+