Parcourir la source

Merge branch 'refs/heads/master' into 企微聊天

# Conflicts:
#	src/api/common.js
#	src/store/index.js
ct il y a 23 heures
Parent
commit
09b62422bc
99 fichiers modifiés avec 25767 ajouts et 59 suppressions
  1. 20 0
      .env.development
  2. 45 0
      .env.prod-bjzm
  3. 32 7
      .env.production
  4. 5 0
      package.json
  5. 10 0
      src/api/common.js
  6. 10 0
      src/api/company/companyUser.js
  7. 62 0
      src/api/live/gift.js
  8. 134 0
      src/api/live/live.js
  9. 77 0
      src/api/live/liveAfterSales.js
  10. 53 0
      src/api/live/liveAnchor.js
  11. 137 0
      src/api/live/liveCoupon.js
  12. 61 0
      src/api/live/liveData.js
  13. 96 0
      src/api/live/liveGoods.js
  14. 62 0
      src/api/live/liveLotteryConf.js
  15. 61 0
      src/api/live/liveLotteryProductConf.js
  16. 62 0
      src/api/live/liveMsg.js
  17. 149 0
      src/api/live/liveOrder.js
  18. 53 0
      src/api/live/liveOrderitems.js
  19. 10 0
      src/api/live/liveProfit.js
  20. 53 0
      src/api/live/liveQuestion.js
  21. 36 0
      src/api/live/liveQuestionBank.js
  22. 89 0
      src/api/live/liveQuestionLive.js
  23. 63 0
      src/api/live/liveRedConf.js
  24. 19 0
      src/api/live/liveRewardRecord.js
  25. 62 0
      src/api/live/liveUserLotteryRecord.js
  26. 68 0
      src/api/live/liveVideo.js
  27. 43 0
      src/api/live/liveWatchUser.js
  28. 86 0
      src/api/live/task.js
  29. 53 0
      src/api/live/words.js
  30. 17 0
      src/api/qw/sopTemp.js
  31. BIN
      src/assets/images/videoIsAudit.png
  32. BIN
      src/assets/images/videoNotStart.png
  33. BIN
      src/assets/logo/bjzmky.png
  34. 274 0
      src/components/LiveVideoUpload/index.vue
  35. 446 0
      src/components/LiveVideoUpload/single.vue
  36. 10 0
      src/router/index.js
  37. 40 1
      src/store/index.js
  38. 96 0
      src/utils/cos.js
  39. 112 0
      src/utils/liveWS.js
  40. 73 0
      src/utils/obs.js
  41. 15 0
      src/utils/util.js
  42. 1 1
      src/views/course/courseWatchLog/index.vue
  43. 1 1
      src/views/course/courseWatchLog/watchLog.vue
  44. 400 0
      src/views/live/components/productAfterSalesOrder.vue
  45. 973 0
      src/views/live/components/productOrder.vue
  46. 319 0
      src/views/live/gift/index.vue
  47. 996 0
      src/views/live/live/index.vue
  48. 457 0
      src/views/live/liveAfteraSales/index.vue
  49. 359 0
      src/views/live/liveAnchor/index.vue
  50. 260 0
      src/views/live/liveConfig/answer.vue
  51. 474 0
      src/views/live/liveConfig/barrage.vue
  52. 619 0
      src/views/live/liveConfig/goods.vue
  53. 67 0
      src/views/live/liveConfig/idCard.vue
  54. 265 0
      src/views/live/liveConfig/index.vue
  55. 563 0
      src/views/live/liveConfig/liveCoupon.vue
  56. 918 0
      src/views/live/liveConfig/liveLotteryConf.vue
  57. 532 0
      src/views/live/liveConfig/liveRedConf.vue
  58. 546 0
      src/views/live/liveConfig/liveReplay.vue
  59. 455 0
      src/views/live/liveConfig/preview.vue
  60. 807 0
      src/views/live/liveConfig/task.vue
  61. 416 0
      src/views/live/liveConfig/watchReward.vue
  62. 61 0
      src/views/live/liveConsole/EchartsComponent.vue
  63. 1521 0
      src/views/live/liveConsole/LiveConsole.vue
  64. 373 0
      src/views/live/liveConsole/LiveDashboard.vue
  65. 144 0
      src/views/live/liveConsole/LivePlayer.vue
  66. 55 0
      src/views/live/liveConsole/ScreenScale.vue
  67. 1344 0
      src/views/live/liveConsole/index-old.vue
  68. 57 0
      src/views/live/liveConsole/index.vue
  69. 1444 0
      src/views/live/liveData/index-old.vue
  70. 659 0
      src/views/live/liveData/index.vue
  71. 425 0
      src/views/live/liveGoods/index.vue
  72. 795 0
      src/views/live/liveLotteryConf/index.vue
  73. 386 0
      src/views/live/liveLotteryProductConf/index.vue
  74. 301 0
      src/views/live/liveMsg/index.vue
  75. 339 0
      src/views/live/liveOrder/index.vue
  76. 913 0
      src/views/live/liveOrder/liveOrderDetails.vue
  77. 358 0
      src/views/live/liveOrderitems/index.vue
  78. 193 0
      src/views/live/liveProfit/index.vue
  79. 324 0
      src/views/live/liveQuestion/index.vue
  80. 552 0
      src/views/live/liveQuestionBank/index.vue
  81. 477 0
      src/views/live/liveRedConf/index.vue
  82. 147 0
      src/views/live/liveRewardRecord/index.vue
  83. 301 0
      src/views/live/liveVideo/index.vue
  84. 51 0
      src/views/live/liveWatchUser/index.vue
  85. 35 0
      src/views/live/talentLiveInfo/index.vue
  86. 280 0
      src/views/live/words/index.vue
  87. 3 2
      src/views/qw/QwWorkTaskNew/qwWorkTask.vue
  88. 12 11
      src/views/qw/externalContact/myExternalContact.vue
  89. 3 3
      src/views/qw/sop/addSop.vue
  90. 1 1
      src/views/qw/sop/deptSop.vue
  91. 1 1
      src/views/qw/sop/mySop.vue
  92. 1 1
      src/views/qw/sop/sop.vue
  93. 67 1
      src/views/qw/sop/updateSop.vue
  94. 934 0
      src/views/qw/sopTemp/deptIndex.vue
  95. 104 2
      src/views/qw/sopTemp/index.vue
  96. 830 0
      src/views/qw/sopTemp/myIndex.vue
  97. 36 14
      src/views/qw/sopTemp/sopTemp.vue
  98. 16 12
      src/views/qw/sopUserLogs/sopUserLogsSchedule.vue
  99. 2 1
      src/views/qw/sopUserLogsInfo/sendMsgSopOpenTool.vue

+ 20 - 0
.env.development

@@ -9,6 +9,26 @@ VUE_APP_ICP_URL =https://beian.miit.gov.cn
 # 网站LOG
 VUE_APP_LOG_URL =@/assets/logo/myhk.png
 
+# 存储桶配置
+VUE_APP_OBS_ACCESS_KEY_ID = K2UTJGIN7UTZJR2XMXYG
+# 存储桶配置
+VUE_APP_OBS_SECRET_ACCESS_KEY = sbyeNJLbcYmH6copxeFP9pAoksM4NIT9Zw4x0SRX
+# 存储桶配置
+VUE_APP_OBS_SERVER = https://obs.cn-north-4.myhuaweicloud.com
+# 存储桶配置
+VUE_APP_OBS_BUCKET = zkzh-hw079058881
+# 存储桶配置
+VUE_APP_COS_BUCKET = fs-1319721001
+# 存储桶配置
+VUE_APP_COS_REGION = ap-chongqing
+# 线路一地址
+VUE_APP_VIDEO_LINE_1 =
+# 线路二地址
+VUE_APP_VIDEO_LINE_2 = https://zkzhobs.ylrztop.com
+
+VUE_APP_LIVE_WS_URL = ws://127.0.0.1:7114/ws
+
+
 # 开发环境配置
 ENV = 'development'
 

+ 45 - 0
.env.prod-bjzm

@@ -0,0 +1,45 @@
+# 页面标题
+VUE_APP_TITLE =北京卓美悦康SCRM销售端
+# 公司名称
+VUE_APP_COMPANY_NAME =北京卓美悦康
+# ICP备案号
+VUE_APP_ICP_RECORD =京ICP备2024068752号
+# ICP网站访问地址
+VUE_APP_ICP_URL =https://beian.miit.gov.cn
+# 网站LOG
+VUE_APP_LOG_URL =@/assets/logo/bjzmky.png
+
+# 存储桶配置
+VUE_APP_OBS_ACCESS_KEY_ID = K2UTJGIN7UTZJR2XMXYG
+# 存储桶配置
+VUE_APP_OBS_SECRET_ACCESS_KEY = sbyeNJLbcYmH6copxeFP9pAoksM4NIT9Zw4x0SRX
+# 存储桶配置
+VUE_APP_OBS_SERVER = https://bjzmobs.cn-north-4.myhuaweicloud.com
+# 存储桶配置
+VUE_APP_OBS_BUCKET = bjzm
+# 存储桶配置
+VUE_APP_COS_BUCKET = bjzmky-1323137866
+# 存储桶配置
+VUE_APP_COS_REGION = ap-guangzhou
+# 线路一地址
+VUE_APP_VIDEO_LINE_1 = https://bjzmtcpv.ylrzcloud.com
+# 线路二地址
+VUE_APP_VIDEO_LINE_2 = https://bjzmobs.ylrztop.com
+
+# 生产环境配置
+ENV = 'production'
+
+# FS管理系统/开发环境
+VUE_APP_BASE_API = '/prod-api'
+
+
+#默认 1、会员 2、企微
+VUE_APP_COURSE_DEFAULT = 1
+
+#项目所属
+VUE_APP_PROJECT_FROM=bjczwh
+
+# 路由懒加载
+VUE_CLI_BABEL_TRANSPILE_MODULES = true
+
+VUE_APP_LIVE_WS_URL = wss://im.fhhx.runtzh.com/ws

+ 32 - 7
.env.production

@@ -1,14 +1,39 @@
 # 页面标题
-VUE_APP_TITLE =互联网医院管理系统
-VUE_APP_COMPANY_NAME =重庆云联融智科技有限公司
-VUE_APP_ICP_RECORD =蜀ICP备2023036719号
+VUE_APP_TITLE = 互联网医院管理系统
+# 公司名称
+VUE_APP_COMPANY_NAME = 重庆云联融智科技有限公司
+# ICP备案号
+VUE_APP_ICP_RECORD = 蜀ICP备2023036719号
+# ICP网站访问地址
 VUE_APP_ICP_URL =https://beian.miit.gov.cn
+# 网站LOG
+VUE_APP_LOG_URL =@/assets/logo/myhk.png
 
-# 生产环境配置
+# 存储桶配置
+VUE_APP_OBS_ACCESS_KEY_ID = K2UTJGIN7UTZJR2XMXYG
+# 存储桶配置
+VUE_APP_OBS_SECRET_ACCESS_KEY = sbyeNJLbcYmH6copxeFP9pAoksM4NIT9Zw4x0SRX
+# 存储桶配置
+VUE_APP_OBS_SERVER = https://obs.cn-north-4.myhuaweicloud.com
+# 存储桶配置
+VUE_APP_OBS_BUCKET = zkzh-hw079058881
+# 存储桶配置
+VUE_APP_COS_BUCKET = fs-1319721001
+# 存储桶配置
+VUE_APP_COS_REGION = ap-chongqing
+# 线路一地址
+VUE_APP_VIDEO_LINE_1 = https://cos.his.cdwjyyh.com
+# 线路二地址
+VUE_APP_VIDEO_LINE_2 = https://zkzhobs.ylrztop.com
+
+# 开发环境配置
 ENV = 'production'
 
-#FS管理系统/生产环境
+# FS管理系统/开发环境
 VUE_APP_BASE_API = '/prod-api'
 
-#项目所属
-VUE_APP_PROJECT_FROM=production
+# 路由懒加载
+VUE_CLI_BABEL_TRANSPILE_MODULES = true
+
+# 直播webSocket地址
+VUE_APP_LIVE_WS_URL = ws://127.0.0.1:7014/ws/

+ 5 - 0
package.json

@@ -50,6 +50,7 @@
     "build:prod-czt": "vue-cli-service build --mode prod-czt",
     "build:prod-jnsyj": "vue-cli-service build --mode prod-jnsyj",
     "build:prod-yxj": "vue-cli-service build --mode prod-yxj",
+    "build:prod-bjzm": "vue-cli-service build --mode prod-bjzm",
     "preview": "node build/index.js --preview",
     "lint": "eslint --ext .js,.vue src",
     "test:unit": "jest --clearCache && vue-cli-service test:unit",
@@ -86,12 +87,15 @@
     "clipboard": "2.0.4",
     "compression-webpack-plugin": "^5.0.1",
     "core-js": "3.6.5",
+    "cos-js-sdk-v5": "^1.10.1",
     "dayjs": "^1.11.13",
     "echarts": "4.2.1",
     "element-ui": "2.15.5",
+    "esdk-obs-browserjs": "^3.25.6",
     "file-saver": "2.0.1",
     "form-making": "^1.2.9",
     "fuse.js": "^3.4.4",
+    "hls.js": "^1.6.13",
     "js-beautify": "1.10.2",
     "js-cookie": "2.2.0",
     "jsencrypt": "3.0.0-rc.1",
@@ -108,6 +112,7 @@
     "stylus": "^0.54.7",
     "stylus-loader": "^3.0.2",
     "v-clipboard": "^2.2.3",
+    "vod-js-sdk-v6": "^1.7.1-beta.1",
     "vue": "2.6.10",
     "vue-clipboard2": "^0.3.1",
     "vue-count-to": "1.0.13",

+ 10 - 0
src/api/common.js

@@ -26,3 +26,13 @@ export function uploadOss(data) {
     data: data
   })
 }
+
+
+export function getTmpSecretKey(query) {
+  return request({
+    url: '/common/getTmpSecretKey',
+    method: 'get',
+    params:query
+  })
+
+}

+ 10 - 0
src/api/company/companyUser.js

@@ -252,6 +252,16 @@ export function getCompanyUserListLikeName(params) {
   })
 }
 
+// 根据名模糊查询用户列表
+export function getCompanyUserListLikeNameByDept(params) {
+  return request({
+    url: '/company/user/getCompanyUserListLikeNameDept',
+    method: 'get',
+    params: params
+  })
+}
+
+
 // 查询企业员工信息列表
 export function listCompanyUser(query) {
   return request({

+ 62 - 0
src/api/live/gift.js

@@ -0,0 +1,62 @@
+import request from '@/utils/request'
+
+// 查询直播间礼物配置列表
+export function listGift(query) {
+  return request({
+    url: '/live/gift/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播间礼物配置详细
+export function getGift(giftId) {
+  return request({
+    url: '/live/gift/' + giftId,
+    method: 'get'
+  })
+}
+
+// 新增直播间礼物配置
+export function addGift(data) {
+  return request({
+    url: '/live/gift',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播间礼物配置
+export function updateGift(data) {
+  return request({
+    url: '/live/gift',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播间礼物配置
+export function delGift(giftId) {
+  return request({
+    url: '/live/gift/' + giftId,
+    method: 'delete'
+  })
+}
+
+// 导出直播间礼物配置
+export function exportGift(query) {
+  return request({
+    url: '/live/gift/export',
+    method: 'get',
+    params: query
+  })
+}
+
+
+// 查询直播间礼物配置详细
+export function getDictData(dictType) {
+  return request({
+    url: '/system/dict/data/type/' + dictType,
+    method: 'get'
+  })
+}

+ 134 - 0
src/api/live/live.js

@@ -0,0 +1,134 @@
+import request from '@/utils/request'
+
+// 查询直播列表
+export function listLive(query) {
+  return request({
+    url: '/live/live/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播详细
+export function getLive(liveId) {
+  return request({
+    url: '/live/live/' + liveId,
+    method: 'get'
+  })
+}
+
+// 新增直播
+export function addLive(data) {
+  return request({
+    url: '/live/live',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播
+export function updateLive(data) {
+  return request({
+    url: '/live/live',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播
+export function delLive(liveId) {
+  return request({
+    url: '/live/live/' + liveId,
+    method: 'delete'
+  })
+}
+
+// 导出直播
+export function exportLive(query) {
+  return request({
+    url: '/live/live/export',
+    method: 'get',
+    params: query
+  })
+}
+
+export function selectLiveToStudent(query) {
+  return request({
+    url: '/live/live/selectLiveToStudent?pageNum=' + query.pageNum + '&pageSize=' + query.pageSize,
+    method: 'post',
+    data: query
+  })
+}
+
+export function selectCompanyTalent(query) {
+  return request({
+    url: '/company/user/selectCompanyTalent/' + query,
+    method: 'get'
+  })
+}
+
+export function getLivingUrl(liveId) {
+  return request({
+    url: '/live/live/living/' + liveId,
+    method: 'get'
+  })
+}
+
+export function verifyIdInfo(data) {
+  return request({
+    url: '/live/live/verifyIdInfo',
+    method: 'post',
+    data: data
+  })
+}
+//上下架视频
+export function handleShelfOrUn(data) {
+  return request({
+    url: '/live/live/handleShelfOrUn',
+    method: 'post',
+    data: data
+  })
+}
+
+
+export function handleDeleteSelected(data) {
+  return request({
+    url: '/live/live/handleDeleteSelected',
+    method: 'post',
+    data: data
+  })
+}
+
+// 结束录播直播间
+export function finishLive(data) {
+  return request({
+    url: '/live/live/finishLive',
+    method: 'get',
+    params: data
+  })
+}
+// 复制录播直播间
+export function copyLive(data) {
+  return request({
+    url: '/live/live/copyLive',
+    method: 'get',
+    params: data
+  })
+}
+
+// 结束录播直播间
+export function startLive(data) {
+  return request({
+    url: '/live/live/startLive',
+    method: 'get',
+    params: data
+  })
+}
+// 生成直播间小程序二维码
+export function generateCode(data) {
+  return request({
+    url: '/live/live/getWxaCodeUnLimit',
+    method: 'get',
+    params: data
+  })
+}

+ 77 - 0
src/api/live/liveAfterSales.js

@@ -0,0 +1,77 @@
+import request from '@/utils/request'
+
+// 查询售后记录列表
+export function listLiveAfterSales(query) {
+  return request({
+    url: '/live/liveAfterSales/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询售后记录详细
+export function getLiveAfterSales(id) {
+  return request({
+    url: '/live/liveAfterSales/' + id,
+    method: 'get'
+  })
+}
+
+// 新增售后记录
+export function addLiveAfterSales(data) {
+  return request({
+    url: '/live/liveAfterSales',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改售后记录
+export function updateLiveAfterSales(data) {
+  return request({
+    url: '/live/liveAfterSales',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除售后记录
+export function delLiveAfterSales(id) {
+  return request({
+    url: '/live/liveAfterSales/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出售后记录
+export function exportLiveAfterSales(query) {
+  return request({
+    url: '/live/liveAfterSales/export',
+    method: 'get',
+    params: query
+  })
+}
+
+export function cancel(data) {
+  return request({
+    url: '/live/liveAfterSales/cancel',
+    method: 'post',
+    data: data
+  })
+}
+
+export function refund(data) {
+  return request({
+    url: '/live/liveAfterSales/refund',
+    method: 'post',
+    data: data
+  })
+}
+
+export function audit(data) {
+  return request({
+    url: '/live/liveAfterSales/audit',
+    method: 'post',
+    data: data
+  })
+}

+ 53 - 0
src/api/live/liveAnchor.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询主播列表
+export function listLiveAnchor(query) {
+  return request({
+    url: '/live/liveAnchor/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询主播详细
+export function getLiveAnchor(anchorId) {
+  return request({
+    url: '/live/liveAnchor/' + anchorId,
+    method: 'get'
+  })
+}
+
+// 新增主播
+export function addLiveAnchor(data) {
+  return request({
+    url: '/live/liveAnchor',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改主播
+export function updateLiveAnchor(data) {
+  return request({
+    url: '/live/liveAnchor',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除主播
+export function delLiveAnchor(anchorId) {
+  return request({
+    url: '/live/liveAnchor/' + anchorId,
+    method: 'delete'
+  })
+}
+
+// 导出主播
+export function exportLiveAnchor(query) {
+  return request({
+    url: '/live/liveAnchor/export',
+    method: 'get',
+    params: query
+  })
+}

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

@@ -0,0 +1,137 @@
+import request from '@/utils/request'
+
+// 查询优惠券列表
+export function listStoreCoupon(query) {
+  return request({
+    url: '/live/coupon/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询优惠券详细
+export function getStoreCoupon(couponId) {
+  return request({
+    url: '/live/coupon/' + couponId,
+    method: 'get'
+  })
+}
+
+// 新增优惠券
+export function addStoreCoupon(data) {
+  return request({
+    url: '/live/coupon',
+    method: 'post',
+    data: data
+  })
+}
+export function publishCoupon(data) {
+  return request({
+    url: '/live/coupon/publish',
+    method: 'post',
+    data: data
+  })
+}
+
+export function batchPublishCoupon(data) {
+  return request({
+    url: '/live/coupon/batchPublish',
+    method: 'post',
+    data: data
+  })
+}
+
+
+
+// 修改优惠券
+export function updateStoreCoupon(data) {
+  return request({
+    url: '/live/coupon',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除优惠券
+export function delStoreCoupon(couponId) {
+  return request({
+    url: '/live/coupon/' + couponId,
+    method: 'delete'
+  })
+}
+
+// 导出优惠券
+export function exportStoreCoupon(query) {
+  return request({
+    url: '/live/coupon/export',
+    method: 'get',
+    params: query
+  })
+}
+
+export function listLiveCoupon(query) {
+  return request({
+    url: '/live/coupon/listLiveCoupon',
+    method: 'get',
+    params: query
+  })
+}
+
+export function listCoupon(query) {
+  return request({
+    url: '/live/coupon/listCoupon',
+    method: 'get',
+    params: query
+  })
+}
+export function addLiveCoupon(data) {
+  return request({
+    url: '/live/coupon/addLiveCoupon',
+    method: 'post',
+    data: data
+  })
+}
+
+export function handleDeleteSelected(data) {
+  return request({
+    url: '/live/coupon/handleDeleteSelected',
+    method: 'post',
+    data: data
+  })
+}
+
+export function handleIsShowChange(data) {
+  return request({
+    url: '/live/coupon/handleIsShowChange',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除直播商品
+export function delLiveCoupon(data) {
+  return request({
+    url: '/live/coupon/delLiveCoupon',
+    method: 'post',
+    data: data
+  })
+}
+// 删除直播商品
+export function updateLiveCouponBind(data) {
+  return request({
+    url: '/live/coupon/updateLiveCouponBind',
+    method: 'post',
+    data: data
+  })
+}
+
+// 查询直播抽奖配置列表  未开启
+export function listLiveCouponOn(query) {
+  return request({
+    url: '/live/coupon/listOn',
+    method: 'get',
+    params: query
+  })
+}
+
+

+ 61 - 0
src/api/live/liveData.js

@@ -0,0 +1,61 @@
+import request from '@/utils/request'
+export function recentLive() {
+  return request({
+    url: '/liveData/liveData/recentLive',
+    method: 'get',
+  })
+}
+
+export function liveTop(query) {
+  return request({
+    url: '/liveData/liveData/getLiveTop',
+    method: 'get',
+    params: query
+  })
+}
+export function getTrendData(queryParams) {
+  return request({
+    url: '/liveData/liveData/getTrendData',
+    method: 'post',
+    data: queryParams
+  })
+}
+
+export function columns() {
+  return request({
+    url: '/liveData/liveData/columns',
+    method: 'get',
+  })
+}
+
+
+export function updateColumns(columns) {
+  return request({
+    url: '/liveData/liveData/updateColumns',
+    method: 'post',
+    data:columns,
+  })
+}
+
+export function queryStudentData(query) {
+  return request({
+    url: '/live/studentData/queryStudentData',
+    method: 'post',
+    data:query,
+  })
+}
+
+export function dashboardData(liveId) {
+  return request({
+    url: '/liveData/liveData/dashboardData' + '?liveId=' +liveId,
+    method: 'get'
+  })
+}
+export function listLiveData(data) {
+  return request({
+    url: '/liveData/liveData/listLiveData',
+    method: 'post',
+    data:data,
+  })
+}
+

+ 96 - 0
src/api/live/liveGoods.js

@@ -0,0 +1,96 @@
+import request from '@/utils/request'
+
+// 查询直播商品列表
+export function listLiveGoods(query) {
+  return request({
+    url: '/live/liveGoods/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播商品详细
+export function getLiveGoods(goodsId) {
+  return request({
+    url: '/live/liveGoods/' + goodsId,
+    method: 'get'
+  })
+}
+
+// 新增直播商品
+export function addLiveGoods(data) {
+  return request({
+    url: '/live/liveGoods',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播商品
+export function updateLiveGoods(data) {
+  return request({
+    url: '/live/liveGoods',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播商品
+export function delLiveGoods(goodsId) {
+  return request({
+    url: '/live/liveGoods/' + goodsId,
+    method: 'delete'
+  })
+}
+
+// 导出直播商品
+export function exportLiveGoods(query) {
+  return request({
+    url: '/live/liveGoods/export',
+    method: 'get',
+    params: query
+  })
+}
+
+// 导出直播商品
+export function listStoreProduct(data) {
+  return request({
+    url: '/live/liveGoods/liveList',
+    method: 'get',
+    params: data
+  })
+}
+
+//上下架商品
+export function handleShelfOrUn(data) {
+  return request({
+    url: '/live/liveGoods/handleShelfOrUn',
+    method: 'post',
+    data: data
+  })
+}
+
+
+export function handleDeleteSelected(data) {
+  return request({
+    url: '/live/liveGoods/handleDeleteSelected',
+    method: 'post',
+    data: data
+  })
+}
+
+export function handleIsShowChange(data) {
+  return request({
+    url: '/live/liveGoods/handleIsShowChange',
+    method: 'post',
+    data: data
+  })
+}
+export function updateGoodsStock(data) {
+  return request({
+    url: '/live/liveGoods',
+    method: 'put',
+    data: data
+  })
+}
+

+ 62 - 0
src/api/live/liveLotteryConf.js

@@ -0,0 +1,62 @@
+import request from '@/utils/request'
+
+// 查询直播抽奖配置列表
+export function listLiveLotteryConf(query) {
+  return request({
+    url: '/live/liveLotteryConf/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播抽奖配置详细
+export function getLiveLotteryConf(lotteryId) {
+  return request({
+    url: '/live/liveLotteryConf/' + lotteryId,
+    method: 'get'
+  })
+}
+
+// 新增直播抽奖配置
+export function addLiveLotteryConf(data) {
+  return request({
+    url: '/live/liveLotteryConf',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播抽奖配置
+export function updateLiveLotteryConf(data) {
+  return request({
+    url: '/live/liveLotteryConf',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播抽奖配置
+export function delLiveLotteryConf(lotteryId) {
+  return request({
+    url: '/live/liveLotteryConf/' + lotteryId,
+    method: 'delete'
+  })
+}
+
+// 导出直播抽奖配置
+export function exportLiveLotteryConf(query) {
+  return request({
+    url: '/live/liveLotteryConf/export',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播抽奖配置列表  未开启
+export function listLiveLotteryConfOn(query) {
+  return request({
+    url: '/live/liveLotteryConf/listOn',
+    method: 'get',
+    params: query
+  })
+}

+ 61 - 0
src/api/live/liveLotteryProductConf.js

@@ -0,0 +1,61 @@
+import request from '@/utils/request'
+
+// 查询直播抽奖记录列表
+export function listLiveLotteryProductConf(query) {
+  return request({
+    url: '/live/liveLotteryProductConf/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播抽奖记录详细
+export function getLiveLotteryProductConf(id) {
+  return request({
+    url: '/live/liveLotteryProductConf/' + id,
+    method: 'get'
+  })
+}
+
+//查询抽奖商品列表
+export function listStoreProduct(query) {
+  return request({
+    url: '/live/liveLotteryConf/getGoods/'+query,
+    method: 'get'
+  })
+}
+
+// 新增直播抽奖记录
+export function addLiveLotteryProductConf(data) {
+  return request({
+    url: '/live/liveLotteryProductConf',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播抽奖记录
+export function updateLiveLotteryProductConf(data) {
+  return request({
+    url: '/live/liveLotteryConf/product',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除直播抽奖记录
+export function delLiveLotteryProductConf(id) {
+  return request({
+    url: '/live/liveLotteryProductConf/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出直播抽奖记录
+export function exportLiveLotteryProductConf(query) {
+  return request({
+    url: '/live/liveLotteryProductConf/export',
+    method: 'get',
+    params: query
+  })
+}

+ 62 - 0
src/api/live/liveMsg.js

@@ -0,0 +1,62 @@
+import request from '@/utils/request'
+
+// 查询直播讨论列表
+export function listLiveMsg(query) {
+  return request({
+    url: '/live/liveMsg/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播讨论列表
+export function listLiveSingleMsg(query) {
+  return request({
+    url: '/live/liveMsg/singleList',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播讨论详细
+export function getLiveMsg(msgId) {
+  return request({
+    url: '/live/liveMsg/' + msgId,
+    method: 'get'
+  })
+}
+
+// 新增直播讨论
+export function addLiveMsg(data) {
+  return request({
+    url: '/live/liveMsg',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播讨论
+export function updateLiveMsg(data) {
+  return request({
+    url: '/live/liveMsg',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播讨论
+export function delLiveMsg(msgId) {
+  return request({
+    url: '/live/liveMsg/' + msgId,
+    method: 'delete'
+  })
+}
+
+// 导出直播讨论
+export function exportLiveMsg(query) {
+  return request({
+    url: '/live/liveMsg/export',
+    method: 'get',
+    params: query
+  })
+}

+ 149 - 0
src/api/live/liveOrder.js

@@ -0,0 +1,149 @@
+import request from '@/utils/request'
+
+// 查询订单列表
+export function listLiveOrder(query) {
+  return request({
+    url: '/live/liveOrder/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询订单详细
+export function getLiveOrder(orderId) {
+  return request({
+    url: '/live/liveOrder/info/' + orderId,
+    method: 'get'
+  })
+}
+
+// 新增订单
+export function addLiveOrder(data) {
+  return request({
+    url: '/live/liveOrder',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改订单
+export function updateLiveOrder(data) {
+  return request({
+    url: '/live/liveOrder/update',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除订单
+export function delLiveOrder(orderId) {
+  return request({
+    url: '/live/liveOrder/' + orderId,
+    method: 'delete'
+  })
+}
+
+// 导出订单
+export function exportLiveOrder(query) {
+  return request({
+    url: '/live/liveOrder/export',
+    method: 'get',
+    params: query
+  })
+}
+
+// 获取表格 时间粒度
+export function getLiveOrderTimeGranularity(query) {
+  return request({
+    url: '/live/liveOrder/getLiveOrderTimeGranularity',
+    method: 'get',
+    params: query
+  })
+}
+
+// 同步快递信息
+export function syncExpress(orderId) {
+  return request({
+    url: '/live/liveOrder/syncExpress/' + orderId,
+    method: 'get'
+  })
+}
+
+
+export function getExpress(orderId) {
+  return request({
+    url: '/live/liveOrder/getExpress/' + orderId,
+    method: 'get'
+  })
+}
+
+export function updateErp(data) {
+  return request({
+    url: '/live/liveOrder/updateErpOrder',
+    method: 'post',
+    data: data
+  })
+}
+
+export function listOrderitem(orderId) {
+  return request({
+    url: '/live/liveOrder/ltemlist/' + orderId,
+    method: 'get'
+  })
+}
+
+export function tuiOrder(data) {
+  return request({
+    url: '/live/liveOrder/tuiOrder',
+    method: 'put',
+    data: data
+  })
+}
+
+export function getExpressByDeliverId(param) {
+  return request({
+    url: '/live/liveOrder/getExpressByDeliverId',
+    method: 'post',
+    data: param
+  })
+}
+
+/**
+ * 根据订单获取物流信息
+ * @param orderId
+ * @returns {*}
+ */
+export function getByOrderId(orderId){
+  return request({
+    url: '/live/liveOrder/getByOrderId/'+orderId,
+    method: 'get'
+  })
+}
+export function bindCustomer(data) {
+  return request({
+    url: '/live/liveOrder/bindCustomer',
+    method: 'post',
+    data: data
+  })
+}
+// 查询订单详细
+export function getLiveOrderAll(id) {
+  return request({
+    url: '/live/liveOrder/' + id,
+    method: 'get'
+  })
+}
+// 查询订单详细
+export function getLiveOrderAddress(id) {
+  return request({
+    url: '/live/liveOrder/queryAddress/' + id,
+    method: 'get'
+  })
+}
+// 查询电话
+export function getUserPhone(id) {
+  return request({
+    url: '/live/liveOrder/queryPhone/' + id,
+    method: 'get'
+  })
+}

+ 53 - 0
src/api/live/liveOrderitems.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询订单商品列表
+export function listLiveOrderitems(query) {
+  return request({
+    url: '/live/liveOrderitems/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询订单商品详细
+export function getLiveOrderitems(id) {
+  return request({
+    url: '/live/liveOrderitems/' + id,
+    method: 'get'
+  })
+}
+
+// 新增订单商品
+export function addLiveOrderitems(data) {
+  return request({
+    url: '/live/liveOrderitems',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改订单商品
+export function updateLiveOrderitems(data) {
+  return request({
+    url: '/live/liveOrderitems',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除订单商品
+export function delLiveOrderitems(id) {
+  return request({
+    url: '/live/liveOrderitems/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出订单商品
+export function exportLiveOrderitems(query) {
+  return request({
+    url: '/live/liveOrderitems/export',
+    method: 'get',
+    params: query
+  })
+}

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

@@ -0,0 +1,10 @@
+import request from '@/utils/request'
+export function liveProfitList(data) {
+  return request({
+    url: '/live/liveProfit/list',
+    method: 'get',
+    params: data
+  })
+}
+
+

+ 53 - 0
src/api/live/liveQuestion.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询问答列表
+export function listLiveQuestion(query) {
+  return request({
+    url: '/live/liveQuestion/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询问答详细
+export function getLiveQuestion(questionId) {
+  return request({
+    url: '/live/liveQuestion/' + questionId,
+    method: 'get'
+  })
+}
+
+// 新增问答
+export function addLiveQuestion(data) {
+  return request({
+    url: '/live/liveQuestion',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改问答
+export function updateLiveQuestion(data) {
+  return request({
+    url: '/live/liveQuestion',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除问答
+export function delLiveQuestion(questionId) {
+  return request({
+    url: '/live/liveQuestion/' + questionId,
+    method: 'delete'
+  })
+}
+
+// 导出问答
+export function exportLiveQuestion(query) {
+  return request({
+    url: '/live/liveQuestion/export',
+    method: 'get',
+    params: query
+  })
+}

+ 36 - 0
src/api/live/liveQuestionBank.js

@@ -0,0 +1,36 @@
+import request from '@/utils/request'
+
+// 查询题库列表
+export function listLiveQuestionBank(query) {
+  return request({
+    url: '/live/liveQuestionBank/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 新增题库
+export function addLiveQuestionBank(data) {
+  return request({
+    url: '/live/liveQuestionBank',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改题库
+export function updateLiveQuestionBank(data) {
+  return request({
+    url: '/live/liveQuestionBank',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除题库
+export function deleteLiveQuestionBank(questionBankId) {
+  return request({
+    url: '/live/liveQuestionBank/' + questionBankId,
+    method: 'delete'
+  })
+}

+ 89 - 0
src/api/live/liveQuestionLive.js

@@ -0,0 +1,89 @@
+import request from '@/utils/request'
+
+// 查询直播间题库列表
+export function listLiveQuestionLive(query) {
+    return request({
+        url: '/live/liveQuestionLive/list',
+        method: 'get',
+        params: query
+    })
+}
+
+// 查询直播间可选题库列表
+export function listLiveQuestionOptionList(query) {
+    return request({
+        url: '/live/liveQuestionLive/optionList',
+        method: 'get',
+        params: query
+    })
+}
+
+// 新增直播间题库
+export function addLiveQuestionLive(data) {
+    return request({
+        url: '/live/liveQuestionLive',
+        method: 'post',
+        params: data
+    })
+}
+
+// 删除直播间题库
+export function deleteLiveQuestionLive(data) {
+    return request({
+        url: '/live/liveQuestionLive/' + data.liveId,
+        method: 'delete',
+        params: {ids: data.ids}
+    })
+}
+
+// 查询直播观看奖励设置列表
+export function listConfig(query) {
+  return request({
+    url: '/live/config/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播观看奖励设置详细
+export function getConfig(id) {
+  return request({
+    url: '/live/config/' + id,
+    method: 'get'
+  })
+}
+
+// 新增直播观看奖励设置
+export function addConfig(data,liveId) {
+  return request({
+    url: '/live/config'  + '?liveId=' + liveId,
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播观看奖励设置
+export function updateConfig(data,liveId) {
+  return request({
+    url: '/live/config'  + '?liveId=' + liveId,
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播观看奖励设置
+export function delConfig(id) {
+  return request({
+    url: '/live/config/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出直播观看奖励设置
+export function exportConfig(query) {
+  return request({
+    url: '/live/config/export',
+    method: 'get',
+    params: query
+  })
+}

+ 63 - 0
src/api/live/liveRedConf.js

@@ -0,0 +1,63 @@
+import request from '@/utils/request'
+
+// 查询直播红包记录配置列表
+export function listLiveRedConf(query) {
+  return request({
+    url: '/live/liveRedConf/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播红包记录配置详细
+export function getLiveRedConf(redId) {
+  return request({
+    url: '/live/liveRedConf/' + redId,
+    method: 'get'
+  })
+}
+
+// 新增直播红包记录配置
+export function addLiveRedConf(data) {
+  return request({
+    url: '/live/liveRedConf',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播红包记录配置
+export function updateLiveRedConf(data) {
+  return request({
+    url: '/live/liveRedConf',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播红包记录配置
+export function delLiveRedConf(redId) {
+  return request({
+    url: '/live/liveRedConf/' + redId,
+    method: 'delete'
+  })
+}
+
+// 导出直播红包记录配置
+export function exportLiveRedConf(query) {
+  return request({
+    url: '/live/liveRedConf/export',
+    method: 'get',
+    params: query
+  })
+}
+
+
+// 查询直播红包 未使用的红包
+export function listLiveRedConfOn(query) {
+  return request({
+    url: '/live/liveRedConf/listOn',
+    method: 'get',
+    params: query
+  })
+}

+ 19 - 0
src/api/live/liveRewardRecord.js

@@ -0,0 +1,19 @@
+import request from '@/utils/request'
+
+
+export function statistics(data) {
+  return request({
+    url: '/live/record/statistics',
+    method: 'post',
+    data: data
+  })
+}
+
+export function exportLiveIntegral(data) {
+  return request({
+    url: '/live/record/export',
+    method: 'post',
+    data: data
+  })
+}
+

+ 62 - 0
src/api/live/liveUserLotteryRecord.js

@@ -0,0 +1,62 @@
+import request from '@/utils/request'
+
+// 查询直播用户中奖记录列表
+export function listLiveUserLotteryRecord(query) {
+  return request({
+    url: '/live/liveUserLotteryRecord/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播用户中奖记录详细
+export function getLiveUserLotteryRecord(id) {
+  return request({
+    url: '/live/liveUserLotteryRecord/' + id,
+    method: 'get'
+  })
+}
+
+// 新增直播用户中奖记录
+export function addLiveUserLotteryRecord(data) {
+  return request({
+    url: '/live/liveUserLotteryRecord',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播用户中奖记录
+export function updateLiveUserLotteryRecord(data) {
+  return request({
+    url: '/live/liveUserLotteryRecord',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播用户中奖记录
+export function delLiveUserLotteryRecord(id) {
+  return request({
+    url: '/live/liveUserLotteryRecord/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出直播用户中奖记录
+export function exportLiveUserLotteryRecord(query) {
+  return request({
+    url: '/live/liveUserLotteryRecord/export',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询单一数据的中奖信息
+export function info(data) {
+  return request({
+    url: '/live/liveUserLotteryRecord/info',
+    method: 'post',
+    data: data
+  })
+}

+ 68 - 0
src/api/live/liveVideo.js

@@ -0,0 +1,68 @@
+import request from '@/utils/request'
+
+// 查询直播视频列表
+export function listLiveVideo(query) {
+  return request({
+    url: '/live/liveVideo/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播视频详细
+export function getLiveVideo(videoId) {
+  return request({
+    url: '/live/liveVideo/' + videoId,
+    method: 'get'
+  })
+}
+
+// 查询直播视频详细
+export function getLiveVideoByLiveId(liveId) {
+  return request({
+    url: '/live/liveVideo/liveVideoByLiveId/' + liveId,
+    method: 'get'
+  })
+}
+// 查询直播视频详细
+export function getLiveVideoByLiveIdAndType(liveId) {
+  return request({
+    url: '/live/liveVideo/preview/' + liveId,
+    method: 'get'
+  })
+}
+
+// 新增直播视频
+export function addLiveVideo(data) {
+  return request({
+    url: '/live/liveVideo',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播视频
+export function updateLiveVideo(data) {
+  return request({
+    url: '/live/liveVideo',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播视频
+export function delLiveVideo(videoId) {
+  return request({
+    url: '/live/liveVideo/' + videoId,
+    method: 'delete'
+  })
+}
+
+// 导出直播视频
+export function exportLiveVideo(query) {
+  return request({
+    url: '/live/liveVideo/export',
+    method: 'get',
+    params: query
+  })
+}

+ 43 - 0
src/api/live/liveWatchUser.js

@@ -0,0 +1,43 @@
+import request from '@/utils/request'
+
+// 查询直播间用户列表
+export function watchUserList(query) {
+  return request({
+    url: '/live/liveWatchUser/watchUserList',
+    method: 'get',
+    params: query
+  })
+}
+// 查询直播间用户列表
+export function dashBoardWatchUserList(query) {
+  return request({
+    url: '/live/liveWatchUser/dashBoardWatchUserList',
+    method: 'get',
+    params: query
+  })
+}
+// 查询直播间用户列表
+export function getLiveUserTotals(query) {
+  return request({
+    url: '/live/liveWatchUser/liveUserTotals',
+    method: 'get',
+    params: query
+  })
+}
+
+// 直播间用户禁言
+export function changeUserStatus(query) {
+  return request({
+    url: '/live/liveWatchUser/changeUserState',
+    method: 'put',
+    params: query
+  })
+}
+
+// 直播间用户禁言
+export function blockUser(query) {
+  return request({
+    url: '/live/liveWatchUser/blockUser/' + query,
+    method: 'get',
+  })
+}

+ 86 - 0
src/api/live/task.js

@@ -0,0 +1,86 @@
+import request from '@/utils/request'
+
+// 查询直播间自动化任务配置列表
+export function listTask(query) {
+  return request({
+    url: '/live/task/list',
+    method: 'get',
+    params: query
+  })
+}
+// 查询直播间自动化任务配置列表
+export function listTaskBarrage(query) {
+  return request({
+    url: '/live/task/listBarrage',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播间自动化任务配置详细
+export function getTask(id) {
+  return request({
+    url: '/live/task/' + id,
+    method: 'get'
+  })
+}
+
+// 新增直播间自动化任务配置
+export function addTask(data) {
+  return request({
+    url: '/live/task',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播间自动化任务配置
+export function updateTask(data) {
+  return request({
+    url: '/live/task',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播间自动化任务配置
+export function delTask(id) {
+  return request({
+    url: '/live/task/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出直播间自动化任务配置
+export function exportTask(query) {
+  return request({
+    url: '/live/task/export',
+    method: 'get',
+    params: query
+  })
+}
+// 导出直播间自动化任务配置
+export function exportTaskBarrage(query) {
+  return request({
+    url: '/live/task/exportData',
+    method: 'get',
+    params: query
+  })
+}
+
+// 下载用户导入模板
+export function importTemplate() {
+  return request({
+    url: '/live/task/importTemplate',
+    method: 'get'
+  })
+}
+
+// 新直播控制台任务列表
+export function consoleList(query) {
+  return request({
+    url: '/live/task/consoleList',
+    method: 'get',
+    params: query
+  })
+}

+ 53 - 0
src/api/live/words.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询直播间敏感词过滤列表
+export function listWords(query) {
+  return request({
+    url: '/live/words/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播间敏感词过滤详细
+export function getWords(wordId) {
+  return request({
+    url: '/live/words/' + wordId,
+    method: 'get'
+  })
+}
+
+// 新增直播间敏感词过滤
+export function addWords(data) {
+  return request({
+    url: '/live/words',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播间敏感词过滤
+export function updateWords(data) {
+  return request({
+    url: '/live/words',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播间敏感词过滤
+export function delWords(wordId) {
+  return request({
+    url: '/live/words/' + wordId,
+    method: 'delete'
+  })
+}
+
+// 导出直播间敏感词过滤
+export function exportWords(query) {
+  return request({
+    url: '/live/words/export',
+    method: 'get',
+    params: query
+  })
+}

+ 17 - 0
src/api/qw/sopTemp.js

@@ -8,6 +8,23 @@ export function listSopTemp(query) {
     params: query
   })
 }
+
+export function listSopTempMyList(query) {
+  return request({
+    url: '/qw/sopTemp/myList',
+    method: 'get',
+    params: query
+  })
+}
+
+export function listSopTempDeptList(query) {
+  return request({
+    url: '/qw/sopTemp/deptList',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询sop模板列表
 export function redList(id) {
   return request({

BIN
src/assets/images/videoIsAudit.png


BIN
src/assets/images/videoNotStart.png


BIN
src/assets/logo/bjzmky.png


+ 274 - 0
src/components/LiveVideoUpload/index.vue

@@ -0,0 +1,274 @@
+<template>
+  <div>
+    <el-form-item label="视频上传">
+      <div class="upload_video" id="upload_video">
+        <el-upload
+          ref="upload"
+          action="#"
+          :http-request="uploadVideoToTxPcdn"
+          accept=".mp4"
+          :limit="1"
+          :on-remove="handleRemove"
+          :on-change="handleChange"
+          :auto-upload="false"
+          :key="uploadKey"
+        >
+          <el-button slot="trigger" size="small" type="primary">选取视频</el-button>
+          <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">点击上传</el-button>
+          <!-- 线路一 -->
+          <div class="progress-container" style="width:100% !important;">
+            <span class="progress-label">线路一</span>
+            <el-progress
+              style="margin-top: 5px;"
+              class="progress"
+              :text-inside="true"
+              :stroke-width="18"
+              :percentage="txProgress"
+              status="success">
+            </el-progress>
+          </div>
+
+          <!-- 线路二 -->
+<!--          <div class="progress-container">-->
+<!--            <span class="progress-label">线路er</span>-->
+<!--            <el-progress-->
+<!--              style="margin-top: 5px;"-->
+<!--              class="progress"-->
+<!--              :text-inside="true"-->
+<!--              :stroke-width="18"-->
+<!--              :percentage="hwProgress"-->
+<!--              status="success">-->
+<!--            </el-progress>-->
+<!--          </div>-->
+          <div slot="tip" class="el-upload__tip">只能上传mp4文件,且不超过500M</div>
+        </el-upload>
+      </div>
+    </el-form-item>
+    <el-form-item label="视频播放">
+      <video v-if="videoUrl" ref="myvideo" :src="videoUrl" id="video" width="100%" height="300px" controls></video>
+      <div v-if="fileName">视频文件名: {{ fileName }}</div>
+      <div v-if="fileKey">文件Key: {{ fileKey }}</div>
+      <div v-if="fileSize">文件大小(MB): {{ (fileSize / (1024 * 1024)).toFixed(2) }} MB</div>
+    </el-form-item>
+    <!-- 仅当showControl为true时显示播放线路选择器 -->
+    <el-form-item v-if="showControl" label="播放线路">
+      <el-radio-group v-model="localUploadType">
+        <el-radio :label="1" >线路一</el-radio>
+<!--        <el-radio :label="2" >线路二</el-radio>-->
+        <!--        <el-radio :label="3" >线路三</el-radio>-->
+      </el-radio-group>
+    </el-form-item>
+
+  </div>
+</template>
+
+<script>
+import { uploadObject } from "@/utils/cos.js";
+import Pagination from "@/components/Pagination";
+
+export default {
+  components: {
+    Pagination
+  },
+  props: {
+    videoUrl: {
+      type: String,
+      default: "",
+    },
+    fileKey: {
+      type: String,
+      default: "",
+    },
+    fileSize: {
+      type: Number,
+      default: null,
+    },
+    fileName: {
+      type: String,
+      default: "",
+    },
+    line_1: {
+      type: String,
+      default: "",
+    },
+    line_2: {
+      type: String,
+      default: "",
+    },
+    line_3: {
+      type: String,
+      default: "",
+    },
+    thumbnail: {
+      type: String,
+      default: "",
+    },
+    uploadType: {
+      type: Number,
+      default: null,
+    },
+    type: {
+      type: Number,
+      default: null,
+    },
+    isPrivate: {
+      type: Number,
+      default: 0,
+    },
+
+    // 使用一个变量控制显示,默认为true显示所有控制项
+    showControl: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  data() {
+    return {
+      videoName:'',
+      isHidden : false,
+      localUploadType: this.uploadType,
+      duration: 0,
+      fileId: "",
+      uploadTypeOptions: [
+        { dictLabel: "线路一", dictValue: 1 }, // 腾讯pcdn
+        // { dictLabel: "线路二", dictValue: 2 }, // 华为云obs
+        // { dictLabel: "华为云VOD", dictValue: 4 },
+        // { dictLabel: "腾讯云VOD", dictValue: 5 },
+      ],
+      fileList: [],
+      txProgress: 0,
+      hwProgress: 0,
+      uploadLoading: false,
+      uploadKey: 0,
+    };
+  },
+  mounted() {
+    this.reset()
+  },
+  watch: {
+    localUploadType(newType) {
+
+      this.$emit("update:uploadType", newType);
+    },
+    uploadType(newType) {
+      this.localUploadType = newType;
+    },
+  },
+  methods: {
+// 提供重置方法供父组件调用
+    reset() {
+      this.txProgress = 0;
+      this.fileList = [];
+      this.$refs.upload.clearFiles();
+      // 重置其他状态...
+    },
+    handleChange(file, fileList) {
+      this.fileList = fileList;
+      this.getVideoDuration(file.raw);
+    },
+    getVideoDuration(file) {
+      const video = document.createElement("video");
+      video.preload = "metadata";
+      video.onloadedmetadata = () => {
+        window.URL.revokeObjectURL(video.src);
+        this.duration = parseInt(video.duration.toFixed(2));
+        console.log("视频时长=========>",this.duration);
+        this.$emit("video-duration", this.duration);
+        console.log("文件大小=====>",file.size);
+        this.$emit("update:fileSize", file.size);
+      };
+      video.src = URL.createObjectURL(file);
+    },
+    async submitUpload() {
+      if (this.fileList.length < 1) {
+        return this.$message.error("请先选取视频,再进行上传");
+      }
+      //同时上传个线路
+      await this.uploadVideoToTxPcdn();
+      // await this.uploadVideoToHwObs();
+      this.$emit("update:fileName", this.fileList[0].name);
+    },
+    //更新华为线路进度条
+    updateHwProgress(progress) {
+      this.hwProgress = progress;
+    },
+    //更新腾讯线路进度条
+    updateTxProgress(progressData) {
+      this.txProgress = Math.round(progressData.percent * 100);
+    },
+    //上传腾讯云Pcdn
+    async uploadVideoToTxPcdn() {
+      try {
+        const file = this.fileList[0].raw;
+        const data = await uploadObject(file, this.updateTxProgress,this.type);
+        console.log("腾讯COS返回========>",data);
+        console.log("isPrivate=======>",this.isPrivate)
+        let line_1='' ;
+        if (this.isPrivate===0){
+          line_1 = `${process.env.VUE_APP_VIDEO_LINE_1}${data.urlPath}`;
+        }else {
+          line_1 = `${process.env.VUE_APP_VIDEO_LINE_1}${data.urlPath}`;
+        }
+        line_1 = line_1.replace(/\.mp4$/, '.m3u8');
+
+        let urlPathWithoutFirstSlash = data.urlPath.substring(1);
+        this.$emit("update:fileKey", urlPathWithoutFirstSlash);
+
+        console.log("文件key",urlPathWithoutFirstSlash);
+        console.log("组装URL========>",line_1);
+        this.$emit("update:videoUrl", line_1);
+        this.$emit("update:line_1", line_1);
+        this.$emit("change", line_1,line_1);
+        // this.$emit("update:line_2", line_2);
+        this.$message.success("线路一上传成功");
+      } catch (error) {
+        this.$message.error("线路一上传失败");
+      }
+    },
+    // //上传华为云Obs
+    // async uploadVideoToHwObs() {
+    //   try {
+    //     const file = this.fileList[0].raw;
+    //     const data = await uploadToOBS(file, this.updateHwProgress,this.type);
+    //     console.log("华为OBS返回========>",data);
+    //     let line_2='' ;
+    //     if (this.isPrivate===0){
+    //       line_2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
+    //     }else {
+    //       line_2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
+    //     }
+    //     this.$emit("update:videoUrl", line_2);
+    //     this.$emit("update:line_2", line_2);
+    //     this.$message.success("线路二上传成功");
+    //   } catch (error) {
+    //     this.$message.error("线路二上传失败");
+    //   }
+    // },
+    handleRemove(file, fileList) {
+      console.log(file, fileList.length);
+    },
+  }
+};
+</script>
+
+<style>
+.progress-container {
+  margin-bottom: 5px; /* 进度条之间的间距 */
+}
+
+.progress-label {
+  display: block;
+  font-weight: bold;
+  font-size: 13px;
+  color: #303331; /* 标签颜色,可以根据需要调整 */
+}
+
+/* 视频库选择对话框样式 */
+.library-search {
+  margin-bottom: 15px;
+}
+
+.el-table .el-table__row:hover {
+  cursor: pointer;
+}
+</style>

+ 446 - 0
src/components/LiveVideoUpload/single.vue

@@ -0,0 +1,446 @@
+<template>
+  <div>
+    <el-form-item label="">
+      <div class="upload_video" id="upload_video">
+<!--        <el-upload-->
+<!--          class="upload-demo"-->
+<!--          ref="upload"-->
+<!--          action="#"-->
+<!--          :http-request="uploadVideoToTxPcdn"-->
+<!--          accept=".mp4"-->
+<!--          :limit="1"-->
+<!--          :on-remove="handleRemove"-->
+<!--          :on-change="handleChange"-->
+<!--          :auto-upload="false"-->
+<!--          :key="uploadKey"-->
+<!--        >-->
+<!--          <el-button slot="trigger" size="small" type="primary" >选取视频</el-button>-->
+<!--          <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">点击上传</el-button>-->
+          <!-- 仅当showControl为true时显示视频库选取按钮 -->
+          <el-button v-if="showControl" style="margin-left: 10px;" size="small" type="success" @click="openVideoLibrary">视频库选取</el-button>
+          <!-- 线路一 -->
+          <div class="progress-container">
+            <span class="progress-label">线路一</span>
+            <el-progress
+              style="margin-top: 5px;"
+              class="progress"
+              :text-inside="true"
+              :stroke-width="18"
+              :percentage="txProgress"
+              status="success">
+            </el-progress>
+          </div>
+
+          <!-- 线路二 -->
+<!--          <div class="progress-container">-->
+<!--            <span class="progress-label">线路二</span>-->
+<!--            <el-progress-->
+<!--              style="margin-top: 5px;"-->
+<!--              class="progress"-->
+<!--              :text-inside="true"-->
+<!--              :stroke-width="18"-->
+<!--              :percentage="hwProgress"-->
+<!--              status="success">-->
+<!--            </el-progress>-->
+<!--          </div>-->
+          <div slot="tip" class="el-upload__tip">只能上传mp4文件,且不超过500M</div>
+        </el-upload>
+      </div>
+    </el-form-item>
+    <el-form-item label="视频播放">
+      <video v-if="videoUrl" ref="myvideo" :src="videoUrl" id="video" width="100%" height="300px" controls></video>
+      <div v-if="fileName">视频文件名: {{ fileName }}</div>
+      <div v-if="fileKey">文件Key: {{ fileKey }}</div>
+      <div v-if="fileSize">文件大小(MB): {{ (fileSize / (1024 * 1024)).toFixed(2) }} MB</div>
+    </el-form-item>
+    <!-- 仅当showControl为true时显示播放线路选择器 -->
+<!--    <el-form-item v-if="showControl" label="播放线路">-->
+<!--      <el-radio-group v-model="localUploadType">-->
+<!--        <el-radio :label="1" >线路一</el-radio>-->
+<!--&lt;!&ndash;        <el-radio :label="2" >线路二</el-radio>&ndash;&gt;-->
+<!--        &lt;!&ndash;        <el-radio :label="3" >线路三</el-radio>&ndash;&gt;-->
+<!--      </el-radio-group>-->
+<!--    </el-form-item>-->
+
+    <!-- 视频库选择对话框 -->
+    <el-dialog title="视频库选择" :visible.sync="libraryOpen" width="900px" append-to-body>
+      <!-- 搜索条件 -->
+      <el-form :inline="true" :model="libraryQueryParams" class="library-search">
+        <el-form-item label="素材名称">
+          <el-input
+            v-model="libraryQueryParams.remark"
+            placeholder="请输入素材名称"
+            clearable
+            size="small"
+            @keyup.enter.native="handleLibraryQuery"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleLibraryQuery">搜索</el-button>
+          <el-button icon="el-icon-refresh" size="mini" @click="resetLibraryQuery">重置</el-button>
+        </el-form-item>
+      </el-form>
+
+      <!-- 视频列表 -->
+      <el-table v-loading="libraryLoading" :data="libraryList" @row-click="handleLibrarySelect" highlight-current-row>
+        <el-table-column label="素材名称" align="center" prop="remark" />
+<!--        <el-table-column label="缩略图" align="center">-->
+<!--          <template slot-scope="scope">-->
+<!--            <video-->
+<!--              :src="scope.row.videoUrl"-->
+<!--              controls-->
+<!--              controlsList="nodownload"-->
+<!--              class="video-player"-->
+<!--              @contextmenu.prevent-->
+<!--            ></video>-->
+<!--          </template>-->
+<!--        </el-table-column>-->
+        <el-table-column label="视频时长" align="center">
+          <template slot-scope="scope">
+            <span>{{ formatDuration(scope.row.duration) }}</span>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <!-- 分页 -->
+      <pagination
+        v-show="libraryTotal>0"
+        :total="libraryTotal"
+        :page.sync="libraryQueryParams.pageNum"
+        :limit.sync="libraryQueryParams.pageSize"
+        @pagination="getList"
+      />
+
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="confirmVideoSelection">确 定</el-button>
+        <el-button @click="cancelVideoSelection">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { uploadObject } from "@/utils/cos.js";
+import Pagination from "@/components/Pagination";
+// import { listVideoResource } from '@/api/course/videoResource';
+import { listLiveVideo, getLiveVideo, delLiveVideo, addLiveVideo, updateLiveVideo, exportLiveVideo } from "@/api/live/liveVideo";
+
+export default {
+  components: {
+    Pagination
+  },
+  props: {
+    videoUrl: {
+      type: String,
+      default: "",
+    },
+    fileKey: {
+      type: String,
+      default: "",
+    },
+    fileSize: {
+      type: Number,
+      default: null,
+    },
+    fileName: {
+      type: String,
+      default: "",
+    },
+    line_1: {
+      type: String,
+      default: "",
+    },
+    line_2: {
+      type: String,
+      default: "",
+    },
+    line_3: {
+      type: String,
+      default: "",
+    },
+    thumbnail: {
+      type: String,
+      default: "",
+    },
+    uploadType: {
+      type: Number,
+      default: null,
+    },
+    type: {
+      type: Number,
+      default: null,
+    },
+    isPrivate: {
+      type: Number,
+      default: 0,
+    },
+
+    // 使用一个变量控制显示,默认为true显示所有控制项
+    showControl: {
+      type: Boolean,
+      default: true,
+    }
+  },
+  data() {
+    return {
+      videoName:'',
+      isHidden : false,
+      localUploadType: this.uploadType,
+      duration: 0,
+      fileId: "",
+      uploadTypeOptions: [
+        { dictLabel: "线路一", dictValue: 1 }, // 腾讯pcdn
+        { dictLabel: "线路二", dictValue: 2 }, // 华为云obs
+        // { dictLabel: "华为云VOD", dictValue: 4 },
+        // { dictLabel: "腾讯云VOD", dictValue: 5 },
+      ],
+      fileList: [],
+      txProgress: 0,
+      hwProgress: 0,
+      uploadLoading: false,
+      uploadKey: 0,
+      // 视频库选择相关数据
+      libraryOpen: false,
+      libraryLoading: false,
+      libraryTotal: 0,
+      libraryList: [],
+      selectedVideo: null,
+      libraryQueryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        resourceName: null,
+        liveId: -1,
+        videoUrl: null,
+        videoType: -1,
+        sort: null,
+        remark: null,
+        finishStatus:1
+      },
+      liveQueryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: -1,
+        videoUrl: null,
+        videoType: -1,
+        sort: null,
+        remark: null,
+      },
+    };
+  },
+  mounted() {
+    this.reset();
+  },
+  watch: {
+    uploadType(newType) {
+      this.localUploadType = newType;
+    },
+  },
+  methods: {
+    /** 查询直播视频列表 */
+    getList() {
+      this.libraryLoading = true;
+      listLiveVideo(this.libraryQueryParams).then(response => {
+        this.libraryList = response.rows;
+        this.libraryTotal = response.total;
+        this.libraryLoading = false;
+      });
+    },
+    // 打开视频库对话框
+    openVideoLibrary() {
+      this.libraryOpen = true;
+      this.selectedVideo = null;
+      this.getList();
+    },
+    handleChange(file, fileList) {
+      this.fileList = fileList;
+      this.getVideoDuration(file.raw);
+    },
+    getVideoDuration(file) {
+      const video = document.createElement("video");
+      video.preload = "metadata";
+      video.onloadedmetadata = () => {
+        window.URL.revokeObjectURL(video.src);
+        this.duration = parseInt(video.duration.toFixed(2));
+        console.log("视频时长=========>",this.duration);
+        this.$emit("video-duration", this.duration);
+        console.log("文件大小=====>",file.size);
+        this.$emit("update:fileSize", file.size);
+      };
+      video.src = URL.createObjectURL(file);
+    },
+    async submitUpload() {
+      if (this.fileList.length < 1) {
+        return this.$message.error("请先选取视频,再进行上传");
+      }
+      //同时上传个线路
+      await this.uploadVideoToTxPcdn();
+      this.$emit("update:fileName", this.fileList[0].name);
+    },
+    //获取第一帧封面
+    async getFirstThumbnail(){
+      const file = this.fileList[0].raw;
+      getThumbnail(file).then(response => {
+        console.log("获取到第一帧为封面======>",response.url)
+        this.$emit("update:thumbnail", response.url);
+      })
+    },
+    //更新华为线路进度条
+    // updateHwProgress(progress) {
+    //   this.hwProgress = progress;
+    // },
+    //更新腾讯线路进度条
+    updateTxProgress(progressData) {
+      this.txProgress = Math.round(progressData.percent * 100);
+    },
+    //上传腾讯云Pcdn
+    async uploadVideoToTxPcdn() {
+      try {
+        const file = this.fileList[0].raw;
+        const data = await uploadObject(file, this.updateTxProgress,this.type);
+        console.log("腾讯COS返回========>",data);
+        console.log("isPrivate=======>",this.isPrivate)
+        let line_1='' ;
+        if (this.isPrivate===0){
+          line_1 = `${process.env.VUE_APP_VIDEO_LINE_1}${data.urlPath}`;
+        }else {
+          line_1 = `${process.env.VUE_APP_VIDEO_LINE_1}${data.urlPath}`;
+        }
+        line_1 = line_1.replace(/\.mp4$/, '.m3u8');
+
+        let urlPathWithoutFirstSlash = data.urlPath.substring(1);
+        this.$emit("update:fileKey", urlPathWithoutFirstSlash);
+
+        console.log("文件key",urlPathWithoutFirstSlash);
+        console.log("组装URL========>",line_1);
+        this.$emit("update:videoUrl", line_1);
+        this.$emit("update:line_1", line_1);
+        this.$emit("change", line_1,line_1);
+        // this.$emit("update:line_2", line_2);
+        this.$message.success("线路一上传成功");
+      } catch (error) {
+        this.$message.error("线路一上传失败");
+      }
+    },
+    //上传华为云Obs
+    async uploadVideoToHwObs() {
+      try {
+        const file = this.fileList[0].raw;
+        const data = await uploadToOBS(file, this.updateHwProgress,this.type);
+        console.log("华为OBS返回========>",data);
+        let line_2='' ;
+        if (this.isPrivate===0){
+          line_2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
+        }else {
+          line_2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
+        }
+        // this.$emit("update:videoUrl", data);
+        this.$emit("update:line_2", line_2);
+        this.$message.success("线路二上传成功");
+      } catch (error) {
+        this.$message.error("线路二上传失败");
+      }
+    },
+    handleRemove(file, fileList) {
+      console.log(file, fileList.length);
+    },
+    reset() {
+      // 重置内部状态
+      this.txProgress = 0;
+      this.fileList = [];
+      this.$refs.upload.clearFiles();
+      this.uploadKey++;
+    },
+    /** 查询视频库列表 */
+    getLibraryList() {
+      this.libraryLoading = true;
+      // listVideoResource(this.libraryQueryParams).then(response => {
+      //   this.libraryList = response.rows;
+      //   this.libraryTotal = response.total;
+      //   this.libraryLoading = false;
+      // });
+    },
+    /** 搜索视频库按钮操作 */
+    handleLibraryQuery() {
+      this.libraryQueryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置视频库查询按钮操作 */
+    resetLibraryQuery() {
+      this.libraryQueryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        resourceName: null,
+        liveId: -1,
+        videoUrl: null,
+        videoType: -1,
+        sort: null,
+        remark: null,
+        finishStatus:1
+      };
+      this.handleLibraryQuery();
+    },
+    /** 视频库选择行点击 */
+    handleLibrarySelect(row) {
+      this.selectedVideo = row;
+    },
+    /** 格式化视频时长 */
+    formatDuration(seconds) {
+      if (!seconds) return '00:00';
+
+      const minutes = Math.floor(seconds / 60);
+      const remainingSeconds = seconds % 60;
+
+      return `${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`;
+    },
+    /** 确认选择视频 */
+    confirmVideoSelection() {
+      if (!this.selectedVideo) {
+        this.$message.warning("请选择一个视频");
+        return;
+      }
+
+      // 更新组件内部数据
+      this.$emit("update:fileName", this.selectedVideo.fileName);
+      this.$emit("update:thumbnail", this.selectedVideo.thumbnail);
+      this.$emit("update:line_1", this.selectedVideo.lineOne);
+      this.$emit("update:fileSize", this.selectedVideo.fileSize);
+      this.$emit("update:fileKey", this.selectedVideo.fileKey);
+      this.$emit("update:uploadType", this.selectedVideo.uploadType);
+      this.$emit("video-duration", this.selectedVideo.duration);
+      // 设置预览URL
+      this.$emit("update:videoUrl", this.selectedVideo.videoUrl);
+      this.$emit("change", this.selectedVideo.videoUrl,this.selectedVideo.lineOne);
+
+
+      this.libraryOpen = false;
+    },
+    /** 取消视频选择 */
+    cancelVideoSelection() {
+      this.libraryOpen = false;
+      this.selectedVideo = null;
+    }
+  }
+};
+</script>
+
+<style>
+.progress-container {
+  margin-bottom: 5px; /* 进度条之间的间距 */
+}
+
+.progress-label {
+  display: block;
+  font-weight: bold;
+  font-size: 13px;
+  color: #303331; /* 标签颜色,可以根据需要调整 */
+}
+
+/* 视频库选择对话框样式 */
+.library-search {
+  margin-bottom: 15px;
+}
+
+.el-table .el-table__row:hover {
+  cursor: pointer;
+}
+</style>

+ 10 - 0
src/router/index.js

@@ -6,6 +6,7 @@ Vue.use(Router)
 /* Layout */
 import Layout from '@/layout'
 import ParentView from '@/components/ParentView';
+import LiveConsole from "@/views/live/liveConsole/index.vue";
 
 /**
  * Note: 路由配置项
@@ -261,6 +262,15 @@ export const constantRoutes = [
       }
     ]
   },
+  // 独立页路由:不嵌套根布局,直接渲染目标组件
+  {
+    path: '/live/liveConsole/:liveId',
+    name: 'LiveConsole',
+    component: LiveConsole, // 直接渲染目标组件,无侧边栏
+    meta: {
+      isIndependentPage: true // 标记为“独立页”
+    }
+  },
 
 
 

+ 40 - 1
src/store/index.js

@@ -7,6 +7,7 @@ import permission from './modules/permission'
 import settings from './modules/settings'
 import getters from './getters'
 import qwIm from './modules/qwIm'
+import {LiveWS} from "@/utils/liveWS";
 
 Vue.use(Vuex)
 
@@ -19,7 +20,45 @@ const store = new Vuex.Store({
     settings,
     qwIm
   },
-  getters
+  getters,
+  state: {
+    liveWs: {}
+  },
+  mutations: {
+    // 更新为支持多个 WebSocket 连接
+    setLiveWs(state, { ws, liveId }) {
+      // 使用 liveId 作为键来存储不同的 WebSocket 连接
+      Vue.set(state.liveWs, liveId, ws);
+    },
+    // 添加移除 WebSocket 连接的 mutation
+    removeLiveWs(state, liveId) {
+      Vue.delete(state.liveWs, liveId);
+    }
+  },
+  actions: {
+    // 修改 action 以正确传递参数
+    initLiveWs({ commit, state }, { liveWsUrl, liveId, userId }) {
+      // 如果已经存在对应 liveId 的连接,先关闭它
+      if (state.liveWs[liveId]) {
+        state.liveWs[liveId].close();
+      }
+
+      // 创建新的 WebSocket 连接
+      const ws = new LiveWS(liveWsUrl, liveId, userId);
+
+      // 提交到 mutation
+      commit('setLiveWs', { ws, liveId });
+
+      return ws;
+    },
+    // 添加关闭特定 WebSocket 连接的 action
+    closeLiveWs({ commit, state }, liveId) {
+      if (state.liveWs[liveId]) {
+        state.liveWs[liveId].close();
+        commit('removeLiveWs', liveId);
+      }
+    }
+  }
 })
 
 export default store

+ 96 - 0
src/utils/cos.js

@@ -0,0 +1,96 @@
+import COS from 'cos-js-sdk-v5';
+import { Message } from 'element-ui';
+import { getTmpSecretKey } from '@/api/common';
+
+console.log('环境变量:', process.env);
+console.log('NODE_ENV:', process.env.NODE_ENV);
+console.log('VUE_APP_COS_BUCKET:', process.env.VUE_APP_COS_BUCKET);
+console.log('VUE_APP_COS_REGION:', process.env.VUE_APP_COS_REGION);
+
+const config = {
+  Bucket: process.env.VUE_APP_COS_BUCKET,
+  Region: process.env.VUE_APP_COS_REGION,
+};
+console.log('COS配置:', config);
+
+// 上传到腾讯云cos
+export const uploadObject = async (file,onProgress,type,callBackUp) => {
+    try {
+        console.log(type);
+        const response = await getTmpSecretKey(); // 后台接口返回 密钥相关信息
+        console.log("Key  ",response);
+        const data = response.data;
+        const credentials = data && data.credentials;
+
+        if (!data || !credentials) {
+            console.error('未获取到参数');
+            return;
+        }
+
+        // 初始化
+        const cos = new COS({
+            getAuthorization: (options, callback) => {
+                callback({
+                    TmpSecretId: credentials.tmpSecretId,
+                    TmpSecretKey: credentials.tmpSecretKey,
+                    XCosSecurityToken: credentials.sessionToken,
+                    StartTime: data.startTime,
+                    ExpiredTime: data.expiredTime,
+                });
+            },
+        });
+
+        console.log("初始化成功")
+        let fileName = file.name || ""
+        const upload_file_name = new Date().getTime() + '.' + fileName.split(".")[fileName.split(".").length - 1];
+        let date =  new Date()
+        let year = date.getFullYear()
+        let month = date.getMonth() + 1
+        let strDate = date.getDate()
+        let uploadDay = `${year}${month}${strDate}`
+        let videoKey = `/userVideo/${uploadDay}/${upload_file_name}`
+        let courseKey = `/live/${uploadDay}/${upload_file_name}`
+        let key = type ===1 ? courseKey : videoKey;
+        console.log("开始上传")
+        return new Promise((resolve, reject) => {
+            console.log("uploadFile")
+            cos.uploadFile(
+                {
+                    Bucket: config.Bucket, /* 必须 */
+                    Region: config.Region, /* 存储桶所在地域,必须字段 */
+                    Key: key, // 文件名
+                    StorageClass: 'STANDARD', // 上传类型,可选
+                    Body: file, // 上传文件对象
+                    // onTaskReady: function (taskId) {
+                    //     // 用于中断分片上传回调
+                    //     console.log('Task ready:', taskId);
+                    //     callBackUp && callBackUp({cos,taskId})
+                    // },
+                    onProgress: function (progressData) {
+                        console.log('COS上传进度=======>:', JSON.stringify(progressData));
+                        onProgress(progressData);
+                    },
+                    // onFileFinish: function (err, data, options) {
+                    //     console.log(options.Key + '上传' + (err ? '失败' : '完成'));
+                    // },
+                },
+                (err, data) => {
+                    if (err) {
+                        reject(err);
+                    } else {
+                        // 将上传的key包含在返回的数据中
+                        const result = {
+                            ...data,
+                            urlPath: key
+                        };
+                        console.log('上传成功', result);
+                        resolve(result);
+                    }
+                }
+            );
+        });
+    } catch (error) {
+        console.error('Error during upload:', error);
+        throw error;
+    }
+};

+ 112 - 0
src/utils/liveWS.js

@@ -0,0 +1,112 @@
+import CryptoJS from 'crypto-js'
+
+export class LiveWS {
+  /**
+   * @param {string} url - WebSocket 服务器地址
+   * @param {number} liveId - 直播间ID
+   * @param {number} userId - 用户ID
+   * @param {number} checkInterval - 检查连接状态的时间间隔,单位毫秒
+   * @param {number} reconnectDelay - 连接断开后重连的延迟,单位毫秒
+   */
+  constructor(url, liveId, userId, checkInterval = 5000, reconnectDelay = 3000) {
+    let timestamp = new Date().getTime()
+    let userType = 1
+    let signature = CryptoJS.HmacSHA256(
+      CryptoJS.enc.Utf8.parse('' + liveId + userId + userType + timestamp),
+      CryptoJS.enc.Utf8.parse(timestamp)).toString(CryptoJS.enc.Hex)
+    this.url = url + `?liveId=${liveId}&userId=${userId}&userType=${userType}&timestamp=${timestamp}&signature=${signature}`;
+    console.log(this.url)
+    this.liveId = liveId;
+    this.userId = userId;
+    this.checkInterval = checkInterval;
+    this.reconnectDelay = reconnectDelay;
+    this.ws = null;
+    this.reconnectTimer = null;
+    this.heartbeatTimer = null;
+    this.isManualClose = false;
+    this.connect();
+    this.startHeartbeat();
+  }
+
+  connect() {
+    // 如果已经有一个连接处于 OPEN 或 CONNECTING 状态,则不再创建新连接
+    if (this.ws && (this.ws.readyState === WebSocket.OPEN || this.ws.readyState === WebSocket.CONNECTING)) {
+      return;
+    }
+
+    this.ws = new WebSocket(this.url);
+
+    // 绑定事件
+    this.ws.onopen = (event) => {
+      // 连接成功后,清除重连计时器
+      if (this.reconnectTimer) {
+        clearTimeout(this.reconnectTimer);
+        this.reconnectTimer = null;
+      }
+    };
+
+    this.ws.onmessage = (event) => {
+      this.onmessage(event);
+    };
+
+    this.ws.onerror = (error) => {
+    };
+
+    this.ws.onclose = (event) => {
+      // 如果不是主动关闭,则重连
+      if (!this.isManualClose) {
+        setTimeout(() => this.reconnect(), this.reconnectDelay);
+      }
+    };
+  }
+
+  onmessage(event) {}
+
+  reconnect() {
+    this.connect();
+  }
+
+  // 调度重连
+  scheduleReconnect() {
+    // 避免多次重连定时器同时存在
+    if (this.reconnectTimer) return;
+    this.reconnectTimer = setTimeout(() => {
+      this.connect();
+    }, this.reconnectDelay);
+  }
+
+  // 定时检查连接状态
+  startHeartbeat() {
+    this.heartbeatTimer = setInterval(() => {
+      if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
+        this.scheduleReconnect();
+      } else {
+        // 发送信息
+        this.ws.send(JSON.stringify({'cmd':'heartbeat','msg':'ping', 'liveId': this.liveId, 'userId': this.userId}));
+      }
+    }, this.checkInterval);
+  }
+
+  // 主动关闭 WebSocket 连接,并清除定时任务
+  close() {
+    this.isManualClose = true;
+    if (this.heartbeatTimer) {
+      clearInterval(this.heartbeatTimer);
+    }
+    if (this.reconnectTimer) {
+      clearTimeout(this.reconnectTimer);
+    }
+    if (this.ws) {
+      this.ws.close();
+    }
+  }
+
+  // 发送消息方法
+  send(message) {
+    if (this.ws && this.ws.readyState === WebSocket.OPEN) {
+      this.ws.send(message);
+    } else {
+      console.error("WebSocket is not open. Message not sent.");
+    }
+  }
+}

+ 73 - 0
src/utils/obs.js

@@ -0,0 +1,73 @@
+import ObsClient from "esdk-obs-browserjs/src/obs"
+
+export const uploadToOBS = async (file, progressCallback, type, cancelCallback) => {
+  try {
+    const obsClient = new ObsClient({
+      access_key_id: process.env.VUE_APP_OBS_ACCESS_KEY_ID,
+      secret_access_key: process.env.VUE_APP_OBS_SECRET_ACCESS_KEY,
+      server: process.env.VUE_APP_OBS_SERVER,
+      timeout: 1200,
+    })
+
+    const fileName = file.name || ""
+    const upload_file_name = new Date().getTime() + "." + fileName.split(".")[fileName.split(".").length - 1]
+    const date = new Date()
+    const year = date.getFullYear()
+    const month = date.getMonth() + 1
+    const strDate = date.getDate()
+    const uploadDay = `${year}${month}${strDate}`
+    const videoKey = `userVideo/${uploadDay}/${upload_file_name}`
+    const courseKey = `course/${uploadDay}/${upload_file_name}`
+    const key = type === 1 ? courseKey : videoKey
+
+    var callback = (transferredAmount, totalAmount, totalSeconds) => {
+      const progress = Number.parseInt((transferredAmount * 100.0) / totalAmount)
+      if (progressCallback) {
+        progressCallback(progress)
+      }
+    }
+
+    return new Promise((resolve, reject) => {
+      let isCancelled = false
+
+      if (cancelCallback) {
+        cancelCallback({
+          cancel: () => {
+            console.log("Cancelling OBS upload")
+            isCancelled = true
+            reject(new Error("Upload cancelled by user"))
+          },
+        })
+      }
+
+      obsClient.putObject(
+        {
+          Bucket: process.env.VUE_APP_OBS_BUCKET,
+          Key: key,
+          Body: file,
+          ProgressCallback: callback,
+        },
+        (err, result) => {
+          if (isCancelled) {
+            return // Don't process result if cancelled
+          }
+
+          if (err) {
+            reject(err)
+            console.error("Error-->" + err)
+          } else {
+            const a = {
+              ...result,
+              urlPath: key,
+            }
+            console.log("上传成功", a)
+            resolve(a)
+          }
+        },
+      )
+    })
+  } catch (error) {
+    console.error("Error during upload:", error)
+    throw error
+  }
+}

+ 15 - 0
src/utils/util.js

@@ -34,3 +34,18 @@ export function randomString(len) {
 }
 
 
+function isEmpty(str) {
+  // 检查是否为 null 或 undefined
+  if (str == null) return true;
+
+  // 检查是否为字符串类型
+  if (typeof str !== 'string') {
+    // 如果不是字符串,尝试转换为字符串再判断
+    return String(str).trim() === '';
+  }
+
+  // 字符串类型直接去除空格后判断
+  return str.trim() === '';
+}
+
+

+ 1 - 1
src/views/course/courseWatchLog/index.vue

@@ -838,7 +838,7 @@ export default {
     },
     setToday(){
       const today = new Date();
-      const todayStart = new Date(today);
+      const todayStart = new Date(today - 60*60*24*7*1000) ;
       todayStart.setHours(0, 0, 0, 0);
       const todayEnd = new Date(today);
       todayEnd.setHours(23, 59, 59, 999);

+ 1 - 1
src/views/course/courseWatchLog/watchLog.vue

@@ -887,7 +887,7 @@ export default {
   methods: {
     setToday(){
       const today = new Date();
-      const todayStart = new Date(today);
+      const todayStart = new Date(today - 60*60*24*7*1000) ;
       todayStart.setHours(0, 0, 0, 0);
       const todayEnd = new Date(today);
       todayEnd.setHours(23, 59, 59, 999);

+ 400 - 0
src/views/live/components/productAfterSalesOrder.vue

@@ -0,0 +1,400 @@
+<template>
+  <div class="order-content">
+      <div class="order-status" v-if="afterSales!=null" >
+          <el-steps :active="afterSales.status==4?afterSales.status+1:afterSales.status" align-center>
+            <el-step title="待审核(24小时自动审核)"></el-step>
+            <el-step title="平台已审核等待用户发货"></el-step>
+            <el-step title="用户已发货待仓库审核"></el-step>
+            <el-step title="财务审核"></el-step>
+            <el-step title="退款成功"></el-step>
+          </el-steps>
+      </div>
+      <div v-if="afterSales!=null">
+      <el-card shadow="never"  style="margin-top: 15px">
+        <div class="operate-container">
+          <span style="margin-left: 20px" class="color-danger">售后状态:
+            <el-tag prop="status" v-for="(item, index) in salesStatusOptions"    v-if="afterSales.salesStatus==item.dictValue">{{item.dictLabel}}</el-tag>
+          </span>
+          <div class="operate-button-container"  >
+            <el-button size="mini" v-hasPermi="['store:storeAfterSales:edit']" v-show="afterSales.salesStatus==0&&afterSales.status===1"  @click="addDelivery">编辑物流</el-button>
+            <el-button size="mini"  @click="showOrder">查看订单</el-button>
+         </div>
+        </div>
+        <div style="margin: 20px 0px">
+          <span class="font-small">基本信息</span>
+        </div>
+        <el-descriptions :column="4" border  >
+            <el-descriptions-item label="订单单号"  >
+                <span v-if="order!=null">
+                  {{order.orderCode}}
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="会员"  >
+                <span v-if="user!=null">
+                  {{user.nickname}}({{user.phone}})
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="退款金额"  >
+                <span v-if="afterSales!=null">
+                  {{afterSales.refundAmount}}
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="申请类型"  >
+                <span v-if="afterSales!=null">
+                  <el-tag prop="serviceType" v-for="(item, index) in serviceTypeOptions"    v-if="afterSales.serviceType==item.dictValue">{{item.dictLabel}}</el-tag>
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="申请原因"  >
+                <span v-if="afterSales!=null">
+                  {{afterSales.reasons}}
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="说明"  >
+                <span v-if="afterSales!=null">
+                  {{afterSales.explains}}
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="状态"  >
+                <span v-if="afterSales!=null">
+                  <el-tag   v-for="(item, index) in statusOptions"    v-if="afterSales.status==item.dictValue" >{{item.dictLabel}}</el-tag>
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="售后状态"  >
+                <span v-if="afterSales!=null">
+                  <el-tag  v-for="(item, index) in salesStatusOptions"    v-if="afterSales.salesStatus==item.dictValue" >{{item.dictLabel}}</el-tag>
+                </span>
+            </el-descriptions-item>
+        </el-descriptions>
+        <div style="margin: 20px 0px">
+          <span class="font-small">收货信息</span>
+        </div>
+        <el-descriptions   :column="4" border  >
+            <el-descriptions-item label="收货人"  >
+                <span v-if="order!=null">
+                  {{order.userName}}
+                </span>
+            </el-descriptions-item>
+<!--            <el-descriptions-item label="收货人"  >-->
+<!--                <span v-if="order!=null">-->
+<!--                  {{order.userName}}-->
+<!--                </span>-->
+<!--            </el-descriptions-item>-->
+            <el-descriptions-item label="手机号码"  >
+                <span v-if="order!=null">
+                  {{order.userPhone}}
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="收货地址"  >
+                <span v-if="order!=null">
+                  {{order.userAddress}}
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="快递公司"  >
+                <span v-if="order!=null">
+                  {{order.deliveryName}}
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="运单号"  >
+                <span v-if="order!=null">
+                  {{order.deliverySn}}
+                </span>
+            </el-descriptions-item>
+        </el-descriptions>
+        <div style="margin-top: 20px">
+          <span class="font-small">商品信息</span>
+        </div>
+        <el-table
+          border
+          :data="items"
+          size="small"
+          style="width: 100%;margin-top: 20px" >
+          <el-table-column label="商品图片" width="150" align="center">
+            <template slot-scope="scope">
+              <img :src="JSON.parse(scope.row.jsonInfo).image" style="height: 80px">
+            </template>
+          </el-table-column>
+          <el-table-column label="商品名称" width="300" align="center">
+            <template slot-scope="scope">
+              <p>{{JSON.parse(scope.row.jsonInfo).productName}}</p>
+            </template>
+          </el-table-column>
+          <el-table-column label="价格" width="240" align="center">
+            <template slot-scope="scope">
+              <p>价格:¥{{JSON.parse(scope.row.jsonInfo).price}}</p>
+
+            </template>
+          </el-table-column>
+          <el-table-column label="属性" width="240" align="center">
+            <template slot-scope="scope">
+              {{JSON.parse(scope.row.jsonInfo).sku}}
+            </template>
+          </el-table-column>
+          <el-table-column label="数量" width="180" align="center">
+            <template slot-scope="scope">
+                {{JSON.parse(scope.row.jsonInfo).num}}
+            </template>
+          </el-table-column>
+          <el-table-column label="小计"  align="center">
+            <template slot-scope="scope">
+              ¥{{JSON.parse(scope.row.jsonInfo).num*JSON.parse(scope.row.jsonInfo).price}}
+            </template>
+          </el-table-column>
+        </el-table>
+        <div style="margin-top: 20px">
+          <span class="font-small">操作信息</span>
+        </div>
+        <el-table style="margin-top: 20px;width: 100%"
+                  ref="orderHistoryTable"
+                  :data="logs" border>
+          <el-table-column label="操作时间"  width="160" align="center">
+            <template slot-scope="scope">
+              {{scope.row.changeTime}}
+            </template>
+          </el-table-column>
+          <el-table-column label="备注" align="center">
+            <template slot-scope="scope">
+              {{scope.row.changeMessage}}
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-card>
+
+    </div>
+    <el-dialog :title="audit.title" :visible.sync="audit.open" width="800px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+        <el-form-item label="退款金额" prop="refundAmount"  >
+          <el-input-number v-model="form.refundAmount"  />
+        </el-form-item>
+        <el-form-item label="退货联系人" prop="consignee"  v-if="form.serviceType==1" >
+          <el-input v-model="form.consignee" placeholder="请输入收货人" />
+        </el-form-item>
+        <el-form-item label="退货手机号" prop="phoneNumber"  v-if="form.serviceType==1">
+          <el-input v-model="form.phoneNumber" placeholder="请输入手机号" />
+        </el-form-item>
+        <el-form-item label="退货地址" prop="address" v-if="form.serviceType==1">
+          <el-input v-model="form.address" placeholder="请输入地址" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitAuditForm">确 定</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :title="show.title" v-if="show.open" :visible.sync="show.open" width="1000px" append-to-body>
+        <product-order  ref="productOrder" />
+    </el-dialog>
+    <el-dialog :title="add.title" :visible.sync="add.open" width="500px" append-to-body>
+
+    <div slot="footer" class="dialog-footer">
+      <el-form ref="addForm" :model="addForm" :rules="addRules" label-width="100px">
+          <el-form-item label="id" prop="id" v-if="false">
+            <el-input v-model="addForm.id" placeholder="请输入"  />
+          </el-form-item>
+          <el-form-item label="快递公司" prop="deliveryName">
+            <el-input v-model="addForm.deliveryName" placeholder="请输入"  />
+          </el-form-item>
+          <el-form-item label="运单号" prop="deliverySn">
+            <el-input v-model="addForm.deliverySn" placeholder="请输入"  />
+          </el-form-item>
+        </el-form>
+      <el-button type="primary" @click="submitForm">确 定</el-button>
+      <el-button @click="cancel1">取 消</el-button>
+    </div>
+  </el-dialog>
+  </div>
+</template>
+
+<script>
+import {getLiveAfterSales,cancel,refund,audit,updateLiveAfterSales } from "@/api/live/liveAfterSales";
+
+import productOrder from "./productOrder";
+export default {
+  components: { productOrder },
+  name: "order",
+  data() {
+    return {
+      show:{
+        open:false,
+        title:"订单详情"
+      },
+      audit:{
+          title:"审核",
+          open:false,
+      },
+      add:{
+        open:false,
+        title:"添加物流"
+      },
+      addForm:{
+        id:null,
+        deliveryName:null,
+        deliverySn:null
+      },
+      addRules:{
+        deliveryName: [
+          { required: true, message: "物流名称不能为空", trigger: "blur" }
+        ],
+        deliverySn: [
+          { required: true, message: "物流单号不能为空", trigger: "blur" }
+        ],
+      },
+      order:null,
+      user:null,
+      serviceTypeOptions:[],
+      salesStatusOptions:[],
+      statusOptions:[],
+      afterSales:null,
+      items:[],
+      logs:[],
+      form:{
+        serviceType:1,
+        refundAmount:0,
+        consignee:null,
+        phoneNumber:null,
+        address:null,
+
+      },
+      rules:{
+        status: [
+          { required: true, message: "状态不能为空", trigger: "blur" }
+        ],
+        refundAmount: [
+          { required: true, message: "退款金额不能为空", trigger: "blur" }
+        ],
+         consignee: [
+          { required: true, message: "退货联系人不能为空", trigger: "blur" }
+        ],
+        phoneNumber: [
+          { required: true, message: "退货手机号不能为空", trigger: "blur" }
+        ],
+         address: [
+          { required: true, message: "退货地址不能为空", trigger: "blur" }
+        ],
+
+      }
+
+    };
+  },
+  created() {
+    this.getDicts("store_after_sales_sales_status").then((response) => {
+        this.salesStatusOptions = response.data;
+    });
+    this.getDicts("store_after_sales_status").then((response) => {
+        this.statusOptions = response.data;
+    });
+     this.getDicts("store_after_sales_service_type").then((response) => {
+        this.serviceTypeOptions = response.data;
+    });
+  },
+  methods: {
+    submitForm() {
+      var id=this.afterSales.id;
+      this.addForm.id = id;
+      updateLiveAfterSales(this.addForm).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("编辑成功");
+                this.add.open = false;
+                this.getLiveAfterSales(id);
+              }
+            });
+    },
+    cancel1(){
+      this.add.open = false;
+    },
+    addDelivery(){
+      this.add.open = true;
+      this.addForm.deliveryName = this.afterSales.deliveryName;
+      this.addForm.deliverySn = this.afterSales.deliverySn;
+    },
+    showOrder(){
+      this.show.open=true;
+      const orderId = this.order.orderId ;
+      setTimeout(() => {
+        this.$refs.productOrder.getOrder(orderId);
+      }, 500);
+    },
+    handleAudit(){
+        this.audit.open=true;
+        this.form.serviceType=this.afterSales.serviceType;
+        this.form.salesId=this.afterSales.id;
+        this.form.refundAmount=this.afterSales.refundAmount;
+    },
+    submitAuditForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+           audit(this.form).then(response => {
+              if (response.code === 200) {
+                this.audit.open = false;
+                this.getLiveAfterSales(this.afterSales.id);
+                this.msgSuccess("操作成功");
+              }
+            });
+        }
+      });
+    },
+    cancel(){
+      var id=this.afterSales.id;
+      this.$confirm('是否确认取消订单?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          var data={salesId:id}
+          return cancel(data);
+        }).then(() => {
+          this.getLiveAfterSales(id);
+          this.msgSuccess("操作成功");
+        }).catch(function() {});
+    },
+    refund(){
+      var id=this.afterSales.id;
+      this.$confirm('是否确认收货,确认后将自动退款给客户', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          var data={salesId:id}
+          console.log(data)
+          return refund(data);
+        }).then(() => {
+          this.getLiveAfterSales(id);
+          this.msgSuccess("操作成功");
+        }).catch(function() {});
+    },
+    getLiveAfterSales(id){
+      getLiveAfterSales(id).then(response => {
+        console.log(response)
+        console.log(123)
+            this.afterSales = response.afterSales;
+            this.logs = response.logs;
+            this.items = response.items;
+            this.user=response.user;
+            this.order=response.order;
+        });
+     }
+  }
+};
+</script>
+<style scoped>
+.order-content{
+  margin: 10px;
+}
+.detail-container {
+  width: 80%;
+  padding: 20px 20px 20px 20px;
+  margin: 20px auto;
+}
+
+.operate-container {
+  background: #F2F6FC;
+  height: 80px;
+  margin: -20px -20px 0;
+  line-height: 80px;
+}
+
+.operate-button-container {
+  float: right;
+  margin-right: 20px
+}
+
+
+</style>

+ 973 - 0
src/views/live/components/productOrder.vue

@@ -0,0 +1,973 @@
+<template>
+  <div class="order-content">
+      <div class="order-status" v-if="order!=null" >
+          <el-steps  :active="order.status==3?order.status+1:order.status" align-center>
+            <el-step title="待支付"></el-step>
+            <el-step title="待发货"></el-step>
+            <el-step title="待收货"></el-step>
+            <el-step title="交易完成"></el-step>
+          </el-steps>
+      </div>
+      <div>
+
+      <el-card shadow="never" style="margin-top: 15px">
+      <div class="operate-container"  v-if="order!=null">
+        <span  style="margin-left: 20px" class="color-danger">订单状态:
+           <el-tag prop="status" v-for="(item, index) in statusOptions"    v-if="order.status==item.dictValue">{{item.dictLabel}}</el-tag>
+        </span>
+
+        <div class="operate-button-container" >
+<!--          <el-button size="mini" @click="handleCertificates()"  v-hasPermi="['store:storeOrder:uploadCredentials']" >上传凭证</el-button>-->
+          <el-button size="mini" @click="handleEditAddress()" v-if="order.status==0||order.status==1"  v-hasPermi="['store:storeOrder:editAddress']" >修改收货地址</el-button>
+          <el-button size="mini" @click="handleBindCustomer()"  v-hasPermi="['store:storeOrder:bindCustomer']" >关联客户</el-button>
+          <el-button size="mini" @click="editOrder()"  v-hasPermi="['store:storeOrder:edit']" >修改订单</el-button>
+          <!-- <el-button size="mini" @click="handleEditUser()"  v-hasPermi="['users:user:edit']" >修改会员修改</el-button> -->
+          <el-button size="mini" v-if="order.customerId!=null&&order.customerId>0"  @click="handleCustomer()"    >查看客户详情</el-button>
+        </div>
+<!--        <div class="operate-button-container"  v-hasPermi="['store:storeOrder:express']"  >-->
+<!--          <el-button size="mini" @click="showExpress()" >查看物流</el-button>-->
+<!--        </div>-->
+      </div>
+      <div style="margin: 20px 0px"  v-if="order!=null">
+        <span class="font-small">
+          基本信息
+        </span>
+      </div>
+      <el-descriptions :column="4" border  >
+            <el-descriptions-item label="订单编号"  >
+                <span v-if="order!=null">
+                  {{order.orderCode}}
+                </span>
+                <el-tag  v-for="(item, index) in createTypeOptions"    v-if="order!=null&&order.orderCreateType==item.dictValue">{{item.dictLabel}}
+                </el-tag>
+            </el-descriptions-item>
+            <el-descriptions-item label="会员"  >
+                <span v-if="user!=null">
+                  {{user.nickname}}({{user.phone}})
+                </span>
+            </el-descriptions-item>
+            <!-- <el-descriptions-item label="进线时间"  >
+                <span v-if="user!=null">
+                  {{user.registerDate}}
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="推线编码"  >
+                <span v-if="user!=null">
+                  {{user.registerCode}}
+                </span>
+            </el-descriptions-item> -->
+
+            <el-descriptions-item label="收货人"  >
+                <span v-if="order!=null ">
+                  {{order.userName }}
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="手机号码"  >
+                <span v-if="order!=null ">
+                  {{order.userPhone }}
+                </span>
+                <el-button type="text" size="mini" @click="callNumber(0,0,orderId)"  v-hasPermi="['store:storeOrder:callNumber']">拨号</el-button>
+                <el-button type="text" size="mini" @click="handleSms(order.userPhone)" v-hasPermi="['store:storeOrder:sendSms']">短信</el-button>
+                <el-button icon="el-icon-search" size="mini" @click="handlePhone()" style="margin-left: 20px;" circle v-hasPermi="['store:storeOrder:queryPhone']"></el-button>
+            </el-descriptions-item>
+            <el-descriptions-item label="收货地址"  >
+              <el-popover
+                v-if="order!=null"
+                placement="top-start"
+                title="收货地址"
+                width="300"
+                trigger="hover"
+                :content="order.userAddress">
+                <span slot="reference">{{order.userAddress}}</span>
+                <el-button icon="el-icon-search" size="mini" @click="handleAddress()" style="margin-left: 20px;" circle v-hasPermi="['store:storeOrder:queryAddress']"></el-button>
+              </el-popover>
+            </el-descriptions-item>
+            <el-descriptions-item label="支付方式"  >
+                <span v-if="order!=null ">
+                  <el-tag prop="orderType" v-for="(item, index) in payTypeOptions"    v-if="order.payType==item.dictValue">{{item.dictLabel}}</el-tag>
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="订单类型"  >
+                <span v-if="order!=null ">
+                  <el-tag prop="orderType" v-for="(item, index) in orderTypeOptions"    v-if="order.orderType==item.dictValue">{{item.dictLabel}}</el-tag>
+                </span>
+            </el-descriptions-item>
+<!--            <el-descriptions-item label="物流公司编号"  >-->
+<!--                <span v-if="order!=null ">-->
+<!--                  {{order.deliverySn }}-->
+<!--                </span>-->
+<!--            </el-descriptions-item>-->
+<!--            <el-descriptions-item label="物流公司名称"  >-->
+<!--                <span v-if="order!=null ">-->
+<!--                  {{order.deliveryName }}-->
+<!--                </span>-->
+<!--            </el-descriptions-item>-->
+<!--            <el-descriptions-item label="快递单号"  >-->
+<!--                <span v-if="order!=null ">-->
+<!--                  {{order.deliveryId }}-->
+<!--                </span>-->
+<!--            </el-descriptions-item>-->
+            <el-descriptions-item label="档期归属"  >
+              <el-tag prop="scheduleId" v-for="(item, index) in scheduleOptions"    v-if="order!=null&&order.scheduleId==item.id">{{item.name}}
+              </el-tag>
+            </el-descriptions-item>
+            <el-descriptions-item label="用户备注"  >
+                <span v-if="order!=null ">
+                  {{order.mark }}
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="平台备注"  >
+                <span v-if="order!=null ">
+                  {{order.remark }}
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item label="跟随阶段"  v-if="company.companyId == 174">
+              <span v-if="order!=null ">
+                <el-tag prop="orderVisit" v-for="(item, index) in customerUserStatusOptions"    v-if="order.orderVisit==item.dictValue">{{item.dictLabel}}</el-tag>
+              </span>
+            </el-descriptions-item>
+            <el-descriptions-item v-if="customerInfo!=null " label="客户编码"  >
+                <span >
+                  {{customerInfo.customerCode }}
+                </span>
+            </el-descriptions-item>
+            <el-descriptions-item v-if="customerInfo!=null " label="进线时间"  >
+                <span >
+                  {{customerInfo.registerDate }}
+                </span>
+            </el-descriptions-item>
+
+      </el-descriptions>
+
+        <div style="margin-top: 20px">
+          <span class="font-small">物流信息</span>
+        </div>
+        <el-table
+          border
+          v-if="deliverList!=null"
+          :data="deliverList"
+          size="small"
+          style="width: 100%;margin-top: 20px" >
+          <el-table-column label="物流公司编码" width="150" align="center">
+            <template slot-scope="scope">
+              <p>{{scope.row.deliverSn}}</p>
+            </template>
+          </el-table-column>
+          <el-table-column label="物流公司名称" width="300" align="center">
+            <template slot-scope="scope">
+              <p>{{scope.row.deliverName}}</p>
+            </template>
+          </el-table-column>
+          <el-table-column label="物流单号" width="300" align="center">
+            <template slot-scope="scope">
+              <p>{{scope.row.deliverId}}</p>
+            </template>
+          </el-table-column>
+          <el-table-column label="物流状态" width="300" align="center">
+            <template slot-scope="scope">
+              <span>
+              <el-tag v-for="(item, index) in deliveryStatusOptions"    v-if="scope.row!=null&&scope.row.status==item.dictValue">
+              {{item.dictLabel}}
+              </el-tag>
+              </span>
+            </template>
+          </el-table-column>
+          <el-table-column label="发货时间" width="240" align="center">
+            <template slot-scope="scope">
+              {{scope.row.deliverSendTime}}
+            </template>
+          </el-table-column>
+          <el-table-column label="操作" width="240" align="center">
+            <template slot-scope="scope">
+              <el-link  type="primary" @click="showExpress(scope)" v-hasPermi="['store:storeOrder:express']">查看物流跟踪</el-link>
+            </template>
+          </el-table-column>
+        </el-table>
+      <div style="margin: 20px 0px"  v-if="order!=null">
+        <span class="font-small">
+          凭证信息
+        </span>
+      </div>
+      <el-image
+          v-if="this.certificates != null"
+          :src="certificates"
+          :preview-src-list="[certificates]"
+          :style="{ width: '100px', height: '100px' }"
+          @click.native="showImageDialog"
+        ></el-image>
+        <el-dialog :visible.sync="dialogVisibleImage" width="10%">
+          <img :src="certificates" style="width: 100%" alt="">
+        </el-dialog>
+
+      <div style="margin-top: 20px">
+        <span class="font-small">商品信息</span>
+      </div>
+      <el-table
+        border
+        v-if="items!=null"
+        :data="items"
+        size="small"
+        style="width: 100%;margin-top: 20px" >
+        <el-table-column label="商品图片" width="150" align="center">
+          <template slot-scope="scope">
+            <img :src="JSON.parse(scope.row.jsonInfo).image" style="height: 80px">
+          </template>
+        </el-table-column>
+        <el-table-column label="商品名称" width="300" align="center">
+          <template slot-scope="scope">
+            <p>{{JSON.parse(scope.row.jsonInfo).productName}}</p>
+          </template>
+        </el-table-column>
+        <el-table-column label="单价" width="240" align="center">
+          <template slot-scope="scope">
+            <p>¥{{JSON.parse(scope.row.jsonInfo).price.toFixed(2)}}</p>
+          </template>
+        </el-table-column>
+        <el-table-column label="规格" width="240" align="center">
+          <template slot-scope="scope">
+            {{JSON.parse(scope.row.jsonInfo).sku}}
+          </template>
+        </el-table-column>
+        <el-table-column label="数量" width="180" align="center">
+          <template slot-scope="scope">
+            {{scope.row.num}}
+          </template>
+        </el-table-column>
+        <el-table-column label="小计"  align="center">
+          <template slot-scope="scope" >
+            ¥{{scope.row.num*JSON.parse(scope.row.jsonInfo).price.toFixed(2)}}
+          </template>
+        </el-table-column>
+      </el-table>
+      <div style="float: right;margin: 20px" v-if="order!=null">
+        合计:<span class="color-danger">¥{{order.totalPrice.toFixed(2)}}</span>
+      </div>
+
+      <div style="margin: 60px 0px 20px 0px">
+        <span class="font-small">费用信息</span>
+      </div>
+      <el-descriptions   :column="4" border  >
+          <el-descriptions-item label="商品合计"  >
+              <span v-if="order!=null">
+                ¥{{order.totalPrice.toFixed(2)}}
+              </span>
+          </el-descriptions-item>
+          <el-descriptions-item label="应付金额"  >
+              <span v-if="order!=null">
+                ¥{{order.payPrice.toFixed(2)}}
+              </span>
+          </el-descriptions-item>
+          <el-descriptions-item label="运费"  >
+              <span v-if="order!=null">
+                ¥{{order.payPostage.toFixed(2)}}
+              </span>
+          </el-descriptions-item>
+<!--          <el-descriptions-item label="优惠券"  >-->
+<!--              <span v-if="order!=null">-->
+<!--                ¥{{order.couponPrice.toFixed(2)}}-->
+<!--              </span>-->
+<!--          </el-descriptions-item>-->
+<!--          <el-descriptions-item label="积分抵扣"  >-->
+<!--              <span v-if="order!=null">-->
+<!--                ¥{{order.deductionPrice.toFixed(2)}}-->
+<!--              </span>-->
+<!--          </el-descriptions-item>-->
+          <el-descriptions-item label="实付金额"  >
+              <span v-if="order!=null">
+                ¥{{order.payMoney.toFixed(2)}}
+              </span>
+          </el-descriptions-item>
+          <el-descriptions-item label="代收金额"  >
+              <span v-if="order!=null">
+                ¥{{order.payDelivery.toFixed(2)}}
+              </span>
+          </el-descriptions-item>
+      </el-descriptions>
+
+      <div style="margin-top: 20px">
+        <svg-icon icon-class="marker" style="color: #606266"></svg-icon>
+        <span class="font-small">支付信息</span>
+      </div>
+      <el-table
+        border
+        :data="payments"
+        size="small"
+        style="width: 100%;margin-top: 20px" >
+          <el-table-column label="支付单号" align="center" prop="payCode" width="120px" />
+          <el-table-column label="支付金额" align="center" prop="payMoney" />
+          <el-table-column label="类型" align="center" prop="payTypeCode" />
+          <el-table-column label="交易单号" align="center" prop="bankTransactionId" />
+          <el-table-column label="银行单号" align="center" prop="bankSerialNo" />
+          <el-table-column label="创建时间" align="center" prop="createTime" />
+          <el-table-column label="支付时间" align="center" prop="payTime" />
+      </el-table>
+
+      <div style="margin-top: 20px">
+        <span class="font-small">操作信息</span>
+      </div>
+      <el-table style="margin-top: 20px;width: 100%"
+                ref="orderHistoryTable"
+                :data="logs" border>
+        <el-table-column label="操作时间"  width="160" align="center">
+          <template slot-scope="scope">
+            {{scope.row.changeTime}}
+          </template>
+        </el-table-column>
+        <el-table-column label="备注" align="center">
+          <template slot-scope="scope">
+            {{scope.row.changeMessage}}
+          </template>
+        </el-table-column>
+      </el-table>
+      </el-card>
+    </div>
+    <el-dialog :title="edit.title" :visible.sync="edit.open" width="600px" append-to-body>
+      <el-form ref="editForm" :model="editForm" :rules="editRules" label-width="100px">
+        <el-form-item label="订单类型" prop="orderType"  >
+            <el-select style="width: 200px" v-model="editForm.orderType" placeholder="请选择订单类型" clearable size="small" >
+              <el-option
+                      v-for="item in orderTypeOptions"
+                      :key="item.dictValue"
+                      :label="item.dictLabel"
+                      :value="item.dictValue"
+                    />
+            </el-select>
+        </el-form-item>
+        <el-form-item label="档期归属" prop="scheduleId"  >
+            <el-select filterable style="width: 200px" v-model="editForm.scheduleId" placeholder="请选择档期" clearable size="small" >
+              <el-option
+                      v-for="item in scheduleOptions"
+                      :key="item.id"
+                      :label="item.name"
+                      :value="item.id"
+                    />
+            </el-select>
+        </el-form-item>
+        <el-form-item label="跟随阶段" prop="orderVisit" v-if="company.companyId == 174" >
+          <el-select filterable style="width: 200px" v-model="editForm.orderVisit" placeholder="请选择跟随阶段" clearable size="small" >
+            <el-option
+                v-for="item in customerUserStatusOptions"
+                :key="item.dictValue"
+                :label="item.dictLabel"
+                :value="item.dictValue"
+              />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="备注" prop="mark"  >
+          <el-input v-model="editForm.mark" placeholder="请输入备注" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitEditForm">确 定</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :title="editUser.title" :visible.sync="editUser.open" width="600px" append-to-body>
+      <el-form ref="editUserForm" :model="editUserForm" :rules="editUserRules" label-width="100px">
+         <el-form-item label="进线时间" prop="registerDate">
+          <el-date-picker clearable size="small"
+            v-model="editUserForm.registerDate"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="选择进线时间">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="推线编码" prop="registerCode">
+          <el-input v-model="editUserForm.registerCode" placeholder="请输入推线编码" />
+        </el-form-item>
+          <el-form-item label="渠道来源" prop="source">
+          <el-input v-model="editUserForm.source" placeholder="请输入渠道来源" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitEditUserForm">确 定</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :title="editAddress.title" :visible.sync="editAddress.open" width="600px" append-to-body>
+      <el-form ref="editAddressForm" :model="editAddressForm" :rules="editAddressRules" label-width="100px">
+        <el-form-item label="收件人" prop="realName">
+          <el-input v-model="editAddressForm.realName" placeholder="请输入收件人" />
+        </el-form-item>
+          <el-form-item label="联系电话" prop="source">
+          <el-input v-model="editAddressForm.userPhone" placeholder="请输入联系电话" />
+        </el-form-item>
+        <el-form-item label="收货地址" prop="district">
+          <el-row :gutter="20">
+          <el-col :span="6">
+             <el-select @change="provinceChange" v-model="editAddressForm.provinceId" placeholder="请选择">
+                <el-option
+                  v-for="item in province"
+                  :key="item.cityId"
+                  :label="item.name"
+                  :value="item.cityId">
+                </el-option>
+              </el-select>
+          </el-col>
+          <el-col :span="6">
+            <el-select @change="cityChange" v-model="editAddressForm.cityId" placeholder="请选择">
+                <el-option
+                  v-for="item in city"
+                  :key="item.cityId"
+                  :label="item.name"
+                  :value="item.cityId">
+                </el-option>
+              </el-select>
+          </el-col>
+          <el-col :span="6">
+             <el-select @change="districtChange" v-model="editAddressForm.districtId" placeholder="请选择">
+                <el-option
+                  v-for="item in district"
+                  :key="item.cityId"
+                  :label="item.name"
+                  :value="item.cityId">
+                </el-option>
+              </el-select>
+          </el-col>
+        </el-row>
+        </el-form-item>
+        <el-form-item label="详细地址" prop="detail">
+          <el-input v-model="editAddressForm.detail" placeholder="请输入收货人详细地址" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitEditAddressForm">确 定</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :title="expressDialog.title" :visible.sync="expressDialog.open" width="600px" append-to-body>
+      <el-table style="margin-top: 20px;width: 100%"
+                ref="orderHistoryTable"
+                :data="traces" border>
+        <el-table-column label="操作时间"  width="160" align="center">
+          <template slot-scope="scope">
+            {{scope.row.AcceptTime}}
+          </template>
+        </el-table-column>
+         <el-table-column label="位置" align="center">
+          <template slot-scope="scope">
+            {{scope.row.Location}}
+          </template>
+        </el-table-column>
+        <el-table-column label="描述" align="center">
+          <template slot-scope="scope">
+            {{scope.row.AcceptStation}}
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-dialog>
+    <el-dialog :title="bindCustomerDialog.title" :visible.sync="bindCustomerDialog.open" width="800px" append-to-body>
+      <el-form ref="bindCustomerForm" :model="bindCustomerForm" :rules="bindCustomerRules" label-width="100px">
+        <el-form-item label="客户查询">
+          <el-row :gutter="10" class="mb8">
+            <el-col :span="1.5">
+              <el-input v-model="bindCustomerForm.mobile"   placeholder="请输入客户手机号"/>
+            </el-col>
+            <el-col :span="1.5">
+              <el-button type="primary" @click="searchCustomer">查看</el-button>
+            </el-col>
+          </el-row>
+
+        </el-form-item>
+        <el-form-item label="客户选择"  prop="customerIds">
+          <el-table   @selection-change="handleSelectionChange"
+                :data="customers" border>
+            <el-table-column type="selection" width="55" align="center" />
+            <el-table-column label="ID" align="center" prop="customerId" />
+            <el-table-column label="客户编号"  width="160" align="center">
+              <template slot-scope="scope">
+                {{scope.row.customerCode}}
+              </template>
+            </el-table-column>
+            <el-table-column label="客户名称"  width="160" align="center">
+              <template slot-scope="scope">
+                {{scope.row.customerName}}
+              </template>
+            </el-table-column>
+            <el-table-column label="客户手机号"  width="160" align="center">
+              <template slot-scope="scope">
+                {{scope.row.mobile}}
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitBindCustomerForm">确 定</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :title="certificateDialig.title" :visible.sync="certificateDialig.open" append-to-body>
+      <el-form ref="certificateForm" :model="certificateForm" :rules="certificateRules" label-width="100px">
+        <el-form-item label="凭证" prop="certificates">
+          <ImageUpload v-model="photoArr" type="image" :num="10" :width="150" :height="150" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="handleConfirm">确 定</el-button>
+      </div>
+    </el-dialog>
+    <el-drawer
+      :append-to-body="true"
+      size="75%"
+      :title="customer.title" :visible.sync="customer.open"
+      >
+        <customer-details  ref="customerDetails" />
+    </el-drawer>
+    <el-dialog :title="addSms.title" :visible.sync="addSms.open" width="800px" append-to-body>
+        <add-sms ref="sms" @close="closeSms()"></add-sms>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {updateUser,getUser } from "@/api/users/user";
+import { getTcmScheduleList } from "@/api/company/tcmScheduleReport";
+import {getCustomerListBySearch } from "@/api/crm/customer";
+import ImageUpload from '@/components/ImageUpload'
+import Material from '@/components/Material'
+import {
+  bindCustomer,
+  getLiveOrderAll,
+  uploadCredentials,
+  updateLiveOrder,
+  getLiveOrderAddress,
+  getUserPhone,
+  getByOrderId, getExpressByDeliverId
+} from "@/api/live/liveOrder";
+import {getAllList} from "@/api/store/city";
+import customerDetails from '../../crm/components/customerDetails.vue';
+import addSms from '../../crm/components/addSms.vue';
+export default {
+  name: "order",
+  components: {customerDetails,
+    ImageUpload,Material ,addSms},
+  data() {
+    return {
+      deliveryStatusOptions:[],
+      deliverList: [],
+      customerUserStatusOptions:[],
+      scheduleOptions:[],
+      dialogVisibleImage: false,
+      customerInfo:null,
+      customer:{
+        title:"客户详情",
+        open:false,
+      },
+      photoArr:null,
+      certificateDialig:{
+        title:"上传凭证",
+        open:false,
+      },
+      certificateForm:{
+        orderCode:null,
+        certificates:null,
+      },
+      addSms:{
+        open:false,
+        title:"发短信"
+      },
+      certificateRules:{
+        certificates:[
+          { required: true, message: "凭证不能为空", trigger: "change" }
+        ]
+      },
+      customers:[],
+      bindCustomerDialog:{
+        title:"关联客户",
+        open:false,
+      },
+      bindCustomerForm:{
+        mobile:null,
+        customerIds:null,
+      },
+      bindCustomerRules:{
+        customerIds: [
+            { required: true, message: "客户不能为空", trigger: "change" }
+        ],
+
+      },
+      orderId:null,
+      expressDialog:{
+        title:"物流信息",
+        open:false,
+      },
+      citys:[],
+      province:[],
+      city:[],
+      district:[],
+      editAddress:{
+        title:"修改收货地址",
+        open:false,
+      },
+      editAddressForm:{
+        districtId:null,
+
+      },
+      editAddressRules:{
+
+      },
+      editUser:{
+        title:"修改会员信息",
+        open:false,
+      },
+      editUserForm:{
+        registerDate:null,
+        registerCode:"",
+        source:"",
+      },
+      editUserRules:{
+
+      },
+      edit:{
+        title:"",
+        open:false,
+      },
+      editForm:{
+        orderType:null,
+        scheduleId:null,
+        orderVisit:null,
+        mark:"",
+      },
+      editRules:{
+
+      },
+      createTypeOptions:[],
+      orderTypeOptions:[],
+      payTypeOptions:[],
+      statusOptions:[],
+      certificates:null,
+      order:null,
+      user:{},
+      logs:[],
+      items:[],
+      express:[],
+      traces:[],
+      payments:[],
+    };
+  },
+  created() {
+    this.getDicts("store_order_delivery_status").then((response) => {
+      this.deliveryStatusOptions = response.data;
+    });
+
+    this.getDicts("crm_customer_user_status").then((response) => {
+            this.customerUserStatusOptions = response.data;
+        });
+    this.getDicts("store_order_type").then((response) => {
+      this.orderTypeOptions = response.data;
+    });
+    this.getDicts("store_order_status").then((response) => {
+      this.statusOptions = response.data;
+    });
+    this.getDicts("store_pay_type").then((response) => {
+      this.payTypeOptions = response.data;
+    });
+    this.getDicts("store_order_create_type").then((response) => {
+      this.createTypeOptions = response.data;
+    });
+    getTcmScheduleList().then(response => {
+      this.scheduleOptions = response.data;
+    });
+  },
+  computed: {
+    company(){
+      return this.$store.state.user.user;
+    }
+  },
+  methods: {
+    getExpressList(){
+      getByOrderId(this.orderId).then(res=>{
+        this.deliverList.push(res.data);
+      })
+    },
+    closeSms(){
+      this.addSms.open=false;
+    },
+    handleSms(mobile){
+        this.addSms.open=true;
+        var that=this;
+        setTimeout(() => {
+            that.$refs.sms.getOrderId(this.orderId,mobile,2);
+        }, 500);
+
+    },
+    handlePhone(){
+      const id = this.order.orderId;
+        getUserPhone(id).then(response =>{
+          this.order.userPhone = response.userPhone;
+        })
+      },
+    handleAddress(){
+      const id = this.order.orderId;
+      getLiveOrderAddress(id).then(response =>{
+          this.order.userAddress = response.address;
+      })
+    },
+    showImageDialog() {
+      this.dialogVisible = true;
+    },
+    handleCustomer(){
+      var that=this;
+      this.customer.open = true;
+      setTimeout(() => {
+          that.$refs.customerDetails.getDetails(this.order.customerId);
+      }, 200);
+    },
+    handleSelectionChange(selection) {
+      this.bindCustomerForm.customerIds = selection.map(item => item.customerId)
+    },
+    searchCustomer(){
+      if(this.bindCustomerForm.mobile==null||this.bindCustomerForm.mobile==""){
+        this.msgError("请输入手机号");
+        return;
+      }
+      var data={mobile:this.bindCustomerForm.mobile};
+      getCustomerListBySearch(data).then(response => {
+          this.customers=response.data;
+      });
+    },
+    handleBindCustomer() {
+      this.customers=[];
+      this.bindCustomerDialog.open = true;
+      this.bindCustomerForm.mobile=null;
+      this.bindCustomerForm.orderId=this.orderId;
+      this.bindCustomerForm.customerIds=null;
+    },
+    /** 提交按钮 */
+    submitBindCustomerForm() {
+      this.$refs["bindCustomerForm"].validate(valid => {
+        if (valid) {
+          bindCustomer(this.bindCustomerForm).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("修改成功");
+                this.bindCustomerDialog.open = false;
+              }
+            });
+        }
+      });
+    },
+    handleCertificates(){
+      this.certificateDialig.open = true;
+      this.photoArr = null;
+    },
+    handleConfirm(){
+      this.certificateForm.id = this.orderId;
+      this.certificateForm.orderCode = this.order.orderCode;
+      this.certificateForm.certificates = this.photoArr;
+      uploadCredentials(this.certificateForm).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("上传成功");
+                this.certificateDialig.open = false;
+                this.getOrder(this.order.orderId);
+              }
+            });
+    },
+    showExpress(scope){
+      this.expressDialog.open=true;
+      getExpressByDeliverId({
+        orderId: this.orderId,
+        deliverId: scope.row.deliverId,
+        deliverSn: scope.row.deliverSn
+      }).then(response => {
+        this.express = response.data;
+        if(this.express!=null&&this.express.Traces!=null){
+          this.traces=this.express.Traces
+        }
+      })
+
+    },
+    districtChange(val){
+      var item=this.citys.find((item)=>{
+        return item.cityId==val&&item.level==2;
+      })
+      this.editAddressForm.district=item.name;
+
+    },
+    cityChange(val){
+      this.district=this.citys.filter(item => item.parentId===val )
+      this.editAddressForm.districtId=null;
+      var item=this.citys.find((item)=>{
+        return item.cityId==val&&item.level==1;
+      })
+      console.log(item)
+      this.editAddressForm.city=item.name;
+
+
+    },
+    provinceChange(val){
+      this.city=this.citys.filter(item => item.parentId===val )
+      this.district=[];
+      this.editAddressForm.cityId=null;
+      this.editAddressForm.districtId=null;
+      var item=this.citys.find((item)=>{
+        return item.cityId==val&&item.level==0;
+      })
+      this.editAddressForm.province=item.name;
+    },
+    getCityList(){
+        getAllList().then(res => {
+          this.citys=res.data;
+          this.province=res.data.filter(item => item.level===0 )
+        })
+    },
+    handleEditAddress() {
+        this.getCityList();
+        this.editAddressForm.id=this.order.orderId;
+        this.editAddressForm.realName=this.order.realName;
+        this.editAddressForm.userPhone=this.order.userPhone;
+        var address=this.order.userAddress.split(' ')
+        var province=this.citys.find((item)=>{
+          return item.name==address[0]&&item.level==0;
+        })
+        if(province!=null){
+          this.editAddressForm.provinceId=province.cityId;
+          this.city=this.citys.filter(item => item.parentId===province.cityId&&item.level==1 )
+        }
+        var city=this.citys.find((item)=>{
+          return item.name==address[1]&&item.level==1;
+        })
+
+        if(city!=null){
+          this.editAddressForm.cityId=city.cityId;
+          this.district=this.citys.filter(item => item.parentId===city.cityId&&item.level==2 )
+        }
+        var district=this.citys.find((item)=>{
+          return item.name==address[2]&&item.level==2;
+        })
+        if(district!=null){
+          this.editAddressForm.districtId=district.cityId;
+        }
+
+        this.editAddress.open = true;
+    },
+    /** 提交按钮 */
+    submitEditAddressForm() {
+      this.$refs["editAddressForm"].validate(valid => {
+        if (valid) {
+           this.editAddressForm.userAddress=this.editAddressForm.province+" "+this.editAddressForm.city+" "+this.editAddressForm.district+" "+this.editAddressForm.detail;
+            updateLiveOrder(this.editAddressForm).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("修改成功");
+                this.editAddress.open = false;
+                this.getOrder(this.order.orderId);
+              }
+            });
+        }
+      });
+    },
+    handleEditUser() {
+      const userId = this.order.userId
+      getUser(userId).then(response => {
+        this.editUserForm.userId=response.data.userId;
+        this.editUserForm.registerDate=response.data.registerDate;
+        this.editUserForm.registerCode=response.data.registerCode;
+        this.editUserForm.source=response.data.source;
+        this.editUser.open = true;
+      });
+    },
+    /** 提交按钮 */
+    submitEditUserForm() {
+      this.$refs["editUserForm"].validate(valid => {
+        if (valid) {
+            updateUser(this.editUserForm).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("修改成功");
+                this.editUser.open = false;
+                this.getOrder(this.order.orderId);
+              }
+            });
+        }
+      });
+    },
+    submitEditForm(){
+        this.$refs["editForm"].validate(valid => {
+        if (valid) {
+          updateStoreOrder(this.editForm).then(response => {
+            if (response.code === 200) {
+              this.msgSuccess("操作成功");
+              this.edit.open = false;
+              this.getOrder(this.order.orderId);
+            }
+          });
+
+        }
+      });
+    },
+    editOrder(){
+        this.edit.open=true;
+        this.editForm.mark=this.order.mark
+        this.editForm.id=this.order.orderId;
+        if(this.order.orderType!=null){
+          this.editForm.orderType=this.order.orderType.toString();
+        }
+        this.editForm.scheduleId=this.order.scheduleId;
+        this.editForm.orderVisit = this.order.orderVisit;
+
+    },
+    getOrder(orderId){
+        this.orderId=orderId;
+        this.certificates = null;
+        getLiveOrderAll(orderId).then(response => {
+            this.order = response.order;
+            if(response.order.certificates != null){
+              this.certificates = response.order.certificates;
+            }
+            this.user = response.user;
+            this.logs = response.logs;
+            this.items = response.items;
+            this.payments=response.payments;
+            this.customerInfo=response.customer;
+        });
+
+      this.getExpressList();
+     }
+  }
+};
+</script>
+<style scoped>
+.order-content{
+  margin: 10px;
+}
+.detail-container {
+  width: 80%;
+  padding: 20px 20px 20px 20px;
+  margin: 20px auto;
+}
+
+.operate-container {
+  background: #F2F6FC;
+  height: 60px;
+  margin: -20px -20px 0;
+  line-height: 60px;
+}
+
+.operate-button-container {
+  float: right;
+  margin-right: 20px
+}
+
+.table-layout {
+  margin-top: 20px;
+  border-left: 1px solid #DCDFE6;
+  border-top: 1px solid #DCDFE6;
+}
+
+.table-cell {
+  height: 60px;
+  line-height: 40px;
+  border-right: 1px solid #DCDFE6;
+  border-bottom: 1px solid #DCDFE6;
+  padding: 10px;
+  font-size: 14px;
+  color: #606266;
+  text-align: center;
+  overflow: hidden;
+}
+
+.table-cell-title {
+  border-right: 1px solid #DCDFE6;
+  border-bottom: 1px solid #DCDFE6;
+  padding: 10px;
+  background: #F2F6FC;
+  text-align: center;
+  font-size: 14px;
+  color: #303133;
+}
+</style>

+ 319 - 0
src/views/live/gift/index.vue

@@ -0,0 +1,319 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="礼物名称" prop="giftName">
+        <el-input
+          v-model="queryParams.giftName"
+          placeholder="请输入礼物名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="礼物当前状态" prop="status" label-width="120px">
+        <el-select v-model="queryParams.status" placeholder="请选择礼物当前状态" clearable size="small">
+          <el-option
+            v-for="dict in statusOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          ></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>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:gift:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['live:gift: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:gift:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:gift:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="giftList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="礼物唯一标识" align="center" prop="giftId" />
+      <el-table-column label="礼物名称" align="center" prop="giftName" />
+      <el-table-column label="礼物描述" align="center" prop="description" />
+      <el-table-column label="礼物图标链接地址" align="center" prop="iconUrl" />
+      <el-table-column label="礼物价格" align="center" prop="price" />
+      <el-table-column label="礼物当前状态" align="center" prop="status" :formatter="formatStatus" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:gift:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:gift:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播间礼物配置对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+        <el-form-item label="礼物名称" prop="giftName">
+          <el-input v-model="form.giftName" placeholder="请输入礼物名称" />
+        </el-form-item>
+        <el-form-item label="礼物描述" prop="description">
+          <el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+        <el-form-item label="图标链接地址" prop="iconUrl">
+          <el-input v-model="form.iconUrl" placeholder="请输入礼物图标链接地址" />
+        </el-form-item>
+        <el-form-item label="礼物价格" prop="price">
+          <el-input v-model="form.price" placeholder="请输入礼物价格" />
+        </el-form-item>
+        <el-form-item label="礼物当前状态">
+          <el-radio-group v-model="form.status">
+            <el-radio
+              v-for="dict in statusOptions"
+              :key="dict.dictValue"
+              :label="dict.dictValue"
+            >
+              {{ dict.dictLabel }}
+            </el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listGift, getGift, delGift, addGift, updateGift, exportGift,getDictData } from "@/api/live/gift";
+
+export default {
+  name: "Gift",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播间礼物配置表格数据
+      giftList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        giftName: null,
+        description: null,
+        status: null
+      },
+      statusOptions:[],
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        giftName: [
+          { required: true, message: "礼物名称不能为空", trigger: "blur" }
+        ],
+        price: [
+          { required: true, message: "礼物价格不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+    this.getDict();
+  },
+  methods: {
+    formatStatus(row, column, cellValue) {
+      const found = this.statusOptions.find(d => d.dictValue === cellValue);
+      return found ? found.dictLabel : '未知';
+    },
+    getDict() {
+      getDictData("sys_normal_disable").then(response => {
+        this.statusOptions = response.data;
+      });
+    },
+    /** 查询直播间礼物配置列表 */
+    getList() {
+      this.loading = true;
+      listGift(this.queryParams).then(response => {
+        this.giftList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        giftId: null,
+        giftName: null,
+        description: null,
+        iconUrl: null,
+        price: null,
+        status: "0"
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.giftId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播间礼物配置";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const giftId = row.giftId || this.ids
+      getGift(giftId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改直播间礼物配置";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.giftId != null) {
+            updateGift(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addGift(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const giftIds = row.giftId || this.ids;
+      this.$confirm('是否确认删除直播间礼物配置编号为"' + giftIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delGift(giftIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播间礼物配置数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportGift(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 996 - 0
src/views/live/live/index.vue

@@ -0,0 +1,996 @@
+<template>
+  <div class="app-container">
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:live:add']"
+        >新增</el-button>
+      </el-col>
+
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="直播名称" prop="liveName">
+        <el-input
+          v-model="queryParams.liveName"
+          placeholder="请输入直播名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="直播状态" prop="liveStatus">
+        <el-select
+          v-model="queryParams.status"
+          placeholder="请选择直播状态"
+          clearable
+          size="small"
+        >
+          <el-option label="待直播" value="1"></el-option>
+          <el-option label="直播中" value="2"></el-option>
+          <el-option label="已结束" value="3"></el-option>
+          <el-option label="直播回放中" value="4"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="公司名称" prop="companyName">
+        <el-input
+          v-model="queryParams.companyName"
+          placeholder="请输入公司名称"
+          clearable
+          size="small"
+        />
+      </el-form-item>
+      <el-form-item label="直播类型" prop="liveType">
+        <el-select
+          v-model="queryParams.liveType"
+          placeholder="请选择直播类型"
+          clearable
+          size="small"
+        >
+          <el-option label="直播" value="1"></el-option>
+          <el-option label="录播" value="2"></el-option>
+          <el-option label="直播回放" value="3"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="开始时间" prop="startTimeS">
+        <el-date-picker
+          v-model="queryParams.startTimeS"
+          type="datetime"
+          placeholder="选择起始时间"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          size="small"
+        ></el-date-picker>
+      </el-form-item>
+      <!-- 开始时间-范围结束 -->
+      <el-form-item label="结束时间" prop="endTimeE">
+        <el-date-picker
+          v-model="queryParams.endTimeE"
+          type="datetime"
+          placeholder="选择结束时间"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          size="small"
+          :disabled="!queryParams.startTimeS"
+        ></el-date-picker>
+      </el-form-item>
+      <el-form-item label="上下架" prop="isShow">
+        <el-select
+          v-model="queryParams.isShow"
+          placeholder="请选择上下架状态"
+          clearable
+          size="small"
+        >
+          <el-option label="上架" value="1"></el-option>
+          <el-option label="下架" value="2"></el-option>
+        </el-select>
+      </el-form-item>
+      <!-- 审核状态 -->
+      <el-form-item label="审核状态" prop="isAudit">
+        <el-select
+          v-model="queryParams.isAudit"
+          placeholder="请选择审核状态"
+          clearable
+          size="small"
+        >
+          <el-option label="审核未通过" value="0"></el-option>
+          <el-option label="审核通过" value="1"></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>
+        <el-button icon="el-icon-download" size="mini" v-hasPermi="['live:live:export']" @click="handleExport">导出</el-button>
+      </el-form-item>
+    </el-form>
+    <div class="selection-toolbar">
+      <el-checkbox :indeterminate="isIndeterminate" v-model="allChecked" @change="toggleSelectAll">
+        {{ multipleSelection.length > 0 ? `已选 ${multipleSelection.length} 条` : '选中本页' }}
+      </el-checkbox>
+      <el-button  plain size="mini" @click="handleShelf">上架</el-button>
+      <el-button  plain size="mini" @click="handleUnshelf">下架</el-button>
+      <el-button  plain size="mini" @click="handleDeleteSelected">删除</el-button>
+<!--      <el-dropdown>-->
+<!--        <el-button plain size="mini">-->
+<!--          更多操作<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
+<!--        </el-button>-->
+<!--        <el-dropdown-menu slot="dropdown">-->
+<!--          <el-dropdown-item>操作一</el-dropdown-item>-->
+<!--          <el-dropdown-item>操作二</el-dropdown-item>-->
+<!--        </el-dropdown-menu>-->
+<!--      </el-dropdown>-->
+    </div>
+    <el-table ref="liveTable" v-loading="loading" :data="liveList"  @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55"></el-table-column>
+      <el-table-column label="直播封面" align="center" prop="liveImgUrl" width="180">
+        <template slot-scope="scope">
+          <el-image style="width: 90px;height: 90px;" :src="scope.row.liveImgUrl" mode="aspectFill" :preview-src-list="[scope.row.liveImgUrl]" />
+        </template>
+      </el-table-column>
+      <el-table-column label="直播名称" align="center" prop="liveName" />
+      <el-table-column label="显示类型" align="center" prop="showType">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.showType == 1">横屏</el-tag>
+          <el-tag v-if="scope.row.showType == 2">竖屏</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-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>
+        </template>
+      </el-table-column>
+      <el-table-column label="公司名称" align="center" prop="companyName" >
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.companyName">{{ scope.row.companyName }}</el-tag>
+          <el-tag v-else>总台</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="直播类型" align="center" prop="liveType">
+        <template slot-scope="scope">
+          <el-tag type="danger" v-if="scope.row.liveType == 1">直播</el-tag>
+          <el-tag type="success" v-if="scope.row.liveType == 2">录播</el-tag>
+          <el-tag v-if="scope.row.liveType == 3">直播回放</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="开始时间" align="center" prop="startTime" width="180" />
+      <el-table-column label="结束时间" align="center" prop="finishTime" width="180" />
+      <el-table-column label="上下架" align="center" prop="isShow">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.isShow == 1">上架</el-tag>
+          <el-tag type="danger" v-if="scope.row.isShow == 2">下架</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="审核状态" align="center" prop="isAudit">
+        <template slot-scope="scope">
+          <el-tag type="danger" v-if="scope.row.isAudit == 0">审核未通过</el-tag>
+          <el-tag v-if="scope.row.isAudit == 1">审核通过</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            v-if="scope.row.companyName != '总台'"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:live:edit']"
+          >修改</el-button>
+          <el-button
+            v-if="scope.row.companyName == '总台'"
+            size="mini"
+            type="text"
+            style="color: #00CC66"
+            icon="el-icon-edit"
+            @click="handleView(scope.row)"
+            v-hasPermi="['live:live:edit']"
+          >查看</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-setting"
+            @click="handleConfig(scope.row)"
+            v-hasPermi="['live:config:list']"
+          >配置</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-service"
+            @click="handleManage(scope.row)"
+            v-hasPermi="['live:console:list']"
+          >进入直播间</el-button>
+          <el-dropdown trigger="hover">
+            <el-button size="mini" type="text" icon="el-icon-more">
+              更多
+            </el-button>
+            <el-dropdown-menu slot="dropdown">
+              <!-- 结束按钮 -->
+              <el-dropdown-item
+                v-if="scope.row.status == 2 && scope.row.liveType == 1"
+                @click.native="showLivingUrl(scope.row)"
+              >
+                <i class="el-icon-switch-button"></i> 推流码
+              </el-dropdown-item>
+
+              <!-- 去直播按钮 -->
+              <el-dropdown-item
+                v-if="scope.row.status != 2"
+                @click.native="handleStart(scope.row)"
+              >
+                <i class="el-icon-monitor"></i> 去直播
+              </el-dropdown-item>
+
+              <!-- 进入直播间按钮 -->
+              <el-dropdown-item
+                v-if="scope.row.status == 2"
+                @click.native="handleEnded(scope.row)"
+              >
+                <i class="el-icon-service"></i> 结束
+              </el-dropdown-item>
+              <el-dropdown-item
+                @click.native="handleCopy(scope.row)"
+              >
+                <i class="el-icon-service"></i> 复制直播间
+              </el-dropdown-item>
+              <el-dropdown-item
+                v-if="scope.row.liveCodeUrl == null"
+                @click.native="handleGenerateCode(scope.row)"
+              >
+                <i class="el-icon-service"></i> 生成二维码
+              </el-dropdown-item>
+              <el-dropdown-item
+                v-if="scope.row.liveCodeUrl != null"
+                @click.native="handleCheckCode(scope.row)"
+              >
+                <i class="el-icon-service"></i> 查看二维码
+              </el-dropdown-item>
+            </el-dropdown-menu>
+          </el-dropdown>
+
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <el-dialog
+      title="直播二维码"
+      :visible.sync="qrcodeDialogVisible"
+    width="500px"
+    :close-on-click-modal="true"
+    :show-close="true"
+    top="10vh"
+    >
+    <div class="qrcode-img-container">
+
+      <img
+        :src="currentQrcodeUrl"
+        alt="直播二维码"
+        class="qrcode-img"
+        @error="handleImgError"
+      >
+    </div>
+    </el-dialog>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="直播名称" prop="liveName">
+          <el-input v-model="form.liveName" placeholder="请输入直播名称" :disabled="isViewOnly"/>
+        </el-form-item>
+        <el-form-item label="显示类型" prop="showType">
+          <el-radio-group v-model="form.showType" :disabled="isViewOnly">
+            <el-radio :label="1">横屏</el-radio>
+            <el-radio :label="2">竖屏</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="直播类型" prop="liveType">
+          <el-radio-group v-model="form.liveType" :disabled="isViewOnly">
+            <el-radio :label="1">直播</el-radio>
+            <el-radio :label="2">录播</el-radio>
+          </el-radio-group>
+        </el-form-item>
+<!--        <el-form-item label="直播达人" prop="talentId">-->
+<!--          <el-select filterable v-model="form.talentId" placeholder="请选择达人">-->
+<!--            <el-option-->
+<!--              v-for="item in talentList"-->
+<!--              :key="item.talentId"-->
+<!--              :label="item.nickName"-->
+<!--              :value="item.talentId">-->
+<!--            </el-option>-->
+<!--          </el-select>-->
+<!--        </el-form-item>-->
+        <el-form-item label="直播描述" prop="liveDesc">
+          <Editor ref="myeditor" :height="300" @on-text-change="updateText"  />
+          <!--          <Editor v-model="form.liveDesc" :height="300" placeholder="直播描述" />-->
+        </el-form-item>
+        <el-form-item label="录播视屏" prop="videoUrl" v-if="form.liveType == 2" >
+          <video-upload :fileKey.sync="form.fileKey" :fileSize.sync="form.fileSize"
+                        :videoUrl.sync="form.videoUrl" :fileName.sync="form.fileName" :line_1.sync="form.lineOne"
+                        :uploadType.sync="form.uploadType" :isTranscode.sync="form.isTranscode"
+                        :isViewOnly="isViewOnly"
+                        ref="videoUpload"
+                        :transcodeFileKey.sync="form.transcodeFileKey" @video-duration="handleVideoDuration"
+                        @change="handleVideoChange"></video-upload>
+        </el-form-item>
+<!--        <video-upload-->
+<!--          v-if="form.liveType == 2"-->
+<!--          :type = "1"-->
+<!--          :isPrivate = "isPrivate"-->
+<!--          :fileKey.sync = "form.fileKey"-->
+<!--          :fileSize.sync = "form.fileSize"-->
+<!--          :videoUrl.sync="videoUrl"-->
+<!--          :fileName.sync="form.fileName"-->
+<!--          :line_2.sync="form.lineTwo"-->
+<!--          :line_1.sync="form.lineOne"-->
+<!--          :thumbnail.sync="form.thumbnail"-->
+<!--          :uploadType.sync="form.uploadType"-->
+<!--          :isTranscode.sync="form.isTranscode"-->
+<!--          :transcodeFileKey.sync="form.transcodeFileKey"-->
+<!--          @video-duration="handleVideoDuration"-->
+<!--          @change="handleVideoChange"-->
+<!--          ref="videoUpload"-->
+<!--          append-to-body-->
+<!--        />-->
+        <el-form-item label="开始时间" prop="startTime">
+          <el-date-picker size="small"
+                          v-model="form.startTime"
+                          @change="timeChange"
+                          type="datetime"
+                          :disabled="isViewOnly"
+                          format="yyyy-MM-dd HH:mm:ss"
+                          value-format="yyyy-MM-dd HH:mm:ss"
+                          :picker-options="{
+                            timePickerOptions: {
+                              selectableRange: '00:00:00 - 23:59:59',
+                              format: 'HH:mm:ss'
+                            }
+                          }"
+                          placeholder="选择开始时间">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="结束时间" prop="finishTime" v-loading="timeLoading">
+          <el-date-picker size="small"
+                          v-model="form.finishTime"
+                          type="datetime"
+                          :disabled="isViewOnly"
+                          format="yyyy-MM-dd HH:mm:ss"
+                          value-format="yyyy-MM-dd HH:mm:ss"
+                          :picker-options="{
+                            timePickerOptions: {
+                              selectableRange: '00:00:00 - 23:59:59',
+                              format: 'HH:mm:ss'
+                            }
+                          }"
+                          placeholder="视屏播放结束">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="直播封面" prop="liveImgUrl">
+          <image-upload v-model="form.liveImgUrl" :limit="1" :disabled="isViewOnly"/>
+        </el-form-item>
+        <el-form-item label="上下架" prop="isShow">
+          <el-radio-group v-model="form.isShow" :disabled="isViewOnly">
+            <el-radio :label="1">上架</el-radio>
+            <el-radio :label="2">下架</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm" v-show="!isViewOnly">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog
+      title="提示"
+      :visible.sync="rtmpUrlVisible"
+      width="30%"
+    >
+      <div>服务器地址:{{serverName}}</div>
+      <div>推流码:{{livingCode}}</div>
+      <span slot="footer" class="dialog-footer">
+    <el-button type="primary" @click="rtmpUrlVisible = false">确 定</el-button>
+  </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  listLive,
+  getLive,
+  delLive,
+  addLive,
+  updateLive,
+  exportLive,
+  selectCompanyTalent,
+  handleShelfOrUn,
+  handleDeleteSelected,
+  finishLive,
+  startLive, copyLive,generateCode
+} from "@/api/live/live";
+import Editor from '@/components/Editor/wang';
+import user from '@/store/modules/user';
+import VideoUpload from "@/components/LiveVideoUpload/single.vue";
+
+export default {
+  name: "Live",
+  components: { Editor,VideoUpload },
+  data() {
+    return {
+      // 是否只读
+      isViewOnly:false,
+      baseUrl: process.env.VUE_APP_BASE_API,
+      uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
+      isPrivate:null,
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      timeLoading: false,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播表格数据
+      liveList: [],
+      // 达人列表
+      talentList: [{talentId:111,nickName:"测试达人"},{talentId:222,nickName:"测试达人2"}],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      liveDesc:null,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveName: null,
+        liveDesc: null,
+        showType: null,
+        status: null,
+        anchorId: null,
+        startTimeS: null,
+        endTimeE: null,
+        liveType: null,
+        startTime: null,
+        finishTime: null,
+        liveImgUrl: null,
+        liveConfig: null,
+        isShow: null,
+        isDel: null,
+        qwQrCode: null,
+        rtmpUrl: null,
+      },
+      // 表单参数
+      form: {
+        uploadType: 1,
+        isTranscode:0,
+        transcodeFileKey:null,
+        videoUrl: null,
+        fileKey: null,
+        fileName: null,
+        fileSize: null,
+        lineOne: null,
+      },
+      // 表单校验
+      rules: {
+        liveName: [
+          { required: true, message: "不能为空", trigger: "burl" }
+        ],
+        showType: [
+          { required: true, message: "不能为空", trigger: "burl" }
+        ],
+        liveType: [
+          { required: true, message: "不能为空", trigger: "burl" }
+        ],
+        startTime: [
+          { required: true, message: "不能为空", trigger: "burl" }
+        ],
+        liveImgUrl: [
+          { required: true, message: "不能为空", trigger: "burl" }
+        ],
+        isShow: [
+          { required: true, message: "不能为空", trigger: "change" }
+        ],
+        talentId: [
+          { required: true, message: "不能为空", trigger: "change" }
+        ]
+      },
+      multipleSelection: [],
+      allChecked: false,
+      isIndeterminate: false,
+      rtmpUrlVisible:false,
+      serverName: '',
+      livingCode:'',
+      videoUrl: "",
+      qrcodeDialogVisible: false,  // 弹窗显示状态:默认隐藏
+      currentQrcodeUrl: "",        // 当前要展示的二维码地址
+      defaultImg: "https://via.placeholder.com/400x400?text=二维码加载失败"  // 占位图
+    };
+  },
+  created() {
+    this.getList();
+  },
+  watch: {
+    'form.startTime': {
+      handler(newVal) {
+        // 1. 若 startTime 为空,直接返回(避免无效处理)
+        if (!newVal) return;
+
+        // 2. 将字符串时间转为 Date 对象(处理 "yyyy-MM-dd HH:mm:ss" 格式)
+        const timeObj = new Date(newVal);
+        // 兼容时间解析失败的情况(如格式错误)
+        if (isNaN(timeObj.getTime())) return;
+
+        // 3. 强制将秒数设为 1 并补零(即 01 秒)
+        timeObj.setSeconds(1); // 固定秒数为 1
+        const formattedSeconds = this.pad(timeObj.getSeconds()); // 补零为 "01"
+
+        // 4. 重新拼接完整的时间字符串(保持原格式:yyyy-MM-dd HH:mm:ss)
+        const year = timeObj.getFullYear();
+        const month = this.pad(timeObj.getMonth() + 1); // 月份从 0 开始,需 +1
+        const day = this.pad(timeObj.getDate());
+        const hours = this.pad(timeObj.getHours());
+        const minutes = this.pad(timeObj.getMinutes());
+
+        // 5. 更新 form.startTime,完成格式强制修正
+        this.form.startTime = `${year}-${month}-${day} ${hours}:${minutes}:${formattedSeconds}`;
+      },
+      immediate: true, // 初始化时立即执行一次(确保初始值也符合格式)
+      deep: false // startTime 是字符串,无需深度监听
+    }
+  },
+  methods: {
+    beforeAvatarUpload(file) {
+      const isLt1M = file.size / 1024 / 1024 < 1;
+      if (!isLt1M) {
+        this.$message.error('上传图片大小不能超过 1MB!');
+      }
+      return   isLt1M;
+    },
+    handleAvatarSuccess(res, file) {
+      if(res.code==200){
+        this.form.thumbnail=res.url;
+        this.$forceUpdate()
+      }
+      else{
+        this.msgError(res.msg);
+      }
+    },
+    handleShelf(){
+      if (this.multipleSelection.length > 0) {
+        var liveList = []
+          this.multipleSelection.forEach(item => {
+            liveList.push(item.liveId);
+          })
+        handleShelfOrUn({"liveIds":liveList,"isShow":1}).then(res=>{
+          if (res.code == 200) {
+            this.getList();
+            this.$refs.liveTable.clearSelection();
+          } else {
+            this.$message.error(res.msg);
+          }
+        })
+      } else {
+        this.$message.info("请选择上架直播!")
+      }
+
+    },
+    handleUnshelf(){
+      if (this.multipleSelection.length > 0) {
+        var liveList = []
+        this.multipleSelection.forEach(item => {
+          console.log(typeof(item.liveId))
+          console.log(item.liveId)
+          liveList.push(item.liveId);
+        })
+        handleShelfOrUn({"liveIds":liveList,"isShow":2}).then(res=>{
+          if (res.code == 200) {
+            this.getList();
+            this.$refs.liveTable.clearSelection();
+          } else {
+            this.$message.error(res.msg);
+          }
+        })
+      } else {
+        this.$message.info("请选择下架直播!")
+      }
+    },
+    handleDeleteSelected(){
+      if (this.multipleSelection.length > 0) {
+        var liveList = []
+        this.multipleSelection.forEach(item => {
+          liveList.push(item.liveId);
+        })
+        handleDeleteSelected({"liveIds":liveList}).then(res=>{
+          if (res.code == 200) {
+            this.getList();
+            this.$refs.liveTable.clearSelection();
+          } else {
+            this.$message.error(res.msg);
+          }
+        })
+      } else {
+        this.$message.info("请选择被删除的直播!")
+      }
+    },
+    // 全选或取消全选
+    toggleSelectAll(val) {
+      this.checked = val; // 更新 checkbox 的状态
+      if (val) {
+        // 如果 checkbox 被选中,则全选
+        this.toggleSelection(this.liveList);
+      } else {
+        // 如果 checkbox 被取消选中,则取消全选
+        this.toggleSelection();
+      }
+    },
+    toggleSelection(rows) {
+      if (rows && !this.isIndeterminate) {
+        rows.forEach(row => {
+          this.$refs.liveTable.toggleRowSelection(row);
+        });
+      } else {
+        this.$refs.liveTable.clearSelection();
+      }
+    },
+    // 多选框选中数据
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+      // 根据选择项的数量更新 checkbox 的状态
+      this.allChecked = val.length === this.liveList.length;
+      this.isIndeterminate = val.length > 0 && val.length < this.liveList.length;
+    },
+    /** 查询直播列表 */
+    getList() {
+      this.loading = true;
+      listLive(this.queryParams).then(response => {
+        this.liveList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    handleVideoDuration(duration) {
+      this.form.duration = duration;
+    },
+    handleVideoChange(videoUrl,lineOne){
+      this.videoUrl = videoUrl;
+      this.form.videoUrl = videoUrl;
+    },
+    changeDuration(e){
+      this.form.duration = e.duration;
+      this.form.durationTime = e.time;
+      this.$forceUpdate();
+      this.timeChange();
+    },
+    timeChange(){
+      if(!this.form.startTime) return;
+      if(!this.form.duration) return;
+      const startDateTime = new Date(this.form.startTime);
+      // 将视频时长(秒)加到开始时间
+      const endDateTime = new Date(startDateTime.getTime() + this.form.duration * 1000); // 毫秒为单位
+      // 格式化为年月日 时分秒
+      this.form.finishTime = this.formatDate(endDateTime);
+      this.$forceUpdate();
+    },
+    // 将秒数转换为时分秒
+    secondsToTime(seconds) {
+      const hours = Math.floor(seconds / 3600);
+      const minutes = Math.floor((seconds % 3600) / 60);
+      const secs = Math.floor(seconds % 60);
+      return `${this.pad(hours)}:${this.pad(minutes)}:${this.pad(secs)}`;
+    },
+    // 补零处理
+    pad(number) {
+      return number < 10 ? `0${number}` : number;
+    },
+    // 格式化日期为 年月日 时分秒
+    formatDate(date) {
+      const year = date.getFullYear();
+      const month = (date.getMonth() + 1).toString().padStart(2, '0');
+      const day = date.getDate().toString().padStart(2, '0');
+      const hours = date.getHours().toString().padStart(2, '0');
+      const minutes = date.getMinutes().toString().padStart(2, '0');
+      const seconds = date.getSeconds().toString().padStart(2, '0');
+
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        showType: 1,
+        liveType: 2,
+        isShow: 1,
+        isTranscode:0,
+        uploadType:1,
+        transcodeFileKey:null
+      };
+      this.videoUrl = "";
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.queryParams.status = null;
+      this.handleQuery();
+    },
+
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.isViewOnly = false
+      this.reset();
+      this.open = true;
+
+      setTimeout(() => {
+        this.$refs.myeditor.setText("");
+        this.$refs.videoUpload.reset();
+      }, 100);
+      this.title = "添加直播间";
+    },
+    updateText(text){
+      setTimeout(() => {
+        if (this.isViewOnly) {
+          this.$refs.myeditor.setText(this.liveDesc);
+          this.form.liveDesc=this.liveDesc;
+        } else {
+          this.form.liveDesc=text;
+        }
+      }, 1);
+
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.isViewOnly = false
+      this.reset();
+      const liveId = row.liveId || this.ids
+      getLive(liveId).then(response => {
+        this.form = response.data;
+        if(this.form.duration){
+          this.form.durationTime = this.secondsToTime(this.form.duration)
+        }
+        this.liveDesc = this.form.liveDesc
+
+        setTimeout(() => {
+          if(this.form.liveDesc==null){
+            this.$refs.myeditor.setText("");
+          }else{
+            this.$refs.myeditor.setText(this.form.liveDesc);
+          }
+          this.form.videoUrl = row.videoUrl
+        }, 1);
+        this.open = true;
+        this.title = "修改直播间";
+      });
+    },
+    /** 修改按钮操作 */
+    handleView(row) {
+      this.isViewOnly = true
+      this.reset();
+      const liveId = row.liveId || this.ids
+      getLive(liveId).then(response => {
+        this.form = response.data;
+        if(this.form.duration){
+          this.form.durationTime = this.secondsToTime(this.form.duration)
+        }
+        this.liveDesc = this.form.liveDesc
+
+        setTimeout(() => {
+          if(this.form.liveDesc==null){
+            this.$refs.myeditor.setText("");
+          }else{
+            this.$refs.myeditor.setText(this.form.liveDesc);
+          }
+          this.form.videoUrl = row.videoUrl
+        }, 1);
+        this.open = true;
+        this.title = "查看直播间";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      if(this.form.liveId != null) { this.videoUrl = this.form.videoUrl; }
+      if(this.form.liveType==2 && this.videoUrl.length == 0) {return this.$message.error("请上传视频");}
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          this.form.videoUrl = this.videoUrl;
+          if (this.form.liveId != null) {
+            updateLive(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addLive(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const liveIds = row.liveId || this.ids;
+      this.$confirm('是否确认删除直播编号为"' + liveIds + '"的数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return delLive(liveIds);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    handleConfig(row) {
+      console.info(row)
+      this.$router.push('/live/liveConfig/' + row.liveId)
+    },
+    handleManage(row) {
+      const routeUrl = this.$router.resolve({
+        path: `/live/liveConsole/` + row.liveId
+      }).href;
+      window.open(routeUrl, '_blank')
+      // this.$router.push('/live/liveConsole/' + row.liveId)
+    },
+    handleEnded(row){
+      this.$confirm('是否确认关闭直播间?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        finishLive({"liveId":row.liveId}).then(response=>{this.getList()})
+      }).catch(() => {});
+    },
+    handleCopy(row){
+      this.$confirm('是否确认复制直播间?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.loading = true;
+        copyLive({"liveId":row.liveId}).then(response=>{this.getList();this.loading = false;})
+      }).catch(() => {});
+    },
+    handleGenerateCode(row){
+      this.$confirm('是否确认生成直播间小程序二维码?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        generateCode({"liveId":row.liveId}).then(response=>{
+          if(response.code == 200){
+            row.liveCodeUrl = response.data.liveCodeUrl
+          }
+        })
+      }).catch(() => {});
+    },
+    // 查看二维码图片
+    handleCheckCode(row) {
+      // 先校验图片地址是否存在
+      if (!row.liveCodeUrl) {
+        this.$message.warning("二维码图片地址不存在,请稍后重试");
+        return;
+      }
+      // 赋值当前图片地址 + 打开弹窗
+      this.currentQrcodeUrl = row.liveCodeUrl;
+      this.qrcodeDialogVisible = true;
+    },
+    // 2. 图片加载失败:替换为占位图
+    handleImgError(e) {
+      e.target.src = this.defaultImg;
+    },
+    handleStart(row){
+      if(row.isShow == 2){
+        this.$message.error("直播间已下架")
+        return
+      }
+      this.$confirm('是否确认开启直播间?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        startLive({"liveId":row.liveId}).then(response=>{this.getList()})
+      }).catch(() => {});
+    },
+    showLivingUrl(row){
+      this.serverName=''
+      this.livingCode=''
+      this.rtmpUrlVisible = true
+      this.serverName = row.rtmpUrl.slice(0,row.rtmpUrl.lastIndexOf('/') + 1)
+      this.livingCode = row.rtmpUrl.slice(row.rtmpUrl.lastIndexOf('/') + 1)
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportLive(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {});
+    }
+  }
+};
+</script>
+
+<style scoped>
+.selection-toolbar {
+  display: flex;
+  align-items: center;
+  margin-bottom: 10px;
+  padding-left: 10px;
+}
+
+.selection-toolbar .el-checkbox {
+  margin-right: 10px;
+}
+
+/* 调整 checkbox 内部输入框的对齐 */
+.selection-toolbar .el-checkbox .el-checkbox__inner {
+  top: 8px; /* 根据实际需求调整 */
+}
+/* 图片容器:居中 + 内边距 */
+.qrcode-img-container {
+  text-align: center;
+  padding: 20px 0;
+}
+
+/* 图片样式:自适应弹窗宽度,避免溢出 */
+.qrcode-img {
+  max-width: 100%;    /* 最大宽度不超过容器 */
+  max-height: 400px;  /* 最大高度限制,避免过高 */
+  cursor: pointer;    /* 鼠标悬浮变指针,提示可点击 */
+  transition: all 0.3s ease;  /* 过渡动画,hover 更流畅 */
+}
+
+/* 图片 hover 效果:轻微放大 */
+.qrcode-img:hover {
+  transform: scale(1.02);
+  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);  /* 加阴影增强层次感 */
+}
+
+/* 底部提示文字样式 */
+.qrcode-footer {
+  text-align: center !important;  /* 覆盖 Element 默认样式,居中显示 */
+}
+
+.text-gray {
+  color: #666;
+  font-size: 12px;
+}
+</style>

+ 457 - 0
src/views/live/liveAfteraSales/index.vue

@@ -0,0 +1,457 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+
+      <el-form-item label="所属部门" prop="deptId">
+        <treeselect style="width:220px" v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择所属部门" />
+      </el-form-item>
+
+      <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="companyUserNickName">
+        <el-input
+          v-model="queryParams.companyUserNickName"
+          placeholder="请输入员工姓名"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="手机号" prop="consigneePhone">
+        <el-input
+          v-model="queryParams.consigneePhone"
+          placeholder="请输入手机号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+
+
+      <el-form-item label="退款类型" prop="serviceType">
+        <el-select  v-model="queryParams.serviceType" placeholder="请选择退款类型" clearable size="small" >
+          <el-option
+            v-for="item in serviceTypeOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue"
+          />
+        </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="item in statusOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="售后状态" prop="salesStatus">
+        <el-select   v-model="queryParams.salesStatus" placeholder="请选择状态" clearable size="small" >
+          <el-option
+            v-for="item in salesStatusOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="订单状态" prop="orderStatus">
+        <el-select   v-model="queryParams.orderStatus" placeholder="请选择订单状态" clearable size="small" >
+          <el-option
+            v-for="item in orderStatusOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="物流状态" prop="deliveryStatus">
+        <el-select   v-model="queryParams.deliveryStatus" placeholder="请选择物流状态" clearable size="small" >
+          <el-option
+            v-for="item in deliveryStatusOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="物流单号" prop="deliverySn">
+        <el-input
+          v-model="queryParams.deliverySn"
+          placeholder="物流/退回物流单号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"/>
+      </el-form-item>
+
+
+      <el-form-item label="提交时间" prop="createTime">
+        <el-date-picker
+          style="width:205.4px"
+          clearable size="small"
+          v-model="dateRange"
+          type="daterange"
+          value-format="yyyy-MM-dd"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="cyan" 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">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          :disabled="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveAfteraSales:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveAfterSalesList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="ID" align="center" prop="id" />
+      <el-table-column label="所属公司" align="center" prop="companyName" />
+      <el-table-column label="所属员工" align="center" prop="companyUserNickName" />
+      <el-table-column label="订单单号" align="center" prop="orderCode" />
+      <el-table-column label="会员手机号" align="center" prop="userPhone" />
+      <el-table-column label="退款金额" align="center" prop="refundAmount" />
+      <el-table-column label="退款类型" align="center" prop="serviceType" >
+        <template slot-scope="scope">
+          <div prop="serviceType" v-for="(item, index) in serviceTypeOptions"    v-if="scope.row.serviceType==item.dictValue">{{item.dictLabel}}</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="申请原因" align="center" prop="reasons" />
+      <el-table-column label="说明" align="center" prop="explains" />
+      <el-table-column label="状态" align="center" prop="status" >
+        <template slot-scope="scope">
+          <div prop="status" v-for="(item, index) in statusOptions"    v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="售后状态" align="center" prop="salesStatus" >
+        <template slot-scope="scope">
+          <div prop="status" v-for="(item, index) in salesStatusOptions"    v-if="scope.row.salesStatus==item.dictValue">{{item.dictLabel}}</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="订单状态" align="center" prop="orderStatus" >
+        <template slot-scope="scope">
+          <div prop="status" v-for="(item, index) in orderStatusOptions"    v-if="scope.row.orderStatus==item.dictValue">{{item.dictLabel}}</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="物流状态" align="center" prop="deliveryStatus" >
+        <template slot-scope="scope">
+          <el-tag prop="status" v-for="(item, index) in deliveryStatusOptions"    v-if="scope.row.deliveryStatus==item.dictValue">{{item.dictLabel}}</el-tag>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="物流单号" align="center" prop="deliveryId" />
+
+      <el-table-column label="客户退回物流单号" align="center" prop="deliverySn" />
+      <el-table-column label="客户退货物流名称" align="center" prop="deliveryName" />
+
+      <el-table-column label="提交时间" align="center" prop="createTime" />
+
+      <el-table-column label="操作" align="center" fixed="right" width="100px" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleShow(scope.row)"
+            v-hasPermi="['store:storeAfterSales:query']"
+          >查看</el-button>
+
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+    <el-drawer
+      size="75%"
+      :title="title" :visible.sync="open"
+    >
+      <product-after-sales-order  ref="afterSalesOrder" />
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import { listLiveAfterSales, getLiveAfterSales, delLiveAfterSales, addLiveAfterSales, updateLiveAfterSales, exportLiveAfterSales } from "@/api/live/liveAfterSales";
+import {getCompanyList} from "@/api/company/company";
+import Treeselect from "@riophae/vue-treeselect";
+import {treeselect} from "@/api/company/companyDept";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import productAfterSalesOrder from "../components/productAfterSalesOrder";
+
+export default {
+  name: "LiveAfterSales",
+  components: {productAfterSalesOrder, Treeselect},
+  data() {
+    return {
+      dateRange:[],
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 售后记录表格数据
+      liveAfterSalesList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        orderCode: null,
+        refundAmount: null,
+        serviceType: null,
+        reasons: null,
+        explains: null,
+        explainImg: null,
+        shipperCode: null,
+        deliverySn: null,
+        deliveryName: null,
+        status: null,
+        salesStatus: null,
+        isDel: null,
+        userId: null,
+        consignee: null,
+        phoneNumber: null,
+        address: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      },
+      orderStatusOptions:[],
+      deliveryStatusOptions:[],
+      serviceTypeOptions:[],
+      salesStatusOptions:[],
+      statusOptions:[],
+      deptOptions:[],
+    };
+  },
+  watch: {
+    // 根据名称筛选部门树
+    deptName(val) {
+      this.$refs.tree.filter(val);
+    },
+  },
+  created() {
+    this.getTreeselect();
+    this.getDicts("store_after_sales_sales_status").then((response) => {
+      this.salesStatusOptions = response.data;
+    });
+    this.getDicts("store_after_sales_status").then((response) => {
+      this.statusOptions = response.data;
+    });
+    this.getDicts("store_after_sales_service_type").then((response) => {
+      this.serviceTypeOptions = response.data;
+    });
+    this.getDicts("store_order_delivery_status").then((response) => {
+      this.deliveryStatusOptions = response.data;
+    });
+    this.getDicts("store_order_status").then((response) => {
+      this.orderStatusOptions = response.data;
+    });
+
+    this.getList();
+  },
+  methods: {
+    handleShow(row){
+      this.title="售后订单"
+      this.open=true;
+      setTimeout(() => {
+        this.$refs.afterSalesOrder.getLiveAfterSales(row.id);
+      }, 200);
+    },
+    /** 查询售后记录列表 */
+    getList() {
+      this.loading = true;
+      listLiveAfterSales(this.queryParams).then(response => {
+        this.liveAfterSalesList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        liveId: null,
+        storeId: null,
+        orderId: null,
+        refundAmount: null,
+        refundType: null,
+        reasons: null,
+        explains: null,
+        explainImg: null,
+        deliveryCode: null,
+        deliverySn: null,
+        deliveryName: null,
+        status: 0,
+        salesStatus: 0,
+        orderStatus: 0,
+        createTime: null,
+        isDel: null,
+        userId: null,
+        consignee: null,
+        phoneNumber: null,
+        address: null,
+        companyId: null,
+        companyUserId: null,
+        deptId: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加售后记录";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getLiveAfterSales(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改售后记录";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateLiveAfterSales(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addLiveAfterSales(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除售后记录编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveAfterSales(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有售后记录数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveAfterSales(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {
+        this.exportLoading = false;
+      });
+    },
+    getTreeselect() {
+      var param={companyId:this.companyId}
+      treeselect(param).then((response) => {
+        this.deptOptions = response.data;
+        console.log(this.deptOptions)
+        if(response.data!=null&&response.data.length>0){
+          //this.queryParams.deptId=response.data[0].id;
+        }
+      });
+    },
+    companyChange(val){
+      console.log(val);
+      this.companyId=val;
+      this.getTreeselect();
+    },
+    currDeptChange(val){
+      console.log(val)
+      this.queryParams.deptId=val;
+      this.getList();
+    },
+  }
+};
+</script>

+ 359 - 0
src/views/live/liveAnchor/index.vue

@@ -0,0 +1,359 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="昵称" prop="nickName">
+        <el-input
+          v-model="queryParams.nickName"
+          placeholder="请输入昵称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="密码" prop="password">
+        <el-input
+          v-model="queryParams.password"
+          placeholder="请输入密码"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="手机号" prop="mobile">
+        <el-input
+          v-model="queryParams.mobile"
+          placeholder="请输入手机号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="微信OPENID" prop="openId">
+        <el-input
+          v-model="queryParams.openId"
+          placeholder="请输入微信OPENID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="身份证反面" prop="idCardBackUrl">
+        <el-input
+          v-model="queryParams.idCardBackUrl"
+          placeholder="请输入身份证反面"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="身份证正面" prop="idCardFrontUrl">
+        <el-input
+          v-model="queryParams.idCardFrontUrl"
+          placeholder="请输入身份证正面"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="状态  1正常 0禁用" prop="status">
+        <el-select v-model="queryParams.status" placeholder="请选择状态  1正常 0禁用" clearable size="small">
+          <el-option label="请选择字典生成" value="" />
+        </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>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:liveAnchor:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['live:liveAnchor: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:liveAnchor:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveAnchor:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveAnchorList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="ID" align="center" prop="anchorId" />
+      <el-table-column label="昵称" align="center" prop="nickName" />
+      <el-table-column label="密码" align="center" prop="password" />
+      <el-table-column label="手机号" align="center" prop="mobile" />
+      <el-table-column label="微信OPENID" align="center" prop="openId" />
+      <el-table-column label="身份证反面" align="center" prop="idCardBackUrl" />
+      <el-table-column label="身份证正面" align="center" prop="idCardFrontUrl" />
+      <el-table-column label="状态  1正常 0禁用" align="center" prop="status" />
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:liveAnchor:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:liveAnchor:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改主播对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="昵称" prop="nickName">
+          <el-input v-model="form.nickName" placeholder="请输入昵称" />
+        </el-form-item>
+        <el-form-item label="密码" prop="password">
+          <el-input v-model="form.password" placeholder="请输入密码" />
+        </el-form-item>
+        <el-form-item label="手机号" prop="mobile">
+          <el-input v-model="form.mobile" placeholder="请输入手机号" />
+        </el-form-item>
+        <el-form-item label="微信OPENID" prop="openId">
+          <el-input v-model="form.openId" placeholder="请输入微信OPENID" />
+        </el-form-item>
+        <el-form-item label="身份证反面" prop="idCardBackUrl">
+          <el-input v-model="form.idCardBackUrl" placeholder="请输入身份证反面" />
+        </el-form-item>
+        <el-form-item label="身份证正面" prop="idCardFrontUrl">
+          <el-input v-model="form.idCardFrontUrl" placeholder="请输入身份证正面" />
+        </el-form-item>
+        <el-form-item label="状态  1正常 0禁用">
+          <el-radio-group v-model="form.status">
+            <el-radio label="1">请选择字典生成</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" placeholder="请输入备注" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveAnchor, getLiveAnchor, delLiveAnchor, addLiveAnchor, updateLiveAnchor, exportLiveAnchor } from "@/api/live/liveAnchor";
+
+export default {
+  name: "LiveAnchor",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 主播表格数据
+      liveAnchorList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        nickName: null,
+        password: null,
+        mobile: null,
+        openId: null,
+        idCardBackUrl: null,
+        idCardFrontUrl: null,
+        status: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询主播列表 */
+    getList() {
+      this.loading = true;
+      listLiveAnchor(this.queryParams).then(response => {
+        this.liveAnchorList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        anchorId: null,
+        nickName: null,
+        password: null,
+        mobile: null,
+        openId: null,
+        idCardBackUrl: null,
+        idCardFrontUrl: null,
+        status: 0,
+        createTime: null,
+        createBy: null,
+        updateBy: null,
+        updateTime: null,
+        remark: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.anchorId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加主播";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const anchorId = row.anchorId || this.ids
+      getLiveAnchor(anchorId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改主播";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.anchorId != null) {
+            updateLiveAnchor(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addLiveAnchor(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const anchorIds = row.anchorId || this.ids;
+      this.$confirm('是否确认删除主播编号为"' + anchorIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveAnchor(anchorIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有主播数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveAnchor(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 260 - 0
src/views/live/liveConfig/answer.vue

@@ -0,0 +1,260 @@
+<template>
+  <div class="container-md">
+    <div class="tip-box">
+      选择用于本节直播课程的题库试题,试题可用于直播间内发送
+      <el-link
+        type="primary"
+        style="margin-left: 5px;"
+        @click="handleToQuestionBank"
+      >配置题库试题 >></el-link>
+    </div>
+
+    <el-button type="primary" icon="el-icon-plus" style="margin: 20px 0;" @click="handleAddQuestion">添加试题</el-button>
+    <!-- 试题列表表格 -->
+    <el-table
+      :data="questionLiveList"
+      style="width: 100%"
+      v-loading="loading"
+    >
+      <!-- 题干列:显示试题的主要内容 -->
+      <el-table-column
+        prop="title"
+        label="题干"
+        show-overflow-tooltip
+      ></el-table-column>
+
+      <!-- 题型列:显示是单选还是多选 -->
+      <el-table-column
+        prop="type"
+        label="题型"
+      >
+        <template slot-scope="scope">
+          {{ scope.row.type === 1 ? '单选题' : '多选题' }}
+        </template>
+      </el-table-column>
+
+      <!-- 创建时间列:显示试题创建的时间 -->
+      <el-table-column
+        prop="createTime"
+        label="创建时间"
+      ></el-table-column>
+
+      <!-- 操作列:包含编辑和删除按钮 -->
+      <el-table-column
+        label="操作"
+        width="180"
+        fixed="right"
+      >
+        <template slot-scope="scope">
+          <!-- 删除按钮:用于移除试题 -->
+          <el-button
+            type="text"
+            size="small"
+            style="color: #F56C6C;"
+            @click="handleDelete(scope.row)"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页组件:用于分页展示试题列表 -->
+    <pagination
+      v-show="questionTotal > 0"
+      :total="questionTotal"
+      :page.sync="questionParams.pageNum"
+      :limit.sync="questionParams.pageSize"
+      @pagination="getLiveQuestionLiveList"
+      style="margin-top: 20px;"
+    />
+
+    <!-- 添加试题弹窗 -->
+    <el-dialog
+      title="添加试题"
+      :visible.sync="questionDialogVisible"
+      width="800px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
+      <div class="dialog-content">
+        <div style="text-align: right; margin-bottom: 20px;">
+          <el-input
+            v-model="searchTitle"
+            placeholder="请输入搜索内容"
+            style="width: 300px;"
+            @input="handleQuestionSearch"
+          ></el-input>
+        </div>
+
+        <el-table
+          ref="questionTable"
+          :data="questionList"
+          style="width: 100%"
+          v-loading="questionLoading"
+          @selection-change="handleSelectionChange"
+          @row-click="handleRowClick"
+          row-key="id"
+        >
+          <!-- 复选框列:用于多选试题 -->
+          <el-table-column
+            type="selection"
+            width="55"
+          >
+          </el-table-column>
+          <!-- 题干列:显示试题的主要内容 -->
+          <el-table-column
+            prop="title"
+            label="题干"
+            class-name="clickable-column"
+          ></el-table-column>
+          <!-- 题型列:显示单选或多选 -->
+          <el-table-column
+            prop="type"
+            label="题型"
+            class-name="clickable-column"
+          >
+            <template slot-scope="scope">
+              {{ scope.row.type === 1 ? '单选题' : '多选题' }}
+            </template>
+          </el-table-column>
+          <!-- 创建人列 -->
+          <el-table-column
+            prop="createBy"
+            label="创建人"
+            class-name="clickable-column"
+          ></el-table-column>
+          <!-- 创建时间列 -->
+          <el-table-column
+            prop="createTime"
+            label="创建时间"
+            width="150"
+            class-name="clickable-column"
+          ></el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="total > 0"
+          :total="total"
+          :page.sync="queryParams.pageNum"
+          :limit.sync="queryParams.pageSize"
+          @pagination="getQuestionList"
+          style="margin-top: 20px;"
+        />
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <div style="display: flex; justify-content: space-between; align-items: center;">
+          <span class="selected-count">当前已选择 <span style="color: #00BFFF; font-style: italic;">{{ selectedQuestions.length }}</span> 题</span>
+          <div>
+            <el-button @click="questionDialogVisible = false">取 消</el-button>
+            <el-button type="primary" @click="confirmAddQuestion">确 定</el-button>
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+import {addLiveQuestionLive, listLiveQuestionLive, listLiveQuestionOptionList} from "@/api/live/liveQuestionLive";
+
+export default {
+  data() {
+    return {
+      questionDialogVisible: false,
+      questionLoading: false,
+      questionTotal: 0,
+      selectedQuestions: [],
+      questionLiveList: [],
+      questionList: [],
+      loading: true,
+      searchTitle: '',
+      total: 0,
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        title: null,
+        liveId: null
+      },
+      questionParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null
+      },
+    };
+  },
+  created() {
+    this.liveId = this.$route.params.liveId
+    this.queryParams.liveId = this.liveId
+    this.questionParams.liveId = this.liveId
+    this.getLiveQuestionLiveList()
+  },
+  methods: {
+    handleQuestionSearch() {
+      this.queryParams.pageNum = 1
+      this.queryParams.title = this.searchTitle
+      this.getQuestionList()
+    },
+    getLiveQuestionLiveList() {
+      this.loading = true
+      listLiveQuestionLive(this.questionParams).then(response => {
+        this.questionLiveList = response.rows
+        this.questionTotal = response.total
+        this.loading = false
+      })
+    },
+    handleToQuestionBank() {
+      this.$router.push('/live/liveQuestionBank')
+    },
+    handleAddQuestion() {
+      this.questionDialogVisible = true
+      this.getQuestionList()
+    },
+    getQuestionList() {
+      this.questionLoading = true
+      listLiveQuestionOptionList(this.queryParams).then(response => {
+        this.questionList = response.rows
+        this.total = response.total
+        this.questionLoading = false
+      })
+    },
+    handleSelectionChange(selection) {
+      this.selectedQuestions = selection
+    },
+    confirmAddQuestion() {
+      if (this.selectedQuestions.length === 0) {
+        this.$message({
+          message: '请选择要添加的试题',
+          type: 'warning'
+        })
+        return
+      }
+      // 调用添加直播间试题接口
+      addLiveQuestionLive({
+        liveId: this.liveId,
+        questionIds: this.selectedQuestions.map(item => item.id).join(',')
+      }).then(response => {
+        this.questionDialogVisible = false
+        this.getLiveQuestionLiveList()
+      })
+    },
+    handleRowClick(row, column) {
+      // 如果点击的是复选框列,不进行处理
+      if (column.type === 'selection') {
+        return
+      }
+
+      // 获取表格实例
+      const table = this.$refs.questionTable[0]
+      if (!table) {
+        return
+      }
+
+      // 判断当前行是否已经被选中
+      const isSelected = this.selectedQuestions.some(item => item.id === row.id)
+
+      // 切换选中状态
+      table.toggleRowSelection(row, !isSelected)
+    },
+  }
+};
+</script>

+ 474 - 0
src/views/live/liveConfig/barrage.vue

@@ -0,0 +1,474 @@
+<template>
+  <div class="app-container">
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary" plain icon="el-icon-refresh" size="mini" @click="handleReload" v-hasPermi="['live:task:add']"
+        >刷新</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          :disabled="isViewOnly"
+          type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['live:task:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple || isViewOnly" @click="handleDelete" v-hasPermi="['live:task:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          :disabled="isViewOnly"
+          type="warning" plain icon="el-icon-download" size="mini" :loading="exportLoading" @click="handleExport" v-hasPermi="['live:task:export']"
+        >导出</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          :disabled="isViewOnly"
+          type="success" plain icon="el-icon-download" size="mini" :loading="exportLoading" @click="handleImport" v-hasPermi="['live:task:export']"
+        >导入</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="taskList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="编号" align="center" prop="id" />
+      <el-table-column label="人物名称" align="center" prop="taskName" />
+      <el-table-column label="弹幕内容" align="center" prop="content" />
+      <el-table-column label="触发类型" align="center" prop="triggerType" :formatter="triggerTypeFormatter" />
+      <el-table-column label="触发时间" align="center" prop="triggerValue" :formatter="triggerValueFormatter" />
+      <!--      <el-table-column label="完成状态" align="center" prop="finishStatus" :formatter="finishStatusFormatter" />-->
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            :disabled="isViewOnly"
+            size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['live:task:edit']"
+          >修改</el-button>
+          <el-button
+            :disabled="isViewOnly"
+            size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['live:task:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"
+    />
+    <!-- 添加或修改直播间自动化任务配置对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="直播间ID" prop="liveId" v-show="false">
+          <el-input :disabled="liveAbled" v-model="form.liveId" placeholder="请输入直播间ID" />
+        </el-form-item>
+        <el-form-item label="人物名称" prop="taskName">
+          <el-input v-model="form.taskName" placeholder="请输入人物名称" />
+        </el-form-item>
+        <el-form-item label="弹幕内容" prop="content">
+          <el-input v-model="form.content" placeholder="请输入弹幕内容" />
+        </el-form-item>
+        <el-form-item label="触发时间" prop="content">
+          <el-time-picker
+            default-value="2025-01-01 00:00:00"
+            v-model="form.triggerValue"
+            :picker-options="{
+      selectableRange: '00:00:00 - 23:59:59'
+    }"
+
+            placeholder="任意时间点">
+          </el-time-picker>
+        </el-form-item>
+        <!--        <el-form-item label="触发类型" prop="triggerType">-->
+        <!--          <el-select v-model="form.triggerType" placeholder="请选择触发类型">-->
+        <!--            <el-option label="请选择字典生成" value="" />-->
+        <!--          </el-select>-->
+        <!--        </el-form-item>-->
+        <!--        <el-form-item label="触发值" prop="triggerValue">-->
+        <!--          <el-input v-model="form.triggerValue" placeholder="请输入触发值" />-->
+        <!--        </el-form-item>-->
+        <!--        <el-form-item label="任务内容">-->
+        <!--          <editor v-model="form.content" :min-height="192"/>-->
+        <!--        </el-form-item>-->
+        <el-form-item label="状态">
+          <el-radio-group v-model="form.status">
+            <el-radio :label="1">启用</el-radio>
+            <el-radio :label="0">禁用</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
+      <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '' " :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <div class="el-upload__tip" slot="tip">
+          <el-link type="info" style="font-size:12px;float:right" @click="importTemplate">下载模板</el-link>
+        </div>
+        <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm">确 定</el-button>
+        <el-button @click="upload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listTaskBarrage, getTask, delTask, addTask, updateTask, exportTaskBarrage,importTemplate } from "@/api/live/task";
+import { getToken } from "@/utils/auth";
+
+export default {
+  props:{
+    isViewOnly: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  name: "Barrage",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      liveAbled: false,
+      // 直播间自动化任务配置表格数据
+      taskList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null,
+        taskName: null,
+        taskType: null,
+        triggerType: null,
+        triggerValue: null,
+        content: null,
+        status: null,
+        createdTime: null,
+        updatedTime: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        liveId: [
+          { required: true, message: "直播间ID不能为空", trigger: "blur" }
+        ],
+        taskName: [
+          { required: true, message: "人物名称不能为空", trigger: "blur" }
+        ],
+        taskType: [
+          { required: true, message: "任务类型:1-定时推送卡片商品 2-定时发送红包 ", trigger: "change" }
+        ],
+        content: [
+          { required: true, message: "任务内容不能为空", trigger: "blur" }
+        ],
+        triggerType: [
+          { required: true, message: "触发类型:相对直播开始时间不能为空", trigger: "change" }
+        ],
+        triggerValue: [
+          { required: true, message: "触发值:绝对时间用yyyy-MM-dd HH:mm:ss,相对时间用分钟数不能为空", trigger: "blur" }
+        ],
+      },
+      // 用户导入参数
+      upload: {
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/live/task/importData",
+      },
+      liveId: null,
+      socket: null,
+      isLoading: false, // 是否正在加载
+      hasMore: true, // 是否还有更多数据
+    };
+  },
+  watch: {
+    // 监听路由的 query 参数变化
+    '$route.query': {
+      handler(newQuery) {
+        if (this.$route.params.liveId) {
+          this.liveId = this.$route.params.liveId;
+        }else {
+          this.liveId = this.$route.query.liveId;
+        }
+        if(this.liveId == null) {
+
+          return;
+        }
+        this.liveAbled = true
+        this.queryParams.liveId = this.liveId;
+        this.upload.url = process.env.VUE_APP_BASE_API + "/live/task/importData?liveId=" + this.liveId;
+        this.getList();
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
+  created() {
+    this.socket = this.$store.state.liveWs[this.liveId]
+  },
+  methods: {
+    triggerTypeFormatter(row, column, value){
+      if (!value) return '--'; // 空值处理
+      switch (value) {
+        case 1:
+          return "相对直播开始时间";
+        case 2:
+          return "相对时间";
+        default:
+          return "--";
+      }
+    },
+    triggerValueFormatter(row, column, value) {
+      if (!value) return '--'; // 空值处理
+
+      // 创建日期对象(兼容时间戳和字符串)
+      let date;
+      if (typeof value === 'number') {
+        // 处理时间戳(注意:如果是10位时间戳需要乘以1000)
+        date = new Date(value.toString().length === 10 ? value * 1000 : value);
+      } else if (typeof value === 'string') {
+        // 处理字符串格式(尝试直接转换)
+        date = new Date(value);
+      } else {
+        return '格式错误';
+      }
+      // 检查日期是否有效
+      if (isNaN(date.getTime())) {
+        return '无效时间';
+      }
+      // 格式化日期为 "yyyy-MM-dd HH:mm:ss"
+      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 `${hours}:${minutes}:${seconds}`;
+    },
+    /** 查询直播间自动化任务配置列表 */
+    getList() {
+      if(this.liveId == null) {
+        this.$message.error("页面错误,请联系管理员");
+        return;
+      }
+      this.loading = true;
+      listTaskBarrage(this.queryParams).then(res => {
+        if(res.rows.length > 0) {
+          this.taskList = res.rows;
+        }
+        this.total = res.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        liveId: this.liveId,
+        taskName: null,
+        taskType: null,
+        triggerType: null,
+        triggerValue: null,
+        content: null,
+        status: 1,
+        createdTime: null,
+        updatedTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播间弹幕脚本";
+    },
+    handleReload() {
+      this.getList()
+    },
+    /** 修改按钮操作 */
+    async handleUpdate(row) {
+      this.reset();
+      this.form = row;
+      this.open = true;
+      this.title = "修改直播间弹幕脚本";
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.form.liveId = this.liveId;
+      if(this.liveId == null) {
+        this.msgError("请选择直播间");
+        return;
+      }
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          this.form.taskType = 3
+          if (this.form.id != null) {
+            updateTask(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addTask(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除直播间弹幕脚本配置编号为"' + ids + '"的数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return delTask(ids);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess("删除成功");
+        const msg={
+          cmd:'delAutoTask',
+          data:row.absValue,
+          liveId:this.liveId,
+          userType:1
+        }
+        this.socket.send(JSON.stringify( msg))
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播间弹幕脚本数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportTaskBarrage(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {});
+    },
+    handleImport() {
+      this.upload.title = "弹幕脚本导入";
+      this.upload.open = true;
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.importMsgOpen=true;
+      this.importMsg=response.msg
+      this.getList();
+    },
+    // 提交上传文件
+    submitFileForm() {
+      if (!this.liveId) {
+        this.$message.error("错误直播间,请联系管理员处理");
+        return ;
+      }
+      this.$refs.upload.submit();
+    },
+    /** 下载模板操作 */
+    importTemplate() {
+      importTemplate().then((response) => {
+        this.download(response.msg);
+      });
+    },
+  }
+};
+</script>
+
+<style scoped>
+.loading-indicator {
+  padding: 10px;
+  text-align: center;
+  color: #606266;
+  font-size: 12px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.loading-indicator .el-icon-loading {
+  margin-right: 5px;
+  animation: rotate 1s linear infinite;
+}
+
+.no-more {
+  padding: 10px;
+  text-align: center;
+  color: #909399;
+  font-size: 12px;
+}
+
+@keyframes rotate {
+  from { transform: rotate(0deg); }
+  to { transform: rotate(360deg); }
+}
+</style>

+ 619 - 0
src/views/live/liveConfig/goods.vue

@@ -0,0 +1,619 @@
+<template>
+  <div class="app-container">
+  <div class="el-container-md">
+
+    <div class="selection-toolbar">
+      <el-checkbox :indeterminate="isIndeterminate" v-model="allChecked" @change="toggleSelectAll">
+        {{ multipleSelection.length > 0 ? `已选 ${multipleSelection.length} 条` : '选中本页' }}
+      </el-checkbox>
+      <el-button  plain size="mini" @click="handleShelf" :disabled="isViewOnly">上架</el-button>
+      <el-button  plain size="mini" @click="handleUnshelf" :disabled="isViewOnly">下架</el-button>
+      <el-button  plain size="mini" @click="handleDeleteSelected" :disabled="isViewOnly">删除</el-button>
+      <el-button  plain type="mini" icon="el-icon-plus" @click="handleAddLiveGoods" :disabled="isViewOnly">添加商品</el-button>
+    </div>
+    <el-table
+      ref="goodTable"
+      :data="goodsLiveList"
+      style="width: 100%"
+      v-loading="loading"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="55"></el-table-column>
+      <!-- 题干列:显示试题的主要内容 -->
+      <el-table-column
+        prop="goodsId"
+        label="商品id"
+        show-overflow-tooltip
+      ></el-table-column>
+
+      <el-table-column
+        label="商品图片"
+      >
+        <template slot-scope="scope">
+          <img
+            :src="scope.row.imgUrl"
+            style="display: block; max-width: 100%; width: 100px; height: 100px"
+          />
+        </template>
+
+      </el-table-column>
+
+      <el-table-column
+        prop="productName"
+        label="商品名称"
+      ></el-table-column>
+
+      <el-table-column
+        prop="price"
+        label="价格"
+      ></el-table-column>
+
+      <el-table-column
+        prop="stock"
+        label="库存"
+      ></el-table-column>
+
+      <el-table-column
+        prop="sales"
+        label="销量"
+      ></el-table-column>
+
+      <el-table-column
+        prop="isShow"
+        label="显示状态"
+      >
+        <template slot-scope="scope">
+            <el-switch
+              :disabled="isViewOnly"
+              v-model="scope.row.isShow"
+              @change="handleSwitchClick(scope.row)"
+              active-color="#13ce66"
+              inactive-color="#ff4949">
+            </el-switch>
+        </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 type="info" v-if="scope.row.status == 0">下架</el-tag>
+        </template>
+      </el-table-column>
+
+      <el-table-column
+        prop="status"
+        label="店铺上下架"
+      >
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.fsStatus == 1">上架</el-tag>
+          <el-tag type="info" v-if="scope.row.fsStatus == 0">下架</el-tag>
+        </template>
+      </el-table-column>
+
+      <!-- 操作列:包含编辑和删除按钮 -->
+      <el-table-column
+        label="操作"
+        width="180"
+        fixed="right"
+      >
+        <template slot-scope="scope">
+          <el-button
+            :disabled="isViewOnly"
+            type="text"
+            size="small"
+            style="color: #0066FF;"
+            @click="handleGoodStock(scope.row)"
+          >调整库存</el-button>
+          <el-button
+            :disabled="isViewOnly"
+            type="text"
+            size="small"
+            style="color: #0066FF;"
+            @click="handleGoodSale(scope.row)"
+          >调整销量</el-button>
+          <el-button
+            :disabled="isViewOnly"
+            type="text"
+            size="small"
+            style="color: #F56C6C;"
+            @click="handleGoodDelete(scope.row)"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页组件:用于分页展示试题列表 -->
+    <pagination
+      v-show="goodsLiveTotal > 0"
+      :total="goodsLiveTotal"
+      :page.sync="goodsParams.pageNum"
+      :limit.sync="goodsParams.pageSize"
+      @pagination="getLiveGoodsList"
+      style="margin-top: 20px;"
+    />
+
+    <!-- 添加商品弹窗 -->
+    <el-dialog
+      title="添加商品"
+      :visible.sync="goodsDialogVisible"
+      width="800px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
+      <div class="dialog-content">
+        <div style="text-align: right; margin-bottom: 20px;">
+          <el-input
+            v-model="searchTitle"
+            placeholder="请输入产品名称"
+            style="width: 300px;"
+            @input="handleGoodsSearch"
+          ></el-input>
+        </div>
+
+        <el-table
+          :data="goodsList"
+          style="width: 100%"
+          v-loading="goodsLoading"
+          @selection-change="handleGoodsChange"
+          @row-click="handleGoodsRowClick"
+          row-key="id"
+        >
+          <el-table-column
+            type="selection"
+            width="55"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="productName"
+            label="产品"
+            class-name="clickable-column"
+          ></el-table-column>
+          <el-table-column
+            prop="price"
+            label="价格"
+            class-name="clickable-column"
+          ></el-table-column>
+          <el-table-column
+            prop="stock"
+            label="库存"
+            class-name="clickable-column"
+          ></el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="goodsTotal > 0"
+          :total="goodsTotal"
+          :page.sync="queryGoodParams.pageNum"
+          :limit.sync="queryGoodParams.pageSize"
+          @pagination="getStoreProductLists"
+          style="margin-top: 20px;"
+        />
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <div style="display: flex; justify-content: space-between; align-items: center;">
+          <span class="selected-count">当前已选择 <span style="color: #00BFFF; font-style: italic;">{{ selectedGoods.length }}</span> 商品</span>
+          <div>
+            <el-button @click="goodsDialogVisible = false">取 消</el-button>
+            <el-button type="primary" @click="confirmAddGoods">确 定</el-button>
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+
+    <el-dialog
+      title="调整库存"
+      :visible.sync="stockDialogVisible"
+      width="400px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
+      <el-form :model="stockForm" ref="stockForm" :rules="stockRules">
+        <el-form-item label="调整后库存" prop="newStock">
+          <el-input-number
+            v-model="stockForm.stock"
+            :min="0"
+            :max="999999"
+            controls-position="right"
+            style="width: 100%;"
+          ></el-input-number>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="stockDialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="confirmStockChange">确 定</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog
+      title="调整销量"
+      :visible.sync="salesDialogVisible"
+      width="400px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
+      <el-form :model="salesForm" ref="salesForm" :rules="salesRules">
+        <el-form-item label="调整后销量" prop="newSales">
+          <el-input-number
+            v-model="salesForm.sales"
+            :min="0"
+            :max="999999"
+            controls-position="right"
+            style="width: 100%;"
+          ></el-input-number>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="salesDialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="confirmSalesChange">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+  </div>
+</template>
+
+<script>
+import {
+  addLiveGoods,
+  delLiveGoods,
+  listLiveGoods,
+  listStoreProduct,
+  handleShelfOrUn,
+  handleDeleteSelected,
+  handleIsShowChange,
+  updateGoodsStock,
+  updateLiveGoods
+} from "@/api/live/liveGoods";
+
+export default {
+  props:{
+    isViewOnly: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  data() {
+    return {
+      liveId: '',
+      loading: true,
+      searchTitle: '',
+      queryGoodParams: {
+        pageNum: 1,
+        pageSize: 10,
+        keywords: null,
+        liveId: null,
+        storeId: null
+      },
+      goodsLiveList: [],
+      goodsLiveTotal: 0,
+      goodsParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null
+      },
+      goodsList: [],
+      goodsTotal: 0,
+      selectedGoods: [],
+      goodsLoading: false,
+      goodsDialogVisible: false,
+      multipleSelection: [],
+      allChecked: false,
+      isIndeterminate: false,
+      socket: null,
+      stockDialogVisible: false,
+      salesDialogVisible: false,
+      stockForm: {
+        goodsId: '',
+        stock: 0,
+        productId: 0,
+      },
+      salesForm: {
+        goodsId: '',
+        sales: 0,
+        productId: 0,
+      },
+      stockRules: {
+        stock: [
+        { required: true, message: '请输入库存数量', trigger: 'blur' },
+        { type: 'number', min: 0, message: '库存数量不能小于0', trigger: 'blur' }
+      ]
+      },
+      salesRules: {
+        sales: [
+          { required: true, message: '请输入销量数量', trigger: 'blur' },
+          { type: 'number', min: 0, message: '库存数量不能小于0', trigger: 'blur' }
+        ]
+      }
+    };
+  },
+  watch: {
+     '$route.query': {
+      handler(newQuery) {
+        if (this.$route.params.liveId) {
+          this.liveId = this.$route.params.liveId;
+        }else {
+          this.liveId = this.$route.query.liveId;
+        }
+        this.goodsParams.liveId = this.liveId
+        if(this.liveId == null) {
+          return;
+        }
+        this.getLiveGoodsList();
+        this.socket = this.$store.state.liveWs[this.liveId]
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
+  created() {
+    // if (this.$route.params.liveId) {
+    //   this.liveId = this.$route.params.liveId;
+    // }else {
+    //   this.liveId = this.$route.query.liveId;
+    // }
+    // this.goodsParams.liveId = this.liveId
+    // this.getLiveGoodsList();
+    // this.socket = this.$store.state.liveWs[this.liveId]
+  },
+  methods: {
+    handleRouteChange(to, from) {
+      // 处理路由变化逻辑
+      console.log('路由变化:', from.path, '->', to.path);
+    },
+    handleSwitchClick(row) {
+      if(this.isViewOnly) return
+      // 1. 获取「即将切换到的目标状态」(当前状态取反)
+      const targetStatus = row.isShow;
+      const originalIsShow = !row.isShow
+      const goodsList = [row.goodsId];
+      if (this.socket == null) {
+        this.$message.error("请从直播间开启展示状态!");
+
+        this.$nextTick(() => {
+          row.isShow = originalIsShow;
+        });
+        return;
+      }
+      handleIsShowChange({"goodsIds":goodsList,"isShow":targetStatus,"liveId":this.liveId}).then(res=>{
+        if(res.code == 200){
+          row.isShow = res.isShow
+          if (res.msg == "目前仅支持单一物品展示") {
+            this.$message.error(res.msg)
+          }
+          if (this.socket != null) {
+            const msg = {
+              cmd: 'goods',
+              data: {"liveId":this.liveId,"goodsId":goodsList[0],"status":targetStatus ? 1 : 0}
+            };
+            this.socket.send(JSON.stringify(msg));
+          }
+        } else {
+          row.isShow = originalIsShow;
+        }
+      }).catch(err => {
+        // 网络错误时,同样恢复原始状态
+        row.isShow = originalIsShow;
+        // this.$set(row, 'isShow', originalIsShow); // 响应式修复
+        console.error("状态切换失败:", err);
+      });
+    },
+    handleShelf(){
+      this.handleShelfOrUn(1)
+    },
+    handleUnshelf(){
+      this.handleShelfOrUn(0)
+    },
+    handleShelfOrUn(type){
+      if (this.multipleSelection.length > 0) {
+        const goodsList = this.getSelectedList();
+        handleShelfOrUn({"goodsIds":goodsList,"status":type}).then(res=>{
+          this.dealResult(res)
+        })
+      } else {
+        this.$message.info("请选择下架商品!")
+      }
+    },
+    handleDeleteSelected(){
+      if (this.multipleSelection.length > 0) {
+        const goodsList = this.getSelectedList();
+        handleDeleteSelected({"goodsIds":goodsList}).then(res=>{
+          this.dealResult(res)
+        })
+      } else {
+        this.$message.info("请选择被删除的商品!")
+      }
+    },
+    dealResult(res){
+      if (res.code == 200) {
+        this.getLiveGoodsList();
+        this.$refs.goodTable.clearSelection();
+      } else {
+        this.$message.error(res.msg);
+      }
+    },
+    getSelectedList(){
+      var goodsList = []
+      this.multipleSelection.forEach(item => {
+        goodsList.push(item.goodsId);
+      })
+      return goodsList;
+    },
+    // 全选或取消全选
+    toggleSelectAll(val) {
+      this.checked = val; // 更新 checkbox 的状态
+      if (val) {
+        // 如果 checkbox 被选中,则全选
+        this.toggleSelection(this.goodsLiveList);
+      } else {
+        // 如果 checkbox 被取消选中,则取消全选
+        this.toggleSelection();
+      }
+    },
+    toggleSelection(rows) {
+      if (rows && !this.isIndeterminate) {
+        rows.forEach(row => {
+          this.$refs.goodTable.toggleRowSelection(row);
+        });
+      } else {
+        this.$refs.goodTable.clearSelection();
+      }
+    },
+    // 多选框选中数据
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+      // 根据选择项的数量更新 checkbox 的状态
+      this.allChecked = val.length === this.goodsLiveList.length;
+      this.isIndeterminate = val.length > 0 && val.length < this.goodsLiveList.length;
+    },
+
+    getLiveGoodsList() {
+      this.loading = true
+      listLiveGoods(this.goodsParams).then(response => {
+        this.goodsLiveList = response.rows
+        this.goodsLiveTotal = response.total
+        this.loading = false
+      })
+    },
+    handleAddLiveGoods(){
+      this.goodsDialogVisible = true;
+      this.getStoreProductLists()
+    },
+    handleGoodsSearch(){
+      this.queryGoodParams.pageNum = 1
+      this.queryGoodParams.keywords = this.searchTitle
+      this.getStoreProductLists()
+    },
+    handleGoodsChange(goods) {
+      this.selectedGoods = goods
+    },
+    confirmAddGoods(){
+      if (this.selectedGoods.length === 0) {
+        this.$message({
+          message: '请选择要添加的商品',
+          type: 'warning'
+        })
+        return
+      }
+      addLiveGoods({
+        liveId: this.liveId,
+        productsId: this.selectedGoods.map(item => item.productId).join(',')
+      }).then(response => {
+        if (response.code !== 200) {
+          this.$message({
+            message: response.msg,
+            type: 'warning'
+          });
+          return;
+        }
+        this.goodsDialogVisible = false;
+        this.getLiveGoodsList()
+      })
+    },
+    handleGoodDelete(row){
+      delLiveGoods(row.goodsId).then(response => {
+        this.getLiveGoodsList()
+      })
+    },
+    handleGoodStock(row){
+      this.stockForm.goodsId = row.goodsId;
+      this.stockForm.stock = row.stock;
+      this.stockForm.productId = row.productId;
+      this.stockDialogVisible = true;
+    },
+    handleGoodSale(row){
+      this.salesForm.goodsId = row.goodsId;
+      this.salesForm.sales = row.sales;
+      this.salesForm.productId = row.productId;
+      this.salesDialogVisible = true;
+    },
+    // 添加确认修改库存方法
+    confirmStockChange() {
+      this.$refs.stockForm.validate((valid) => {
+        if (valid) {
+          updateGoodsStock({
+            goodsId: this.stockForm.goodsId,
+            stock: this.stockForm.stock,
+            productId: this.stockForm.productId
+          }).then(response => {
+            if (response.code === 200) {
+              this.$message.success('库存修改成功');
+              this.stockDialogVisible = false;
+              this.getLiveGoodsList(); // 重新获取列表数据
+            } else {
+              this.$message.error(response.msg || '库存修改失败');
+            }
+          });
+        }
+      });
+    },
+    // 添加确认修改库存方法
+    confirmSalesChange() {
+      this.$refs.salesForm.validate((valid) => {
+        if (valid) {
+          updateLiveGoods({
+            goodsId: this.salesForm.goodsId,
+            sales: this.salesForm.sales,
+            productId: this.salesForm.productId
+          }).then(response => {
+            if (response.code === 200) {
+              this.$message.success('销量修改成功');
+              this.salesDialogVisible = false;
+              this.getLiveGoodsList(); // 重新获取列表数据
+            } else {
+              this.$message.error(response.msg || '销量修改失败');
+            }
+          });
+        }
+      });
+    },
+    /** 处理行点击事件 */
+    handleGoodsRowClick(row, column) {
+      // 如果点击的是复选框列,不进行处理
+      if (column.type === 'selection') {
+        return
+      }
+
+      // 获取表格实例
+      const table = this.$refs.goodsTable[0]
+      if (!table) {
+        return
+      }
+
+      // 判断当前行是否已经被选中
+      const isSelected = this.selectedGoods.some(item => item.id === row.id)
+
+      // 切换选中状态
+      table.toggleRowSelection(row, !isSelected)
+    },
+    getStoreProductLists() {
+      this.queryGoodParams.liveId = this.liveId
+      listStoreProduct(this.queryGoodParams).then(response => {
+        this.goodsList = response.rows
+        this.goodsTotal = response.total
+        this.loading = false
+      })
+    }
+
+  }
+};
+</script>
+
+<style scoped>
+.selection-toolbar {
+  display: flex;
+  align-items: center;
+  margin-bottom: 10px;
+  padding-left: 10px;
+}
+
+.selection-toolbar .el-checkbox {
+  margin-right: 10px;
+}
+
+/* 调整 checkbox 内部输入框的对齐 */
+.selection-toolbar .el-checkbox .el-checkbox__inner {
+  top: 8px; /* 根据实际需求调整 */
+}
+</style>

+ 67 - 0
src/views/live/liveConfig/idCard.vue

@@ -0,0 +1,67 @@
+<template>
+  <el-form ref="form"  label-width="80px">
+    <el-form-item>
+      <el-form-item label="上传图片" prop="materialUrl">
+        <img :src="idCardUrl" alt="身份证" style="height: 150px; width: 150px" v-if="idCardUrl != null">
+        <ImageUpload @input="handleUrl" type="image" :num="10" :width="150" :height="150" />
+      </el-form-item>
+      <el-button type="primary" size="mini" @click="submit" v-show="!isViewOnly">保存</el-button>
+    </el-form-item>
+  </el-form>
+</template>
+
+<script>
+import ImageUpload from '@/components/ImageUpload/index';
+import {verifyIdInfo, getLive} from '@/api/live/live'
+
+export default {
+  props:{
+    isViewOnly: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  components: { ImageUpload },
+  data() {
+    return {
+      test: "1test",
+      idCardUrl: "",
+      liveId: null,
+    };
+  },
+  watch: {
+    // 监听路由的 query 参数变化
+    '$route.query': {
+      handler(newQuery) {
+        this.liveId = this.$route.params.liveId
+        if(this.liveId == null) {
+          return;
+        }
+        getLive(this.liveId).then(res => {
+          this.idCardUrl = res.data.idCardUrl;
+        })
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
+  created() {
+  },
+  methods: {
+    submit(){
+      verifyIdInfo({ liveId: this.liveId, idCardUrl: this.idCardUrl}).then(response => {
+        if (response.code == 200) {
+          this.$message.success("保存成功");
+        } else {
+          this.$message.success(response.msg);
+        }
+      })
+    },
+    handleUrl(data){
+      if (data.length > 0) {
+        this.idCardUrl = data;
+      }
+    }
+  }
+};
+</script>

+ 265 - 0
src/views/live/liveConfig/index.vue

@@ -0,0 +1,265 @@
+<template>
+  <div class="live-config-container">
+    <el-card class="box-card live-config-header">
+      <div class="detail-header">
+        <div class="header-left-area">
+          <img :src="liveInfo.liveImgUrl" alt="直播封面">
+          <!-- 加载遮罩 -->
+          <div class="ss-loading-mask" style="display: none;">
+            <div class="ss-loading-spinner is-module-loading">
+              <div class="ss-loading-dot-flashing"></div>
+            </div>
+          </div>
+        </div>
+
+        <div class="header-middle-area">
+          <div class="live-info-title">
+            <div class="title-text">{{ liveInfo.liveName }}</div>
+          </div>
+
+          <div class="live-info-desc">
+            <div class="live-type">{{ liveInfo.liveType == 1 ? '视频直播' : '录播' }}</div>
+            <div class="line"></div>
+            <div class="live-mode">{{ liveInfo.showType == 1 ? '横屏' : '竖屏' }}</div>
+            <div class="big-screen-info">
+              <div class="dataLarge">
+                <a class="dataLarge__screen ss-popover__reference" aria-describedby="ss-popover-7614" tabindex="0" data-auth-id="818">
+                  <span class="dataLarge__screen__icon"></span>
+                  <span class="dataLarge__screen__txt">实时大屏</span>
+                </a>
+              </div>
+            </div>
+          </div>
+
+          <div class="live-info-state">
+            <div class="info-state-text live-time">直播时间:{{ liveInfo.startTime }} 至 {{ liveInfo.finishTime }}</div>
+            <div class="line"></div>
+            <div class="info-state-text live-state">{{ liveInfo.status == 3 ? '已结束' : liveInfo.status == 2 ? '直播中' : '未开始'}}</div>
+            <div class="line"></div>
+            <div class="info-state-text live-active-state">{{ liveInfo.isShow == 1 ? '上架' : '下架' }}</div>
+            <div class="line"></div>
+          </div>
+        </div>
+      </div>
+    </el-card>
+    <el-card class="box-card live-config-left">
+      <div class="container">
+      <!-- 左边菜单 -->
+        <div class="left-menu">
+          <el-menu default-active="1" class="el-menu-vertical-demo" @select="handleSelect">
+            <el-menu-item :index="item.index" v-for="item in menuList">
+              <span>{{item.name}}</span>
+            </el-menu-item>
+          </el-menu>
+        </div>
+        <!-- 右边信息 -->
+        <div class="right-info">
+          <!-- 动态组件 -->
+          <component :is="currentComponent" :isViewOnly="isViewOnly"></component>
+        </div>
+      </div>
+    </el-card>
+
+  </div>
+</template>
+<script>
+import WatchReward from './watchReward.vue';
+import Answer from './answer.vue';
+import Goods from './goods.vue';
+import IdCard from './idCard.vue';
+import Task from './task.vue';
+import LiveRedConf from './liveRedConf.vue'
+import LiveLotteryConf from './liveLotteryConf.vue'
+import LiveReplay from './liveReplay.vue'
+import Preview from './preview.vue'
+import LiveCoupon from './liveCoupon.vue'
+import Barrage from './barrage.vue'
+import { listLive, getLive, delLive, addLive, updateLive, exportLive,selectCompanyTalent,handleShelfOrUn,handleDeleteSelected } from "@/api/live/live";
+
+
+export default {
+  name: 'LiveConfig',
+  components: {
+    WatchReward,
+    LiveRedConf,
+    LiveLotteryConf,
+    LiveReplay,
+    Answer,
+    Goods,
+    IdCard,
+    Task,
+    LiveCoupon,
+    Barrage,
+    Preview
+  },
+  data() {
+    return {
+      isViewOnly: false,
+      activeTab: 'watchReward',
+      liveId: null,
+      liveInfo: {},
+      currentComponent: WatchReward,
+      menuList:[
+        { name: '观看奖励', label: '观看奖励', index: 'watchReward'},
+        { name: '直播预告', label: '直播预告', index: 'preview'},
+        { name: '红包配置', label: '红包配置', index: 'liveRedConf'},
+        { name: '抽奖配置', label: '抽奖配置', index: 'liveLotteryConf'},
+        { name: '优惠券配置', label: '优惠券配置', index: 'liveCoupon'},
+        // { name: '答题', label: '答题', index: 'answer'},
+        { name: '直播商品', label: '直播商品', index: 'goods'},
+        { name: '回放设置', label: '回放设置', index: 'liveReplay'},
+        { name: '运营自动化', label: '运营自动化', index: 'task'},
+        { name: '弹幕脚本', label: '弹幕脚本', index: 'barrage'},
+        { name: '身份认证', label: '身份认证', index: 'idCard'},
+      ],
+
+    }
+  },
+  created() {
+    this.liveId = this.$route.params.liveId
+    this.getLiving()
+  },
+  methods: {
+    handleSelect(index){
+      this.currentComponent = index; // 切换当前显示的组件
+    },
+    getLiving() {
+      getLive(this.liveId).then(res => {
+        this.liveInfo = res.data
+        if(this.liveInfo.companyId == null || this.liveInfo.companyId == ''){
+          this.isViewOnly = true
+          console.log(this.isViewOnly)
+        }
+      })
+    },
+  }
+}
+</script>
+
+
+<style scoped>
+.el-tabs__header .is-top {
+  display: none !important;
+}
+.live-config-header{
+  padding: 5px;
+  border: 1px solid #ebeef5;
+}
+.detail-header {
+  display: flex;
+  padding: 20px;
+  border-bottom: 1px solid #ebeef5;
+}
+
+.header-left-area {
+  flex: 0 0 120px;
+  position: relative;
+}
+
+.header-left-area img {
+  width: 100px;
+  height: 100px;
+  border-radius: 4px;
+}
+
+.header-middle-area {
+  flex: 1;
+  padding: 0 20px;
+}
+
+.header-right-area {
+  flex: 0 0 200px;
+}
+
+.live-info-title .title-text {
+  font-size: 20px;
+  font-weight: 500;
+  color: #303133;
+}
+
+.live-info-desc {
+  display: flex;
+  align-items: center;
+  margin-top: 10px;
+}
+
+.live-info-desc .line {
+  width: 1px;
+  height: 12px;
+  background: #c0c4cc;
+  margin: 0 10px;
+}
+
+.live-info-state {
+  display: flex;
+  align-items: center;
+  margin-top: 10px;
+}
+
+.live-info-state .line {
+  width: 1px;
+  height: 12px;
+  background: #c0c4cc;
+  margin: 0 10px;
+}
+
+.live-state-dot {
+  width: 8px;
+  height: 8px;
+  border-radius: 50%;
+}
+
+.live-state-dot-liveEnd {
+  background: #909399;
+}
+
+.info-state-text {
+  font-size: 14px;
+  color: #606266;
+}
+
+.operation-wrapper {
+  display: flex;
+  align-items: center;
+}
+
+.operation-item {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  cursor: pointer;
+}
+
+.operation-item-text {
+  font-size: 12px;
+  color: #606266;
+  margin-top: 4px;
+}
+
+.operation-wrapper .line {
+  width: 1px;
+  height: 20px;
+  background: #c0c4cc;
+  margin: 0 10px;
+}
+
+.container {
+  display: flex;
+  height: 100%;
+}
+.left-menu {
+  width: 200px;
+  border-right: 1px solid #e4e7ed;
+  flex-shrink: 0; /* 不收缩 */
+}
+
+.right-info {
+  flex: 1;
+  padding: 20px;
+}
+
+.right-tabs {
+  height: 100%;
+}
+
+</style>

+ 563 - 0
src/views/live/liveConfig/liveCoupon.vue

@@ -0,0 +1,563 @@
+<template>
+  <div class="app-container">
+  <div class="el-container-md">
+
+    <div class="selection-toolbar">
+      <el-checkbox :indeterminate="isIndeterminate" v-model="allChecked" @change="toggleSelectAll">
+        {{ multipleSelection.length > 0 ? `已选 ${multipleSelection.length} 条` : '选中本页' }}
+      </el-checkbox>
+      <!--      <el-button  plain size="mini" @click="handleShelf">上架</el-button>-->
+      <!--      <el-button  plain size="mini" @click="handleUnshelf">下架</el-button>-->
+      <el-button  plain size="mini" @click="handleDeleteSelected" :disabled="isViewOnly">删除</el-button>
+      <el-button  plain type="mini" icon="el-icon-plus" @click="handleAddLiveCoupon" :disabled="isViewOnly">添加优惠券</el-button>
+    </div>
+    <el-table
+      ref="couponTable"
+      :data="couponLiveList"
+      style="width: 100%"
+      v-loading="loading"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="55"></el-table-column>
+      <!-- 题干列:显示试题的主要内容 -->
+      <el-table-column
+        prop="couponId"
+        label="优惠券id"
+        show-overflow-tooltip
+      ></el-table-column>
+
+      <el-table-column
+        prop="title"
+        label="优惠券名称"
+      ></el-table-column>
+
+      <el-table-column
+        prop="couponPrice"
+        label="优惠券价格"
+      ></el-table-column>
+
+      <el-table-column
+        prop="useMinPrice"
+        label="优惠券使用最低价格"
+      ></el-table-column>
+
+      <el-table-column
+        prop="couponTime"
+        label="优惠券有效时间"
+      ></el-table-column>
+      <el-table-column
+        prop="productName"
+        label="绑定直播商品"
+      ></el-table-column>
+
+      <el-table-column
+        prop="isShow"
+        label="显示状态"
+      >
+        <template slot-scope="scope">
+          <el-switch
+            :disabled="isViewOnly"
+            v-model="scope.row.isShow == 1"
+            @click.native.capture.prevent="handleSwitchClick(scope.row)"
+            active-color="#13ce66"
+            inactive-color="#ff4949">
+          </el-switch>
+        </template>
+      </el-table-column>
+
+
+
+      <!-- 操作列:包含编辑和删除按钮 -->
+      <el-table-column
+        label="操作"
+        width="180"
+        fixed="right"
+      >
+        <template slot-scope="scope">
+          <el-button
+            :disabled="isViewOnly"
+            type="text"
+            size="small"
+            style="color: #0fae11;"
+            @click="handleCouponBind(scope.row)"
+          >绑定商品</el-button>
+          <el-button
+            :disabled="isViewOnly"
+            type="text"
+            size="small"
+            style="color: #F56C6C;"
+            @click="handleCouponDelete(scope.row)"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页组件:用于分页展示试题列表 -->
+    <pagination
+      v-show="couponLiveTotal > 0"
+      :total="couponLiveTotal"
+      :page.sync="couponParams.pageNum"
+      :limit.sync="couponParams.pageSize"
+      @pagination="getLiveCouponList"
+      style="margin-top: 20px;"
+    />
+
+    <!-- 添加优惠券弹窗 -->
+    <el-dialog
+      title="添加优惠券"
+      :visible.sync="couponDialogVisible"
+      width="800px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
+      <div class="dialog-content">
+        <div style="text-align: right; margin-bottom: 20px;">
+          <el-input
+            v-model="searchTitle"
+            placeholder="请输入优惠券名称"
+            style="width: 300px;"
+            @input="handleCouponSearch"
+          ></el-input>
+        </div>
+
+        <el-table
+          :data="couponList"
+          style="width: 100%"
+          v-loading="couponLoading"
+          @selection-change="handleCouponChange"
+          @row-click="handleCouponRowClick"
+          row-key="id"
+        >
+          <el-table-column
+            type="selection"
+            width="55"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="title"
+            label="优惠券名称"
+            class-name="clickable-column"
+          ></el-table-column>
+          <el-table-column
+            prop="couponPrice"
+            label="优惠券价格"
+            class-name="clickable-column"
+          ></el-table-column>
+          <el-table-column
+            prop="useMinPrice"
+            label="优惠券使用最低价格"
+            class-name="clickable-column"
+          ></el-table-column>
+          <el-table-column
+            prop="couponTime"
+            label="优惠券有效时间"
+            class-name="clickable-column"
+          ></el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="couponTotal > 0"
+          :total="couponTotal"
+          :page.sync="queryCouponParams.pageNum"
+          :limit.sync="queryCouponParams.pageSize"
+          @pagination="getCouponLists"
+          style="margin-top: 20px;"
+        />
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <div style="display: flex; justify-content: space-between; align-items: center;">
+          <span class="selected-count">当前已选择 <span style="color: #00BFFF; font-style: italic;">{{ selectedCoupon.length }}</span> 优惠券</span>
+          <div>
+            <el-button @click="couponDialogVisible = false">取 消</el-button>
+            <el-button type="primary" @click="confirmAddCoupon">确 定</el-button>
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+
+
+    <el-dialog
+      title="绑定商品"
+      :visible.sync="goodsDialogVisible"
+      width="400px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
+      <el-form :model="goodsForm" ref="goodsForm" :rules="salesRules">
+        <!-- 新增商品下拉选择 -->
+        <el-form-item label="选择商品" prop="goodsId">
+          <el-select
+            v-model="goodsForm.goodsId"
+            placeholder="请选择商品"
+            filterable
+            style="width: 100%;"
+            @change="handleGoodsChange"
+          >
+            <el-option
+              v-for="goods in goodsList"
+              :key="goods.goodsId"
+              :label="goods.productName"
+              :value="goods.goodsId"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="goodsDialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="confirmGoodChange">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+  </div>
+</template>
+
+<script>
+import {
+  listLiveCoupon,
+  addLiveCoupon,
+  handleIsShowChange,
+  handleDeleteSelected,
+  delLiveCoupon,
+  updateLiveCouponBind,
+  listCoupon
+} from "@/api/live/liveCoupon";
+import { listLiveGoods} from "@/api/live/liveGoods";
+
+
+export default {
+  props:{
+    isViewOnly: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  data() {
+    return {
+      liveId: '',
+      loading: true,
+      searchTitle: '',
+      queryCouponParams: {
+        pageNum: 1,
+        pageSize: 10,
+        couponName: '',
+        liveId: null,
+      },
+      couponLiveList: [],
+      couponLiveTotal: 0,
+      couponParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null
+      },
+      couponList: [],
+      couponTotal: 0,
+      selectedCoupon: [],
+      couponLoading: false,
+      couponDialogVisible: false,
+      multipleSelection: [],
+      allChecked: false,
+      isIndeterminate: false,
+      socket: null,
+      stockDialogVisible: false,
+      goodsDialogVisible: false,
+      goodsList: [],
+      stockForm: {
+        goodsId: '',
+        stock: 0,
+        productId: 0,
+      },
+      goodsForm: {
+        goodsId: '',
+        sales: 0,
+        productId: 0,
+      },
+      stockRules: {
+        stock: [
+          { required: true, message: '请输入库存数量', trigger: 'blur' },
+          { type: 'number', min: 0, message: '库存数量不能小于0', trigger: 'blur' }
+        ]
+      },
+      salesRules: {
+        sales: [
+          { required: true, message: '请输入销量数量', trigger: 'blur' },
+          { type: 'number', min: 0, message: '库存数量不能小于0', trigger: 'blur' }
+        ]
+      }
+    };
+  },
+  watch: {
+    '$route.query': {
+      handler(newQuery) {
+        if (this.$route.params.liveId) {
+          this.liveId = this.$route.params.liveId;
+        }else {
+          this.liveId = this.$route.query.liveId;
+        }
+        this.couponParams.liveId = this.liveId
+        if(this.liveId == null) {
+          return;
+        }
+        this.getLiveCouponList();
+        this.socket = this.$store.state.liveWs[this.liveId]
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
+  created() {
+    // if (this.$route.params.liveId) {
+    //   this.liveId = this.$route.params.liveId;
+    // }else {
+    //   this.liveId = this.$route.query.liveId;
+    // }
+    // this.goodsParams.liveId = this.liveId
+    // this.getLiveGoodsList();
+    // this.socket = this.$store.state.liveWs[this.liveId]
+  },
+  methods: {
+    handleGoodsChange(row){
+
+    },
+    getLiveGoodsList() {
+      listLiveGoods({"liveId":this.liveId,"pageNum":1,"pageSize":50}).then(response => {
+        this.goodsList = response.rows
+        this.goodsDialogVisible = true;
+      })
+    },
+    handleRouteChange(to, from) {
+      // 处理路由变化逻辑
+      console.log('路由变化:', from.path, '->', to.path);
+    },
+    handleSwitchClick(row) {
+      if(this.isViewOnly) return;
+      // 1. 获取「即将切换到的目标状态」(当前状态取反)
+      const targetStatus = !row.isShow
+      const couponList = row.id;
+      if (this.socket == null) {
+        this.$message.error("请从直播间开启展示状态!");
+        return;
+      }
+      handleIsShowChange({"couponId":couponList,"isShow":targetStatus,"liveId":this.liveId}).then(res=>{
+        if(res.code == 200){
+          row.isShow = targetStatus
+          if (res.msg == "目前仅支持单一优惠券推送") {
+            this.$message.error(res.msg)
+            return;
+          }
+          const msg = {
+            cmd: 'coupon',
+            data: {"liveId":this.liveId,"couponIssueId":row.id,"status":targetStatus ? 1 : 0,"goodsId":row.goodsId,"couponName":row.title,
+              "couponPrice":row.couponPrice,"useMinPrice":row.useMinPrice,"couponTime":row.couponTime}
+          }
+          this.socket.send(JSON.stringify(msg));
+
+        }
+      })
+    },
+
+    handleDeleteSelected(){
+      if (this.multipleSelection.length > 0) {
+        const goodsList = this.getSelectedList();
+        handleDeleteSelected({"couponIds":goodsList,"liveId":this.liveId}).then(res=>{
+          this.dealResult(res)
+        })
+      } else {
+        this.$message.info("请选择被删除的优惠券!")
+      }
+    },
+    dealResult(res){
+      if (res.code == 200) {
+        this.getLiveCouponList();
+        this.$refs.couponTable.clearSelection();
+      } else {
+        this.$message.error(res.msg);
+      }
+    },
+    getSelectedList(){
+      var couponList = []
+      this.multipleSelection.forEach(item => {
+        couponList.push(item.id);
+      })
+      return couponList;
+    },
+    // 全选或取消全选
+    toggleSelectAll(val) {
+      this.checked = val; // 更新 checkbox 的状态
+      if (val) {
+        // 如果 checkbox 被选中,则全选
+        this.toggleSelection(this.couponLiveList);
+      } else {
+        // 如果 checkbox 被取消选中,则取消全选
+        this.toggleSelection();
+      }
+    },
+    toggleSelection(rows) {
+      if (rows && !this.isIndeterminate) {
+        rows.forEach(row => {
+          this.$refs.couponTable.toggleRowSelection(row);
+        });
+      } else {
+        this.$refs.couponTable.clearSelection();
+      }
+    },
+    // 多选框选中数据
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+      // 根据选择项的数量更新 checkbox 的状态
+      this.allChecked = val.length === this.couponLiveList.length;
+      this.isIndeterminate = val.length > 0 && val.length < this.couponLiveList.length;
+    },
+
+    getLiveCouponList() {
+      this.loading = true
+      listLiveCoupon(this.couponParams).then(response => {
+        this.couponLiveList = response.rows
+        this.couponLiveTotal = response.total
+        this.loading = false
+      })
+    },
+
+    // // 添加确认修改库存方法
+    // goodsDialogVisible() {
+    //   this.$refs.couponForm.validate((valid) => {
+    //     if (valid) {
+    //       updateLiveCouponBind({
+    //         goodsId: this.goodsForm.goodsId,
+    //         couponId: this.goodsForm.sales,
+    //         productId: this.goodsForm.productId
+    //       }).then(response => {
+    //         if (response.code === 200) {
+    //           this.$message.success('销量修改成功');
+    //           this.salesDialogVisible = false;
+    //           this.getLiveCouponList(); // 重新获取列表数据
+    //         } else {
+    //           this.$message.error(response.msg || '销量修改失败');
+    //         }
+    //       });
+    //     }
+    //   });
+    // },
+    /** 处理行点击事件 */
+    handleCouponRowClick(row, column) {
+      // 如果点击的是复选框列,不进行处理
+      if (column.type === 'selection') {
+        return
+      }
+
+      // 获取表格实例
+      const table = this.$refs.couponTable[0]
+      if (!table) {
+        return
+      }
+
+      // 判断当前行是否已经被选中
+      const isSelected = this.selectedCoupon.some(item => item.id === row.id)
+
+      // 切换选中状态
+      table.toggleRowSelection(row, !isSelected)
+    },
+    getCouponLists() {
+      this.queryCouponParams.liveId = this.liveId
+      listCoupon(this.queryCouponParams).then(response => {
+        this.couponList = response.rows
+        this.couponTotal = response.total
+        this.loading = false
+      })
+    },
+    handleAddLiveCoupon(){
+      this.couponDialogVisible = true;
+      this.getCouponLists()
+    },
+    handleCouponSearch(){
+      this.queryCouponParams.pageNum = 1
+      this.queryCouponParams.couponName = this.searchTitle
+      this.getCouponLists()
+    },
+    handleCouponChange(coupon) {
+      this.selectedCoupon = coupon
+    },
+    confirmAddCoupon(){
+      if (this.selectedCoupon.length === 0) {
+        this.$message({
+          message: '请选择要添加的优惠券',
+          type: 'warning'
+        })
+        return
+      }
+      addLiveCoupon({
+        liveId: this.liveId,
+        couponIds: this.selectedCoupon.map(item => item.id).join(',')
+      }).then(response => {
+        if (response.code !== 200) {
+          this.$message({
+            message: response.msg,
+            type: 'warning'
+          });
+          return;
+        }
+        this.couponDialogVisible = false;
+        this.getLiveCouponList()
+      })
+    },
+    handleCouponDelete(row){
+      var couponList = []
+      couponList.push(row.id);
+      delLiveCoupon({"couponIds":couponList,"liveId":this.liveId}).then(response => {
+        this.getLiveCouponList()
+      })
+    },
+    handleCouponBind(row){
+      this.goodsForm.couponId = row.id;
+      this.goodsForm.goodsId = row.goodsId;
+      this.getLiveGoodsList()
+    },
+
+
+    handleGoodStock(row){
+      this.stockForm.goodsId = row.goodsId;
+      this.stockForm.stock = row.stock;
+      this.stockForm.productId = row.productId;
+      this.stockDialogVisible = true;
+    },
+    // 绑定商品
+    confirmGoodChange() {
+      this.$refs.goodsForm.validate((valid) => {
+        if (valid) {
+          updateLiveCouponBind({
+            goodsId: this.goodsForm.goodsId,
+            couponId: this.goodsForm.couponId,
+            liveId: this.liveId
+          }).then(response => {
+            if (response.code === 200) {
+              this.$message.success('商品修改成功');
+              this.goodsDialogVisible = false;
+              this.getLiveCouponList(); // 重新获取列表数据
+            } else {
+              this.$message.error(response.msg || '商品修改失败');
+            }
+          });
+        }
+      });
+    },
+
+  }
+};
+</script>
+
+<style scoped>
+.selection-toolbar {
+  display: flex;
+  align-items: center;
+  margin-bottom: 10px;
+  padding-left: 10px;
+}
+
+.selection-toolbar .el-checkbox {
+  margin-right: 10px;
+}
+
+/* 调整 checkbox 内部输入框的对齐 */
+.selection-toolbar .el-checkbox .el-checkbox__inner {
+  top: 8px; /* 根据实际需求调整 */
+}
+</style>

+ 918 - 0
src/views/live/liveConfig/liveLotteryConf.vue

@@ -0,0 +1,918 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="直播间ID" prop="liveId">
+        <el-input
+          v-model="queryParams.liveId"
+          placeholder="请输入直播间ID"
+          clearable
+          size="small"
+          :disabled="canLiveId"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="参与方式" prop="require">
+        <el-select v-model="queryParams.require" placeholder="请输入参与抽奖方式">
+          <el-option v-for="(item,index) in requireOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="抽奖状态" prop="require">
+        <el-select v-model="queryParams.lotteryStatus" placeholder="请输入参与抽奖方式">
+          <el-option v-for="(item,index) in lotteryStatusOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="抽奖标题" prop="desc">
+        <el-input
+          v-model="queryParams.desc"
+          placeholder="请输入描述"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="创建日期" prop="createTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.createTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择创建日期">
+        </el-date-picker>
+      </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">
+      <el-col :span="1.5">
+        <el-button
+          :disabled="isViewOnly"
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:liveLotteryConf:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single || isViewOnly"
+          @click="handleUpdate"
+          v-hasPermi="['live:liveLotteryConf: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:liveLotteryConf:remove']"
+        >删除</el-button>
+      </el-col>-->
+      <el-col :span="1.5">
+        <el-button
+          :disabled="isViewOnly"
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveLotteryConf:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveLotteryConfList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="抽奖ID" align="center" prop="lotteryId" />
+      <el-table-column label="操作商品" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button v-if="scope.row.lotteryStatus+'' === '0'" @click="handleUpdateProduct(scope.row)">编辑商品</el-button>
+          <el-button v-else @click="handleDetailProduct(scope.row)">查看商品</el-button>
+        </template>
+      </el-table-column>
+      <el-table-column label="直播间ID" align="center" prop="liveId" />
+      <el-table-column label="参与方式" align="center" prop="require" :formatter="requireFormatter"/>
+      <el-table-column label="抽奖状态" align="center" prop="lotteryStatus" :formatter="lotteryStatusFormatter"/>
+      <el-table-column label="配置" align="center" prop="requireConf" />
+      <el-table-column label="持续时间" align="center" prop="duration" />
+      <el-table-column label="抽奖标题" align="center" prop="desc" />
+      <el-table-column label="创建日期" align="center" prop="createTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            :disabled="isViewOnly"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+            style="margin-left: 10px"
+          >修改</el-button>
+          <!-- 开始 -->
+          <el-button
+            :disabled="isViewOnly"
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'1')"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+          >开始</el-button>
+          <!-- 暂停 -->
+          <el-button
+            :disabled="isViewOnly"
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'3')"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+          >暂停</el-button>
+          <!-- 结算 -->
+          <el-button
+            :disabled="isViewOnly"
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'2')"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+          >结算</el-button>
+
+          <el-button
+            :disabled="isViewOnly"
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+          >删除</el-button>
+          <el-button
+            v-if="scope.row.lotteryStatus+'' === '2'"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="showInfo(scope.row)"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+            style="margin-left: 10px"
+          >查看中奖</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播抽奖配置对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="直播间ID" prop="liveId">
+          <el-input v-model="form.liveId" placeholder="请输入直播间ID"
+                    :disabled="canLiveId"/>
+        </el-form-item>
+        <el-form-item label="参与方式" prop="require" >
+          <el-select v-model="form.require" placeholder="请输入参与抽奖方式">
+            <el-option v-for="(item,index) in requireOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+          </el-select>
+        </el-form-item>
+<!--        <el-form-item label="方式配置" prop="requireConf">-->
+<!--          <el-input v-model="form.requireConf" placeholder="请输入参与抽奖方式" />-->
+<!--          <span style="margin-bottom:10px;font-size: 10px; font-family: Arial,serif">当参与方式选择为“送礼参与”或“下单参与”时,此处填写商品ID及数量</span>-->
+<!--        </el-form-item>-->
+        <el-form-item label="持续时间" prop="duration" style="margin-top: 50px;">
+          <el-input v-model="form.duration" placeholder="请输入持续时间 单位:分" />
+        </el-form-item>
+        <el-form-item label="抽奖标题" prop="desc">
+          <el-input v-model="form.desc" placeholder="请输入描述" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog :title="titleProduct" :visible.sync="openProduct" width="800px" append-to-body>
+      <el-form ref="form1" :model="form1" :rules="rules1" label-width="100px" :disabled="isDetail">
+        <!-- 基础信息 -->
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="抽奖ID" prop="lotteryId">
+              <el-input v-model="form1.lotteryId" placeholder="请输入抽奖ID" :disabled="isViewOnly"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+<!--            <el-form-item label="直播间ID" prop="liveId">
+              <el-input v-model="form1.liveId" placeholder="请输入直播间ID" />
+            </el-form-item>-->
+          </el-col>
+        </el-row>
+
+        <!-- 动态奖品配置 -->
+        <el-divider content-position="left">奖品配置</el-divider>
+
+        <el-card v-for="(prize, index) in form1.prizes" :key="index" class="prize-card" shadow="hover">
+          <div slot="header" class="prize-header">
+            <span><b>奖品等级 :{{ prize.prizeLevel }}</b></span>
+            <el-button
+              :disabled="isViewOnly"
+              v-if="form1.prizes.length > 1"
+              @click="removePrize(index)"
+              type="danger"
+              icon="el-icon-delete"
+              size="mini"
+              circle
+            ></el-button>
+          </div>
+
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item
+                label="商品名称"
+                :prop="'prizes.' + index + '.productId'"
+                :rules="[{ required: true, message: '请输入商品', trigger: 'blur' }]">
+<!--                <el-input v-model="prize.productId" placeholder="请输入商品ID" />-->
+                <el-select
+                  :disabled="isViewOnly"
+                  v-model="prize.productId"
+                  :filterable="true"
+                  clearable
+                  remote
+                reserve-keyword
+                placeholder="请输入关键字搜索"
+                :loading="loadingProducts"
+                size="small"
+                style="width: 180px"
+                >
+                <el-option
+                  v-for="product in productOptions"
+                  :key="product.productId"
+                  :label="product.productName"
+                  :value="product.productId"
+                />
+                <span style="float: left">{{ product.productId }}</span>
+                <span style="margin-left: 30px ;">{{product.productName}}</span>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item
+                label="奖品等级"
+                :prop="'prizes.' + index + '.prizeLevel'"
+                :rules="[{ required: true, message: '请输入奖品等级', trigger: 'blur' }]">
+                <el-input v-model="prize.prizeLevel" placeholder="请输入奖品等级" :disabled="isViewOnly"/>
+              </el-form-item>
+            </el-col>
+          </el-row>
+
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item
+                label="单奖数量"
+                :prop="'prizes.' + index + '.perLotteryNum'"
+                :rules="[
+                { required: true, message: '请输入单次中奖数量', trigger: 'blur' },
+                { type: 'number', message: '必须为数字值' }
+              ]">
+                <el-input-number
+                  :disabled="isViewOnly"
+                  v-model="prize.perLotteryNum"
+                  :min="1"
+                  :max="100"
+                  controls-position="right"
+                  placeholder="单次中奖数量" />
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item
+                label="奖励总份数"
+                :prop="'prizes.' + index + '.totalLots'"
+                :rules="[
+                { required: true, message: '请输入奖励总份数', trigger: 'blur' },
+                { type: 'number', message: '必须为数字值' }
+              ]">
+                <el-input-number
+                  :disabled="isViewOnly"
+                  v-model="prize.totalLots"
+                  :min="1"
+                  controls-position="right"
+                  placeholder="奖励总份数" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item
+                label="实发份数"
+                :prop="'prizes.' + index + '.totalSend'"
+                >
+                <el-input-number
+                  v-model="prize.totalSend"
+                  :min="0"
+                  :max="prize.totalLots"
+                  controls-position="right"
+                  placeholder="实际发放份数"
+                  :disabled="true"/>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-card>
+
+        <div class="add-prize-btn">
+          <el-button
+            :disabled="isViewOnly"
+            @click="addPrize"
+            type="primary"
+            icon="el-icon-plus"
+            plain
+            size="small">
+            添加奖品配置
+          </el-button>
+        </div>
+      </el-form>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancel1">取 消</el-button>
+        <el-button type="primary" @click="submitForm1" v-show="!isViewOnly">确 定</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog
+      title="提示"
+      :visible.sync="recordShow"
+      width="30%"
+    >
+      <el-table border  :data="recordList" >
+        <el-table-column label="用户ID" align="center" prop="userId" />
+        <el-table-column label="产品ID" align="center" prop="productId" />
+        <el-table-column label="用户名称" align="center" prop="userName" />
+        <el-table-column label="产品名称" align="center" prop="productName" />
+      </el-table>
+      <span slot="footer" class="dialog-footer">
+    <el-button type="primary" @click="recordShow = false">关 闭</el-button>
+  </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveLotteryConf, getLiveLotteryConf, delLiveLotteryConf, addLiveLotteryConf, updateLiveLotteryConf, exportLiveLotteryConf } from "@/api/live/liveLotteryConf";
+import LiveLotteryProductConf from '@/views/live/liveLotteryProductConf/index.vue'
+import {
+  listStoreProduct,
+  updateLiveLotteryProductConf
+} from '@/api/live/liveLotteryProductConf'
+import {info} from '@/api/live/liveUserLotteryRecord'
+import { listLiveGoods } from '@/api/live/liveGoods'
+import {isView} from "core-js/internals/array-buffer-view-core";
+
+export default {
+  props:{
+    isViewOnly: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  name: "LiveLotteryConf",
+  components: { LiveLotteryProductConf },
+  data() {
+    return {
+      recordList:[],
+      recordShow: false,
+      //字典
+      requireOptions: [],
+      // 抽奖状态
+      lotteryStatusOptions: [],
+      //加载商品
+      loadingProducts: false,
+      //
+      productOptions: [],
+      isDetail: false,
+      canLiveId:false,
+      //parentLiveId
+      parentLiveId : null,
+      liveId: null,
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播抽奖配置表格数据
+      liveLotteryConfList: [],
+      // 弹出层标题
+      title: "",
+      titleProduct: "编辑抽奖商品",
+      // 是否显示弹出层
+      open: false,
+      openProduct: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null,
+        require: null,
+        desc: null,
+        createTime: null,
+        lotteryStatus: null
+      },
+      //商品信息列表
+      productList: [],
+      // 商品信息
+      product: {
+        productId: null,
+        prizeLevel: null,
+        perLotteryNum: null,
+        totalLots: null,
+        totalSend: null
+      },
+      // 表单参数
+      form:{
+        lotteryId: '',
+        liveId: '',
+        require: '',
+        requireConf: '',
+        duration: null,
+        desc: null
+      },
+      // 表单参数
+      form1: {
+        liveId: '',
+        lotteryId: '',
+        prizes: [this.getDefaultPrize()]
+      },
+      // 表单校验
+      rules: {
+        liveId: [
+          { required: true, message: "直播间ID不能为空", trigger: "blur" }
+        ],
+        require: [
+          { required: true, message: "参与抽奖方式", trigger: "blur" }
+        ],
+        //如果require为2或3,requireConf不能为空
+        requireConf: [
+          { validator: this.validRequireConf,message: "当参与方式选择为“送礼参与”或“下单参与”时,对应的配置:送礼数量/指定商品Id及数量不能为空", trigger: "blur" }
+        ],
+        duration: [
+          { required: true, message: "持续时间 单位:分不能为空", trigger: "blur" }
+        ],
+        desc: [
+          { required: true, message: "描述不能为空", trigger: "blur" }
+        ],
+      },
+      //抽奖商品表单
+      rules1: {
+        lotteryId: [
+          { required: true, message: '请输入抽奖ID', trigger: 'blur' }
+        ],
+        liveId: [
+          { required: true, message: '请输入直播间ID', trigger: 'blur' }
+        ]
+      }
+    };
+  },
+  watch: {
+    // 监听路由的 query 参数变化
+    '$route.query': {
+      handler(newQuery) {
+        if (this.$route.params.liveId) {
+          this.liveId = this.$route.params.liveId;
+        }else {
+          this.liveId = this.$route.query.liveId;
+        }
+        this.parentLiveId = this.liveId;
+        this.queryParams.liveId = this.parentLiveId;
+        if(this.queryParams.liveId){
+          this.form.liveId = this.parentLiveId;
+          //设置查询条件直播间ID不可修改
+          this.canLiveId = true;
+        }
+        if(this.liveId == null) {
+          return;
+        }
+        this.getList();
+        this.getProducts();
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
+  created() {
+    // 1在线观众  2下单 3送礼
+    this.getDicts("sys_live_lottery_require").then(response => {
+      this.requireOptions = response.data;
+    });
+    this.getDicts("sys_live_lottery_status").then(response => {
+      this.lotteryStatusOptions = response.data;
+    });
+  },
+  mounted() {
+    this.$watch(
+      () => this.form.require,
+      (newVal) => {
+        this.$refs.form.validateField('requireConf');
+      }
+    );
+  },
+  methods: {
+    isView,
+    getProducts(){
+      const queryParam = {
+          liveId : this.liveId
+      }
+      this.loadingProducts = true;
+      try {
+        listLiveGoods(queryParam).then(response => {
+          this.productOptions = response.rows;
+        })
+      } catch (err) {
+        console.error('查询商品失败:', err);
+        this.productOptions = [];
+      } finally {
+        this.loadingProducts = false;
+      }
+    },
+    // async fetchProducts(query) {
+    //   const queryParam = {
+    //     liveId : this.liveId,
+    //     keywords: query
+    //   }
+    //   this.loadingProducts = true;
+    //   try {
+    //     listLiveGoods(queryParam).then(response => {
+    //       this.productOptions = response.rows;
+    //     })
+    //   } catch (err) {
+    //     console.error('查询商品失败:', err);
+    //     this.productOptions = [];
+    //   } finally {
+    //     this.loadingProducts = false;
+    //   }
+    // },
+    // 获取默认奖品配置
+    getDefaultPrize() {
+      return {
+        productId: '',
+        prizeLevel: '',
+        perLotteryNum: 1,
+        totalLots: 1,
+        totalSend: 0
+      }
+    },
+    // 添加奖品配置
+    addPrize() {
+      this.form1.prizes.push(this.getDefaultPrize())
+    },
+
+    // 删除奖品配置
+    removePrize(index) {
+      if (this.form1.prizes.length <= 1) {
+        this.$message.warning('至少需要保留一个奖品配置')
+        return
+      }
+      this.form1.prizes.splice(index, 1)
+    },
+
+    requireFormatter(row, column) {
+      return this.selectDictLabel(this.requireOptions, row.require);
+    },
+    lotteryStatusFormatter(row, column) {
+      return this.selectDictLabel(this.lotteryStatusOptions, row.lotteryStatus);
+    },
+    validRequireConf(rule, value, callback) {
+      if(this.form.require+"" === "2" || this.form.require+"" === "3"){
+        if(!value){
+          callback(new Error());
+          return false;
+        }
+      }
+      callback();
+      return true;
+    },
+    /** 查询直播抽奖配置列表 */
+    getList() {
+      this.loading = true;
+      listLiveLotteryConf(this.queryParams).then(response => {
+        this.liveLotteryConfList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 取消
+    cancel1() {
+      this.openProduct = false;
+    },
+
+    // 重置表单
+    resetForm1() {
+      this.form1 = {
+        lotteryId: '',
+        liveId: '',
+        prizes: [this.getDefaultPrize()]
+      }
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        lotteryId: null,
+        liveId: null,
+        require: null,
+        requireConf: null,
+        duration: null,
+        desc: null
+      };
+      this.resetForm("form");
+      this.checkParentLiveId();
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.queryParams = {
+          pageNum: 1,
+          pageSize: 10,
+          liveId: null,
+          require: null,
+          desc: null,
+          createTime: null,
+          lotteryStatus: null
+      }
+      this.resetForm("queryForm");
+      this.checkParentLiveId();
+      this.handleQuery();
+    },
+    //判断父页面传入参数
+    checkParentLiveId(){
+      if(this.parentLiveId){
+        this.form.liveId = this.parentLiveId;
+        this.queryParams.liveId = this.parentLiveId;
+      }
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.lotteryId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播抽奖配置";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const lotteryId = row.lotteryId || this.ids
+      //只能对未开始或暂停的抽奖进行修改
+      if(row.lotteryStatus+"" !== "0" && row.lotteryStatus+"" !== "3"){
+        this.msgError("只能对未开始或暂停的抽奖进行修改");
+        return;
+      }
+      getLiveLotteryConf(lotteryId).then(response => {
+        this.form = response.data;
+        this.form.require = this.form.require + ""
+        this.open = true;
+        this.title = "修改直播抽奖配置";
+      });
+    },
+    /** 修改按钮操作 */
+    handleUpdateProduct(row) {
+      this.form1.lotteryId = row.lotteryId;
+      //如果状态为已结束,则不能修改
+      if(row.lotteryStatus+"" === "2"){
+        this.msgError("已结束的抽奖不能修改");
+        return;
+      }
+      this.openProduct = true;
+      this.isDetail = false;
+      listStoreProduct(row.lotteryId).then(response => {
+        this.form1 = response.data;
+        if(this.form1.prizes.length === 0)
+          this.form1.prizes = [this.getDefaultPrize()]
+        this.form1.liveId = row.liveId;
+      });
+    },
+    /** 详情按钮操作 */
+    handleDetailProduct(row) {
+      this.form1.lotteryId = row.lotteryId;
+      //如果状态为已结束,则不能修改
+      if(row.status+"" === "2"){
+        this.msgError("已结束的抽奖不能修改");
+        return;
+      }
+      this.openProduct = true;
+      this.isDetail = true;
+      listStoreProduct(row.lotteryId).then(response => {
+        this.form1 = response.data;
+        this.form1.liveId = row.liveId;
+      });
+    },
+    /** 抽奖状态修改 */
+    handleStatusChange(row, status) {
+      if (this.$store.state.liveWs[this.liveId] == null) {
+        this.msgError("请从直播间进行操作!");
+        return;
+      }
+      //结束的抽奖不能进行操作
+      if(row.lotteryStatus+"" === "2"){
+        this.msgError("已结束的抽奖不能进行操作");
+        return;
+      }
+      switch (status+"") {
+        case "1":
+          //只能对未开启的抽奖进行操作
+          if(row.lotteryStatus+"" !== "0" && row.lotteryStatus+"" !== "3"){
+            this.msgError("只能对未开启或暂停的抽奖进行开始操作");
+            return;
+          }
+          break;
+        case "2":
+          //只能对进行中或暂停的抽奖进行结算
+          if(row.lotteryStatus+"" !== "1" && row.lotteryStatus+"" !== "3"){
+            this.msgError("只能对进行中或暂停的抽奖进行结算");
+            return;
+          }
+          break;
+        case "3":
+          //只能对进行中的抽奖执行暂停操作
+          if(row.lotteryStatus+"" !== "1"){
+            this.msgError("只能对进行中的抽奖执行暂停操作");
+            return;
+          }
+          break;
+        default:
+          return;
+      }
+      const doLotteryParam = {
+        lotteryId: row.lotteryId,
+        lotteryStatus: status,
+        liveId:this.liveId,
+        duration: row.duration,
+        status: status
+      };
+      updateLiveLotteryConf(doLotteryParam).then(response => {
+        if(response.code === 200){
+          const msg = {
+            cmd: 'lottery',
+            data: doLotteryParam
+          };
+          this.$store.state.liveWs[this.liveId].send(JSON.stringify(msg));
+
+          this.msgSuccess("修改成功");
+        }else{
+          this.msgError(response.msg);
+        }
+          this.open = false;
+          this.getList();
+        });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.lotteryId != null) {
+            updateLiveLotteryConf(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addLiveLotteryConf(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    submitForm1() {
+      console.log("form1")
+      console.log(this.form1)
+      this.$refs["form1"].validate(valid => {
+        if (valid) {
+          updateLiveLotteryProductConf(this.form1).then(response => {
+            //200 成功
+            this.msgSuccess("保存成功");
+            this.openProduct = false;
+            this.resetForm1();
+          });
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      //如果抽奖状态不为0,则不能删除
+      if(row.lotteryStatus+"" !== "0"){
+        this.msgError("只能删除未开始的抽奖配置");
+        return;
+      }
+      const lotteryIds = row.lotteryId || this.ids;
+      this.$confirm('是否确认删除直播抽奖配置编号为"' + lotteryIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveLotteryConf(lotteryIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+          const msg = {
+            cmd: 'lottery',
+            data: {
+              lotteryId: row.lotteryId,
+              lotteryStatus: 2,
+              duration: row.duration
+            }
+          };
+          this.$store.state.liveWs[this.liveId].send(JSON.stringify(msg));
+        }).catch(() => {});
+    },
+
+    showInfo(row) {
+      this.recordList = []
+      //如果抽奖状态不为0,则不能删除
+      const lotteryIds = row.lotteryId;
+      if(row.lotteryStatus+"" !== "2") {
+        this.msgError("只能查看已结束的中奖名单");
+        return;
+      }
+      info({lotteryId: lotteryIds, liveId: this.liveId}).then(response => {
+        this.recordList = response.data;
+        this.recordShow = true;
+      });
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播抽奖配置数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveLotteryConf(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>
+<style scoped>
+.prize-card {
+  margin-bottom: 20px;
+}
+
+.prize-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.add-prize-btn {
+  margin-top: 10px;
+  text-align: center;
+}
+
+.dialog-footer {
+  text-align: right;
+}
+
+</style>

+ 532 - 0
src/views/live/liveConfig/liveRedConf.vue

@@ -0,0 +1,532 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="红包状态" prop="redStatus">
+        <el-select v-model="queryParams.redStatus" placeholder="请选择红包状态" clearable size="small">
+          <el-option v-for="(item,index) in redStatusOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="红包类型" prop="redType">
+        <el-select v-model="queryParams.redType" placeholder="请选择红包类型" clearable size="small">
+          <el-option v-for="(item,index) in redTypeOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="直播间ID" prop="liveId" >
+        <el-input
+          v-model="queryParams.liveId"
+          placeholder="请输入直播间ID"
+          clearable
+          size="small"
+          :disabled="canLiveId"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="红包标题" prop="desc">
+        <el-input
+          v-model="queryParams.desc"
+          placeholder="请输入描述"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+<!--      <el-form-item label="创建日期" prop="createTime">-->
+<!--        <el-date-picker clearable size="small"-->
+<!--          v-model="queryParams.createTime"-->
+<!--          type="date"-->
+<!--          value-format="yyyy-MM-dd"-->
+<!--          placeholder="选择创建日期">-->
+<!--        </el-date-picker>-->
+<!--      </el-form-item>-->
+<!--      <el-form-item label="修改日期" prop="updateTime">-->
+<!--        <el-date-picker clearable size="small"-->
+<!--          v-model="queryParams.updateTime"-->
+<!--          type="date"-->
+<!--          value-format="yyyy-MM-dd"-->
+<!--          placeholder="选择修改日期">-->
+<!--        </el-date-picker>-->
+<!--      </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">
+      <el-col :span="1.5">
+        <el-button
+          :disabled="isViewOnly"
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:liveRedConf:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single || isViewOnly"
+          @click="handleUpdate"
+          v-hasPermi="['live:liveRedConf:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          :disabled="isViewOnly"
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveRedConf:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveRedConfList" @selection-change="handleSelectionChange">
+      <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="有效时间 单位:分" align="center" prop="duration" />
+      <el-table-column label="红包类型" align="center" prop="redType" :formatter="redTypeFormatter"/>
+      <el-table-column label="直播间ID" align="center" prop="liveId" />
+      <el-table-column label="芳华币数量" align="center" prop="redNum" />
+      <el-table-column label="可中奖份量" align="center" prop="totalLots" />
+      <el-table-column label="实际发放奖励份量" align="center" prop="totalSend" />
+      <el-table-column label="红包标题" align="center" prop="desc" />
+      <el-table-column label="创建日期" align="center" prop="createTime" width="120">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="修改日期" align="center" prop="updateTime" width="120">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            :disabled="isViewOnly"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:liveRedConf:edit']"
+            style="margin-left: 10px"
+          >修改</el-button>
+          <!-- 开始 -->
+          <el-button
+            :disabled="isViewOnly"
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'1')"
+            v-hasPermi="['live:liveRedConf:edit']"
+          >开始</el-button>
+          <!-- 暂停 -->
+          <el-button
+            :disabled="isViewOnly"
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'3')"
+            v-hasPermi="['live:liveRedConf:edit']"
+          >暂停</el-button>
+          <!-- 结算 -->
+          <el-button
+            :disabled="isViewOnly"
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'2')"
+            v-hasPermi="['live:liveRedConf:edit']"
+          >结算</el-button>
+
+          <el-button
+            :disabled="isViewOnly"
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:liveRedConf:edit']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播红包记录配置对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="持续时间" prop="duration">
+          <el-input v-model="form.duration" placeholder="请输入红包有效时间 单位:分" />
+        </el-form-item>
+<!--        <el-form-item label="红包类型" prop="redType">
+          <el-select v-model="form.redType" placeholder="请选择红包类型">
+            <el-option v-for="(item,index) in redTypeOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+          </el-select>
+        </el-form-item>-->
+        <el-form-item label="直播间ID" prop="liveId">
+          <el-input v-model="form.liveId" placeholder="请输入直播间ID" :disabled="canLiveId"/>
+        </el-form-item>
+        <el-form-item label="芳华币数" prop="redNum">
+          <el-input v-model="form.redNum" placeholder="请输入芳华币数量" />
+        </el-form-item>
+        <el-form-item label="中奖份量" prop="totalLots">
+          <el-input v-model="form.totalLots" placeholder="请输入可中奖份量" />
+        </el-form-item>
+        <el-form-item label="红包标题" prop="desc">
+          <el-input v-model="form.desc" placeholder="请输入红包描述" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveRedConf, getLiveRedConf, delLiveRedConf, addLiveRedConf, updateLiveRedConf, exportLiveRedConf } from "@/api/live/liveRedConf";
+
+export default {
+  props:{
+    isViewOnly: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  name: "LiveRedConf",
+  data() {
+    return {
+      //字典
+      // redStatusOptions: [{label:"未发放",value:0},{label:"发放中",value:1},{label:"已结束",value:2},{label:"暂停",value:3}],
+      redStatusOptions: [],
+      redTypeOptions: [],
+      canLiveId:false,
+      //parentLiveId
+      parentLiveId : null,
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播红包记录配置表格数据
+      liveRedConfList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        redStatus: null,
+        redType: null,
+        liveId: null,
+        desc: null,
+        createTime: null,
+        updateTime: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        duration: [
+          { required: true, message: "有效时间 单位:分不能为空", trigger: "blur" }
+        ],
+        /* redType: [
+          { required: true, message: "红包类型不能为空", trigger: "change" }
+        ], */
+        liveId: [
+          { required: true, message: "直播间ID不能为空", trigger: "blur" }
+        ],
+        redNum: [
+          { required: true, message: "芳华币数量不能为空", trigger: "blur" }
+        ],
+        totalLots: [
+          { required: true, message: "可中奖份量不能为空", trigger: "blur" }
+        ],
+        desc: [
+          { required: true, message: "描述不能为空", trigger: "blur" }
+        ],
+      },
+
+    };
+  },
+  watch: {
+    // 监听路由的 query 参数变化
+    '$route.query': {
+      handler(newQuery) {
+        if (this.$route.params.liveId) {
+          this.liveId = this.$route.params.liveId;
+        }else {
+          this.liveId = this.$route.query.liveId;
+        }
+        this.queryParams.liveId = this.liveId;
+        this.parentLiveId = this.liveId;
+        if(this.queryParams.liveId){
+          this.form.liveId = this.parentLiveId;
+          //设置查询条件直播间ID不可修改
+          this.canLiveId = true;
+        }
+        if(this.liveId == null) {
+          return;
+        }
+        this.getList();
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
+  created() {
+    this.getDicts("sys_live_red_status").then(response => {
+      this.redStatusOptions = response.data;
+    });
+    this.getDicts("sys_live_red_type").then(response => {
+      this.redTypeOptions = response.data;
+    });
+  },
+  computed: {
+
+  },
+  methods: {
+    handleStatusChange(row, status) {
+      if (this.$store.state.liveWs[this.liveId] == null) {
+        this.msgError("请从直播间进行操作!");
+        return;
+      }
+      //结束的抽奖不能进行操作
+      if(row.redStatus+"" === "2"){
+        this.msgError("已结束的红包不能进行操作");
+        return;
+      }
+      switch (status+"") {
+        case "1":
+          //只能对未开启的抽奖进行操作
+          if(row.redStatus+"" !== "0" && row.redStatus+"" !== "3"){
+            this.msgError("只能对未开启或暂停的红包进行开始操作");
+            return;
+          }
+          break;
+        case "2":
+          //只能对进行中或暂停的红包进行结算
+          if(row.redStatus+"" !== "1" && row.redStatus+"" !== "3"){
+            this.msgError("只能对进行中或暂停的红包进行结算");
+            return;
+          }
+          break;
+        case "3":
+          //只能对进行中的抽奖执行暂停操作
+          if(row.redStatus+"" !== "1"){
+            this.msgError("只能对进行中的红包执行暂停操作");
+            return;
+          }
+          break;
+        default:
+          return;
+      }
+      const doRedParam = {
+        redId: row.redId,
+        redStatus: status,
+        totalLots: row.totalLots,
+        liveId: this.liveId,
+        status: status,
+        duration: row.duration
+      };
+      updateLiveRedConf(doRedParam).then(response => {
+        if(response.code === 200){
+          const msg = {
+            cmd: 'red',
+            data: doRedParam
+          };
+          this.$store.state.liveWs[this.liveId].send(JSON.stringify(msg));
+          this.msgSuccess("修改成功");
+          console.log(1)
+        }else{
+          this.msgError(response.msg);
+          console.log(2)
+        }
+        this.open = false;
+        this.getList();
+        console.log(3)
+      });
+    },
+    redStatusFormatter(row, column) {
+      return this.selectDictLabel(this.redStatusOptions, row.redStatus);
+    },
+    redTypeFormatter(row, column) {
+      return this.selectDictLabel(this.redTypeOptions, row.redType);
+    },
+    /** 查询直播红包记录配置列表 */
+    getList() {
+      this.loading = true;
+      listLiveRedConf(this.queryParams).then(response => {
+        this.liveRedConfList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        redId: null,
+        redStatus: null,
+        duration: null,
+        //redType: null,
+        liveId: null,
+        redNum: null,
+        totalLots: null,
+        totalSend: null,
+        desc: null,
+        createTime: null,
+        updateTime: null,
+        createBy: null,
+        updateBy: null
+      };
+      this.resetForm("form");
+      this.checkParentLiveId();
+    },
+    //判断父页面传入参数
+    checkParentLiveId(){
+      if(this.parentLiveId){
+        this.form.liveId = this.parentLiveId;
+        this.queryParams.liveId = this.parentLiveId;
+      }
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.checkParentLiveId();
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.redId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播红包记录配置";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      //只能对未开始或暂停的抽奖进行修改
+      if(row.redStatus+"" !== "0" && row.redStatus+"" !== "3"){
+        this.msgError("只能对未开始或暂停的红包进行修改");
+        return;
+      }
+      this.reset();
+      const redId = row.redId || this.ids
+      getLiveRedConf(redId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改直播红包记录配置";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.redId != null) {
+            updateLiveRedConf(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            this.form.redType = 1;
+            addLiveRedConf(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      //如果状态不为0,则不能删除
+      if (row.redStatus+"" !== "0") {
+        this.msgError("只能删除未发放的红包");
+        return;
+      }
+      const redIds = row.redId || this.ids;
+      this.$confirm('是否确认删除直播红包记录配置编号为"' + redIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveRedConf(redIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+          const msg = {
+            cmd: 'red',
+            data: {
+              redId: row.redId,
+              status: 2,
+              totalLots: row.totalLots,
+              duration: row.duration
+            }
+          };
+          this.$store.state.liveWs[this.liveId].send(JSON.stringify(msg));
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播红包记录配置数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveRedConf(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 546 - 0
src/views/live/liveConfig/liveReplay.vue

@@ -0,0 +1,546 @@
+<template>
+  <div class="app-container" v-loading.fullscreen.lock="loading">
+    <!-- 直播回放开关区域 -->
+
+    <div class="switch-area">
+      <span class="switch-label">直播回放:</span>
+      <el-switch
+        v-model="replayForm.isPlaybackOpen"
+        @change="handlePlaybackSwitch"
+        :disabled="isViewOnly"
+      />
+      <span class="switch-desc" style="color: #9c9c9c;margin-left: 10px">开启回放,直播结束后学员可查看回放视频</span>
+    </div>
+
+    <!-- 回放模式区域 -->
+    <div class="playback-mode" v-if="replayForm.isPlaybackOpen">
+      <div class="mode-title">回放模式:</div>
+      <div class="mode-option">
+        <el-radio v-model="replayForm.playbackMode" label="1">模式一:以直播间全部直播视频作为回看</el-radio>
+      </div>
+<!--      <div class="mode-option">-->
+<!--        <el-radio v-model="playbackMode" label="2">模式二:以直播间最后一次直播视频作为回看</el-radio>-->
+<!--      </div>-->
+<!--      <div class="mode-option">-->
+<!--        <el-radio v-model="playbackMode" label="3">模式三:自主选择本直播间或素材库任一视频作为回看</el-radio>-->
+<!--      </div>-->
+    </div>
+
+    <!-- 回放有效期区域 -->
+    <div class="validity-period" v-if="replayForm.isPlaybackOpen">
+      <div class="period-title">回放有效期:</div>
+      <div class="period-option">
+        <el-radio @change="updateForm" v-model="replayForm.validityType" label="permanent">永久有效</el-radio>
+      </div>
+      <div class="period-option">
+        <el-radio v-model="replayForm.validityType" label="days">
+          直播结束后
+          <el-input
+            v-model.number="replayForm.validDays"
+            type="number"
+            @change="updateForm"
+            :min="1"
+            placeholder="天数"
+          />
+          天有效
+          <el-tooltip
+            content="以直播实际结束时间为准"
+            placement="top"
+            effect="light"
+          >
+            <i class="el-icon-question" style="color: #999; margin-left: 5px" />
+          </el-tooltip>        </el-radio>
+      </div>
+      <div class="period-desc">
+        到期后,学员无法观看回放内容
+      </div>
+
+      <!-- 倍速播放区域 -->
+      <div class="speed-play">
+        <div class="speed-label">倍速播放/快进:</div>
+        <el-radio @change="updateForm" v-model="replayForm.isSpeedAllowed" label="1">允许</el-radio>
+        <el-radio @change="updateForm" v-model="replayForm.isSpeedAllowed" label="0">禁止</el-radio>
+        <span class="speed-desc">禁止时,课程未学完学员不可倍速播放、拖动进度条</span>
+        <span class="pro-tag">专业版</span>
+      </div>
+    </div>
+
+    <!-- 回放内容区域 -->
+    <div class="playback-content">
+      <div>
+        <span>回放内容:</span>
+<!--        <el-button-->
+<!--          class="upload-btn"-->
+<!--          type="text"-->
+<!--          icon="el-icon-plus"-->
+<!--          @click="handleUploadVideo"-->
+<!--        >上传视频</el-button>-->
+<!--        <span class="upload-tip">上传视频大小不可超过5GB</span>-->
+      </div>
+
+      <!-- 视频列表 -->
+      <el-table
+        :data="videoList"
+        border
+        style="width: 100%; margin-top: 10px"
+      >
+        <el-table-column prop="videoName" label="视频名称">
+          <template slot-scope="scope">
+            <div class="video-item">
+<!--              <img-->
+<!--                :src="scope.row.videoCover"-->
+<!--                class="video-cover"-->
+<!--                alt="视频封面"-->
+<!--              />-->
+              <div class="video-info">
+                <div class="video-name">{{ scope.row.videoName }}</div>
+              </div>
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="duration" label="时长" />
+        <el-table-column prop="status" label="状态">
+          <template slot-scope="scope">
+            <span v-if="scope.row.status === '回放中'">
+              <span class="status-dot" />{{ scope.row.status }}
+            </span>
+            <span v-else>{{ scope.row.status }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="updateTime" label="更新时间" />
+        <el-table-column label="视频地址" prop="videoUrl" >
+          <template slot-scope="scope">
+            <el-tooltip
+              :content="scope.row.videoUrl"
+              placement="top"
+              effect="dark"
+            >
+              <a
+                :href="scope.row.videoUrl"
+                target="_blank"
+                class="video-url-container"
+                rel="noopener noreferrer"
+              >
+                {{
+                  scope.row.videoUrl.length > 32
+                    ? scope.row.videoUrl.substring(0, 32) + '...'
+                    : scope.row.videoUrl
+                }}
+                <i class="el-icon-external-link video-url-icon"></i>
+              </a>
+            </el-tooltip>
+          </template>
+        </el-table-column>
+<!--        <el-table-column label="操作" prop="videoUrl" >-->
+<!--          <template slot-scope="scope">-->
+
+<!--            &lt;!&ndash;            <el-button&ndash;&gt;-->
+<!--            &lt;!&ndash;              type="text"&ndash;&gt;-->
+<!--            &lt;!&ndash;              size="small"&ndash;&gt;-->
+<!--            &lt;!&ndash;              @click="handleCut(scope.row)"&ndash;&gt;-->
+<!--            &lt;!&ndash;            >剪切</el-button>&ndash;&gt;-->
+<!--            &lt;!&ndash;            <el-button&ndash;&gt;-->
+<!--            &lt;!&ndash;              type="text"&ndash;&gt;-->
+<!--            &lt;!&ndash;              size="small"&ndash;&gt;-->
+<!--            &lt;!&ndash;              @click="handleGenerateAiSummary(scope.row)"&ndash;&gt;-->
+<!--            &lt;!&ndash;            >生成AI速览</el-button>&ndash;&gt;-->
+<!--            &lt;!&ndash;            <el-button&ndash;&gt;-->
+<!--            &lt;!&ndash;              type="text"&ndash;&gt;-->
+<!--            &lt;!&ndash;              size="small"&ndash;&gt;-->
+<!--            &lt;!&ndash;              @click="handleGenerateSubtitle(scope.row)"&ndash;&gt;-->
+<!--            &lt;!&ndash;            >生成字幕</el-button>&ndash;&gt;-->
+<!--            &lt;!&ndash;            <el-button&ndash;&gt;-->
+<!--            &lt;!&ndash;              type="text"&ndash;&gt;-->
+<!--            &lt;!&ndash;              size="small"&ndash;&gt;-->
+<!--            &lt;!&ndash;              @click="handlePlaybackSegment(scope.row)"&ndash;&gt;-->
+<!--            &lt;!&ndash;            >回放片段</el-button>&ndash;&gt;-->
+<!--          </template>-->
+<!--        </el-table-column>-->
+      </el-table>
+    </div>
+  </div>
+</template>
+
+<script>
+import {getLive, updateLive,} from '@/api/live/live'
+import {getLiveVideoByLiveId,} from '@/api/live/liveVideo'
+
+export default {
+  props:{
+    isViewOnly: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  name: "LiveReplay",
+  data() {
+    return {
+      loading: true,
+      replayForm:{
+        isPlaybackOpen: false, // 直播回放开关状态
+        playbackMode: "1", // 回放模式,默认模式一
+        validityType: "days", // 回放有效期类型,默认天数
+        validDays: 7, // 有效天数
+        isSpeedAllowed: "1", // 是否允许倍速播放,默认允许
+      },
+      videoList: [
+
+      ], // 视频列表数据,实际需从接口获取
+      liveId: null,
+      liveInfo: null,
+
+    };
+  },
+  watch: {
+    // 监听路由的 query 参数变化
+    '$route.query': {
+      handler(newQuery) {
+        if (this.$route.params.liveId) {
+          this.liveId = this.$route.params.liveId;
+        }else {
+          this.liveId = this.$route.query.liveId;
+        }
+        if(this.liveId == null) {
+          return;
+        }
+        this.getLive();
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
+  created() {
+    // if (this.$route.params.liveId) {
+    //   this.liveId = this.$route.params.liveId;
+    // }else {
+    //   this.liveId = this.$route.query.liveId;
+    // }
+    // if(this.liveId == null) {
+    //   this.$message.error("页面错误,请联系管理员");
+    //   return;
+    // }
+    // this.getLive();
+  },
+  methods: {
+    getLiveVideo() {
+      getLiveVideoByLiveId(this.liveId).then(res => {
+        let dataEntity =
+        {
+          duration: "00:00",
+          status: "回放中",
+          updateTime: "2025-09-08 14:28:24",
+        };
+
+        //将秒数转为时分秒
+        dataEntity.duration = this.convertSeconds(res.data.duration);
+        dataEntity.updateTime = res.data.updateTime;
+        dataEntity.videoUrl = res.data.videoUrl;
+        dataEntity.videoName = this.extractFileName(dataEntity.videoUrl)
+
+        this.videoList.push(dataEntity);
+      });
+    },
+    /**
+     * 提取文件名称核心方法
+     * 逻辑:通过split('/')分割路径,取最后一个非空元素作为文件名称
+     */
+    extractFileName(data) {
+      try {
+        this.errorMsg = '';
+        const trimmedUrl = data.trim();
+        // 用'/'分割路径,过滤空字符串(避免路径末尾有'/'导致的空元素)
+        const pathSegments = trimmedUrl.split('/').filter(segment => segment);
+        if (pathSegments.length === 0) {
+          throw new Error('输入的路径格式无效,请检查后重新输入');
+        }
+        // 最后一个分段即为文件名称
+        const fileName = pathSegments[pathSegments.length - 1];
+        // 简单校验是否为常见视频文件格式(可选,根据需求调整)
+        const videoExtensions = ['mp4', 'mov', 'avi', 'flv', 'mkv'];
+        const fileExtension = fileName.split('.').pop()?.toLowerCase();
+        if (!fileExtension || !videoExtensions.includes(fileExtension)) {
+          this.errorMsg = '提示:提取到的文件可能不是常见视频格式,请注意校验';
+        }
+        return fileName;
+      } catch (err) {
+        this.errorMsg = err.message;
+        return '';
+      }
+    },
+    convertSeconds(data) {
+      // 确保输入是有效的数字
+      const totalSeconds = Math.max(0, parseInt(data) || 0);
+
+      // 计算时、分、秒
+      const hours = Math.floor(totalSeconds / 3600);
+      const minutes = Math.floor((totalSeconds % 3600) / 60);
+      const seconds = totalSeconds % 60;
+
+      // 格式化每个部分为两位数
+      return `${this.padWithZero(hours)}:${this.padWithZero(minutes)}:${this.padWithZero(seconds)}`;
+    },
+    padWithZero(num) {
+      // 将数字转换为两位数格式
+      return num.toString().padStart(2, '0');
+    },
+    getLive() {
+      getLive(this.liveId).then(res => {
+        this.liveInfo = res.data;
+        if(res.data.liveConfig){
+          this.replayForm = JSON.parse(res.data.liveConfig);
+          this.getLiveVideo();
+        }else{
+          this.resetForm();
+        }
+        this.loading = false;
+      });
+    },
+    resetForm() {
+      this.replayForm={
+          isPlaybackOpen: false, // 直播回放开关状态
+          playbackMode: "1", // 回放模式,默认模式一
+          validityType: "days", // 回放有效期类型,默认天数
+          validDays: 7, // 有效天数
+          isSpeedAllowed: "1", // 是否允许倍速播放,默认允许
+      }
+    },
+    // 直播回放开关变更处理
+    handlePlaybackSwitch(val) {
+      if(this.isViewOnly) return;
+      if (this.liveInfo.liveType != 1 && this.liveInfo.liveType != 3) {
+        this.replayForm.isPlaybackOpen = !val;
+        this.$message.error("直播回放开关仅支持直播");
+        return;
+      }
+
+      if (!this.liveInfo.finishTime) {
+        this.replayForm.isPlaybackOpen = !val;
+        this.$message.error("直播未结束");
+        return;
+      }
+      this.replayForm.isPlaybackOpen = val;
+      this.updateForm()
+    },
+    updateForm(){
+      let param = {
+        liveId: this.liveId,
+        startTime:this.liveInfo.startTime,
+        finishTime:this.liveInfo.finishTime,
+        status:4,
+        liveConfig: JSON.stringify(this.replayForm)
+      };
+      updateLive(param).then(res => {
+        if (res.code != 200) {
+          this.$message.error(res.msg);
+        }
+      });
+    },
+    // 上传视频处理
+    handleUploadVideo() {
+      // 模拟上传视频逻辑,实际需调用上传组件或接口
+      this.$message.info("点击了上传视频按钮,实际需对接上传逻辑");
+    },
+    // 剪切视频处理
+    handleCut(video) {
+      this.$message.info(`点击了剪切视频,视频名称:${video.videoName}`);
+      // 实际剪切逻辑
+    },
+    // 生成AI速览处理
+    handleGenerateAiSummary(video) {
+      this.$message.info(`点击了生成AI速览,视频名称:${video.videoName}`);
+      // 实际生成AI速览逻辑
+    },
+    // 生成字幕处理
+    handleGenerateSubtitle(video) {
+      this.$message.info(`点击了生成字幕,视频名称:${video.videoName}`);
+      // 实际生成字幕逻辑
+    },
+    // 回放片段处理
+    handlePlaybackSegment(video) {
+      this.$message.info(`点击了回放片段,视频名称:${video.videoName}`);
+      // 实际回放片段逻辑
+    },
+  },
+};
+</script>
+
+<style scoped>
+.live-playback-setting {
+  font-family: "Microsoft Yahei", sans-serif;
+  color: #333;
+  background-color: #fff;
+  padding: 20px;
+  border-radius: 4px;
+  box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
+}
+
+.switch-area {
+  display: flex;
+  align-items: center;
+  margin-bottom: 20px;
+}
+.switch-area .switch-label {
+  margin-right: 10px;
+  font-size: 14px;
+}
+.switch-area .switch-desc {
+  color: #999;
+  font-size: 12px;
+}
+
+.playback-mode {
+  background-color: #f9fafc;
+  padding: 15px;
+  border-radius: 4px;
+  margin-bottom: 20px;
+}
+.playback-mode .mode-title {
+  font-size: 14px;
+  margin-bottom: 10px;
+}
+.playback-mode .mode-option {
+  display: flex;
+  align-items: center;
+  margin-bottom: 8px;
+}
+.playback-mode .mode-option .el-radio {
+  margin-left: 2%;
+}
+.playback-mode .mode-option label {
+  font-size: 13px;
+}
+
+.validity-period {
+  background-color: #f9fafc;
+  padding: 15px;
+  border-radius: 4px;
+  margin-bottom: 20px;
+}
+.validity-period .period-title {
+  font-size: 14px;
+  margin-bottom: 10px;
+}
+.validity-period .period-option {
+  display: flex;
+  align-items: center;
+  margin-bottom: 8px;
+}
+.validity-period .period-option .el-radio {
+  margin-left: 2%;
+}
+.validity-period .period-option label {
+  font-size: 13px;
+}
+.validity-period .period-desc {
+  color: #999;
+  font-size: 12px;
+  margin-top: 5px;
+  margin-left: 2%;
+}
+.validity-period .day-input {
+  width: 60px;
+  height: 28px;
+  border: 1px solid #ddd;
+  border-radius: 4px;
+  padding: 0 8px;
+  margin: 0 5px;
+}
+
+.speed-play {
+  display: flex;
+  align-items: center;
+  margin-top: 15px;
+}
+.speed-play .speed-label {
+  font-size: 13px;
+  margin-right: 10px;
+}
+.speed-play .el-radio {
+  margin-right: 5px;
+}
+.speed-play .speed-desc {
+  color: #999;
+  font-size: 12px;
+  margin-left: 10px;
+}
+
+.pro-tag {
+  display: inline-block;
+  background-color: #007bff;
+  color: #fff;
+  font-size: 10px;
+  padding: 2px 5px;
+  border-radius: 3px;
+  margin-left: 5px;
+  vertical-align: middle;
+}
+
+.playback-content {
+  margin-top: 20px;
+}
+.playback-content .upload-btn {
+  display: inline-block;
+  background-color: #fff;
+  border: 1px dashed #ddd;
+  color: #007bff;
+  padding: 8px 15px;
+  border-radius: 4px;
+  cursor: pointer;
+  font-size: 13px;
+  margin-bottom: 15px;
+}
+.playback-content .upload-btn:hover {
+  border-color: #007bff;
+}
+.playback-content .upload-tip {
+  font-size: 12px;
+  color: #999;
+  margin-left: 10px;
+}
+
+.video-item {
+  display: flex;
+  align-items: center;
+}
+.video-cover {
+  width: 80px;
+  height: 45px;
+  border-radius: 4px;
+  margin-right: 10px;
+}
+.video-info .video-name {
+  font-size: 13px;
+  margin-bottom: 3px;
+}
+.video-info .video-desc {
+  font-size: 12px;
+  color: #999;
+}
+.video-duration,
+.video-source,
+.video-status,
+.video-update-time {
+  color: #666;
+}
+.video-status .status-dot {
+  display: inline-block;
+  width: 8px;
+  height: 8px;
+  background-color: #007bff;
+  border-radius: 50%;
+  margin-right: 5px;
+  vertical-align: middle;
+}
+.video-operation .el-button {
+  color: #007bff;
+  font-size: 12px;
+  margin-right: 10px;
+}
+.video-url-container {
+  cursor: pointer;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  max-width: 100%;
+}
+</style>

+ 455 - 0
src/views/live/liveConfig/preview.vue

@@ -0,0 +1,455 @@
+<template>
+  <div class="app-container" v-loading.fullscreen.lock="loading">
+    <!-- 直播回放开关区域 -->
+
+    <!-- 回放内容区域 -->
+    <div class="playback-content">
+      <div>
+        <span>预告内容:</span>
+        <el-button class="upload-btn" type="normal" @click="handleUploadVideo" v-show="!isViewOnly">上传视频</el-button>
+        <!--        <el-button-->
+        <!--          class="upload-btn"-->
+        <!--          type="text"-->
+        <!--          icon="el-icon-plus"-->
+        <!--          @click="handleUploadVideo"-->
+        <!--        >上传视频</el-button>-->
+        <!--        <span class="upload-tip">上传视频大小不可超过5GB</span>-->
+      </div>
+      <el-dialog title="添加直播预告" :visible.sync="open" width="900px" append-to-body>
+        <el-form ref="form" :model="form"  label-width="80px">
+          <video-upload
+            :type = "1"
+            :isPrivate = "isPrivate"
+            :fileKey.sync = "form.fileKey"
+            :fileSize.sync = "form.fileSize"
+            :videoUrl.sync="videoUrl"
+            :fileName.sync="form.fileName"
+            :line_2.sync="form.lineTwo"
+            :line_1.sync="form.lineOne"
+            :thumbnail.sync="form.thumbnail"
+            :uploadType.sync="form.uploadType"
+            :isTranscode.sync="form.isTranscode"
+            :transcodeFileKey.sync="form.transcodeFileKey"
+            @video-duration="handleVideoDuration"
+            @change="handleVideoChange"
+            ref="videoUpload"
+            append-to-body
+          />
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="submitForm">确 定</el-button>
+          <el-button @click="open = false">取 消</el-button>
+        </div>
+      </el-dialog>
+
+      <!-- 视频列表 -->
+      <el-table
+        :data="videoList"
+        border
+        style="width: 100%; margin-top: 10px"
+      >
+        <el-table-column prop="duration" label="时长" />
+        <el-table-column prop="updateTime" label="更新时间" />
+        <el-table-column label="视频地址(可点击查看)" prop="videoUrl" >
+          <template slot-scope="scope">
+            <el-tooltip
+              :content="scope.row.videoUrl"
+              placement="top"
+              effect="dark"
+            >
+              <a
+                :href="scope.row.videoUrl"
+                target="_blank"
+                class="video-url-container"
+                rel="noopener noreferrer"
+              >
+                {{
+                  scope.row.videoUrl.length > 32
+                    ? scope.row.videoUrl.substring(0, 32) + '...'
+                    : scope.row.videoUrl
+                }}
+                <i class="el-icon-external-link video-url-icon"></i>
+              </a>
+            </el-tooltip>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+  </div>
+</template>
+
+<script>
+import { getLive,} from '@/api/live/live'
+import {getLiveVideoByLiveIdAndType,addLiveVideo} from '@/api/live/liveVideo'
+import VideoUpload from "@/components/LiveVideoUpload/index.vue";
+
+export default {
+  props:{
+    isViewOnly: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  name: "Preview",
+  components: {VideoUpload},
+  data() {
+    return {
+      loading: true,
+      videoList: [
+
+      ], // 视频列表数据,实际需从接口获取
+      liveId: null,
+      liveInfo: null,
+      isPrivate:null,
+      // 表单参数
+      form: {
+        uploadType: 1,
+        isTranscode:0,
+        transcodeFileKey:null
+      },
+      videoUrl:"",
+      // 是否显示弹出层
+      open: false,
+
+    };
+  },
+  watch: {
+    // 监听路由的 query 参数变化
+    '$route.query': {
+      handler(newQuery) {
+        if (this.$route.params.liveId) {
+          this.liveId = this.$route.params.liveId;
+        }else {
+          this.liveId = this.$route.query.liveId;
+        }
+        if(this.liveId == null) {
+          return;
+        }
+        this.getLiveVideo();
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
+  created() {
+    // if (this.$route.params.liveId) {
+    //   this.liveId = this.$route.params.liveId;
+    // }else {
+    //   this.liveId = this.$route.query.liveId;
+    // }
+    // if(this.liveId == null) {
+    //   this.$message.error("页面错误,请联系管理员");
+    //   return;g
+    // }
+    // this.getLive();
+  },
+  methods: {
+    submitForm() {
+      this.open = false;
+      var line_1 = this.videoUrl;
+      line_1 = line_1.replace(/\.mp4$/, '.m3u8');
+      const doParam = {
+        liveId: this.liveId,
+        videoUrl: line_1,
+        videoType: 3,
+        duration: this.form.duration,
+        fileSize: this.form.fileSize,
+       }
+      addLiveVideo(doParam).then(response => {
+        if (response.code == 200) {
+          this.$message.success("上传成功");
+        } else {
+          this.$message.warning(response.msg);
+        }
+        this.getLiveVideo()
+        this.$refs.form.resetFields();
+      })
+    },
+    handleVideoDuration(duration) {
+      this.form.duration = duration;
+    },
+    handleVideoChange(videoUrl,lineOne){
+      this.videoUrl = videoUrl;
+      this.form.videoUrl = videoUrl;
+      console.log(this.videoUrl)
+    },
+    getLiveVideo() {
+      this.videoList = [];
+      getLiveVideoByLiveIdAndType(this.liveId).then(res => {
+        let dataEntity =
+          {
+            duration: "00:00",
+            status: "回放中",
+            updateTime: "2025-09-08 14:28:24",
+          };
+
+        //将秒数转为时分秒
+        dataEntity.duration = this.convertSeconds(res.data.duration);
+        dataEntity.updateTime = res.data.updateTime;
+        dataEntity.videoUrl = res.data.videoUrl;
+        dataEntity.videoName = this.extractFileName(dataEntity.videoUrl)
+
+        this.videoList.push(dataEntity);
+      });
+      this.loading = false;
+    },
+    /**
+     * 提取文件名称核心方法
+     * 逻辑:通过split('/')分割路径,取最后一个非空元素作为文件名称
+     */
+    extractFileName(data) {
+      try {
+        this.errorMsg = '';
+        const trimmedUrl = data.trim();
+        // 用'/'分割路径,过滤空字符串(避免路径末尾有'/'导致的空元素)
+        const pathSegments = trimmedUrl.split('/').filter(segment => segment);
+        if (pathSegments.length === 0) {
+          throw new Error('输入的路径格式无效,请检查后重新输入');
+        }
+        // 最后一个分段即为文件名称
+        const fileName = pathSegments[pathSegments.length - 1];
+        // 简单校验是否为常见视频文件格式(可选,根据需求调整)
+        const videoExtensions = ['mp4', 'mov', 'avi', 'flv', 'mkv'];
+        const fileExtension = fileName.split('.').pop()?.toLowerCase();
+        if (!fileExtension || !videoExtensions.includes(fileExtension)) {
+          this.errorMsg = '提示:提取到的文件可能不是常见视频格式,请注意校验';
+        }
+        return fileName;
+      } catch (err) {
+        this.errorMsg = err.message;
+        return '';
+      }
+    },
+    convertSeconds(data) {
+      // 确保输入是有效的数字
+      const totalSeconds = Math.max(0, parseInt(data) || 0);
+
+      // 计算时、分、秒
+      const hours = Math.floor(totalSeconds / 3600);
+      const minutes = Math.floor((totalSeconds % 3600) / 60);
+      const seconds = totalSeconds % 60;
+
+      // 格式化每个部分为两位数
+      return `${this.padWithZero(hours)}:${this.padWithZero(minutes)}:${this.padWithZero(seconds)}`;
+    },
+    padWithZero(num) {
+      // 将数字转换为两位数格式
+      return num.toString().padStart(2, '0');
+    },
+    getLive() {
+      getLive(this.liveId).then(res => {
+        this.liveInfo = res.data;
+        if (res.data.liveType == 1) {
+          this.getLiveVideo();
+        }
+        this.loading = false;
+      });
+    },
+    resetForm() {
+      this.replayForm={
+        isPlaybackOpen: false, // 直播回放开关状态
+        playbackMode: "1", // 回放模式,默认模式一
+        validityType: "days", // 回放有效期类型,默认天数
+        validDays: 7, // 有效天数
+        isSpeedAllowed: "1", // 是否允许倍速播放,默认允许
+      }
+    },
+    // 上传视频处理
+    handleUploadVideo() {
+      this.form = {
+        uploadType: 1,
+        isTranscode:0,
+        transcodeFileKey:null,
+        videoUrl: null,
+        fileSize: null,
+      };
+      setTimeout(() => {
+        this.$refs.videoUpload.reset();
+      }, 100);
+      // 模拟上传视频逻辑,实际需调用上传组件或接口
+      this.open = true;
+    },
+  },
+};
+</script>
+
+<style scoped>
+.live-playback-setting {
+  font-family: "Microsoft Yahei", sans-serif;
+  color: #333;
+  background-color: #fff;
+  padding: 20px;
+  border-radius: 4px;
+  box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
+}
+
+.switch-area {
+  display: flex;
+  align-items: center;
+  margin-bottom: 20px;
+}
+.switch-area .switch-label {
+  margin-right: 10px;
+  font-size: 14px;
+}
+.switch-area .switch-desc {
+  color: #999;
+  font-size: 12px;
+}
+
+.playback-mode {
+  background-color: #f9fafc;
+  padding: 15px;
+  border-radius: 4px;
+  margin-bottom: 20px;
+}
+.playback-mode .mode-title {
+  font-size: 14px;
+  margin-bottom: 10px;
+}
+.playback-mode .mode-option {
+  display: flex;
+  align-items: center;
+  margin-bottom: 8px;
+}
+.playback-mode .mode-option .el-radio {
+  margin-left: 2%;
+}
+.playback-mode .mode-option label {
+  font-size: 13px;
+}
+
+.validity-period {
+  background-color: #f9fafc;
+  padding: 15px;
+  border-radius: 4px;
+  margin-bottom: 20px;
+}
+.validity-period .period-title {
+  font-size: 14px;
+  margin-bottom: 10px;
+}
+.validity-period .period-option {
+  display: flex;
+  align-items: center;
+  margin-bottom: 8px;
+}
+.validity-period .period-option .el-radio {
+  margin-left: 2%;
+}
+.validity-period .period-option label {
+  font-size: 13px;
+}
+.validity-period .period-desc {
+  color: #999;
+  font-size: 12px;
+  margin-top: 5px;
+  margin-left: 2%;
+}
+.validity-period .day-input {
+  width: 60px;
+  height: 28px;
+  border: 1px solid #ddd;
+  border-radius: 4px;
+  padding: 0 8px;
+  margin: 0 5px;
+}
+
+.speed-play {
+  display: flex;
+  align-items: center;
+  margin-top: 15px;
+}
+.speed-play .speed-label {
+  font-size: 13px;
+  margin-right: 10px;
+}
+.speed-play .el-radio {
+  margin-right: 5px;
+}
+.speed-play .speed-desc {
+  color: #999;
+  font-size: 12px;
+  margin-left: 10px;
+}
+
+.pro-tag {
+  display: inline-block;
+  background-color: #007bff;
+  color: #fff;
+  font-size: 10px;
+  padding: 2px 5px;
+  border-radius: 3px;
+  margin-left: 5px;
+  vertical-align: middle;
+}
+
+.playback-content {
+  margin-top: 20px;
+}
+.playback-content .upload-btn {
+  display: inline-block;
+  background-color: #fff;
+  border: 1px dashed #ddd;
+  color: #007bff;
+  padding: 8px 15px;
+  border-radius: 4px;
+  cursor: pointer;
+  font-size: 13px;
+  margin-bottom: 15px;
+}
+.playback-content .upload-btn:hover {
+  border-color: #007bff;
+}
+.playback-content .upload-tip {
+  font-size: 12px;
+  color: #999;
+  margin-left: 10px;
+}
+
+.video-item {
+  display: flex;
+  align-items: center;
+}
+.video-cover {
+  width: 80px;
+  height: 45px;
+  border-radius: 4px;
+  margin-right: 10px;
+}
+.video-info .video-name {
+  font-size: 13px;
+  margin-bottom: 3px;
+}
+.video-info .video-desc {
+  font-size: 12px;
+  color: #999;
+}
+.video-duration,
+.video-source,
+.video-status,
+.video-update-time {
+  color: #666;
+}
+.video-status .status-dot {
+  display: inline-block;
+  width: 8px;
+  height: 8px;
+  background-color: #007bff;
+  border-radius: 50%;
+  margin-right: 5px;
+  vertical-align: middle;
+}
+.video-operation .el-button {
+  color: #007bff;
+  font-size: 12px;
+  margin-right: 10px;
+}
+.video-url-container {
+  cursor: pointer;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  max-width: 100%;
+}
+</style>

+ 807 - 0
src/views/live/liveConfig/task.vue

@@ -0,0 +1,807 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="直播间ID" prop="liveId">
+        <el-input
+          v-model="queryParams.liveId"
+          placeholder="请输入直播间ID"
+          clearable
+          :disabled="liveAbled"
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="任务名称" prop="taskName">
+        <el-input
+          v-model="queryParams.taskName"
+          placeholder="请输入任务名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="任务类型" prop="taskType">
+        <el-select v-model="queryParams.taskType" placeholder="请选择任务类型" clearable size="small">
+          <el-option v-for="i in taskTypeOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>
+        </el-select>
+      </el-form-item>
+<!--      <el-form-item label="触发类型" prop="triggerType">-->
+<!--        <el-select v-model="queryParams.triggerType" placeholder="请选择触发类型" clearable size="small">-->
+<!--          <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>
+        <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">
+      <el-col :span="1.5">
+        <el-button
+          :disabled="isViewOnly"
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:task:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single || isViewOnly"
+          @click="handleUpdate"
+          v-hasPermi="['live:task:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple || isViewOnly"
+          @click="handleDelete"
+          v-hasPermi="['live:task:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          :disabled="isViewOnly"
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:task:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="taskList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="编号" align="center" prop="id" />
+      <el-table-column label="任务名称" align="center" prop="taskName" />
+      <el-table-column label="任务类型" align="center" prop="taskType" :formatter="taskTypeFormatter" />
+      <el-table-column label="触发类型" align="center" prop="triggerType" :formatter="triggerTypeFormatter" />
+      <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="updatedTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            :disabled="isViewOnly"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:task:edit']"
+          >修改</el-button>
+          <el-button
+            :disabled="isViewOnly"
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:task:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播间自动化任务配置对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="直播间ID" prop="liveId">
+          <el-input :disabled="liveAbled" v-model="form.liveId" placeholder="请输入直播间ID" />
+        </el-form-item>
+        <el-form-item label="任务名称" prop="taskName">
+          <el-input v-model="form.taskName" placeholder="请输入任务名称" />
+        </el-form-item>
+        <el-form-item label="任务类型" prop="taskType">
+          <el-select v-model="form.taskType" placeholder="请选择任务类型" @change="updateTaskType()" >
+            <el-option v-for="i in taskTypeOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="商品选择" prop="content" v-if="form.taskType == 1">
+          <el-select v-model="form.content" placeholder="请选择商品" ref="selectRef" >
+            <el-option v-for="i in productOptions" :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 == 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" 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"
+            v-model="form.triggerValue"
+            :picker-options="{
+      selectableRange: '00:00:00 - 23:59:59'
+    }"
+
+            placeholder="任意时间点">
+          </el-time-picker>
+        </el-form-item>
+<!--        <el-form-item label="触发类型" prop="triggerType">-->
+<!--          <el-select v-model="form.triggerType" placeholder="请选择触发类型">-->
+<!--            <el-option label="请选择字典生成" value="" />-->
+<!--          </el-select>-->
+<!--        </el-form-item>-->
+<!--        <el-form-item label="触发值" prop="triggerValue">-->
+<!--          <el-input v-model="form.triggerValue" placeholder="请输入触发值" />-->
+<!--        </el-form-item>-->
+<!--        <el-form-item label="任务内容">-->
+<!--          <editor v-model="form.content" :min-height="192"/>-->
+<!--        </el-form-item>-->
+        <el-form-item label="状态">
+          <el-radio-group v-model="form.status">
+            <el-radio :label="1">启用</el-radio>
+            <el-radio :label="0">禁用</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<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";
+import {listLiveCouponOn} from "@/api/live/liveCoupon";
+
+
+export default {
+  props:{
+    isViewOnly: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  name: "Task",
+  data() {
+    return {
+      taskTypeOptions:[
+        {
+          value: 1,
+          label: "定时卡片推荐商品"
+        },
+        {
+          value: 2,
+          label: "定时红包发送"
+        },
+        {
+          value: 4,
+          label: "定时抽奖"
+        },
+        {
+          value: 5,
+          label: "定时优惠券"
+        }
+      ],
+      statusOptions:[{
+        value: "0",
+        label: "禁用"
+      },
+        {
+          value: "1",
+          label: "启用"
+        }
+      ],
+      productOptions:[],
+      haveData:{
+        goods:false,
+        red:false,
+        lottery:false,
+        coupon:false
+      },
+      redOptions:[],
+      lotteryOptions:[],
+      couponOptions:[],
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      liveAbled: false,
+      // 直播间自动化任务配置表格数据
+      taskList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null,
+        taskName: null,
+        taskType: null,
+        triggerType: null,
+        triggerValue: null,
+        content: null,
+        status: null,
+        createdTime: null,
+        updatedTime: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        liveId: [
+          { required: true, message: "直播间ID不能为空", trigger: "blur" }
+        ],
+        taskName: [
+          { required: true, message: "任务名称不能为空", trigger: "blur" }
+        ],
+        taskType: [
+          { required: true, message: "任务类型:1-定时推送卡片商品 2-定时发送红包 ", trigger: "change" }
+        ],
+        triggerType: [
+          { required: true, message: "触发类型:相对直播开始时间不能为空", trigger: "change" }
+        ],
+        triggerValue: [
+          { required: true, message: "触发值:绝对时间用yyyy-MM-dd HH:mm:ss,相对时间用分钟数不能为空", trigger: "blur" }
+        ],
+        status: [
+          { required: true, message: "状态:0-禁用 1-启用不能为空", trigger: "blur" }
+        ],
+        createdTime: [
+          { required: true, message: "创建时间不能为空", trigger: "blur" }
+        ],
+        updatedTime: [
+          { required: true, message: "更新时间不能为空", trigger: "blur" }
+        ]
+      },
+      liveId: null,
+      listParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null
+      },
+      socket: null,
+      isLoading: false, // 是否正在加载
+      hasMore: true, // 是否还有更多数据
+    };
+  },
+  watch: {
+    // 监听路由的 query 参数变化
+    '$route.query': {
+      handler(newQuery) {
+        if (this.$route.params.liveId) {
+          this.liveId = this.$route.params.liveId;
+        }else {
+          this.liveId = this.$route.query.liveId;
+        }
+        if(this.liveId == null) {
+
+          return;
+        }
+        this.liveAbled = true
+        this.queryParams.liveId = this.liveId;
+        this.getList();
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
+  created() {
+    this.socket = this.$store.state.liveWs[this.liveId]
+  },
+  methods: {
+    statusFormatter(row, column, value){
+      if (!value) return '--'; // 空值处理
+      switch ( value){
+        case 0:
+          return "禁用";
+        case 1:
+          return "启用";
+        default:
+          return "--";
+      }
+    },
+    finishStatusFormatter(row, column, value){
+      if (!value) return '--'; // 空值处理
+      switch ( value){
+        case 0:
+          return "未执行";
+        case 1:
+          return "已执行";
+        default:
+          return "--";
+      }
+    },
+    taskTypeFormatter(row, column, value){
+      if (!value) return '--'; // 空值处理
+      switch (value) {
+        case 1:
+          return "定时推送卡片商品";
+        case 2:
+          return "定时发送红包";
+        case 4:
+          return "定时抽奖";
+        case 5:
+          return "定时优惠券";
+        default:
+          return "--";
+      }
+    },
+    triggerTypeFormatter(row, column, value){
+      if (!value) return '--'; // 空值处理
+      switch (value) {
+        case 1:
+          return "相对直播开始时间";
+        case 2:
+          return "相对时间";
+        default:
+          return "--";
+      }
+    },
+    productNameFormatter(row, column, value){
+      let content = JSON.parse(row.content)
+      if(content.productName) {
+        return content.productName
+      }
+      return "--";
+    },
+    triggerValueFormatter(row, column, value) {
+      if (!value) return '--'; // 空值处理
+
+      // 创建日期对象(兼容时间戳和字符串)
+      let date;
+      if (typeof value === 'number') {
+        // 处理时间戳(注意:如果是10位时间戳需要乘以1000)
+        date = new Date(value.toString().length === 10 ? value * 1000 : value);
+      } else if (typeof value === 'string') {
+        // 处理字符串格式(尝试直接转换)
+        date = new Date(value);
+      } else {
+        return '格式错误';
+      }
+
+      // 检查日期是否有效
+      if (isNaN(date.getTime())) {
+        return '无效时间';
+      }
+      // 格式化日期为 "yyyy-MM-dd HH:mm:ss"
+      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 `${hours}:${minutes}:${seconds}`;
+    },
+    async updateTaskType(){
+      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();
+        }else if (this.form.taskType == 2) {
+          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);
+      }finally {
+        this.isLoading = false;
+      }
+
+    },
+    addGoodsList() {
+      if(this.haveData.goods) return
+      listLiveGoods(this.listParams).then(res => {
+        if(res.rows.length > 0) {
+          res.rows.forEach(item => {
+            // 根据productName和goodsId组装成为label和value
+            this.productOptions.push({
+              value: item.goodsId,
+              label: item.productName
+            })
+          })
+          this.listParams.pageNum++;
+          // 判断是否还有更多数据
+          this.hasMore = this.productOptions.length < res.total;
+          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.addLotteryList();
+          } else {
+            this.haveData.lottery = true
+          }
+        } else {
+          this.haveData.lottery = true
+          this.hasMore = false;
+        }
+      });
+    },
+    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) {
+        this.$message.error("页面错误,请联系管理员");
+        return;
+      }
+      this.loading = true;
+      listTask(this.queryParams).then(res => {
+
+        this.taskList = res.rows;
+
+        this.total = res.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        liveId: this.liveId,
+        taskName: null,
+        taskType: null,
+        triggerType: null,
+        triggerValue: null,
+        content: null,
+        status: 1,
+        createdTime: null,
+        updatedTime: null
+      };
+      this.listParams={
+          pageNum: 1,
+          pageSize: 10,
+          liveId: this.liveId
+      }
+      this.hasMore = true;
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播间自动化任务配置";
+    },
+    /** 修改按钮操作 */
+    async handleUpdate(row) {
+      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();
+      }else if(row.taskType == 5) {
+        await this.addCouponList();
+      }
+      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) {
+          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;
+        }else if(this.form.taskType == 5){
+          this.form.content = content.couponId;
+        }
+        this.open = true;
+        this.title = "修改直播间自动化任务配置";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.form.liveId = this.liveId;
+      if(this.liveId == null) {
+        this.msgError("请选择直播间");
+        return;
+      }
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateTask(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addTask(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      if(this.socket == null) {
+        this.$message.error("请进入直播间后,在进行操作!")
+        return;
+      }
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除直播间自动化任务配置编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delTask(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+          const msg={
+            cmd:'delAutoTask',
+            data:row.absValue,
+            liveId:this.liveId,
+            userType:1
+          }
+          this.socket.send(JSON.stringify( msg))
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播间自动化任务配置数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportTask(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    },
+  }
+};
+</script>
+
+<style scoped>
+.loading-indicator {
+  padding: 10px;
+  text-align: center;
+  color: #606266;
+  font-size: 12px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.loading-indicator .el-icon-loading {
+  margin-right: 5px;
+  animation: rotate 1s linear infinite;
+}
+
+.no-more {
+  padding: 10px;
+  text-align: center;
+  color: #909399;
+  font-size: 12px;
+}
+
+@keyframes rotate {
+  from { transform: rotate(0deg); }
+  to { transform: rotate(360deg); }
+}
+</style>

+ 416 - 0
src/views/live/liveConfig/watchReward.vue

@@ -0,0 +1,416 @@
+<template >
+  <div v-loading.fullscreen.lock="loading">
+    <!-- 提示信息 -->
+    <div class="tip-message" >
+      设置观看奖励,用户达到直播观看时长后可领取奖励
+    </div>
+
+    <!-- 开启观看奖励开关 -->
+    <div class="reward-switch">
+      <span class="switch-label">开启观看奖励</span>
+      <el-switch v-model="watchRewardForm.enabled" :disabled="isViewOnly"></el-switch>
+    </div>
+
+    <!-- 观看奖励设置 -->
+    <div v-if="watchRewardForm.enabled" class="section-block">
+      <div class="section-title">观看奖励设置</div>
+
+      <!-- 表单内容 -->
+      <el-form
+        :model="watchRewardForm"
+        :rules="rules"
+        ref="watchRewardForm"
+        label-width="130px"
+      >
+        <!-- 参与条件 -->
+        <el-form-item label="参与条件" prop="participateCondition">
+          <el-radio v-model="watchRewardForm.participateCondition" label="1">
+            达到指定观看时长
+          </el-radio>
+        </el-form-item>
+
+        <!-- 观看时长 -->
+        <el-form-item label="观看时长" prop="watchDuration">
+          <el-input v-model="watchRewardForm.watchDuration" placeholder="请输入观看时长" class="duration-input" :disabled="isViewOnly">
+            <template #append>分钟</template>
+          </el-input>
+        </el-form-item>
+
+        <!-- 实施动作 -->
+        <el-form-item label="实施动作" prop="action">
+          <el-select v-model="watchRewardForm.action" placeholder="请选择实施动作" style="width: 300px;" :disabled="isViewOnly">
+            <el-option
+              v-for="item in actionOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+
+        <!-- 领取提示语 -->
+<!--        <el-form-item label="领取提示语" prop="receivePrompt">-->
+<!--          <el-input v-model="watchRewardForm.receivePrompt" placeholder="请输入领取提示语"></el-input>-->
+<!--        </el-form-item>-->
+
+        <!-- 红包设置 -->
+        <div>
+          <div class="section-title">红包设置</div>
+
+          <!-- 根据实施动作类型显示不同的表单内容 -->
+          <template v-if="watchRewardForm.action === '1'">
+            <!-- 现金红包设置 -->
+            <!-- 红包发放方式   1固定金额 2随机金额 -->
+            <el-form-item label="红包发放方式" prop="redPacketType">
+              <el-radio-group v-model="watchRewardForm.redPacketType" :disabled="isViewOnly">
+                <el-radio label="1">固定金额</el-radio>
+                <el-radio label="2">随机金额</el-radio>
+              </el-radio-group>
+            </el-form-item>
+
+            <!-- 红包金额 -->
+            <el-form-item label="红包金额" prop="redPacketAmount">
+              <el-input v-model="watchRewardForm.redPacketAmount" placeholder="请输入红包金额" :disabled="isViewOnly"></el-input>
+            </el-form-item>
+
+            <!-- 红包发放数量 -->
+            <el-form-item label="红包发放数量" prop="redPacketCount">
+              <el-input v-model="watchRewardForm.redPacketCount" placeholder="红包数量+28888人数" :disabled="isViewOnly"></el-input>
+            </el-form-item>
+
+            <!-- 红包领取方式  1二维码核销 2微信提现 -->
+            <el-form-item label="红包领取方式" prop="receiveMethod">
+              <el-radio-group v-model="watchRewardForm.receiveMethod" :disabled="isViewOnly">
+                <el-radio label="1">二维码领取</el-radio>
+                <el-radio label="2">微信发放</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </template>
+
+          <template v-else>
+            <!-- 积分红包设置 -->
+            <!-- 积分值 -->
+            <el-form-item label="积分值" prop="scoreAmount">
+              <el-input
+                :disabled="isViewOnly"
+                v-model="watchRewardForm.scoreAmount"
+                placeholder="请输入积分值"                style="width: 300px;"
+              ></el-input>
+            </el-form-item>
+
+            <!-- 最大领取人数 -->
+<!--            <el-form-item label="最大领取人数" prop="maxReceivers">-->
+<!--              <el-input-->
+<!--                v-model="watchRewardForm.maxReceivers"-->
+<!--                placeholder="请输入最大领取人数"                style="width: 300px;"-->
+<!--              ></el-input>-->
+<!--            </el-form-item>-->
+          </template>
+        </div>
+
+        <!-- 其他设置 -->
+        <div >
+          <div class="section-title">其他设置</div>
+
+          <template v-if="watchRewardForm.action === '1'">
+            <!-- 客服引导  1跟进企业微信 2不设置 -->
+            <el-form-item label="客服引导" prop="showGuide">
+              <el-radio-group v-model="watchRewardForm.showGuide" :disabled="isViewOnly">
+                <el-radio label="1">跟进企业微信</el-radio>
+                <el-radio label="2">不设置</el-radio>
+              </el-radio-group>
+            </el-form-item>
+
+            <!-- 客服引导语 -->
+            <el-form-item label="客服引导语" prop="guideText">
+              <el-input
+                :disabled="isViewOnly"
+                v-model="watchRewardForm.guideText"
+                placeholder="请输入客服引导语"                style="width: 300px;"
+              ></el-input>
+            </el-form-item>
+          </template>
+
+          <template v-else>
+            <!-- 积分使用引导语 -->
+            <el-form-item label="积分使用引导语" prop="scoreGuideText">
+              <el-input
+                :disabled="isViewOnly"
+                v-model="watchRewardForm.scoreGuideText"
+                placeholder="请输入积分使用引导语"                style="width: 300px;"
+              ></el-input>
+            </el-form-item>
+
+            <!-- 积分使用引导链接 -->
+            <el-form-item label="积分使用引导链接" prop="scoreGuideLink">
+              <el-input
+                :disabled="isViewOnly"
+                v-model="watchRewardForm.scoreGuideLink"
+                placeholder="请输入积分使用引导链接"                style="width: 300px;"
+              ></el-input>
+            </el-form-item>
+
+            <!-- 引导语 -->
+<!--            <el-form-item label="引导语" prop="guideText">-->
+<!--              <el-input-->
+<!--                v-model="watchRewardForm.guideText"-->
+<!--                placeholder="请输入引导语"                style="width: 300px;"-->
+<!--              ></el-input>-->
+<!--            </el-form-item>-->
+          </template>
+        </div>
+
+        <!-- 保存按钮 -->
+        <div class="form-actions">
+          <el-button type="primary" @click="saveWatchReward" v-show="!isViewOnly">保存</el-button>
+        </div>
+      </el-form>
+    </div>
+  </div>
+</template>
+
+<script>
+import {addConfig, getConfig, updateConfig} from "@/api/live/liveQuestionLive";
+
+export default {
+  props:{
+    isViewOnly: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  data() {
+    return {
+      loading: true,
+      liveId: null,
+      watchRewardForm: {
+        id: null,
+        liveId: null,
+        // 是否启用观看奖励
+        enabled: false,
+        // 参与条件
+        participateCondition: '1',
+        // 观看时长
+        watchDuration: '',
+        // 实施动作
+        action: '2',
+        // 领取提示语
+        receivePrompt: '',
+        // 红包发放方式(固定金额/随机金额)
+        redPacketType: '1',
+        // 红包金额
+        redPacketAmount: '',
+        // 红包发放数量
+        redPacketCount: '',
+        // 红包领取方式
+        receiveMethod: '1',
+        // 是否显示客服引导
+        showGuide: '1',
+        // 客服引导语
+        guideText: '',
+        // 积分值
+        scoreAmount: '',
+        // // 最大领取人数
+        // maxReceivers: '',
+        // 积分使用引导语
+        scoreGuideText: '',
+        // 积分使用引导链接
+        scoreGuideLink: ''
+      },
+      rules:{
+        participateCondition:[
+          { required: true, message: '请选择参与条件', trigger: 'blur'}
+        ],
+        watchDuration:[
+          { required: true, message: '请输入观看时长', trigger: 'blur'}
+        ],
+        action:[
+          { required: true, message: '请选择实施动作', trigger: 'blur'}
+        ],
+        // receivePrompt:[
+        //   { required: true, message: '请输入领取提示语', trigger: 'blur'}
+        // ],
+        redPacketType:[
+          { required: true, message: '请选择红包发放方式', trigger: 'blur'}
+        ],
+        redPacketAmount:[
+          { required: true, message: '请输入红包金额', trigger: 'blur'}
+        ],
+        receiveMethod:[
+          { required: true, message: '请选择红包领取方式', trigger: 'blur'}
+        ],
+        // guideText:[
+        //   { required: true, message: '请输入客服引导语', trigger: 'blur'}
+        // ],
+        showGuide:[
+          { required: true, message: '请选择是否显示客服引导', trigger: 'blur'}
+        ]
+      },
+      // 添加实施动作选项
+      actionOptions: [
+        // {
+        //   label: '现金红包',
+        //   value: '1'
+        // },
+        {
+          label: '积分红包',
+          value: '2'
+        }
+      ],
+
+    };
+  },
+  watch: {
+    // 监听路由的 query 参数变化
+    '$route.query': {
+      handler(newQuery) {
+        this.liveId = this.$route.params.liveId
+        this.watchRewardForm.liveId = this.liveId
+        if(this.liveId == null) {
+          return;
+        }
+        this.getLiveConfig();
+
+      },
+      // 初始化时立即执行一次
+      immediate: true
+    }
+  },
+  created() {
+
+  },
+  methods: {
+    getLiveConfig(){
+      getConfig(this.liveId).then(response => {
+        if(response.code === 200 && response.data != null && response.data.length > 0){
+          this.watchRewardForm = JSON.parse(response.data)
+        }
+        this.loading = false
+      })
+    },
+    saveWatchReward() {
+      this.$refs["watchRewardForm"].validate(valid => {
+        console.log(valid)
+        if (valid) {
+          if (this.watchRewardForm.id == null) {
+            // 调用保存观看奖励接口
+            // 实现保存逻辑
+            addConfig(this.watchRewardForm,this.liveId).then(res => {
+              if (res.code == 200) {
+                this.msgSuccess("修改成功");
+              }
+            })
+          } else {
+            updateConfig(this.watchRewardForm,this.liveId).then(response => {
+              this.msgSuccess("修改成功");
+            });
+          }
+        }
+      })
+    },
+  }
+};
+</script>
+
+<style scoped>
+/* 提示信息样式 */
+.tip-message {
+  padding: 12px 16px;
+  background-color: #FFF6F2;
+  border-radius: 4px;
+  color: #666;
+  font-size: 14px;
+  margin-bottom: 20px;
+}
+
+
+/* 开关容器样式 */
+.reward-switch {
+  margin-left: 200px;
+  margin-bottom: 20px;
+  padding: 20px;
+  background-color: #fff;
+  border-radius: 4px;
+  display: flex;
+  align-items: center;
+}
+
+/* 开关标签样式 */
+.reward-switch .switch-label {
+  margin-right: 10px;
+  font-size: 14px;
+  color: #333;
+  margin-left: 50px;
+}
+
+/* 表单区块样式 */
+.section-block {
+  width: 50%;
+  background-color: #fff;
+  padding: 20px;
+  border-radius: 4px;
+  margin-left: 50px;
+  margin-bottom: 20px;
+}
+
+/* 标题样式 */
+.section-block .section-title {
+  font-size: 14px;
+  color: #333;
+  margin-bottom: 20px;
+  border-left: 4px solid #409EFF;
+  padding-left: 10px;
+  line-height: 1;
+}
+
+/* 表单样式 */
+.reward-form {
+  margin-top: 20px;
+}
+
+/* 表单项样式 */
+.reward-form .el-form-item {
+  margin-bottom: 22px;
+  padding-left: 50px;
+}
+
+.reward-form .el-form-item:last-child {
+  margin-bottom: 0;
+}
+
+/* 表单标签样式 */
+.reward-form .el-form-item .el-form-item__label {
+  color: #606266;
+}
+
+/* 输入框统一宽度 */
+.reward-form .el-form-item .el-input {
+  width: 300px;
+}
+
+/* 必填项星号样式 */
+.reward-form .el-form-item.is-required .el-form-item__label:before {
+  color: #F56C6C;
+}
+
+/* 观看时长输入框样式 */
+.reward-form .el-form-item .duration-input {
+  width: 300px;
+}
+
+.reward-form .el-form-item .duration-input .el-input__inner {
+  text-align: left;
+}
+
+/* 保存按钮样式 */
+.form-actions {
+  width: 600px;
+  text-align: center;
+  margin-top: 30px;
+}
+
+.form-actions .el-button {
+  padding: 8px 20px;
+  font-size: 13px;
+}
+</style>

+ 61 - 0
src/views/live/liveConsole/EchartsComponent.vue

@@ -0,0 +1,61 @@
+<template>
+  <div :id="chartId" class="chart-container"></div>
+</template>
+
+<script>
+import * as echarts from 'echarts';
+import 'echarts/map/js/china'; // 确保地图模块引入
+
+export default {
+  name: 'EChartsComponent',
+  props: {
+    chartId: {type: String, required: true},
+    option: {type: Object, required: true}
+  },
+  mounted() {
+    this.$nextTick(() => { // 确保DOM渲染完成后初始化
+      this.initChart();
+      window.addEventListener('resize', this.resizeChart);
+    });
+  },
+  // 监听 option 变化,自动更新图表
+  watch: {
+    option: {
+      deep: true, // 深度监听对象内部变化
+      handler(newVal) {
+        if (this.chart) {
+          this.chart.setOption(newVal); // 关键:用新数据更新图表
+        }
+      }
+    }
+  },
+  beforeDestroy() {
+    window.removeEventListener('resize', this.resizeChart);
+    if (this.chart) this.chart.dispose();
+  },
+  methods: {
+    initChart() {
+      const container = document.getElementById(this.chartId);
+      if (!container) return; // 防止容器不存在
+      this.chart = echarts.init(container);
+      this.chart.setOption(this.option);
+    },
+    resizeChart() {
+      if (this.chart) this.chart.resize();
+    },
+    // 暴露手动更新方法(可选,用于特殊场景)
+    updateOption(newOption) {
+      if (this.chart) {
+        this.chart.setOption(newOption);
+      }
+    }
+  }
+};
+</script>
+
+<style scoped>
+.chart-container {
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 1521 - 0
src/views/live/liveConsole/LiveConsole.vue

@@ -0,0 +1,1521 @@
+<template>
+  <div class="console">
+
+    <div class="left-panel">
+      <h2>学员列表</h2>
+      <div class="search">
+        <input type="text" placeholder="搜索用户昵称" v-model="searchKeyword">
+        <button @click="searchUsers()">搜索</button>
+      </div>
+      <el-tabs class="live-console-tab-right" v-model="tabLeft.activeName" @tab-click="handleUserClick" :stretch="true">
+        <el-tab-pane :label="alLabel" name="al">
+          <el-scrollbar class="custom-scrollbar" ref="manageLeftRef_al" style="height: 800px; width: 100%;">
+            <el-row class='scrollbar-demo-item' v-for="u in alDisplayList" :key="u.userId">
+              <el-col :span="20">
+                <el-row type="flex" align="middle">
+                  <el-col :span="4" style="padding-left: 10px;"><el-avatar :src="u.avatar"></el-avatar></el-col>
+                  <el-col :span="19" :offset="1">{{ u.nickName }}</el-col>
+                  <el-col :span="19" :offset="1">{{ u.userId }}</el-col>
+                </el-row>
+              </el-col>
+              <el-col :span="4" >
+                <el-popover
+                  width="100"
+                  trigger="click">
+                  <a style="cursor: pointer;color: #ff0000;" @click="changeUserState(u)">{{ u.msgStatus === 1 ? '解禁' : '禁言' }}</a>
+                  <a style="cursor: pointer;color: #ff0000;margin-left:10px" @click="blockUser(u)">拉黑</a>
+                  <i class="el-icon-more" slot="reference"></i>
+                </el-popover>
+              </el-col>
+            </el-row>
+          </el-scrollbar>
+        </el-tab-pane>
+        <el-tab-pane :label="onlineLabel" name="online">
+          <el-scrollbar class="custom-scrollbar" ref="manageLeftRef_online" style="height: 800px; width: 100%;">
+            <el-row class='scrollbar-demo-item' v-for="u in onlineDisplayList" :key="u.userId">
+              <el-col :span="20">
+                <el-row type="flex" align="middle">
+                  <el-col :span="4" style="padding-left: 10px;"><el-avatar :src="u.avatar"></el-avatar></el-col>
+                  <el-col :span="19" :offset="1">{{ u.nickName }}</el-col>
+                  <el-col :span="19" :offset="1">{{ u.userId }}</el-col>
+                </el-row>
+              </el-col>
+              <el-col :span="4" >
+                <el-popover
+                  width="100"
+                  trigger="click">
+                  <a style="cursor: pointer;color: #ff0000;" @click="changeUserState(u)">{{ u.msgStatus === 1 ? '解禁' : '禁言' }}</a>
+                  <a style="cursor: pointer;color: #ff0000;margin-left:10px" @click="blockUser(u)">拉黑</a>
+                  <i class="el-icon-more" slot="reference"></i>
+                </el-popover>
+              </el-col>
+            </el-row>
+          </el-scrollbar>
+        </el-tab-pane>
+        <el-tab-pane :label="offlineLabel" name="offline">
+          <el-scrollbar class="custom-scrollbar" ref="manageLeftRef_offline" style="height: 800px; width: 100%;">
+            <el-row class='scrollbar-demo-item' v-for="u in offlineDisplayList" :key="u.userId">
+              <el-col :span="20">
+                <el-row type="flex" align="middle">
+                  <el-col :span="4" style="padding-left: 10px;"><el-avatar :src="u.avatar"></el-avatar></el-col>
+                  <el-col :span="19" :offset="1">{{ u.nickName }}</el-col>
+                  <el-col :span="19" :offset="1">{{ u.userId }}</el-col>
+                </el-row>
+              </el-col>
+              <el-col :span="4" >
+                <el-popover
+                  width="100"
+                  trigger="click">
+                  <a style="cursor: pointer;color: #ff0000;" @click="changeUserState(u)">{{ u.msgStatus === 1 ? '解禁' : '禁言' }}</a>
+                  <i class="el-icon-more" slot="reference"></i>
+                  <a style="cursor: pointer;color: #ff0000;margin-left:10px" @click="blockUser(u)">拉黑</a>
+                </el-popover>
+              </el-col>
+            </el-row>
+          </el-scrollbar>
+        </el-tab-pane>
+        <el-tab-pane :label="silencedUserLabel" name="silenced">
+          <el-scrollbar class="custom-scrollbar" ref="manageLeftRef_silenced" style="height: 800px; width: 100%;">
+            <el-row class='scrollbar-demo-item' v-for="u in silencedDisplayList" :key="u.userId">
+              <el-col :span="20">
+                <el-row type="flex" align="middle">
+                  <el-col :span="4" style="padding-left: 10px;"><el-avatar :src="u.avatar"></el-avatar></el-col>
+                  <el-col :span="19" :offset="1">{{ u.nickName }}</el-col>
+                  <el-col :span="19" :offset="1">{{ u.userId }}</el-col>
+                </el-row>
+              </el-col>
+              <el-col :span="4" >
+                <el-popover
+                  width="100"
+                  trigger="click">
+                  <a style="cursor: pointer;color: #ff0000;" @click="changeUserState(u)">{{ u.msgStatus === 1 ? '解禁' : '禁言' }}</a>
+                  <a style="cursor: pointer;color: #ff0000;margin-left:10px" @click="blockUser(u)">拉黑</a>
+                  <i class="el-icon-more" slot="reference"></i>
+                </el-popover>
+              </el-col>
+            </el-row>
+          </el-scrollbar>
+        </el-tab-pane>
+      </el-tabs>
+    </div>
+
+    <div class="middle-panel">
+      <h2>消息管理</h2>
+
+
+      <div class="discussion-messages">
+        <h3>讨论区消息</h3>
+        <div class="message-settings">
+          <label>
+            <input type="checkbox" v-model="globalVisible" @change="globalVisibleChange">
+            全局用户自见
+          </label>
+        </div>
+        <el-scrollbar class="custom-scrollbar" style="height: 500px; width: 100%;" ref="manageRightRef">
+          <el-row v-for="m in msgList" >
+            <el-row v-if="m.userId !== userId" style="margin-top: 5px" type="flex" align="top" >
+              <el-col :span="3" style="margin-left: 10px"><el-avatar :src="m.avatar"/></el-col>
+              <el-col :span="15">
+                <el-row style="margin-left: 10px">
+                  <el-col><div style="font-size: 12px; color: #999; margin-bottom: 3px;">{{ m.nickName }}</div></el-col>
+                  <el-col :span="24" style="max-width: 200px;">
+                    <div style="white-space: normal; word-wrap: break-word;background-color: #f0f2f5; padding: 8px; border-radius: 5px;font-size: 14px;width: 100%;">
+                      {{ m.msg }}
+                    </div>
+                  </el-col>
+                  <el-col>
+                    <a style="cursor: pointer;color: #ff0000;padding: 8px 8px 0 0;font-size: 12px;" @click="changeUserState(m)">{{ m.msgStatus === 1 ? '解禁' : '禁言' }}</a>
+                    <a style="cursor: pointer;color: #ff0000;padding: 8px 8px 0 0;font-size: 12px;" @click="blockUser(m)">拉黑</a>
+                    <a v-if="m.singleVisible === 1" style="cursor: pointer;color: #ff0000;padding: 8px 8px 0 0;font-size: 12px;" @click="singleVisible(m)">解除用户自见</a>
+                    <a v-else style="cursor: pointer;color: #ff0000;padding: 8px 8px 0 0;font-size: 12px;" @click="singleVisible(m)">用户自见</a>
+                  </el-col>
+                </el-row>
+              </el-col>
+            </el-row>
+            <el-row v-if="m.userId === userId" style="padding: 8px 0" type="flex" align="top" justify="end">
+              <div style="display: flex;justify-content: flex-end">
+                <div style="display: flex;justify-content: flex-end;flex-direction: column;max-width: 200px;align-items: flex-end">
+                  <div style="font-size: 12px; color: #999; margin-bottom: 3px;">{{ m.nickName }}</div>
+                  <div style="white-space: normal; word-wrap: break-word;width: 100%; background-color: #e6f7ff; padding: 8px; border-radius: 5px;font-size: 14px;">{{ m.msg }}</div>
+                </div>
+                <el-avatar :src="m.avatar" style="margin-left: 10px; margin-right: 10px;"/>
+              </div>
+            </el-row>
+          </el-row>
+          <!-- 底部留白 -->
+          <div style="height: 20px;"></div>
+        </el-scrollbar>
+<!--        <div class="message-list">-->
+<!--          <div class="message-item" v-for="msg in msgList" :key="msg.id">-->
+<!--            <div class="message-avatar">-->
+<!--              <img :src="msg.avatar" alt="用户头像">-->
+<!--            </div>-->
+<!--            <div class="message-content">-->
+<!--              <div class="message-user">{{ msg.user }}</div>-->
+<!--              <div class="message-text">{{ msg.text }}</div>-->
+<!--            </div>-->
+<!--            <div class="message-actions">-->
+<!--&lt;!&ndash;              <button @click="toggleVisible(msg)">&ndash;&gt;-->
+<!--&lt;!&ndash;                {{ msg.isVisible ? '仅用户自见' : '全局可见' }}&ndash;&gt;-->
+<!--&lt;!&ndash;              </button>&ndash;&gt;-->
+<!--              <button @click="deleteMessage(msg)">删除</button>-->
+<!--            </div>-->
+<!--          </div>-->
+<!--        </div>-->
+      </div>
+      <div class="system-messages">
+        <h3>系统消息</h3>
+        <textarea placeholder="输入系统消息" v-model="newMsg"></textarea>
+        <div class="message-actions">
+          <button @click="sendMessage">发送消息</button>
+          <button @click="sendPopMessage">弹窗消息</button>
+        </div>
+      </div>
+    </div>
+
+    <div class="right-panel">
+      <h2>运营工具</h2>
+      <div class="live-player">
+        <h3>直播观看</h3>
+        <LivePlayer ref="livePlayer" :videoParam="videoParam" />
+      </div>
+
+      <div class="automation">
+        <h3>运营自动化</h3>
+        <div class="timeline">
+          <h4>时间轴设置</h4>
+          <div class="timeline-items">
+            <div class="timeline-item" v-for="item in timelineItems.slice(0,2)" :key="item.time">
+              <div class="time">{{ formatDate(item.absValue) }}</div>
+              <div class="action">{{ item.taskName }}</div>
+              <button class="delete" @click="removeTimelineItem(item)">删除</button>
+            </div>
+          </div>
+<!--          <button class="add" @click="addTimelineItem">添加时间节点</button>-->
+        </div>
+      </div>
+
+      <div class="watermark">
+        <h3>直播氛围自动化</h3>
+        <div class="watermark-settings">
+          <textarea :disabled="autoWatermark" v-model="watermarkTemplate" placeholder="水军弹幕内容模板,每行一条"></textarea>
+          <div class="watermark-options">
+            <label>
+              发送间隔:
+              <input type="number" :disabled="autoWatermark" v-model.number="interval" min="1">
+              秒
+            </label>
+            <label>
+              <input type="checkbox" v-model="autoWatermark" @change="changeAutoWatermark">
+              启用水军自动化
+            </label>
+          </div>
+        </div>
+      </div>
+    </div>
+
+  </div>
+</template>
+
+<script>
+import LivePlayer from './LivePlayer.vue';
+import {blockUser, changeUserStatus, getLiveUserTotals, dashBoardWatchUserList} from '@/api/live/liveWatchUser'
+import { listLiveSingleMsg } from '@/api/live/liveMsg'
+import { getLive } from '@/api/live/live'
+import { consoleList } from '@/api/live/task'
+import ScreenScale from './ScreenScale.vue'; // 路径根据实际位置调整
+
+
+export default {
+  components: {
+    LivePlayer,ScreenScale
+  },
+  props: {
+    liveId: {
+      type: String,
+      default: null
+    }
+  },
+  data() {
+    return {
+      watermarkIndex: 0,
+      watermarkList:[],
+      watermarkTemplate: '',
+      liveInfo: {},
+      videoParam:{
+        startTime:'',
+        livingUrl: '',
+        liveType: 1,
+        videoUrl: '',
+      },
+      msgList:[],
+      currentTab: 'al',
+      searchKeyword: '',
+      globalVisible: false,
+      interval: 10,
+      autoWatermark: false,
+      streamUrl: 'rtmp://your-live-stream-url',
+      users: [
+        { id: 1, name: '用户1', avatar: 'https://via.placeholder.com/40', status: 'online', statusText: '在线', silenced: false, msgStatus: false },
+        { id: 2, name: '用户2', avatar: 'https://via.placeholder.com/40', status: 'online', statusText: '在线', silenced: false, msgStatus: true },
+        { id: 3, name: '用户3', avatar: 'https://via.placeholder.com/40', status: 'offline', statusText: '离线', silenced: true, msgStatus: false },
+        { id: 4, name: '用户4', avatar: 'https://via.placeholder.com/40', status: 'online', statusText: '在线', silenced: false, msgStatus: false },
+        { id: 5, name: '用户5', avatar: 'https://via.placeholder.com/40', status: 'offline', statusText: '离线', silenced: false, msgStatus: false }
+      ],
+      messages: [
+        { id: 1, user: '用户1', avatar: 'https://via.placeholder.com/30', text: '这个产品怎么样?', isVisible: true },
+        { id: 2, user: '用户2', avatar: 'https://via.placeholder.com/30', text: '看起来不错', isVisible: true },
+        { id: 3, user: '用户3', avatar: 'https://via.placeholder.com/30', text: '有优惠吗?', isVisible: true }
+      ],
+      timelineItems: [
+        { "searchValue": null,
+          "createBy": null,
+          "createTime": "2025-09-23 10:36:17",
+          "updateBy": null,
+          "updateTime": "2025-10-17 09:18:00",
+          "remark": null,
+          "params": {},
+          "id": 6573,
+          "liveId": 128,
+          "taskName": "2",
+          "taskType": 1,
+          "triggerType": 2,
+          "triggerValue": "2025-01-01T00:02:00.000+0800",
+          "absValue": "2025-11-23T10:43:00.000+0800",
+          "status": 1,
+          "finishStatus": 0 },
+      ],
+      userTotal: {
+        online: 0,       // 在线总人数
+        offline: 0,      // 离线总人数
+        silenced: 0,      // 禁言总人数
+        al: 0
+      },
+      tabLeft: {
+        activeName: "al",
+      },
+      taskParams:{
+        currentPage: 1,
+        pageSize: 20,
+        prevPage: 0,
+        totalLoaded: 0,
+        total: 0,
+        hasMore: true,
+        hasPrev: false
+      },
+      loadMsgMaxPage: 2,
+      liveWsUrl: process.env.VUE_APP_LIVE_WS_URL + '/app/webSocket',
+      alDisplayList: [],
+      onlineDisplayList: [],    // 在线用户显示列表
+      offlineDisplayList: [],   // 离线用户显示列表
+      silencedDisplayList: [],  // 禁言用户显示列表
+      // 各Tab的分页参数
+      pageParams: {
+        al: {
+          currentPage: 1,
+          pageSize: 20,
+          prevPage: 0,
+          totalLoaded: 0,
+          total: 0,
+          hasMore: true,
+          hasPrev: false
+        },
+        online: {
+          currentPage: 1,       // 当前页(下一页加载用)
+          pageSize: 20,       // 当前页(下一页加载用)
+          prevPage: 0,          // 上一页页码(上一页加载用)
+          totalLoaded: 0,       // 已加载总条数
+          total: 0,             // 总数据量
+          hasMore: true,        // 是否有下一页
+          hasPrev: false        // 是否有上一页
+        },
+        offline: {
+          currentPage: 1,
+          pageSize: 20,
+          prevPage: 0,
+          totalLoaded: 0,
+          total: 0,
+          hasMore: true,
+          hasPrev: false
+        },
+        silenced: {
+          currentPage: 1,
+          pageSize: 20,
+          prevPage: 0,
+          totalLoaded: 0,
+          total: 0,
+          hasMore: true,
+          hasPrev: false
+        }
+      },
+      scrLoading: {
+        al: { next: false, prev: false },
+        online: { next: false, prev: false },
+        offline: { next: false, prev: false },
+        silenced: { next: false, prev: false }
+      },
+      newMsg:'',
+      autoMsgTimer: null,
+      checkInterval: 2000, // 检查间隔(1分钟,可根据需求调整)
+    };
+  },
+  computed: {
+    userId() {
+      return this.$store.state.user.user.userId
+    },
+    companyId() {
+      return this.$store.state.user.user.companyId
+    },
+    onlineLabel() {
+      return `在线(${this.userTotal.online})`;
+    },
+    alLabel() {
+      return `全部(${this.userTotal.al})`;
+    },
+    offlineLabel() {
+      return `离线(${this.userTotal.offline})`;
+    },
+    silencedUserLabel() {
+      return `禁言(${this.userTotal.silenced})`;
+    }
+  },
+  created() {
+    if(!this.liveId) return
+    this.getList()
+    this.handleUserClick({name:'al'})
+    this.connectWebSocket()
+    this.getLive()
+  },
+  mounted() {
+    this.$nextTick(() => {
+      this.restoreChatScrollPosition();
+
+      if (this.$refs.manageRightRef && this.$refs.manageRightRef.wrap) {
+        this.$refs.manageRightRef.wrap.addEventListener('scroll', this.saveChatScrollPosition);
+      }
+    });
+    this.initScrollListeners();
+  },
+  methods: {
+    singleVisible(m){
+      // 过滤当前所有消息 找到userId的相同的消息 更改他们的自可见状态
+      m.singleVisible= m.singleVisible === 1 ? 0 : 1
+      this.msgList.forEach(m1 => {m1.singleVisible = m1.userId === m.userId ? m.singleVisible : !m.singleVisible})
+      // 消息自可见
+      let msg = {
+        liveId: this.liveId,
+        userId: m.userId,
+        userType: 0,
+        cmd: 'singleVisible',
+        status:m.singleVisible
+      }
+      this.socket.send(JSON.stringify(msg))
+    },
+    globalVisibleChange( val){
+      // 消息自可见
+      let msg = {
+        liveId: this.liveId,
+        userId: '9999',
+        userType: 0,
+        cmd: 'globalVisible',
+        status:this.globalVisible ? 1 :0
+      }
+      this.socket.send(JSON.stringify(msg))
+    },
+    changeAutoWatermark( val){
+      this.watermarkList = this.watermarkTemplate
+        .split('\n')
+        .map(line => line.trim())
+        .filter(line => line !== '');
+      if(this.watermarkTemplate.length < 1 || this.watermarkList.length === 0) {
+        this.$message.warning('请先填写水印模板')
+        this.$nextTick(() => {
+          this.autoWatermark = false
+        });
+        return
+      }
+      this.disabled = this.autoWatermark
+      if(this.autoWatermark){
+          this.autoMsgTimer = setInterval(() => {
+            this.sendNormalMessage()
+          }, 1000 * this.interval)
+      } else {
+        clearInterval(this.autoMsgTimer)
+        this.watermarkIndex = 0;
+        this.watermarkList = [];
+      }
+    },
+    sendNormalMessage() {
+      if(this.watermarkIndex >= this.watermarkList.length){
+        clearInterval(this.autoMsgTimer)
+        this.watermarkIndex = 0;
+        this.watermarkList = [];
+        this.$message.success('自动发送消息已结束');
+        this.$nextTick(() => {
+          this.autoWatermark = false
+        });
+        return;
+      }
+      const curMsg = this.watermarkList[this.watermarkIndex]
+      // 发送前简单校验
+      if (curMsg.trim() === '') {
+        return;
+      }
+      let msg = {
+        msg: curMsg,
+        liveId: this.liveId,
+        userId: '9999',
+        userType: 0,
+        cmd: 'sendNormalMsg',
+        avatar: this.$store.state.user.user.avatar,
+        nickName: this.$store.state.user.user.nickName,
+      }
+      this.socket.send(JSON.stringify(msg))
+      this.watermarkIndex += 1
+    },
+    // 弹窗消息
+    sendPopMessage() {
+      // 发送前简单校验
+      if (this.newMsg.trim() === '') {
+        return;
+      }
+
+      let msg = {
+        msg: this.newMsg,
+        liveId: this.liveId,
+        userId: this.userId,
+        userType: 1,
+        cmd: 'sendPopMsg',
+        avatar: this.$store.state.user.user.avatar,
+        nickName: this.$store.state.user.user.nickName,
+      }
+
+      this.socket.send(JSON.stringify(msg))
+
+      this.newMsg = '';
+    },
+    sendMessage() {
+      // 发送前简单校验
+      if (this.newMsg.trim() === '') {
+        return;
+      }
+
+      let msg = {
+        msg: this.newMsg,
+        liveId: this.liveId,
+        userId: this.userId,
+        userType: 1,
+        cmd: 'sendMsg',
+        avatar: this.$store.state.user.user.avatar,
+        nickName: this.$store.state.user.user.nickName,
+      }
+
+      this.socket.send(JSON.stringify(msg))
+
+      this.newMsg = '';
+    },
+    handleWsMessage(event) {
+      let { code, data } = JSON.parse(event.data)
+      if (code === 200) {
+        let { cmd } = data
+        if (cmd === 'sendMsg') {
+          let message = JSON.parse(data.data)
+
+          let user = this.alDisplayList.find(u => u.userId === message.userId)
+          if (user) {
+            message.msgStatus = user.msgStatus
+          } else {
+            message.msgStatus = 0
+          }
+          delete message.params
+          if(this.msgList.length > 50){
+            this.msgList.shift()
+          }
+          this.msgList.push(message)
+          // 移动到底部
+          this.$nextTick(() => {
+            setTimeout(() => {
+              this.$refs.manageRightRef.wrap.scrollTop = this.$refs.manageRightRef.wrap.scrollHeight - this.$refs.manageRightRef.wrap.clientHeight
+            }, 200)
+          })
+        } else if (cmd === 'entry' || cmd === 'out') {
+          const user = data;
+          const online = cmd === 'entry' ? 0 : 1; // 0=在线,1=离线
+          const info = {
+            online:online,
+            msgStatus: user.msgStatus || 0,
+            nickName: user.nickName || '',
+            userType: user.userType || 0,
+            userId: user.userId || '',
+          };
+
+          // 1. 更新总人数(在线/离线互转)
+          if (cmd === 'entry') {
+            this.userTotal.online += 1;
+            this.userTotal.offline = Math.max(0, this.userTotal.offline - 1); // 确保不小于0
+          } else {
+            this.userTotal.offline += 1;
+            this.userTotal.online = Math.max(0, this.userTotal.online - 1); // 确保不小于0
+          }
+          // 2. 强制更新相关列表(无论当前激活哪个Tab)
+          if (cmd === 'entry') {
+            // 用户进入:从离线列表删除,添加到在线列表
+            this.offlineDisplayList = this.offlineDisplayList.filter(u => u.userId !== user.userId);
+            const newOnlineList = this.onlineDisplayList.filter(u => u.userId !== user.userId);
+            newOnlineList.push(info);
+            this.onlineDisplayList = newOnlineList.slice(-40); // 限制最大50条
+          } else {
+            // 用户离开:从在线列表删除,添加到离线列表
+            this.onlineDisplayList = this.onlineDisplayList.filter(u => u.userId !== user.userId);
+            const newOfflineList = this.offlineDisplayList.filter(u => u.userId !== user.userId);
+            newOfflineList.push(info);
+            this.offlineDisplayList = newOfflineList.slice(-40); // 限制最大50条
+          }
+          // 3. 处理禁言列表(如果用户是禁言状态,无论进出都要同步)
+          if (info.msgStatus === 1) {
+            // 禁言用户:从禁言列表删除旧数据,添加新数据
+            const newSilencedList = this.silencedDisplayList.filter(u => u.userId !== user.userId);
+            newSilencedList.push(info);
+            this.silencedDisplayList = newSilencedList.slice(-40);
+          } else {
+            // 非禁言用户:从禁言列表删除(如果存在)
+            this.silencedDisplayList = this.silencedDisplayList.filter(u => u.userId !== user.userId);
+          }
+
+        } else if (cmd === 'live_start') {
+
+        } else if (cmd === 'live_end') {
+
+        }
+      }
+    },
+    getLive(){
+      getLive(this.liveId).then(res => {
+        if (res.code == 200) {
+          if (res.data.isAudit != 1) {
+            this.$message.error("当前直播间未经审核");
+            this.loading = false
+            return
+          }
+          this.isAudit = true
+          this.status = res.data.status
+          this.videoParam.startTime = new Date(res.data.startTime).getTime()
+          if(res.data.status == 4){
+            this.videoParam.liveType = 3
+            this.videoParam.videoUrl = res.data.videoUrl;
+          }else {
+            if (res.data.status != 2) {
+              this.$message.error("当前直播间未直播");
+              this.loading = false
+              return
+            }
+            if (res.data.liveType == 1) {
+              this.videoParam.livingUrl = res.data.flvHlsUrl
+              this.videoParam.livingUrl = this.livingUrl.replace("flv","m3u8")
+              // this.$nextTick(() => {
+              //   this.initPlayer()
+              // })
+              // this.processInterval = setInterval(this.updateLiveProgress, 1000);
+            } else {
+              this.videoParam.liveType = 2
+              this.videoParam.videoUrl = res.data.videoUrl;
+              // this.$nextTick(() => {
+              //   this.initVideoPlayer(res.data.startTime)
+              // })
+            }
+          }
+          this.$nextTick(() => {
+            this.globalVisible = res.data.globalVisible
+            this.$refs.livePlayer.initPlayer()
+          })
+          this.loading = false
+        } else {
+          this.$message.error(res.msg)
+          this.loading = false
+        }
+        this.liveInfo = res.data
+      })
+    },
+    connectWebSocket() {
+      this.$store.dispatch('initLiveWs', {
+        liveWsUrl: this.liveWsUrl,
+        liveId: this.liveId,
+        userId: this.userId
+      })
+      this.socket = this.$store.state.liveWs[this.liveId]
+      this.socket.onmessage = (event) => this.handleWsMessage(event)
+    },
+    changeUserState(u) {
+      const displayList = this[`${this.currentTab}DisplayList`];
+      // 修改状态
+      changeUserStatus({liveId: u.liveId, userId: u.userId}).then(response => {
+        let { code } = response;
+        if (200 === code) {
+          u.msgStatus = u.msgStatus === 0 ? 1 : 0
+          // 同步更新消息列表中相同用户的状态
+          this.msgList.forEach(msg => {
+            if (msg.userId === u.userId) {
+              msg.msgStatus = u.msgStatus;
+            }
+          });
+
+          displayList.forEach(user => {
+            if (user.userId === u.userId) {
+              user.msgStatus = u.msgStatus;
+            }
+          });
+          // 4. 关键:重新筛选所有Tab的显示列表,确保状态同步
+          this.refreshUserDisplayLists(u);
+
+          let msg = u.msgStatus === 0 ? "已解禁" : "已禁言"
+          this.msgSuccess(msg);
+          return
+        }
+        this.msgError("操作失败");
+      })
+    },
+    refreshUserDisplayLists(user) {
+      const { userId, msgStatus: newStatus, online } = user;
+      const oldStatus = newStatus === 1 ? 0 : 1; // 操作前的状态(反向)
+
+      // 1. 禁言操作(newStatus=1):从原在线/离线列表移除,加入禁言列表
+      if (newStatus === 1) {
+        // 从在线/离线列表中移除该用户(根据当前在线状态)
+        if (online === 0) {
+          this.onlineDisplayList = this.onlineDisplayList.filter(u => u.userId !== userId);
+          this.userTotal.online = Math.max(0, this.userTotal.online - 1);
+        } else {
+          this.offlineDisplayList = this.offlineDisplayList.filter(u => u.userId !== userId);
+          this.userTotal.offline = Math.max(0, this.userTotal.offline - 1);
+        }
+        this.userTotal.silenced = this.userTotal.silenced + 1;
+        // 添加到禁言列表(去重+限制长度)
+        const silencedList = this.silencedDisplayList.filter(u => u.userId !== userId);
+        silencedList.push(user);
+        this.silencedDisplayList = silencedList.slice(-40);
+      }
+
+      // 2. 解禁操作(newStatus=0):从禁言列表移除,回到原在线/离线列表
+      else {
+        // 从禁言列表移除
+        this.silencedDisplayList = this.silencedDisplayList.filter(u => u.userId !== userId);
+        this.userTotal.silenced = Math.max(0, this.userTotal.silenced - 1);
+        // 回到对应的在线/离线列表(根据当前在线状态)
+        if (online === 0) {
+          // 加入在线列表(去重+限制长度)
+          const onlineList = this.onlineDisplayList.filter(u => u.userId !== userId);
+          onlineList.push(user);
+          this.onlineDisplayList = onlineList.slice(-40);
+          this.userTotal.online = this.userTotal.online + 1;
+        } else {
+          // 加入离线列表(去重+限制长度)
+          const offlineList = this.offlineDisplayList.filter(u => u.userId !== userId);
+          offlineList.push(user);
+          this.offlineDisplayList = offlineList.slice(-40);
+          this.userTotal.offline = this.userTotal.offline + 1;
+        }
+      }
+    },
+    blockUser(u){
+      this.$confirm('是否确认封禁用户账号为:"' + u.nickName + '-' + u.userId + '"?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return blockUser(u.userId);
+      }).then(() => {
+        if(u.msgStatus === 1){
+          this.userTotal.silenced -= 1
+          this.silencedDisplayList = this.silencedDisplayList.filter(user => user.userId !== u.userId)
+        } else if( u.online === 0){
+          this.userTotal.online -= 1
+          this.onlineDisplayList = this.onlineDisplayList.filter(user => user.userId !== u.userId)
+        } else {
+          this.userTotal.offline -= 1
+          this.offlineDisplayList = this.offlineDisplayList.filter(user => user.userId !== u.userId)
+        }
+        this.userTotal.al -= 1
+        this.alDisplayList = this.alDisplayList.filter(user => user.userId !== u.userId)
+        let msg = {
+          msg: "",
+          liveId: this.liveId,
+          userId: u.userId,
+          userType: 0,
+          cmd: 'blockUser',
+          avatar: this.$store.state.user.user.avatar,
+          nickName: this.$store.state.user.user.nickName
+        }
+        this.socket.send(JSON.stringify(msg))
+        this.msgSuccess("封禁成功");
+
+
+      }).catch(() => {});
+    },
+    searchUsers(){
+      this.resetUserParams()
+      this.loadNextPage(this.currentTab)
+    },
+    handleUserClick(tab){
+      const tabName = tab.name;
+      this.currentTab = tabName;
+      const params = this.pageParams[tabName];
+      const displayList = this[`${tabName}DisplayList`];
+      // 首次切换到该Tab或列表为空时初始化
+      if (displayList.length < 20) {
+        // 重置分页参数
+        params.currentPage = 1;
+        params.pageSize = 20;
+        params.prevPage = 0;
+        params.totalLoaded = 0;
+        params.hasMore = true;
+        params.hasPrev = false;
+        // 加载第一页
+        this.loadNextPage(tabName);
+      } else {
+        // 非首次切换,恢复滚动位置
+        this.$nextTick(() => {
+          const scrollEl = this.getScrollElement(tabName);
+          if (scrollEl) {
+            scrollEl.scrollTop = this.tabScrollPositions[tabName] || 0;
+          }
+        });
+      }
+    },
+    loadNextPage(tabName) {
+      const params = this.pageParams[tabName];
+      const displayList = this[`${tabName}DisplayList`];
+
+      // 若没有更多数据或正在加载,直接返回
+      if (!params.hasMore || this.scrLoading[tabName].next) {
+        return;
+      }
+
+      this.scrLoading[tabName].next = true;
+      const queryParams = {
+        liveId: this.liveId,
+        pageNum: params.currentPage,
+        pageSize: 20,
+        online: tabName === 'online' ? 0 : 1,
+        msgStatus: tabName === 'silenced' ? 1 : 0,
+        all: tabName === 'al' ? 1 : 0,
+        userName: this.searchKeyword
+      };
+      // 调用接口加载对应状态的分页数据(需后端支持按状态筛选)
+      dashBoardWatchUserList(queryParams).then(response => {
+        this.scrLoading[tabName].next = false;
+        if (response.code !== 200) return;
+
+        const { rows, total } = response;
+        params.total = total; // 记录总数据量
+        // 过滤重复数据(基于userId)
+        const newRows = rows.filter(row =>
+          !displayList.some(u => u.userId === row.userId)
+        );
+        displayList.push(...newRows)
+        // 添加新数据并限制最大长度(避免内存占用过大)
+        if (displayList.length >= 40) { // 最大保留100条
+          this[`${tabName}DisplayList`] = displayList.slice(-40);
+          // 记录滚动位置(用于加载后校准)
+          const scrollEl = this.getScrollElement(tabName);
+          // 校准滚动位置(保持视觉连续性)
+          this.$nextTick(() => {
+            if (scrollEl) {
+              scrollEl.scrollTop = scrollEl.scrollHeight * 0.5;
+            }
+          });
+        }
+        // 更新分页状态
+        params.hasMore = params.currentPage * params.pageSize < total;
+        params.currentPage += 1;
+        params.hasPrev = params.currentPage > 2; // 当前页>2时一定有上一页
+        params.prevPage = params.currentPage - 2;
+      }).catch(() => {
+        this.scrLoading[tabName].next = false;
+      });
+    },
+    // 新增:加载上一页(向上滚动时)
+    loadPrevPage(tabName) {
+      const params = this.pageParams[tabName];
+      const displayList = this[`${tabName}DisplayList`];
+      // 边界校验:无上一页/正在加载/当前页<=1
+      console.log(`加载 ${tabName} 上一页`);
+      console.log(!params.hasPrev || this.scrLoading[tabName].prev || params.currentPage <= 1)
+      if (!params.hasPrev || this.scrLoading[tabName].prev || params.currentPage <= 1) {
+        return;
+      }
+      this.scrLoading[tabName].prev = true;
+      const targetPage = params.prevPage > 0 ? params.prevPage : params.currentPage - 2;
+      const queryParams = {
+        liveId: this.liveId,
+        pageNum: targetPage,
+        pageSize: 20,
+        online: tabName === 'online' ? 0 : 1,
+        msgStatus: tabName === 'silenced' ? 1 : 0,
+        all: tabName === 'al' ? 1 : 0,
+        userName: this.searchKeyword
+      };
+      dashBoardWatchUserList(queryParams).then(response => {
+        this.scrLoading[tabName].prev = false;
+        if (response.code !== 200) return;
+
+        const { rows } = response;
+        if (rows.length === 0) {
+          params.hasPrev = false;
+          return;
+        }
+
+        // 记录滚动位置(用于加载后校准)
+        const scrollEl = this.getScrollElement(tabName);
+        const scrollTop = scrollEl?.scrollTop || 0;
+        const itemHeight = 80; // 预估行高(根据实际样式调整)
+        const newItemsHeight = rows.length * itemHeight;
+
+        // 过滤重复数据并添加到列表头部
+        const newRows = rows.filter(row => !displayList.some(u => u.userId === row.userId));
+        this[`${tabName}DisplayList`] = [...newRows, ...displayList];
+        params.totalLoaded += newRows.length;
+
+        // 限制最大长度
+        if (this[`${tabName}DisplayList`].length > 40) {
+          this[`${tabName}DisplayList`] = this[`${tabName}DisplayList`].slice(0, 40);
+        }
+
+        // 更新分页状态
+        params.prevPage = targetPage - 1;
+        params.hasPrev = targetPage > 1; // 上一页页码>1时还有更多上一页
+        params.currentPage = params.currentPage - 1;
+        if(params.currentPage * 20 < params.total) params.hasMore = true;
+        // 校准滚动位置(保持视觉连续性)
+        this.$nextTick(() => {
+          if (scrollEl) {
+            scrollEl.scrollTop = scrollEl.scrollHeight * 0.5;
+          }
+        });
+      }).catch(() => {
+        this.scrLoading[tabName].prev = false;
+      });
+    },
+    getList() {
+      this.resetUserParams()
+      this.resetMsgParams()
+      // this.loadUserList()
+      this.loadUserTotals(); // 先加载总人数
+      // this.handleClick('online')
+      // this.handleClick({name:'online'})
+      this.loadMsgList()
+      this.loadLiveTask()
+    },
+    formatDate(value) {
+      // 检查值是否存在且为日期类型(或可转换为日期)
+      if (!value) return '';
+
+      let date;
+      // 处理字符串类型的日期
+      if (typeof value === 'string') {
+        date = new Date(value);
+      }
+      // 处理Date对象
+      else if (value instanceof Date) {
+        date = value;
+      }
+      // 无效类型直接返回原值
+      else {
+        return value;
+      }
+
+      // 检查是否为有效日期
+      if (isNaN(date.getTime())) {
+        return value;
+      }
+
+      // 格式化年月日时分秒(补零处理)
+      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}`;
+    },
+    loadLiveTask(){
+      if(!this.taskParams.hasMore) return
+      const queryParams = {
+        liveId: this.liveId,
+        pageSize: 10,
+        pageNum: 1
+      }
+      consoleList(queryParams).then(res => {
+        let {code, rows,total} = res;
+        if (code === 200) {
+          this.taskParams.total = total
+          this.timelineItems = rows
+          if(rows.length  < this.taskParams.pageSize){
+            this.taskParams.hasMore = false
+          }
+          this.startTaskTimer()
+        } else {
+          this.stopTaskTimer()
+        }
+      })
+    },
+    loadMsgList(){
+      // 直播间消息
+      listLiveSingleMsg({
+        liveId:this.liveId,
+        pageNum: this.msgParams.pageNum,
+        pageSize: this.msgParams.pageSize
+      }).then(response => {
+        let {code, rows,total} = response;
+        if (code === 200) {
+          let totalPage = (total % this.msgParams.pageSize == 0) ? Math.floor(total / this.msgParams.pageSize) : Math.floor(total / this.msgParams.pageSize + 1);
+          rows.forEach(row => {
+            if (!this.msgList.some(m => m.msgId === row.msgId)) {
+
+              let user = this.alDisplayList.find(u => u.userId === row.userId)
+              if (user) {
+                row.msgStatus = user.msgStatus
+              } else {
+                row.msgStatus = 0
+              }
+
+              this.msgList.push(row)
+
+              // 移动到底部
+              this.$nextTick(() => {
+                setTimeout(() => {
+                  this.$refs.manageRightRef.wrap.scrollTop = this.$refs.manageRightRef.wrap.scrollHeight - this.$refs.manageRightRef.wrap.clientHeight
+                }, 200)
+              })
+            }
+          })
+
+          this.msgList.reverse()
+          // 同步更新消息列表中相同用户的状态
+          this.alDisplayList.forEach(u => {
+            this.msgList.filter(m => m.userId === u.userId).forEach(m => m.msgStatus = u.msgStatus)
+          })
+        }
+      })
+
+      // 添加滚动监听
+      this.$nextTick(() => {
+        this.$refs.manageRightRef.wrap.addEventListener("scroll", this.manageRightScroll)
+      })
+    },
+    loadUserTotals() {
+      if (!this.liveId) return;
+      // 假设后端提供一个接口返回总人数(如果没有,可通过首次加载全量数据后统计)
+      getLiveUserTotals({ liveId: this.liveId }).then(res => {
+        if (res.code === 200) {
+          this.userTotal = res.data; // { online, offline, silenced }
+        }
+      });
+    },
+    toggleBlack(user) {
+      user.isBlack = !user.isBlack;
+    },
+    toggleMute(user) {
+      user.isMuted = !user.isMuted;
+    },
+    toggleVisible(msg) {
+      msg.isVisible = !msg.isVisible;
+    },
+    deleteMessage(msg) {
+      const index = this.messages.indexOf(msg);
+      if (index > -1) {
+        this.messages.splice(index, 1);
+      }
+    },
+    addTimelineItem() {
+      this.timelineItems.push({ time: '00:00', action: '新动作' });
+    },
+    removeTimelineItem(item) {
+      const index = this.timelineItems.indexOf(item);
+      if (index > -1) {
+        this.timelineItems.splice(index, 1);
+      }
+    },
+    resetUserParams() {
+      // 重置各Tab的显示列表和分页参数
+      this.alDisplayList = [];
+      this.onlineDisplayList = [];   // 在线用户显示列表
+      this.offlineDisplayList = [];   // 离线用户显示列表
+      this.silencedDisplayList = [];  // 禁言用户显示列表
+      this.pageParams=  {
+        al: {
+          currentPage: 1,
+            pageSize: 20,
+            prevPage: 0,
+            totalLoaded: 0,
+            total: 0,
+            hasMore: true,
+            hasPrev: false
+        },
+        online: {
+          currentPage: 1,       // 当前页(下一页加载用)
+            pageSize: 20,       // 当前页(下一页加载用)
+            prevPage: 0,          // 上一页页码(上一页加载用)
+            totalLoaded: 0,       // 已加载总条数
+            total: 0,             // 总数据量
+            hasMore: true,        // 是否有下一页
+            hasPrev: false        // 是否有上一页
+        },
+        offline: {
+          currentPage: 1,
+            pageSize: 20,
+            prevPage: 0,
+            totalLoaded: 0,
+            total: 0,
+            hasMore: true,
+            hasPrev: false
+        },
+        silenced: {
+          currentPage: 1,
+            pageSize: 20,
+            prevPage: 0,
+            totalLoaded: 0,
+            total: 0,
+            hasMore: true,
+            hasPrev: false
+        }
+      },
+      this.scrLoading = {
+        al: { next: false, prev: false },
+        online: { next: false, prev: false },
+        offline: { next: false, prev: false },
+        silenced: { next: false, prev: false }
+      }
+    },
+    resetMsgParams() {
+      // 消息参数保留
+      this.msgList = [];
+      this.msgParams = {
+        pageNum: 1,
+        pageSize: 30,
+        liveId: this.liveId
+      };
+      this.taskParams = {
+          currentPage: 1,
+          pageSize: 20,
+          prevPage: 0,
+          totalLoaded: 0,
+          total: 0,
+          hasMore: true,
+          hasPrev: false
+      }
+    },
+    getScrollElement(tabName) {
+      const scrollRefs = {
+        al: this.$refs.manageLeftRef_al,
+        online: this.$refs.manageLeftRef_online,
+        offline: this.$refs.manageLeftRef_offline,
+        silenced: this.$refs.manageLeftRef_silenced
+      };
+      return scrollRefs[tabName]?.wrap;
+    },
+    // 初始化滚动监听(在mounted中调用)
+    initScrollListeners() {
+      // 为每个Tab的滚动容器添加监听
+      this.$nextTick(() => {
+        const scrollRefs = {
+          al: this.$refs.manageLeftRef_al,
+          online: this.$refs.manageLeftRef_online,
+          offline: this.$refs.manageLeftRef_offline,
+          silenced: this.$refs.manageLeftRef_silenced
+        };
+
+        Object.keys(scrollRefs).forEach(tabName => {
+          const scrollEl = scrollRefs[tabName]?.wrap;
+          if (scrollEl) {
+            scrollEl.addEventListener('scroll', () =>
+              this.handleTabScroll(tabName, scrollEl)
+            );
+          }
+        });
+      });
+    },
+    // 处理Tab滚动事件(判断是否触底)
+    handleTabScroll(tabName, scrollEl) {
+      const { scrollTop, scrollHeight, clientHeight } = scrollEl;
+      const bottomThreshold = 50; // 距离底部100px触发下一页
+      const topThreshold = 50;    // 距离顶部100px触发上一页
+
+      // 加载下一页(滚动到底部附近)
+      if (scrollHeight - scrollTop - clientHeight < bottomThreshold) {
+        this.loadNextPage(tabName);
+      }
+
+      // 加载上一页(滚动到顶部附近)
+      if (scrollTop < topThreshold) {
+        this.loadPrevPage(tabName);
+      }
+    },
+    // 恢复聊天滚动位置
+    restoreChatScrollPosition() {
+      if (this.$refs.manageRightRef && this.$refs.manageRightRef.wrap) {
+        this.$refs.manageRightRef.wrap.scrollTop = this.chatScrollTop;
+      }
+    },
+    // 保存聊天滚动位置
+    saveChatScrollPosition() {
+      if (this.$refs.manageRightRef && this.$refs.manageRightRef.wrap) {
+        this.chatScrollTop = this.$refs.manageRightRef.wrap.scrollHeight - this.$refs.manageRightRef.wrap.clientHeight;
+      }
+    },
+    /**
+     * 停止任务检测定时器
+     */
+    stopTaskTimer() {
+      if (this.taskTimer) {
+        clearInterval(this.taskTimer);
+        this.taskTimer = null;
+      }
+    },
+    /**
+     * 启动任务检测定时器
+     */
+    startTaskTimer() {
+      // 先清除已有定时器,避免重复
+      if (this.taskTimer) {
+        clearInterval(this.taskTimer);
+      }
+
+      // 立即执行一次检查
+      this.checkTaskExpiration();
+
+      // 启动定时器,定期检查
+      this.taskTimer = setInterval(() => {
+        this.checkTaskExpiration();
+      }, this.checkInterval);
+    },
+    /**
+     * 检查时间轴第一条任务是否过期
+     */
+    checkTaskExpiration() {
+      // 如果没有任务,直接返回
+      if (!this.timelineItems || this.timelineItems.length === 0) {
+        this.stopTaskTimer()
+        return;
+      };
+
+      // 获取第一条任务的时间
+      const firstTask = this.timelineItems[0];
+      const taskTime = new Date(firstTask.absValue).getTime();
+      const currentTime = new Date().getTime();
+
+      // 如果任务时间已过当前时间(过期),重新加载任务列表
+      if (taskTime < currentTime) {
+        this.timelineItems.shift()
+        this.loadLiveTask(); // 重新加载任务列表
+      }
+    },
+  },
+  beforeDestroy() {
+    if (this.autoMsgTimer != null) {
+      clearInterval(this.autoMsgTimer);
+    }
+  },
+  // 使用 deactivated 和 activated 钩子替代 beforeDestroy 和 destroyed
+  deactivated() {
+    this.saveChatScrollPosition();
+  },
+  activated() {
+    this.$nextTick(() => {
+      this.restoreChatScrollPosition();
+    });
+    // todo yhq
+    // this.$nextTick(() => {
+    //   const video = this.$refs.videoPlayer;
+    //   if (video != null) {
+    //     this.initVideoPlayer(this.liveInfo.startTime)
+    //   }
+    // })
+  },
+};
+</script>
+
+<style scoped>
+.console {
+  display: flex;
+  height: 100vh;
+}
+
+.left-panel, .middle-panel, .right-panel {
+  padding: 20px;
+  box-sizing: border-box;
+}
+
+.left-panel {
+  width: 30%;
+  background: #f8fafc;
+  border-right: 1px solid #e2e8f0;
+}
+
+.middle-panel {
+  width: 40%;
+  background: #f8fafc;
+  border-right: 1px solid #e2e8f0;
+}
+
+.right-panel {
+  width: 30%;
+  background: #f8fafc;
+}
+
+.search {
+  margin: 10px 0;
+}
+
+.search input {
+  width: 70%;
+  padding: 8px;
+  border: 1px solid #cbd5e1;
+  border-radius: 4px;
+}
+
+.search button {
+  padding: 8px 15px;
+  background: #3b82f6;
+  color: #fff;
+  border: none;
+  border-radius: 4px;
+  cursor: pointer;
+}
+
+.tabs {
+  display: flex;
+  margin: 10px 0;
+}
+
+.tabs button {
+  padding: 8px 15px;
+  border: 1px solid #e2e8f0;
+  background: #fff;
+  cursor: pointer;
+}
+
+.tabs button.active {
+  background: #3b82f6;
+  color: #fff;
+  border-color: #3b82f6;
+}
+
+.user-list {
+  max-height: 600px;
+  overflow-y: auto;
+}
+
+.user-item {
+  display: flex;
+  align-items: center;
+  padding: 10px;
+  border-bottom: 1px solid #e2e8f0;
+}
+
+.user-item img {
+  width: 40px;
+  height: 40px;
+  border-radius: 50%;
+  margin-right: 10px;
+}
+
+.user-info {
+  flex: 1;
+}
+
+.user-name {
+  font-weight: bold;
+}
+
+.user-status {
+  font-size: 12px;
+  color: #64748b;
+}
+
+.online {
+  color: #10b981;
+}
+
+.offline {
+  color: #94a3b8;
+}
+
+.user-actions {
+  display: flex;
+}
+
+.user-actions button {
+  padding: 5px 10px;
+  margin-left: 5px;
+  border: none;
+  border-radius: 4px;
+  cursor: pointer;
+}
+
+.block {
+  background: #ef4444;
+  color: #fff;
+}
+
+.unblock {
+  background: #10b981;
+  color: #fff;
+}
+
+.mute {
+  background: #f59e0b;
+  color: #fff;
+}
+
+.unmute {
+  background: #3b82f6;
+  color: #fff;
+}
+
+.system-messages, .discussion-messages {
+  margin: 20px 0;
+  background: #fff;
+  padding: 15px;
+  border-radius: 8px;
+  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
+}
+
+.system-messages textarea {
+  width: 100%;
+  height: 100px;
+  border: 1px solid #e2e8f0;
+  border-radius: 4px;
+  padding: 8px;
+  box-sizing: border-box;
+}
+
+.message-actions {
+  margin-top: 10px;
+}
+
+.message-actions button {
+  padding: 5px 10px;
+  margin-right: 5px;
+  background: #3b82f6;
+  color: #fff;
+  border: none;
+  border-radius: 4px;
+  cursor: pointer;
+}
+
+.message-list {
+  max-height: 300px;
+  overflow-y: auto;
+  margin-top: 10px;
+}
+
+.message-item {
+  display: flex;
+  margin-bottom: 10px;
+  padding-bottom: 10px;
+  border-bottom: 1px solid #e2e8f0;
+}
+
+.message-avatar img {
+  width: 30px;
+  height: 30px;
+  border-radius: 50%;
+  margin-right: 10px;
+}
+
+.message-content {
+  flex: 1;
+}
+
+.message-user {
+  font-weight: bold;
+}
+
+.message-text {
+  font-size: 14px;
+  color: #64748b;
+}
+
+.message-actions button {
+  padding: 3px 8px;
+  font-size: 12px;
+  background: #3b82f6;
+  color: #fff;
+  border: none;
+  border-radius: 4px;
+  cursor: pointer;
+}
+
+.live-player, .automation, .watermark {
+  margin: 20px 0;
+  background: #fff;
+  padding: 15px;
+  border-radius: 8px;
+  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
+}
+
+.timeline-items {
+  margin: 10px 0;
+}
+
+.timeline-item {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 8px 0;
+  border-bottom: 1px solid #e2e8f0;
+}
+
+.delete {
+  background: #ef4444;
+  color: #fff;
+  border: none;
+  border-radius: 4px;
+  padding: 3px 8px;
+  cursor: pointer;
+}
+
+.add {
+  background: #10b981;
+  color: #fff;
+  border: none;
+  border-radius: 4px;
+  padding: 8px 15px;
+  cursor: pointer;
+}
+
+.watermark-settings textarea {
+  width: 100%;
+  height: 100px;
+  border: 1px solid #e2e8f0;
+  border-radius: 4px;
+  padding: 8px;
+  box-sizing: border-box;
+}
+
+.watermark-options {
+  margin-top: 10px;
+}
+
+.watermark-options label {
+  display: block;
+  margin-bottom: 5px;
+}
+/* 隐藏 el-scrollbar 的横向滚动条 */
+.el-scrollbar__wrap {
+  overflow-x: hidden !important;
+}
+.custom-scrollbar .el-scrollbar__wrap {
+  overflow-x: hidden !important;
+}
+.scrollbar-demo-item{
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  height: 50px;
+  margin: 10px;
+  text-align: center;
+  border-radius: 4px;
+}
+</style>

+ 373 - 0
src/views/live/liveConsole/LiveDashboard.vue

@@ -0,0 +1,373 @@
+<template>
+  <div class="dashboard-container">
+    <!-- 实时大屏主体(100%占满父容器) -->
+    <div class="dashboard">
+      <!-- 顶部数据卡片区(占满宽度,高度20%) -->
+      <div class="data-cards">
+        <div class="card" v-for="item in dataCards" :key="item.title">
+          <h3>{{ item.title }}</h3>
+          <p class="value">{{ item.value }}</p>
+        </div>
+      </div>
+
+      <!-- 中间内容区(上下分两部分,各占40%高度) -->
+      <div class="middle-content">
+        <!-- 左侧用户分析区(占50%宽度) -->
+        <div class="user-analysis">
+          <div class="new-old">
+            <h3>新老用户占比</h3>
+            <EChartsComponent chartId="newOldChart" :option="newOldOption" />
+          </div>
+          <div class="region">
+            <h3>地域访客</h3>
+            <EChartsComponent chartId="regionChart" :option="regionOption" />
+          </div>
+        </div>
+
+        <!-- 右侧来源与榜单区(占50%宽度) -->
+        <div class="source-rank">
+          <div class="source">
+            <h3>观众来源</h3>
+            <EChartsComponent chartId="sourceChart" :option="sourceOption" />
+          </div>
+          <div class="rank">
+            <h3>邀请达人榜</h3>
+            <ul class="rank-list" v-if="rankList.length > 0">
+              <li v-for="(item, index) in rankList" :key="index">
+                <span class="rank-num">{{ index + 1 }}</span>
+                <span class="rank-name">{{ item.userName }}</span>
+                <span class="rank-count">{{ item.inviteNum }}</span>
+              </li>
+            </ul>
+            <p class="no-data" style="text-align: center;" v-if="rankList.length == 0">暂无数据</p>
+          </div>
+        </div>
+      </div>
+
+      <!-- 底部趋势图(占20%高度) -->
+<!--      <div class="trend">-->
+<!--        <h3>实时在线人数趋势</h3>-->
+<!--        <EChartsComponent chartId="trendChart" :option="trendOption" />-->
+<!--      </div>-->
+    </div>
+  </div>
+</template>
+
+<script>
+import EChartsComponent from './EchartsComponent.vue';
+import {dashboardData} from '@/api/live/liveData'
+
+export default {
+  components: { EChartsComponent },
+  props: {
+    liveId: {
+      type: String,
+      default: null
+    }
+  },
+  data() {
+    return {
+      // 数据保持不变(与原代码一致)
+      dataCards: [
+        { title: '在线人数', value: '2.5k' },
+        { title: '观看人次', value: '15.2k' },
+        { title: '点赞数', value: '12.8k' },
+        { title: '评论数', value: '3.2k' }
+      ],
+      newOldOption: {
+        tooltip: { trigger: 'item' },
+        series: [{
+          type: 'pie', radius: '70%',
+          data: [{ value: 65, name: '新用户' }, { value: 35, name: '老用户' }],
+          itemStyle: { colors: ['#36cfc9', '#722ed1'] }
+        }]
+      },
+      regionOption: {
+        tooltip: { trigger: 'item' },
+        series: [{
+          type: 'map', map: 'china', roam: true,
+          itemStyle: {
+            normal: { areaColor: '#36cfc9', borderColor: '#fff' },
+            emphasis: { areaColor: '#722ed1' }
+          },
+          data: [{ name: '北京', value: 120 }, { name: '上海', value: 150 }, { name: '广州', value: 90 }, { name: '深圳', value: 80 }, { name: '杭州', value: 70 }]
+        }]
+      },
+      sourceOption: {
+        tooltip: { trigger: 'item' },
+        series: [{
+          type: 'pie', radius: '70%',
+          data: [{ value: 45, name: '分享链接' }, { value: 30, name: '直接访问' }, { value: 25, name: '其他' }],
+          itemStyle: { colors: ['#3b82f6', '#10b981', '#f59e0b'] }
+        }]
+      },
+      rankList: [
+        { userName: '达人1', inviteNum: 258 },
+        { userName: '达人2', inviteNum: 186 },
+        { userName: '达人3', inviteNum: 152 },
+        { userName: '达人4', inviteNum: 121 },
+        { userName: '达人5', inviteNum: 98 }
+      ],
+      trendOption: {
+        // 网格:控制图表与容器的边距,避免内容被裁剪
+        grid: {
+          left: '3%',
+          right: '4%',
+          bottom: '3%',
+          top: '10%',
+          containLabel: true // 确保坐标轴标签不被裁剪
+        },
+        // X轴配置(补充样式,适配深色背景)
+        xAxis: {
+          type: 'category',
+          data: ['09:00', '09:10', '09:20', '09:30', '09:40', '09:50'],
+          axisLine: {
+            lineStyle: {
+              color: '#475569' // 坐标轴线条颜色(深色背景可见)
+            }
+          },
+          axisLabel: {
+            color: '#cbd5e1' // 坐标轴文字颜色
+          }
+        },
+        // Y轴配置(同上)
+        yAxis: {
+          type: 'value',
+          axisLine: {
+            lineStyle: {
+              color: '#475569'
+            }
+          },
+          axisLabel: {
+            color: '#cbd5e1'
+          },
+          splitLine: {
+            lineStyle: {
+              color: 'rgba(71, 85, 105, 0.3)' // 网格线半透明
+            }
+          }
+        },
+        // 系列配置(补充线条和区域样式)
+        series: [{
+          data: [1200, 1500, 1800, 2100, 2300, 2500],
+          type: 'line',
+          smooth: true,
+          // 线条样式
+          lineStyle: {
+            color: '#36cfc9',
+            width: 3
+          },
+          // 点样式
+          itemStyle: {
+            color: '#36cfc9',
+            borderWidth: 2,
+            borderColor: '#fff' // 点边缘白色,突出显示
+          },
+          // 填充区域(可选,增强视觉效果)
+          areaStyle: {
+            color: {
+              type: 'linear',
+              x: 0,
+              y: 0,
+              x2: 0,
+              y2: 1,
+              colorStops: [{
+                offset: 0, color: 'rgba(54, 207, 201, 0.3)'
+              }, {
+                offset: 1, color: 'rgba(54, 207, 201, 0)'
+              }]
+            }
+          }
+        }]
+      },
+      socket:null,
+      timer: null
+    };
+  },
+  created() {
+    this.getInitData()
+    this.timer = setInterval(() => {
+      this.getInitData();
+    }, 30000);
+  },
+  beforeDestroy() {
+    clearInterval(this.timer); // 组件销毁时清除定时器
+  },
+  methods: {
+    async getInitData() {
+      dashboardData(this.liveId).then(res => {
+        if(res.code == 200){
+          this.dealData(res.data)
+        }
+      });
+    },
+    dealData(data){
+      this.dataCards = [
+        { title: '在线人数', value: data.onlineNum },
+        { title: '观看人次', value: data.viewNum },
+        { title: '点赞数', value: data.likeNum },
+        { title: '评论数', value: data.commentNum }
+      ]
+      this.newOldOption= {
+        tooltip: { trigger: 'item' },
+        series: [{
+          type: 'pie', radius: '70%',
+          data: [{ value: data.newUserNum, name: '新用户' }, { value: data.oldUserNum, name: '老用户' }],
+          itemStyle: { colors: ['#36cfc9', '#722ed1'] }
+        }]
+      }
+      this.sourceOption = {
+        tooltip: { trigger: 'item' },
+        series: [{
+          type: 'pie', radius: '70%',
+          data: [{ value: data.shareUrlNum, name: '分享链接' }, { value: data.directAccessNum, name: '直接访问' }, { value: 0, name: '其他' }],
+          itemStyle: { colors: ['#3b82f6', '#10b981', '#f59e0b'] }
+        }]
+      }
+      this.rankList = data.inviteUserList;
+    },
+  }
+};
+</script>
+
+<style scoped>
+/* 容器占满整个屏幕 */
+.dashboard-container {
+  width: 100vw;
+  height: 92vh;
+  overflow: hidden;
+  background-color: #0f172a;
+}
+
+/* 大屏主体:100%宽高,内边距用百分比 */
+.dashboard {
+  width: 100%;
+  height: 100%;
+  padding: 1%; /* 用百分比内边距,适配不同屏幕 */
+  box-sizing: border-box;
+  color: #fff;
+  display: flex;
+  flex-direction: column;
+  gap: 1%; /* 区域间间距 */
+}
+
+/* 顶部数据卡片区:高度20%,横向排列 */
+.data-cards {
+  width: 100%;
+  height: 20%;
+  display: flex;
+  justify-content: space-between;
+  gap: 1%; /* 卡片间间距 */
+}
+
+/* 每个卡片:平均分配宽度(4个卡片各占 ~24%) */
+.card {
+  width: 24%; /* 100% - 3个间距(1%) = 97% → 97%/4 ≈ 24% */
+  height: 100%;
+  background: #1a202c;
+  border-radius: 8px;
+  padding: 1%;
+  box-sizing: border-box;
+  text-align: center;
+}
+
+.card h3 {
+  font-size: 1.2vw; /* 字体用vw单位,随屏幕宽度缩放 */
+  margin: 0 0 5% 0;
+}
+
+.card .value {
+  font-size: 2vw;
+  font-weight: bold;
+  margin: 0;
+}
+
+/* 中间内容区:高度40%,左右分栏 */
+.middle-content {
+  width: 100%;
+  height: 70%;
+  display: flex;
+  gap: 1%;
+}
+
+/* 左侧用户分析区:占50%宽度,内部上下分栏 */
+.user-analysis {
+  width: 50%;
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  gap: 1%;
+}
+
+/* 右侧来源与榜单区:占50%宽度,内部上下分栏 */
+.source-rank {
+  width: 50%;
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  gap: 1%;
+}
+
+/* 中间区域的子模块(新老用户/地域/来源/榜单):各占50%高度 */
+.new-old, .region, .source, .rank {
+  width: 100%;
+  height: 60.5%; /* 100% - 1个间距(1%) = 99% → 99%/2 ≈ 49.5% */
+  background: #1a202c;
+  border-radius: 8px;
+  padding: 1%;
+  box-sizing: border-box;
+}
+
+/* 标题样式:用vw单位适配 */
+.new-old h3, .region h3, .source h3, .rank h3, .trend h3 {
+  font-size: 1.1vw;
+  margin: 0 0 2% 0;
+}
+
+/* 达人榜单列表 */
+.rank-list {
+  list-style: none;
+  padding: 0;
+  height: calc(100% - 15%); /* 减去标题高度 */
+  overflow-y: auto;
+}
+
+.rank-list li {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 2%;
+  margin-bottom: 1%;
+  border-bottom: 1px solid #2d3748;
+  font-size: 1vw;
+}
+
+.rank-num {
+  width: 3vw;
+  height: 3vw;
+  max-width: 30px;
+  max-height: 30px;
+  border-radius: 50%;
+  background: #36cfc9;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 0.8vw;
+}
+
+/* 底部趋势图:高度20% */
+.trend {
+  width: 100%;
+  height: 20%;
+  background: #1a202c;
+  border-radius: 8px;
+  padding: 1%;
+  box-sizing: border-box;
+}
+
+/* ECharts图表容器:占满父元素 */
+::v-deep .chart-container {
+  width: 100% !important;
+  height: calc(100% - 15%) !important; /* 减去标题高度 */
+}
+</style>

+ 144 - 0
src/views/live/liveConsole/LivePlayer.vue

@@ -0,0 +1,144 @@
+<template>
+  <div class="live-player">
+    <video ref="videoPlayer" loop autoplay class="player">
+      <source :src="videoParam.videoUrl" type="application/x-mpegURL">
+    </video>
+  </div>
+</template>
+
+<script>
+import Hls from "hls.js";
+
+export default {
+  name: 'LivePlayer',
+  props: {
+    videoParam: {
+      type: Object,
+      required: true,
+      default: () => ({
+        startTime: '',
+        livingUrl: '',
+        liveType: 1,
+        videoUrl: ''
+      }),
+    }
+  },
+  data() {
+    return {
+      videoDuration: 0, // 视频总时长(秒)
+      startTime: 0, // 开播时间戳(毫秒)
+      hls: null, // HLS 实例
+    };
+  },
+  mounted() {
+
+    // 这里可以添加播放器初始化逻辑
+  },
+  methods: {
+    videoPlay(url) {
+      if (Hls.isSupported()) {
+        const videoElement = this.$refs.videoPlayer
+        if (!videoElement) {
+          console.error('找不到 video 元素')
+          return
+        }
+        this.hls = new Hls();
+        this.hls.attachMedia(videoElement);
+        this.hls.on(Hls.Events.MEDIA_ATTACHED, () => {
+          this.hls.loadSource(url);
+          this.hls.on(Hls.Events.STREAM_LOADED, (event, data) => {
+            videoElement.play();
+          });
+        });
+        this.hls.on(Hls.Events.ERROR, (event, data) => {
+          console.error('HLS 错误:', data);
+        });
+        // 1. 初始化开播时间
+        this.startTime = new Date(this.videoParam.startTime).getTime();
+        if (this.videoParam.liveType === 2) {
+          // 2. 监听视频元数据加载完成(获取视频时长)
+          videoElement.addEventListener('loadedmetadata', () => {
+            this.videoDuration = videoElement.duration; // 获取视频时长(秒)
+
+            // 初始化视频播放位置
+            this.updateVideoPosition(videoElement);
+
+          });
+        }
+      } else {
+        console.error('浏览器不支持 HLS')
+      }
+    },
+    updateVideoPosition(video){
+      const currentTime = new Date().getTime(); // 当前时间戳(毫秒)
+      const elapsedTime = currentTime - this.startTime; // 已流逝时间(毫秒)
+      if (elapsedTime < 0) {
+        // 未开播:视频停在初始位置
+        video.currentTime = 0;
+        return;
+      }
+
+      // 已开播:计算视频循环后的位置(流逝时间 % 视频时长)
+      const elapsedSeconds = elapsedTime / 1000; // 转换为秒
+       // 视频内的播放位置(秒)
+      // 设置视频播放位置
+      video.currentTime = elapsedSeconds % this.videoDuration;
+    },
+    initPlayer() {
+
+      if (this.videoParam.liveType === 1) {
+        // 直播
+        const isUrl = this.videoParam.livingUrl === null || this.videoParam.livingUrl.trim() === '';
+        if (isUrl) {
+          console.error('直播地址为空,无法初始化播放器')
+          return
+        }
+        this.videoPlay(this.videoParam.livingUrl);
+        return;
+      }
+      const viUrl = this.videoParam.videoUrl === null || this.videoParam.videoUrl.trim() === ''
+      if (viUrl) {
+        console.error('播放地址为空,无法初始化播放器')
+        return
+      }
+      if(this.videoParam.liveType === 2){
+        // 录播
+        this.videoPlay(this.videoParam.videoUrl);
+      } else if(this.videoParam.liveType === 3){
+        // 直播回放
+        this.videoPlay(this.videoParam.videoUrl);
+      }else {
+        console.error('直播类型错误,无法初始化播放器')
+      }
+      // 创建播放器实例
+      const videoPlayer = this.$refs.videoPlayer;
+      // 添加播放器事件监听器
+      videoPlayer.addEventListener('play', () => {
+        console.log('播放器已开始播放');
+      });
+      videoPlayer.addEventListener('pause', () => {
+        console.log('播放器已暂停');
+      });
+      videoPlayer.addEventListener('ended', () => {
+        console.log('播放器已结束');
+      });
+    }
+  },
+  beforeDestroy() {
+    this.hls?.destroy()
+    // 销毁播放器实例
+  }
+};
+</script>
+
+<style scoped>
+.live-player {
+  margin-bottom: 20px;
+}
+
+.player {
+  width: 100%;
+  height: auto;
+  border-radius: 8px;
+}
+</style>

+ 55 - 0
src/views/live/liveConsole/ScreenScale.vue

@@ -0,0 +1,55 @@
+<template>
+  <div class="container">
+    <div ref="scaleContainer" class="scale-content">
+      <slot />
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'ScreenScale',
+  mounted() {
+    this.calculateRatio();
+    window.addEventListener('resize', this.calculateRatio);
+  },
+  beforeDestroy() {
+    window.removeEventListener('resize', this.calculateRatio);
+  },
+  methods: {
+    calculateRatio() {
+      const baseWidth = 1920;
+      const baseHeight = 1080;
+      const el = this.$refs.scaleContainer;
+      // 基于父容器宽高计算缩放比(而非整个窗口)
+      const parentWidth = el.parentElement.clientWidth;
+      const parentHeight = el.parentElement.clientHeight;
+      const widthRatio = parentWidth / baseWidth;
+      const heightRatio = parentHeight / baseHeight;
+      const scale = Math.min(widthRatio, heightRatio); // 取最小缩放比防止溢出
+
+      el.style.transform = `scale(${scale}) translate(-50%, -50%)`;
+      el.style.transformOrigin = 'top left';
+    }
+  }
+};
+</script>
+
+<style scoped>
+.container {
+  width: 100vw;
+  height: 100vh;
+  display: flex;
+  justify-content: center;
+  align-items: flex-start;
+  overflow: hidden;
+  background-color: #0f172a;
+}
+
+.scale-content {
+  position: relative;
+  width: 1920px;
+  height: 1080px;
+  transform-origin: top left;
+}
+</style>

+ 1344 - 0
src/views/live/liveConsole/index-old.vue

@@ -0,0 +1,1344 @@
+<template>
+  <div class="el-container">
+
+
+  <!-- 直播中控台 start -->
+  <el-row type="flex" justify="center" class="live-console" :gutter="10" v-loading="loading">>
+    <!-- 聊天 start -->
+    <el-col class="live-console-col" :span="6">
+      <el-tabs class="live-console-tab-left" v-model="tabRight.activeName" @tab-click="handleClick" :stretch="true">
+        <el-tab-pane label="讨论" name="talk">
+          <el-scrollbar style="height: 500px; width: 100%;" ref="manageRightRef">
+            <el-row v-for="m in msgList" >
+              <el-row v-if="m.userId !== userId" style="margin-top: 5px" type="flex" align="top" >
+                <el-col :span="3" style="margin-left: 10px"><el-avatar :src="m.avatar"/></el-col>
+                <el-col :span="15">
+                  <el-row style="margin-left: 10px">
+                    <el-col><div style="font-size: 12px; color: #999; margin-bottom: 3px;">{{ m.nickName }}</div></el-col>
+                    <el-col :span="24" style="max-width: 200px;">
+                      <div style="white-space: normal; word-wrap: break-word;background-color: #f0f2f5; padding: 8px; border-radius: 5px;font-size: 14px;width: 100%;">
+                        {{ m.msg }}
+                      </div>
+                    </el-col>
+                    <el-col>
+                      <a style="cursor: pointer;color: #ff0000;padding: 8px 8px 0 0;font-size: 12px;" @click="changeUserState(m)">{{ m.msgStatus === 1 ? '解禁' : '禁言' }}</a>
+                      <a style="cursor: pointer;color: #ff0000;padding: 8px 8px 0 0;font-size: 12px;" @click="blockUser(m)">拉黑</a>
+                    </el-col>
+                  </el-row>
+                </el-col>
+              </el-row>
+              <el-row v-if="m.userId === userId" style="padding: 8px 0" type="flex" align="top" justify="end">
+                <div style="display: flex;justify-content: flex-end">
+                  <div style="display: flex;justify-content: flex-end;flex-direction: column;max-width: 200px;align-items: flex-end">
+                    <div style="font-size: 12px; color: #999; margin-bottom: 3px;">{{ m.nickName }}</div>
+                    <div style="white-space: normal; word-wrap: break-word;width: 100%; background-color: #e6f7ff; padding: 8px; border-radius: 5px;font-size: 14px;">{{ m.msg }}</div>
+                  </div>
+                  <el-avatar :src="m.avatar" style="margin-left: 10px; margin-right: 10px;"/>
+                </div>
+              </el-row>
+            </el-row>
+            <!-- 底部留白 -->
+            <div style="height: 20px;"></div>
+          </el-scrollbar>
+
+          <!-- 消息输入区域 -->
+          <div style="padding: 10px; border-top: 1px solid #ebeef5; background-color: #fff; min-height: 120px;">
+            <el-input
+              type="textarea"
+              v-model="newMsg"
+              placeholder="请输入消息..."
+              :rows="8"
+              @keyup.enter.native="sendMessage"
+              clearable
+              resize="none"
+              style="flex: 1; margin-right: 10px;"
+            >
+            </el-input>
+            <div style="display: flex; justify-content: flex-end; margin-top: 10px;">
+              <el-button plain @click="sendMessage">发送</el-button>
+            </div>
+          </div>
+        </el-tab-pane>
+      </el-tabs>
+    </el-col>
+    <!-- 聊天 end -->
+
+
+    <!-- 直播/视频 start -->
+    <el-col class="live-console-col" :span="12">
+      <div style="background: #000; border-radius: 5px; overflow: hidden; margin: 10px 5px;">
+        <div style="border-radius: 5px; overflow: hidden;" v-if="!isAudit">
+          <img :src="require('@/assets/images/videoIsAudit.png')" style="width: 100%; height: 45vh;">
+        </div>
+        <div style="border-radius: 5px; overflow: hidden;" v-else-if="status != 2 && status != 4">
+          <img :src="require('@/assets/images/videoNotStart.png')" style="width: 100%; height: 45vh;">
+        </div>
+        <div style="border-radius: 5px; overflow: hidden;" v-else-if="liveType == 1">
+          <video
+            controls
+            ref="livingPlayer"
+            autoplay
+            @click.prevent
+            @contextmenu.prevent
+            class="custom-video"
+            width="100%"
+            style="display: block; background: #000; height: 45vh;"
+          ></video>
+
+          <!-- 时间显示(可选) -->
+          <div ref="liveElapsedTime" class="time-display">
+            已播放:<span id="liveElapsedTime">00:00:00</span>
+          </div>
+        </div>
+        <div style="border-radius: 5px; overflow: hidden;" v-else-if="liveType == 2">
+          <video
+            controls
+            ref="videoPlayer"
+            loop
+            autoplay
+            width="100%"
+            muted
+            playsinline
+            @click.prevent
+            @contextmenu.prevent
+            class="custom-video"
+            style="display: block; background: #000; height: 40vh;"
+          >
+            <source :src="videoUrl" type="application/x-mpegURL">
+          </video>
+          <!-- 自定义进度条容器 -->
+          <div ref="progressBar" class="progress-container">
+            <div id="progressBar" class="progress-bar"></div>
+          </div>
+
+          <!-- 时间显示(可选) -->
+          <div ref="elapsedTime" class="time-display">
+            已播放:<span id="elapsedTime">00:00:00</span>
+          </div>
+        </div>
+        <div style="border-radius: 5px; overflow: hidden;" v-else-if="liveType == 3">
+          <video
+            controls
+            ref="liveReplay"
+            loop
+            autoplay
+            width="100%"
+            playsinline
+            style="display: block; background: #000; height: 40vh;"
+          >
+            <source :src="videoUrl" type="application/x-mpegURL">
+          </video>
+        </div>
+        <div style="border-radius: 5px; overflow: hidden;" v-else>
+          <img :src="require('@/assets/images/videoNotStart.png')" style="width: 100%; height: 45vh;">
+        </div>
+      </div>
+      <!-- 底部导航栏 -->
+      <div style="display: flex; justify-content: space-around; padding: 15px 0; background: #fff; border-top: 1px solid #f0f0f0;">
+        <div style="display: flex; flex-direction: column; align-items: center; cursor: pointer;" @click="handleClickRed">
+          <i class="el-icon-money" style="font-size: 20px;"></i>
+          <span style="font-size: 12px; margin-top: 4px;">红包配置</span>
+        </div>
+        <div style="display: flex; flex-direction: column; align-items: center; cursor: pointer;" @click="handleClickLottery">
+          <i class="el-icon-present" style="font-size: 20px;"></i>
+          <span style="font-size: 12px; margin-top: 4px;">抽奖配置</span>
+        </div>
+        <div style="display: flex; flex-direction: column; align-items: center; cursor: pointer;" @click="handleClickGoods">
+          <i class="el-icon-goods" style="font-size: 20px;"></i>
+          <span style="font-size: 12px; margin-top: 4px;">商品</span>
+        </div>
+        <div style="display: flex; flex-direction: column; align-items: center; cursor: pointer;" @click="handleClickOrder">
+          <i class="el-icon-goods" style="font-size: 20px;"></i>
+          <span style="font-size: 12px; margin-top: 4px;">直播订单</span>
+        </div>
+        <div style="display: flex; flex-direction: column; align-items: center; cursor: pointer;" @click="handleClickCoupon">
+          <i class="el-icon-goods" style="font-size: 20px;"></i>
+          <span style="font-size: 12px; margin-top: 4px;">直播优惠券</span>
+        </div>
+      </div>
+      <el-radio-group v-model="tableRadio" >
+        <el-radio-button label="订单数">订单数</el-radio-button>
+      </el-radio-group>
+      <div  style="position: relative;width: 100%; height: 300px;">
+        <div ref="chartContainer" style="width: 100%; height: 100%;"></div>
+        <div style="position: absolute; top: 10px; right: 10px; background: #fff; padding: 5px; z-index: 1;">
+          <el-select v-model="searchQuery.timeOptions" placeholder="请选择" style="width: 150px"  @change="timeChange">
+            <el-option
+              v-for="item in timeOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+          <el-select v-model="searchQuery.timeGranularity" placeholder="请选择" style="width: 150px"  @change="timeGranularityChange">
+            <el-option
+              v-for="item in timeGranularity"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+<!--          <el-button type="primary" @click="applyFilter">搜索</el-button>-->
+        </div>
+      </div>
+    </el-col>
+    <!-- 直播/视频 end -->
+
+    <!-- 用户列表 start -->
+    <el-col class="live-console-col" :span="6">
+      <el-tabs class="live-console-tab-right" v-model="tabLeft.activeName" @tab-click="handleClick" :stretch="true">
+        <el-tab-pane :label="onlineLabel" name="online">
+          <el-scrollbar ref="manageLeftRef_online" style="height: 800px; width: 100%;">
+            <el-row style="margin-top: 10px" type="flex" align="middle" v-for="u in onlineDisplayList" :key="u.userId">
+              <el-col :span="20">
+                <el-row type="flex" align="middle">
+                  <el-col :span="4" style="padding-left: 10px;"><el-avatar :src="u.avatar"></el-avatar></el-col>
+                  <el-col :span="19" :offset="1">{{ u.nickName }}</el-col>
+                  <el-col :span="19" :offset="1">{{ u.userId }}</el-col>
+                </el-row>
+              </el-col>
+              <el-col :span="4" >
+                <el-popover
+                  width="100"
+                  trigger="click">
+                  <a style="cursor: pointer;color: #ff0000;" @click="changeUserState(u)">{{ u.msgStatus === 1 ? '解禁' : '禁言' }}</a>
+                  <a style="cursor: pointer;color: #ff0000;margin-left:10px" @click="blockUser(u)">拉黑</a>
+                  <i class="el-icon-more" slot="reference"></i>
+                </el-popover>
+              </el-col>
+            </el-row>
+          </el-scrollbar>
+        </el-tab-pane>
+        <el-tab-pane :label="offlineLabel" name="offline">
+          <el-scrollbar ref="manageLeftRef_offline" style="height: 800px; width: 100%;">
+            <el-row style="margin-top: 10px" type="flex" align="middle" v-for="u in offlineDisplayList" :key="u.userId">
+              <el-col :span="20">
+                <el-row type="flex" align="middle">
+                  <el-col :span="4" style="padding-left: 10px;"><el-avatar :src="u.avatar"></el-avatar></el-col>
+                  <el-col :span="19" :offset="1">{{ u.nickName }}</el-col>
+                  <el-col :span="19" :offset="1">{{ u.userId }}</el-col>
+                </el-row>
+              </el-col>
+              <el-col :span="4" >
+                <el-popover
+                  width="100"
+                  trigger="click">
+                  <a style="cursor: pointer;color: #ff0000;" @click="changeUserState(u)">{{ u.msgStatus === 1 ? '解禁' : '禁言' }}</a>
+                  <i class="el-icon-more" slot="reference"></i>
+                  <a style="cursor: pointer;color: #ff0000;margin-left:10px" @click="blockUser(u)">拉黑</a>
+                </el-popover>
+              </el-col>
+            </el-row>
+          </el-scrollbar>
+        </el-tab-pane>
+        <el-tab-pane :label="silencedUserLabel" name="silenced">
+          <el-scrollbar ref="manageLeftRef_silenced" style="height: 800px; width: 100%;">
+            <el-row style="margin-top: 10px" type="flex" align="middle" v-for="u in silencedDisplayList" :key="u.userId">
+              <el-col :span="20">
+                <el-row type="flex" align="middle">
+                  <el-col :span="4" style="padding-left: 10px;"><el-avatar :src="u.avatar"></el-avatar></el-col>
+                  <el-col :span="19" :offset="1">{{ u.nickName }}</el-col>
+                  <el-col :span="19" :offset="1">{{ u.userId }}</el-col>
+                </el-row>
+              </el-col>
+              <el-col :span="4" >
+                <el-popover
+                  width="100"
+                  trigger="click">
+                  <a style="cursor: pointer;color: #ff0000;" @click="changeUserState(u)">{{ u.msgStatus === 1 ? '解禁' : '禁言' }}</a>
+                  <a style="cursor: pointer;color: #ff0000;margin-left:10px" @click="blockUser(u)">拉黑</a>
+                  <i class="el-icon-more" slot="reference"></i>
+                </el-popover>
+              </el-col>
+            </el-row>
+          </el-scrollbar>
+        </el-tab-pane>
+      </el-tabs>
+    </el-col>
+    <!-- 用户列表 end -->
+  </el-row>
+  </div>
+  <!-- 直播中控台  end -->
+</template>
+
+
+<script>
+import {blockUser, changeUserStatus, getLiveUserTotals, watchUserList} from '@/api/live/liveWatchUser'
+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 Hls from 'hls.js';
+import {onBeforeUnmount} from 'vue';
+import LiveLotteryConf from '@/views/live/liveConfig/liveLotteryConf.vue'
+import LiveRedConf from '@/views/live/liveConfig/liveRedConf.vue'
+import LiveGoods from '@/views/live/liveConfig/goods.vue'
+import LiveOrder from '@/views/live/liveOrder/index.vue'
+import LiveCoupon from '@/views/live/liveConfig/liveCoupon.vue'
+import echarts from 'echarts'
+
+
+export default {
+  name: "LiveConsole",
+  components: { LiveLotteryConf,LiveRedConf,LiveGoods },
+  data() {
+    return {
+      loading: true,
+      tabLeft: {
+        activeName: "online",
+      },
+      tabRight: {
+        activeName: "talk",
+      },
+      livingUrl: "",
+      videoUrl: "",
+      status: 0,
+      loadMsgMaxPage: 2,
+      his: null,
+      liveVideo: {},
+      socket: null,
+      liveWsUrl: process.env.VUE_APP_LIVE_WS_URL + '/app/webSocket',
+      userParams:{
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null
+      },
+      msgParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null
+      },
+      userList: [],
+      msgList: [],
+      newMsg: '',
+      isAudit: false,
+      myChart: null, // 用于存储 ECharts 实例
+      liveType: 1,
+      tableRadio: '订单数',
+      // ... 其他数据 ...
+      searchQuery: {timeOptions:'2',timeGranularity:'10',liveId: null}, // 搜索查询条件
+      timeOptions: [
+        {value:'2',label:'最近2小时',key:'2'},
+        {value:'4',label:'最近4小时',key:'4'},
+        {value:'all',label:'全场',key:'all'},
+      ],
+      timeGranularity: [
+        {value:'10',label:'10分钟',key:'10'},
+        {value:'30',label:'30分钟',key:'30'},
+        {value:'60',label:'1小时',key:'60'},
+      ],
+      videoDuration: 0,
+      startTime: null,
+      processInterval: null,
+      // ... 其他数据
+      chatScrollTop: 0, // 保存聊天滚动位置,
+      liveId: null,
+      userTotal: {
+        online: 0,       // 在线总人数
+        offline: 0,      // 离线总人数
+        silenced: 0      // 禁言总人数
+      },
+      // 各Tab的显示列表(仅存储当前需要展示的数据)
+      onlineDisplayList: [],    // 在线用户显示列表
+      offlineDisplayList: [],   // 离线用户显示列表
+      silencedDisplayList: [],  // 禁言用户显示列表
+      // 各Tab的分页参数
+      pageParams: {
+        online: {
+          currentPage: 1,       // 当前页(下一页加载用)
+          pageSize: 20,       // 当前页(下一页加载用)
+          prevPage: 0,          // 上一页页码(上一页加载用)
+          totalLoaded: 0,       // 已加载总条数
+          total: 0,             // 总数据量
+          hasMore: true,        // 是否有下一页
+          hasPrev: false        // 是否有上一页
+        },
+        offline: {
+          currentPage: 1,
+          pageSize: 20,
+          prevPage: 0,
+          totalLoaded: 0,
+          total: 0,
+          hasMore: true,
+          hasPrev: false
+        },
+        silenced: {
+          currentPage: 1,
+          pageSize: 20,
+          prevPage: 0,
+          totalLoaded: 0,
+          total: 0,
+          hasMore: true,
+          hasPrev: false
+        }
+      },
+      scrLoading: {
+        online: { next: false, prev: false },
+        offline: { next: false, prev: false },
+        silenced: { next: false, prev: false }
+      }
+    }
+  },
+  created() {
+    if (this.$route.params.liveId) {
+      this.liveId = this.$route.params.liveId;
+    }else {
+      this.liveId = this.$route.query.liveId;
+    }
+    // this.getLiveVideo()
+    this.getList()
+    this.connectWebSocket()
+    this.getLive()
+    this.searchQuery.liveId = this.liveId
+  },
+  computed: {
+    userId() {
+      return this.$store.state.user.user.userId
+    },
+    companyId() {
+      return this.$store.state.user.user.companyId
+    },
+    onlineLabel() {
+      return `在线(${this.userTotal.online})`;
+    },
+    offlineLabel() {
+      return `离线(${this.userTotal.offline})`;
+    },
+    silencedUserLabel() {
+      return `禁言(${this.userTotal.silenced})`;
+    }
+  },
+  mounted() {
+    this.$nextTick(() => {
+      this.restoreChatScrollPosition();
+    });
+    this.getEchartsTables();
+    // 添加滚动事件监听器
+    this.$nextTick(() => {
+      if (this.$refs.manageRightRef && this.$refs.manageRightRef.wrap) {
+        this.$refs.manageRightRef.wrap.addEventListener('scroll', this.saveChatScrollPosition);
+      }
+    });
+    this.initScrollListeners();
+  },
+  beforeDestroy() {
+    this.saveTabScrollPositions()
+    // 移除滚动监听(避免内存泄漏)
+    const scrollRefs = {
+      online: this.$refs.manageLeftRef_online,
+      offline: this.$refs.manageLeftRef_offline,
+      silenced: this.$refs.manageLeftRef_silenced
+    };
+    Object.keys(scrollRefs).forEach(tabName => {
+      const scrollEl = scrollRefs[tabName]?.wrap;
+      if (scrollEl) {
+        scrollEl.removeEventListener('scroll', () =>
+          this.handleTabScroll(tabName, scrollEl)
+        );
+      }
+    })
+  },
+  // 使用 deactivated 和 activated 钩子替代 beforeDestroy 和 destroyed
+  deactivated() {
+    this.saveChatScrollPosition();
+  },
+  activated() {
+    this.$nextTick(() => {
+      this.restoreChatScrollPosition();
+    });
+    this.$nextTick(() => {
+      const video = this.$refs.videoPlayer;
+      if (video != null) {
+        this.initVideoPlayer(this.liveInfo.startTime)
+      }
+    })
+  },
+  methods: {
+    handleClickCoupon(){
+      this.$router.push({
+        name: 'LiveCoupon',
+        query: {
+          liveId: this.liveId
+        }
+      })
+    },
+    // 保存聊天滚动位置
+    saveChatScrollPosition() {
+      if (this.$refs.manageRightRef && this.$refs.manageRightRef.wrap) {
+        this.chatScrollTop = this.$refs.manageRightRef.wrap.scrollHeight - this.$refs.manageRightRef.wrap.clientHeight;
+      }
+    },
+
+    // 恢复聊天滚动位置
+    restoreChatScrollPosition() {
+      if (this.$refs.manageRightRef && this.$refs.manageRightRef.wrap) {
+        this.$refs.manageRightRef.wrap.scrollTop = this.chatScrollTop;
+      }
+    },
+    getLive(){
+      getLive(this.liveId).then(res => {
+        if (res.code == 200) {
+          if (res.data.isAudit != 1) {
+            this.$message.error("当前直播间未经审核");
+            this.loading = false
+            return
+          }
+          this.isAudit = true
+          this.status = res.data.status
+
+          if(res.data.status == 4){
+            this.liveType = 3
+            this.videoUrl = res.data.videoUrl;
+          }else {
+            if (res.data.status != 2) {
+              this.$message.error("当前直播间未直播");
+              this.loading = false
+              return
+            }
+            if (res.data.liveType == 1) {
+              this.livingUrl = res.data.flvHlsUrl
+              this.livingUrl = this.livingUrl.replace("flv","m3u8")
+              this.$nextTick(() => {
+                this.initPlayer()
+              })
+              this.startTime = new Date(res.data.startTime).getTime()
+              this.processInterval = setInterval(this.updateLiveProgress, 1000);
+            } else {
+              this.liveType = 2
+              this.videoUrl = res.data.videoUrl;
+              this.$nextTick(() => {
+                this.initVideoPlayer(res.data.startTime)
+              })
+            }
+          }
+          this.loading = false
+        } else {
+          this.$message.error(res.msg)
+          this.loading = false
+        }
+        this.liveInfo = res.data
+      })
+    },
+    initVideoPlayer: function (startTime) {
+      const video = this.$refs.videoPlayer;
+
+      this.hls = new Hls();
+      this.hls.attachMedia(video);
+      this.hls.on(Hls.Events.MEDIA_ATTACHED, () => {
+        this.hls.loadSource(this.videoUrl);
+        this.hls.on(Hls.Events.STREAM_LOADED, (event, data) => {
+          video.play();
+        });
+      });
+      this.hls.on(Hls.Events.ERROR, (event, data) => {
+        console.error('HLS 错误:', data);
+      });
+      // 1. 初始化开播时间
+      startTime = new Date(startTime).getTime();
+      this.startTime = startTime;
+      // 2. 监听视频元数据加载完成(获取视频时长)
+      video.addEventListener('loadedmetadata', () => {
+        this.videoDuration = video.duration; // 获取视频时长(秒)
+
+        // 初始化视频播放位置
+        this.updateVideoPosition(video);
+
+        // 启动实时进度更新(每秒刷新一次)
+        this.processInterval = setInterval(this.updateProgress, 1000);
+      });
+
+    },
+    updateVideoPosition(video){
+      const currentTime = new Date().getTime(); // 当前时间戳(毫秒)
+      const elapsedTime = currentTime - this.startTime; // 已流逝时间(毫秒)
+
+      if (elapsedTime < 0) {
+        // 未开播:视频停在初始位置
+        video.currentTime = 0;
+        return;
+      }
+
+      // 已开播:计算视频循环后的位置(流逝时间 % 视频时长)
+      const elapsedSeconds = elapsedTime / 1000; // 转换为秒
+      const videoPosition = elapsedSeconds % this.videoDuration; // 视频内的播放位置(秒)
+
+      // 设置视频播放位置
+      video.currentTime = videoPosition;
+    },
+    updateProgress() {
+      const progressBar = this.$refs.progressBar;
+      const elapsedTimeEl = this.$refs.elapsedTime;
+      if (!this.videoDuration) return; // 视频时长未加载时不更新
+
+      const currentTime = new Date().getTime();
+      const elapsedTime = currentTime - this.startTime; // 总流逝时间(毫秒)
+
+      if (elapsedTime < 0) {
+        // 未开播状态
+        progressBar.style.width = '0%';
+        elapsedTimeEl.textContent = '00:00:00';
+        return;
+      }
+
+      // 计算进度百分比(基于视频循环)
+      const elapsedSeconds = elapsedTime / 1000;
+      const videoPosition = elapsedSeconds % this.videoDuration; // 当前在视频中的位置
+      const progressPercent = (videoPosition / this.videoDuration) * 100; // 进度百分比
+
+      // 更新进度条宽度
+      progressBar.style.width = `${progressPercent}%`;
+
+      // 格式化总流逝时间为“时:分:秒”并显示
+      elapsedTimeEl.textContent = this.formatTime(elapsedTime);
+    },
+    updateLiveProgress() {
+      const elapsedTimeEl = this.$refs.liveElapsedTime;
+
+      const currentTime = new Date().getTime();
+      const elapsedTime = currentTime - this.startTime; // 总流逝时间(毫秒)
+
+      if (elapsedTime < 0) {
+        elapsedTimeEl.textContent = '00:00:00';
+        return;
+      }
+
+
+      // 格式化总流逝时间为“时:分:秒”并显示
+      elapsedTimeEl.textContent = this.formatTime(elapsedTime);
+    },
+    formatTime(ms) {
+      const totalSeconds = Math.floor(ms / 1000);
+      const hours = Math.floor(totalSeconds / 3600);
+      const minutes = Math.floor((totalSeconds % 3600) / 60);
+      const seconds = totalSeconds % 60;
+
+      // 补零处理(确保两位数)
+      return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
+    },
+    // ... 其他方法 ...
+    timeChange(val) {
+      this.searchQuery.timeOptions = val
+      this.getEchartsTables(this.searchQuery)
+      this.initChart()
+    },
+    timeGranularityChange(val) {
+      this.searchQuery.timeGranularity =  val
+      this.getEchartsTables()
+      this.initChart()
+    },
+    getEchartsTables() {
+      getLiveOrderTimeGranularity(this.searchQuery).then(res => {
+        if (res.code == 200) {
+          this.echartsXLine = res.hourlySlots
+          this.echartsXValue = res.hourlySlotsValue
+          this.initChart()
+        }
+      })
+    },
+    initChart() {
+      const chartDom = this.$refs.chartContainer;
+      this.myChart = echarts.init(chartDom);
+      const option = {
+        tooltip: {trigger: 'axis'},
+        legend: {data: ['订单数']},
+        xAxis: {type: 'category', boundaryGap: false, data: this.echartsXLine},
+        yAxis: {type: 'value'},
+        series: [
+          {name: '订单数', type: 'line', data: this.echartsXValue}
+        ],
+      };
+      this.myChart.setOption(option);
+    },
+
+    handleClickRed(){
+      this.$router.push({
+        name: 'LiveRedConf',
+        query: {
+          liveId: this.liveId
+        }
+      })
+    },
+    handleClickLottery(){
+      this.$router.push({
+        name: 'LiveLotteryConf',
+        query: {
+          liveId: this.liveId
+        }
+      })
+    },
+    handleClickGoods(){
+      this.$router.push({
+        name: 'LiveGoods',
+        query: {
+          liveId: this.liveId
+        }
+      })
+    },
+    handleClickOrder(){
+      this.$router.push({
+        name: 'LiveOrder',
+        query: {
+          liveId: this.liveId
+        }
+      })
+    },
+    initPlayer(){
+      var isUrl = this.livingUrl === null || this.livingUrl.trim() === ''
+      if (isUrl) {
+        console.error('直播地址为空,无法初始化播放器')
+        return
+      }
+      if (Hls.isSupported() && !isUrl) {
+        const videoElement = this.$refs.livingPlayer
+        if (!videoElement) {
+          console.error('找不到 video 元素')
+          return
+        }
+        this.hls = new Hls();
+        this.hls.attachMedia(videoElement);
+        this.hls.on(Hls.Events.MEDIA_ATTACHED, () => {
+          this.hls.loadSource(this.livingUrl);
+          this.hls.on(Hls.Events.STREAM_LOADED, (event, data) => {
+            videoElement.play();
+          });
+        });
+        this.hls.on(Hls.Events.ERROR, (event, data) => {
+          console.error('HLS 错误:', data);
+        });
+      } else {
+        console.error('浏览器不支持 HLS')
+      }
+    },
+    handleClick(tab) {
+      const tabName = tab.name;
+      const params = this.pageParams[tabName];
+      const displayList = this[`${tabName}DisplayList`];
+      // 首次切换到该Tab或列表为空时初始化
+      if (displayList.length < 20) {
+        // 重置分页参数
+        params.currentPage = 1;
+        params.pageSize = 20;
+        params.prevPage = 0;
+        params.totalLoaded = 0;
+        params.hasMore = true;
+        params.hasPrev = false;
+        // 加载第一页
+        this.loadNextPage(tabName);
+      } else {
+        // 非首次切换,恢复滚动位置
+        this.$nextTick(() => {
+          const scrollEl = this.getScrollElement(tabName);
+          if (scrollEl) {
+            scrollEl.scrollTop = this.tabScrollPositions[tabName] || 0;
+          }
+        });
+      }
+    },
+    saveTabScrollPositions() {
+      this.tabScrollPositions = {
+        online: this.getScrollElement('online')?.scrollTop || 0,
+        offline: this.getScrollElement('offline')?.scrollTop || 0,
+        silenced: this.getScrollElement('silenced')?.scrollTop || 0
+      };
+    },
+    // 加载指定Tab的用户列表(核心加载逻辑)
+    loadNextPage(tabName) {
+      const params = this.pageParams[tabName];
+      const displayList = this[`${tabName}DisplayList`];
+      console.log(`加载 ${tabName} 用户列表`)
+      console.log(!params.hasMore || this.scrLoading[tabName].next)
+      console.log(params.currentPage)
+      // 若没有更多数据或正在加载,直接返回
+      if (!params.hasMore || this.scrLoading[tabName].next) {
+        return;
+      }
+
+      this.scrLoading[tabName].next = true;
+      const queryParams = {
+        liveId: this.liveId,
+        pageNum: params.currentPage,
+        pageSize: 20,
+        online: tabName === 'online' ? 0 : 1,
+        msgStatus: tabName === 'silenced' ? 1 : 0
+      };
+      // 调用接口加载对应状态的分页数据(需后端支持按状态筛选)
+      watchUserList(queryParams).then(response => {
+        this.scrLoading[tabName].next = false;
+        if (response.code !== 200) return;
+
+        const { rows, total } = response;
+        params.total = total; // 记录总数据量
+        // 过滤重复数据(基于userId)
+        const newRows = rows.filter(row =>
+          !displayList.some(u => u.userId === row.userId)
+        );
+        displayList.push(...newRows)
+        // 添加新数据并限制最大长度(避免内存占用过大)
+        if (displayList.length >= 40) { // 最大保留100条
+          this[`${tabName}DisplayList`] = displayList.slice(-40);
+          // 记录滚动位置(用于加载后校准)
+          const scrollEl = this.getScrollElement(tabName);
+          // 校准滚动位置(保持视觉连续性)
+          this.$nextTick(() => {
+            if (scrollEl) {
+              scrollEl.scrollTop = scrollEl.scrollHeight * 0.5;
+            }
+          });
+        }
+        // 更新分页状态
+        params.hasMore = params.currentPage * params.pageSize < total;
+        params.currentPage += 1;
+        params.hasPrev = params.currentPage > 2; // 当前页>2时一定有上一页
+        params.prevPage = params.currentPage - 2;
+      }).catch(() => {
+        this.scrLoading[tabName].next = false;
+      });
+    },
+    // 新增:加载上一页(向上滚动时)
+    loadPrevPage(tabName) {
+      const params = this.pageParams[tabName];
+      const displayList = this[`${tabName}DisplayList`];
+      // 边界校验:无上一页/正在加载/当前页<=1
+      console.log(`加载 ${tabName} 上一页`);
+      console.log(!params.hasPrev || this.scrLoading[tabName].prev || params.currentPage <= 1)
+      if (!params.hasPrev || this.scrLoading[tabName].prev || params.currentPage <= 1) {
+        return;
+      }
+      this.scrLoading[tabName].prev = true;
+      const targetPage = params.prevPage > 0 ? params.prevPage : params.currentPage - 2;
+      const queryParams = {
+        liveId: this.liveId,
+        pageNum: targetPage,
+        pageSize: 20,
+        online: tabName === 'online' ? 0 : 1,
+        msgStatus: tabName === 'silenced' ? 1 : 0
+      };
+      watchUserList(queryParams).then(response => {
+        this.scrLoading[tabName].prev = false;
+        if (response.code !== 200) return;
+
+        const { rows } = response;
+        if (rows.length === 0) {
+          params.hasPrev = false;
+          return;
+        }
+
+        // 记录滚动位置(用于加载后校准)
+        const scrollEl = this.getScrollElement(tabName);
+        const scrollTop = scrollEl?.scrollTop || 0;
+        const itemHeight = 80; // 预估行高(根据实际样式调整)
+        const newItemsHeight = rows.length * itemHeight;
+
+        // 过滤重复数据并添加到列表头部
+        const newRows = rows.filter(row => !displayList.some(u => u.userId === row.userId));
+        this[`${tabName}DisplayList`] = [...newRows, ...displayList];
+        params.totalLoaded += newRows.length;
+
+        // 限制最大长度
+        if (this[`${tabName}DisplayList`].length > 40) {
+          this[`${tabName}DisplayList`] = this[`${tabName}DisplayList`].slice(0, 40);
+        }
+
+        // 更新分页状态
+        params.prevPage = targetPage - 1;
+        params.hasPrev = targetPage > 1; // 上一页页码>1时还有更多上一页
+        params.currentPage = params.currentPage - 1;
+        if(params.currentPage * 20 < params.total) params.hasMore = true;
+        // 校准滚动位置(保持视觉连续性)
+        this.$nextTick(() => {
+          if (scrollEl) {
+            scrollEl.scrollTop = scrollEl.scrollHeight * 0.5;
+          }
+        });
+      }).catch(() => {
+        this.scrLoading[tabName].prev = false;
+      });
+    },
+    // 辅助:获取Tab对应的滚动容器
+    getScrollElement(tabName) {
+      const scrollRefs = {
+        online: this.$refs.manageLeftRef_online,
+        offline: this.$refs.manageLeftRef_offline,
+        silenced: this.$refs.manageLeftRef_silenced
+      };
+      return scrollRefs[tabName]?.wrap;
+    },
+
+    getList() {
+      this.resetParams()
+      // this.loadUserList()
+      this.loadUserTotals(); // 先加载总人数
+      // this.handleClick('online')
+      this.handleClick({name:'online'})
+      this.loadMsgList()
+    },
+    loadUserTotals() {
+      if (!this.liveId) return;
+      // 假设后端提供一个接口返回总人数(如果没有,可通过首次加载全量数据后统计)
+      getLiveUserTotals({ liveId: this.liveId }).then(res => {
+        if (res.code === 200) {
+          this.userTotal = res.data; // { online, offline, silenced }
+        }
+      });
+    },
+    resetParams() {
+      // 重置各Tab的显示列表和分页参数
+      this.onlineDisplayList = [];
+      this.offlineDisplayList = [];
+      this.silencedDisplayList = [];
+      this.pageParams = {
+        online: {
+          currentPage: 1,       // 当前页(下一页加载用)
+          pageSize: 20,       // 当前页(下一页加载用)
+          prevPage: 0,          // 上一页页码(上一页加载用)
+          totalLoaded: 0,       // 已加载总条数
+          total: 0,             // 总数据量
+          hasMore: true,        // 是否有下一页
+          hasPrev: false        // 是否有上一页
+        },
+        offline: {
+          currentPage: 1,
+          pageSize: 20,
+          prevPage: 0,
+          totalLoaded: 0,
+          total: 0,
+          hasMore: true,
+          hasPrev: false
+        },
+        silenced: {
+          currentPage: 1,
+          pageSize: 20,
+          prevPage: 0,
+          totalLoaded: 0,
+          total: 0,
+          hasMore: true,
+          hasPrev: false
+        }
+      };
+      // 消息参数保留
+      this.msgList = [];
+      this.msgParams = {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: this.liveId
+      };
+    },
+    loadUserList() {
+      if(this.liveId == null)  return
+      // 直播间用户
+      watchUserList({
+        liveId: this.liveId,
+        pageNum: this.userParams.pageNum,
+        pageSize: this.userParams.pageSize
+      }).then(response => {
+        let {code,rows,total} = response
+        if (code === 200) {
+          let totalPage = (total % this.userParams.pageSize == 0) ? Math.floor(total / this.userParams.pageSize) : Math.floor(total / this.userParams.pageSize + 1);
+          rows.forEach(row => {
+            if (!this.userList.some(u => u.userId === row.userId)) {
+              this.userList.push(row)
+            }
+          })
+
+          // 没加载完继续加载
+          if (this.userParams.pageNum < totalPage) {
+            this.userParams.pageNum = parseInt(this.userParams.pageNum) + 1;
+            this.loadUserList()
+          }
+        }
+      })
+    },
+    loadMsgList() {
+      // 直播间消息
+      listLiveMsg({
+        liveId:this.liveId,
+        pageNum: this.msgParams.pageNum,
+        pageSize: this.msgParams.pageSize
+      }).then(response => {
+          let {code, rows,total} = response;
+          if (code === 200) {
+            let totalPage = (total % this.msgParams.pageSize == 0) ? Math.floor(total / this.msgParams.pageSize) : Math.floor(total / this.msgParams.pageSize + 1);
+            rows.forEach(row => {
+              if (!this.msgList.some(m => m.msgId === row.msgId)) {
+
+                let user = this.userList.find(u => u.userId === row.userId)
+                if (user) {
+                  row.msgStatus = user.msgStatus
+                } else {
+                  row.msgStatus = 0
+                }
+
+                this.msgList.push(row)
+
+                // 移动到底部
+                this.$nextTick(() => {
+                  setTimeout(() => {
+                    this.$refs.manageRightRef.wrap.scrollTop = this.$refs.manageRightRef.wrap.scrollHeight - this.$refs.manageRightRef.wrap.clientHeight
+                  }, 200)
+                })
+              }
+            })
+
+            // 没加载完继续加载
+            if (this.msgParams.pageNum < this.loadMsgMaxPage) {
+              this.msgParams.pageNum = parseInt(this.msgParams.pageNum) + 1;
+              this.loadMsgList()
+            }
+
+            // 同步更新消息列表中相同用户的状态
+            this.userList.forEach(u => {
+              this.msgList.filter(m => m.userId === u.userId).forEach(m => m.msgStatus = u.msgStatus)
+            })
+          }
+        })
+
+      // 添加滚动监听
+      this.$nextTick(() => {
+        this.$refs.manageRightRef.wrap.addEventListener("scroll", this.manageRightScroll)
+      })
+    },
+    manageRightScroll() {
+      this.saveChatScrollPosition();
+    },
+    blockUser(u){
+      this.$confirm('是否确认封禁用户账号为:"' + u.nickName + '-' + u.userId + '"?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return blockUser(u.userId);
+      }).then(() => {
+        let msg = {
+          msg: "",
+          liveId: this.liveId,
+          userId: u.userId,
+          userType: 0,
+          cmd: 'blockUser',
+          avatar: this.$store.state.user.user.avatar,
+          nickName: this.$store.state.user.user.nickName
+        }
+        this.socket.send(JSON.stringify(msg))
+        this.msgSuccess("封禁成功");
+      }).catch(() => {});
+    },
+    changeUserState(u) {
+      // 修改状态
+      changeUserStatus({liveId: u.liveId, userId: u.userId}).then(response => {
+        let { code } = response;
+        if (200 === code) {
+          u.msgStatus = u.msgStatus === 0 ? 1 : 0
+          // 同步更新消息列表中相同用户的状态
+          this.msgList.forEach(msg => {
+            if (msg.userId === u.userId) {
+              msg.msgStatus = u.msgStatus;
+            }
+          });
+
+          this.userList.forEach(user => {
+            if (user.userId === u.userId) {
+              user.msgStatus = u.msgStatus;
+            }
+          });
+          // 4. 关键:重新筛选所有Tab的显示列表,确保状态同步
+          this.refreshUserDisplayLists(u);
+
+          let msg = u.msgStatus === 0 ? "已解禁" : "已禁言"
+          this.msgSuccess(msg);
+          return
+        }
+        this.msgError("操作失败");
+      })
+    },
+
+    // 新增:重新筛选所有Tab的显示列表
+    refreshUserDisplayLists(user) {
+      const { userId, msgStatus: newStatus, online } = user;
+      const oldStatus = newStatus === 1 ? 0 : 1; // 操作前的状态(反向)
+
+      // 1. 禁言操作(newStatus=1):从原在线/离线列表移除,加入禁言列表
+      if (newStatus === 1) {
+        // 从在线/离线列表中移除该用户(根据当前在线状态)
+        if (online === 0) {
+          this.onlineDisplayList = this.onlineDisplayList.filter(u => u.userId !== userId);
+          this.userTotal.online = Math.max(0, this.userTotal.online - 1);
+        } else {
+          this.offlineDisplayList = this.offlineDisplayList.filter(u => u.userId !== userId);
+          this.userTotal.offline = Math.max(0, this.userTotal.offline - 1);
+        }
+        this.userTotal.silenced = this.userTotal.silenced + 1;
+        // 添加到禁言列表(去重+限制长度)
+        const silencedList = this.silencedDisplayList.filter(u => u.userId !== userId);
+        silencedList.push(user);
+        this.silencedDisplayList = silencedList.slice(-40);
+      }
+
+      // 2. 解禁操作(newStatus=0):从禁言列表移除,回到原在线/离线列表
+      else {
+        // 从禁言列表移除
+        this.silencedDisplayList = this.silencedDisplayList.filter(u => u.userId !== userId);
+        this.userTotal.silenced = Math.max(0, this.userTotal.silenced - 1);
+        // 回到对应的在线/离线列表(根据当前在线状态)
+        if (online === 0) {
+          // 加入在线列表(去重+限制长度)
+          const onlineList = this.onlineDisplayList.filter(u => u.userId !== userId);
+          onlineList.push(user);
+          this.onlineDisplayList = onlineList.slice(-40);
+          this.userTotal.online = this.userTotal.online + 1;
+        } else {
+          // 加入离线列表(去重+限制长度)
+          const offlineList = this.offlineDisplayList.filter(u => u.userId !== userId);
+          offlineList.push(user);
+          this.offlineDisplayList = offlineList.slice(-40);
+          this.userTotal.offline = this.userTotal.offline + 1;
+        }
+      }
+    },
+    connectWebSocket() {
+      this.$store.dispatch('initLiveWs', {
+        liveWsUrl: this.liveWsUrl,
+        liveId: this.liveId,
+        userId: this.userId
+      })
+      this.socket = this.$store.state.liveWs[this.liveId]
+      this.socket.onmessage = (event) => this.handleWsMessage(event)
+    },
+    handleWsMessage(event) {
+      let { code, data } = JSON.parse(event.data)
+      if (code === 200) {
+        let { cmd } = data
+        if (cmd === 'sendMsg') {
+          let message = JSON.parse(data.data)
+
+          let user = this.userList.find(u => u.userId === message.userId)
+          if (user) {
+            message.msgStatus = user.msgStatus
+          } else {
+            message.msgStatus = 0
+          }
+          delete message.params
+          if(this.msgList.length > 50){
+            this.msgList.shift()
+          }
+          this.msgList.push(message)
+          // 移动到底部
+          this.$nextTick(() => {
+            setTimeout(() => {
+              this.$refs.manageRightRef.wrap.scrollTop = this.$refs.manageRightRef.wrap.scrollHeight - this.$refs.manageRightRef.wrap.clientHeight
+            }, 200)
+          })
+        } else if (cmd === 'entry' || cmd === 'out') {
+          const user = data;
+          const online = cmd === 'entry' ? 0 : 1; // 0=在线,1=离线
+          const info = {
+            online:online,
+            msgStatus: user.msgStatus || 0,
+            nickName: user.nickName || '',
+            userType: user.userType || 0,
+            userId: user.userId || '',
+          };
+
+          // 1. 更新总人数(在线/离线互转)
+          if (cmd === 'entry') {
+            this.userTotal.online += 1;
+            this.userTotal.offline = Math.max(0, this.userTotal.offline - 1); // 确保不小于0
+          } else {
+            this.userTotal.offline += 1;
+            this.userTotal.online = Math.max(0, this.userTotal.online - 1); // 确保不小于0
+          }
+          // 2. 强制更新相关列表(无论当前激活哪个Tab)
+          if (cmd === 'entry') {
+            // 用户进入:从离线列表删除,添加到在线列表
+            this.offlineDisplayList = this.offlineDisplayList.filter(u => u.userId !== user.userId);
+            const newOnlineList = this.onlineDisplayList.filter(u => u.userId !== user.userId);
+            newOnlineList.push(info);
+            this.onlineDisplayList = newOnlineList.slice(-40); // 限制最大50条
+          } else {
+            // 用户离开:从在线列表删除,添加到离线列表
+            this.onlineDisplayList = this.onlineDisplayList.filter(u => u.userId !== user.userId);
+            const newOfflineList = this.offlineDisplayList.filter(u => u.userId !== user.userId);
+            newOfflineList.push(info);
+            this.offlineDisplayList = newOfflineList.slice(-40); // 限制最大50条
+          }
+          // 3. 处理禁言列表(如果用户是禁言状态,无论进出都要同步)
+          if (info.msgStatus === 1) {
+            // 禁言用户:从禁言列表删除旧数据,添加新数据
+            const newSilencedList = this.silencedDisplayList.filter(u => u.userId !== user.userId);
+            newSilencedList.push(info);
+            this.silencedDisplayList = newSilencedList.slice(-40);
+          } else {
+            // 非禁言用户:从禁言列表删除(如果存在)
+            this.silencedDisplayList = this.silencedDisplayList.filter(u => u.userId !== user.userId);
+          }
+
+        } else if (cmd === 'live_start') {
+
+        } else if (cmd === 'live_end') {
+
+        }
+      }
+    },
+    sendMessage() {
+      // 发送前简单校验
+      if (this.newMsg.trim() === '') {
+        return;
+      }
+
+      let msg = {
+        msg: this.newMsg,
+        liveId: this.liveId,
+        userId: this.userId,
+        userType: 1,
+        cmd: 'sendMsg',
+        avatar: this.$store.state.user.user.avatar,
+        nickName: this.$store.state.user.user.nickName
+      }
+
+      this.socket.send(JSON.stringify(msg))
+
+      this.newMsg = '';
+    },
+    // 初始化滚动监听(在mounted中调用)
+    initScrollListeners() {
+      // 为每个Tab的滚动容器添加监听
+      this.$nextTick(() => {
+        const scrollRefs = {
+          online: this.$refs.manageLeftRef_online,
+          offline: this.$refs.manageLeftRef_offline,
+          silenced: this.$refs.manageLeftRef_silenced
+        };
+
+        Object.keys(scrollRefs).forEach(tabName => {
+          const scrollEl = scrollRefs[tabName]?.wrap;
+          if (scrollEl) {
+            scrollEl.addEventListener('scroll', () =>
+              this.handleTabScroll(tabName, scrollEl)
+            );
+          }
+        });
+      });
+    },
+
+    // 处理Tab滚动事件(判断是否触底)
+    handleTabScroll(tabName, scrollEl) {
+      const { scrollTop, scrollHeight, clientHeight } = scrollEl;
+      const bottomThreshold = 50; // 距离底部100px触发下一页
+      const topThreshold = 50;    // 距离顶部100px触发上一页
+
+      // 加载下一页(滚动到底部附近)
+      if (scrollHeight - scrollTop - clientHeight < bottomThreshold) {
+        this.loadNextPage(tabName);
+      }
+
+      // 加载上一页(滚动到顶部附近)
+      if (scrollTop < topThreshold) {
+        this.loadPrevPage(tabName);
+      }
+    },
+  },
+  destroyed() {
+    this.hls?.destroy();
+    clearInterval(this.processInterval)
+  }
+}
+</script>
+
+<style scoped>
+.talk-list{
+  display: flex;
+}
+  .live-console {
+    width: 100vw;
+
+    background-color: #f5f4f4;
+  }
+  .live-console .live-console-col {
+    height: 100vh;
+    margin-left: 5px;
+
+    background-color: white;
+    border-radius: 4px;
+  }
+  /*隐藏水平滚动条*/
+  ::v-deep .el-scrollbar__wrap {
+    overflow-x: hidden;
+  }
+  /* 消息输入区域 */
+  .chat-input {
+    display: flex;
+    padding: 10px;
+    border-top: 1px solid #ebeef5;
+    background-color: #fff;
+    min-height: 120px;
+  }
+
+  .chat-input .el-input {
+    flex: 1;
+    margin-right: 10px;
+  }
+
+  .chat-input .el-textarea__inner {
+    resize: none;
+    min-height: 100px;
+  }
+  ::v-deep .el-textarea__inner {
+    border: none !important;
+    box-shadow: none !important;
+    resize: none !important;
+  }
+  ::v-deep .el-textarea__inner:focus {
+    border: none !important;
+    box-shadow: none !important;
+  }
+::v-deep .el-tabs__item {
+  padding: 0;
+}
+.live-console-tab-left ::v-deep .el-tabs__active-bar {
+  width: 41px!important;
+  margin-left: calc((100% / 1 - 41px) / 2);
+  height: 4px;
+  border-radius: 4px;
+}
+
+/* calc 3是tab数量 */
+.live-console-tab-right ::v-deep .el-tabs__active-bar {
+  width: 51px!important;
+  margin-left: calc((100% / 3 - 51px) / 2);
+  height: 4px;
+  border-radius: 4px;
+}
+.custom-video {
+  pointer-events: none !important; /* 完全禁止鼠标交互,避免悬停时显示工具栏 */
+  outline: none !important; /* 移除焦点轮廓 */
+}
+/* 额外的兼容性隐藏 */
+.custom-video::-webkit-media-controls {
+  display: none !important;
+}
+
+.custom-video::-webkit-media-controls-panel {
+  display: none !important;
+}
+/* 进度条容器 */
+.progress-container {
+  width: 100%;
+  height: 6px;
+  background: #eee;
+  border-radius: 3px;
+  margin: 10px 0;
+  cursor: pointer;
+}
+
+/* 进度条填充部分 */
+.progress-bar {
+  height: 100%;
+  background: #42b983;  /* Vue 绿色主题示例 */
+  border-radius: 3px;
+  width: 0%;  /* 初始进度为 0 */
+}
+
+/* 时间显示样式 */
+.time-display {
+  color: #ffffff;
+  font-size: 14px;
+}
+</style>

+ 57 - 0
src/views/live/liveConsole/index.vue

@@ -0,0 +1,57 @@
+<template>
+  <div id="app">
+    <div class="nav">
+      <button @click="currentView = 'dashboard'">实时大屏</button>
+      <button @click="currentView = 'console'">中控台</button>
+    </div>
+    <component :is="currentView" :liveId="liveId"></component>
+  </div>
+</template>
+
+<script>
+import LiveDashboard from './LiveDashboard.vue';
+import LiveConsole from './LiveConsole.vue';
+
+export default {
+  name: 'LiveConsole',
+  components: {
+    dashboard: LiveDashboard,
+    console: LiveConsole
+  },
+  data() {
+    return {
+      liveId: this.$route.params.liveId,
+      currentView: 'dashboard'
+    };
+  },
+  created() {
+
+  }
+};
+</script>
+
+<style>
+body {
+  margin: 0;
+  font-family: 'Arial', sans-serif;
+}
+
+.nav {
+  display: flex;
+  background: #1e3a8a;
+  color: white;
+}
+
+.nav button {
+  padding: 15px 20px;
+  border: none;
+  background: none;
+  color: white;
+  cursor: pointer;
+  font-size: 16px;
+}
+
+.nav button:hover {
+  background: #3b82f6;
+}
+</style>

+ 1444 - 0
src/views/live/liveData/index-old.vue

@@ -0,0 +1,1444 @@
+<template>
+  <div class="app-container">
+    <div class="title">近期直播</div>
+    <div class="live-container">
+      <div class="live-card" v-for="live in displayLives" :key="live.liveId">
+        <!-- 直播状态 -->
+        <div class="status" :class="getStatusClass(live.status)">
+          {{ getStatusText(live.status) }}
+        </div>
+        <!-- 直播信息 -->
+        <div class="content">
+          <img :src="live.liveImgUrl" alt="直播封面" class="cover-image" />
+          <div class="info">
+            <h3 class="live-title">{{ live.liveName }}</h3>
+            <p class="time">开播时间: {{ live.startTime }}</p>
+          </div>
+        </div>
+
+        <!-- 直播数据 -->
+        <div class="stats">
+          <div class="stat-item">
+            <p class="label">直播间浏览量</p>
+            <p class="value">{{ live.pageViews }}</p>
+          </div>
+          <div class="stat-item">
+            <p class="label">直播间访客数</p>
+            <p class="value">{{ live.uniqueVisitors }}</p>
+          </div>
+        </div>
+      </div>
+    </div>
+    <!-- 直播趋势统计 -->
+    <div class="trend-section">
+      <div class="trend-header">
+        <h3>直播趋势</h3>
+        <div class="filter-container">
+        <!-- 时间范围选择(下拉框) -->
+          <span class="filter-label">时间筛选:</span>
+          <el-select v-model="selectedTimeRange" placeholder="选择时间范围" @change="changeTimeRange" style="width: 180px">
+            <el-option label="自然天" value="day"></el-option>
+            <el-option label="自然周" value="week"></el-option>
+            <el-option label="自然月" value="month"></el-option>
+          </el-select>
+
+          <!-- 日期选择器 -->
+          <!-- 选择日期 -->
+          <el-date-picker
+            ref="datePickerRef"
+            v-model="selectedDate"
+            :type="datePickerType"
+            :format="selectedTimeRange === 'week' ? weekRange : dateFormat"
+            :value-format="valueFormat"
+            placeholder="选择日期"
+            style="width: 280px"
+            @change="changeDate"
+            @blur="setDefaultDate"
+          />
+        </div>
+      </div>
+
+      <div class="trend-cards">
+        <div class="trend-card"
+             :class="{ 'active': selectedMetric === 'page_views' }"
+             @click="changeMetric('page_views')">
+          <p class="trend-title">
+            浏览量
+            <el-tooltip class="item" effect="dark" content="观看页面的总浏览量" placement="top">
+              <i class="el-icon-info"></i>
+            </el-tooltip>
+          </p>
+          <p class="trend-value">{{ trendData.views || 0 }}</p>
+          <p class="trend-tip">{{ changeLabel }}: {{ trendData.viewsChange }}%</p>
+
+        </div>
+
+        <div class="trend-card"
+             :class="{ 'active': selectedMetric === 'unique_visitors' }"
+             @click="changeMetric('unique_visitors')">
+          <p class="trend-title">
+            访客数
+            <el-tooltip class="item" effect="dark" content="进入直播间的访客数" placement="top">
+              <i class="el-icon-info"></i>
+            </el-tooltip>
+          </p>
+          <p class="trend-value">{{ trendData.visitors|| 0 }}</p>
+          <p class="trend-tip">{{ changeLabel }}: {{ trendData.visitorsChange }}%</p>
+
+        </div>
+
+        <div class="trend-card"
+             :class="{ 'active': selectedMetric === 'streams' }"
+             @click="changeMetric('streams')">
+          <p class="trend-title">
+            创建直播数
+            <el-tooltip class="item" effect="dark" content="创建的直播间数量" placement="top">
+              <i class="el-icon-info"></i>
+            </el-tooltip>
+          </p>
+          <p class="trend-value">{{ trendData.streams|| 0 }}</p>
+          <p class="trend-tip">{{ changeLabel }}: {{ trendData.streamsChange }}%</p>
+
+        </div>
+
+        <div class="trend-card"
+             :class="{ 'active': selectedMetric === 'total_views' }"
+             @click="changeMetric('total_views')">
+          <p class="trend-title">
+            累计观看人次
+            <el-tooltip class="item" effect="dark" content="直播间被观看的总人次" placement="top">
+              <i class="el-icon-info"></i>
+            </el-tooltip>
+          </p>
+          <p class="trend-value">{{ trendData.pv|| 0 }}</p>
+          <p class="trend-tip">{{ changeLabel }}: {{ trendData.pvChange }}%</p>
+
+        </div>
+
+        <div class="trend-card"
+             :class="{ 'active': selectedMetric === 'unique_viewers' }"
+             @click="changeMetric('unique_viewers')">
+          <p class="trend-title">
+            累计观看人数
+            <el-tooltip class="item" effect="dark" content="去重后的观看人数" placement="top">
+              <i class="el-icon-info"></i>
+            </el-tooltip>
+          </p>
+          <p class="trend-value">{{ trendData.uv|| 0 }}</p>
+          <p class="trend-tip">{{ changeLabel }}: {{ trendData.uvChange }}%</p>
+
+        </div>
+      </div>
+
+
+      <!-- 直播趋势折线图 -->
+      <div id="liveChart" class="chart"></div>
+    </div>
+    <!-- 直播TOP10排行榜 -->
+    <div class="top10-section">
+      <h3>直播TOP10排行榜</h3>
+      <div class="ranking-container">
+          <!-- 红榜 -->
+          <div class="ranking-section red-rank">
+            <span class="rank-title">红榜</span>
+            <div class="rank-filters">
+              <button
+                v-for="item in redRankTypes"
+                :key="item.value"
+                :class="{ active: selectedRank === item.value }"
+                @click="selectRank(item.value)"
+              >
+                {{ item.label }}
+              </button>
+            </div>
+          </div>
+
+          <!-- 黑榜 -->
+          <div class="ranking-section black-rank">
+            <div class="rank-filters">
+              <button
+                v-for="item in blackRankTypes"
+                :key="item.value"
+                :class="{ active: selectedRank === item.value }"
+                @click="selectRank(item.value)"
+              >
+                {{ item.label }}
+              </button>
+            </div>
+            <span class="rank-title">黑榜</span>
+          </div>
+      </div>
+      <el-table :data="top10List" border style="width: 100%">
+        <el-table-column prop="rank" label="排名" width="80"></el-table-column>
+        <el-table-column prop="liveName" label="直播名称">
+          <template #default="scope">
+            <div class="live-name">
+              <img :src="scope.row.liveImgUrl" class="live-cover" alt="封面">
+              <span class="live-title">{{ scope.row.liveName }}</span>
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="pageViews" label="直播间浏览量(PV)"></el-table-column>
+        <el-table-column prop="uniqueVisitors" label="直播间访客数(UV)"></el-table-column>
+        <el-table-column prop="totalViews" label="累计观看人次(PV)"></el-table-column>
+        <el-table-column prop="uniqueViewers" label="累计观看人数(UV)"></el-table-column>
+        <!--<el-table-column prop="avgTime" label="人均观看时长"></el-table-column>-->
+        <el-table-column prop="peakConcurrentViewers" label="最高在线人数"></el-table-column>
+      </el-table>
+
+    </div>
+<!--    <div class="student-section">-->
+<!--      <h3>直播间学员</h3>-->
+<!--        <el-form :inline="true" v-show="showAdvancedSearch" label-width="100px">-->
+<!--          &lt;!&ndash; 直播列表弹框 &ndash;&gt;-->
+<!--          <el-dialog title="选择直播" :visible.sync="dialogVisible" width="70%">-->
+<!--            <el-row :gutter="20">-->
+<!--              <el-col :span="8" :sm="12" :md="8">-->
+<!--                <el-form-item label="直播名称:">-->
+<!--                  <el-input v-model="liveFiltersParam.liveName" placeholder="请输入直播名称"></el-input>-->
+<!--                </el-form-item>-->
+<!--              </el-col>-->
+<!--              <el-col :span="8" :sm="12" :md="8">-->
+<!--                <el-form-item label="直播状态:">-->
+<!--                  <el-select v-model="liveFiltersParam.status" placeholder="请选择直播状态" clearable>-->
+<!--                    <el-option label="全部" value=""></el-option>-->
+<!--                    <el-option label="已结束" value="3"></el-option>-->
+<!--                    <el-option label="进行中" value="2"></el-option>-->
+<!--                    <el-option label="未开始" value="1"></el-option>-->
+<!--                  </el-select>-->
+<!--                </el-form-item>-->
+<!--              </el-col>-->
+<!--              <el-col :span="8" :sm="12" :md="8">-->
+<!--                <el-form-item label="直播时间:">-->
+<!--                  <el-date-picker-->
+<!--                    v-model="liveDateRange"-->
+<!--                    type="daterange"-->
+<!--                    value-format="yyyy-MM-dd"-->
+<!--                    range-separator="至"-->
+<!--                    start-placeholder="开始日期"-->
+<!--                    end-placeholder="结束日期"-->
+<!--                    clearable-->
+<!--                    style="width: 250px"-->
+<!--                    @change="handleLiveDateChange"-->
+<!--                  ></el-date-picker>-->
+<!--                </el-form-item>-->
+<!--              </el-col>-->
+<!--              &lt;!&ndash; 查询 & 重置 按钮 &ndash;&gt;-->
+<!--              <el-col :span="4" class="button-group">-->
+<!--                <el-button type="primary" @click="getLive">查询</el-button>-->
+<!--                <el-button @click="resetLiveFilters">重置</el-button>-->
+<!--              </el-col>-->
+<!--            </el-row>-->
+
+<!--            &lt;!&ndash; 直播列表 &ndash;&gt;-->
+<!--            <el-table :data="liveList" border @selection-change="handleSelectionChange">-->
+<!--              <el-table-column type="selection" width="50" align="center" />-->
+<!--              &lt;!&ndash; 直播信息列 &ndash;&gt;-->
+<!--              <el-table-column label="直播名称" min-width="250">-->
+<!--                <template slot-scope="{ row }">-->
+<!--                  <div class="live-info">-->
+<!--                    &lt;!&ndash; 直播封面图 &ndash;&gt;-->
+<!--                    <img :src="row.liveImgUrl" class="live-cover" />-->
+<!--                    &lt;!&ndash; 直播名称 + 时间 &ndash;&gt;-->
+<!--                    <div class="live-text">-->
+<!--                      <div type="text"class="live-name">{{ row.liveName }}</div>-->
+<!--                      <div class="live-time">{{ row.startTime }}-{{row.finishTime}}</div>-->
+<!--                    </div>-->
+<!--                  </div>-->
+<!--                </template>-->
+<!--              </el-table-column>-->
+
+<!--              &lt;!&ndash; 直播状态 &ndash;&gt;-->
+<!--              <el-table-column label="直播状态" min-width="120">-->
+<!--                <template slot-scope="{ row }">-->
+<!--                  <div class="status-container">-->
+<!--                    <span :class="['status-dot', getStatusClass(row.status)]"></span>-->
+<!--                    <span>{{ getStatusText(row.status) }}</span>-->
+<!--                  </div>-->
+<!--                </template>-->
+<!--              </el-table-column>-->
+
+<!--              &lt;!&ndash; 讲师 &ndash;&gt;-->
+<!--              <el-table-column label="讲师" prop="teacher" min-width="120"></el-table-column>-->
+<!--            </el-table>-->
+<!--            <pagination-->
+<!--              v-show="liveTotal>0"-->
+<!--              :total="liveTotal"-->
+<!--              :page.sync="liveFiltersParam.pageNum"-->
+<!--              :limit.sync="liveFiltersParam.pageSize"-->
+<!--              @pagination="getLive"-->
+<!--            />-->
+<!--            &lt;!&ndash; 确认按钮 &ndash;&gt;-->
+<!--            <span slot="footer" class="dialog-footer">-->
+<!--              <el-button @click="dialogVisible = false">取消</el-button>-->
+<!--              <el-button type="primary" @click="confirmSelection">确认</el-button>-->
+<!--            </span>-->
+<!--          </el-dialog>-->
+<!--          &lt;!&ndash; 基础筛选项:始终显示 &ndash;&gt;-->
+<!--          <el-row :gutter="20">-->
+<!--            <el-col :span="8" :sm="12" :md="8">-->
+<!--              <el-form-item label="直播名称:" class="el-form-item-ellipsis">-->
+<!--                <el-input-->
+<!--                  v-model="filters.liveName"-->
+<!--                  placeholder="请选择直播"-->
+<!--                  @focus="openDialog"-->
+<!--                  type="text"-->
+<!--                  readonly-->
+<!--                >-->
+<!--                  <template slot="prepend">-->
+<!--                    <div v-if="filters.liveNames.length > 0" class="selected-lives">-->
+<!--                      <el-tag-->
+<!--                        v-for="(name, index) in filters.liveNames"-->
+<!--                        :key="index"-->
+<!--                        closable-->
+<!--                        @close="removeLive(index)"-->
+<!--                        class="live-name-tag"-->
+<!--                      >-->
+<!--                        {{ name }}-->
+<!--                      </el-tag>-->
+<!--                    </div>-->
+<!--                  </template>-->
+<!--                </el-input>-->
+<!--              </el-form-item>-->
+<!--            </el-col>-->
+<!--            <el-col :span="8" :sm="12" :md="8">-->
+<!--              <el-form-item label="用户名:" class="el-form-item-ellipsis">-->
+<!--                <el-input v-model="filters.userName" placeholder="请输入用户名"></el-input>-->
+<!--              </el-form-item>-->
+<!--            </el-col>-->
+<!--            <el-col :span="8" :sm="12" :md="8">-->
+<!--              <el-form-item label="手机号:" class="el-form-item-ellipsis">-->
+<!--                <el-input v-model="filters.userPhone" placeholder="请输入手机号"></el-input>-->
+<!--              </el-form-item>-->
+<!--            </el-col>-->
+<!--          </el-row>-->
+<!--          &lt;!&ndash; 高级筛选项 &ndash;&gt;-->
+<!--          <el-row :gutter="24" v-show="showAllFilters">-->
+<!--            <el-col :span="8" :sm="12" :md="8" >-->
+<!--              <el-form-item label="用户创建时间:">-->
+<!--                <el-date-picker-->
+<!--                  v-model="dateRange"-->
+<!--                  type="daterange"-->
+<!--                  range-separator="至"-->
+<!--                  start-placeholder="开始日期"-->
+<!--                  end-placeholder="结束日期"-->
+<!--                  value-format="yyyy-MM-dd"-->
+<!--                  @change="handleDateChange"-->
+<!--                  class="full-width-picker"-->
+<!--                />-->
+<!--              </el-form-item>-->
+<!--            </el-col>-->
+<!--            <el-col :span="8" :sm="12" :md="8">-->
+<!--              <el-form-item label="分享次数:" class="el-form-item-ellipsis">-->
+<!--                <el-input v-model="filters.shareCount" placeholder="请输入分享次数"></el-input>-->
+<!--              </el-form-item>-->
+<!--            </el-col>-->
+<!--            <el-col :span="8" :sm="12" :md="8">-->
+<!--              <el-form-item label="所属部门:" prop="deptId">-->
+<!--                <treeselect style="width:220px" v-model="filters.deptId" :options="deptOptions" :show-count="true" placeholder="请选择所属部门" />-->
+<!--              </el-form-item>-->
+<!--            </el-col>-->
+<!--          </el-row>-->
+<!--          <el-row :gutter="20" v-show="showAllFilters">-->
+<!--            <el-col :span="8" :sm="12" :md="8"> &lt;!&ndash; 每列 span 总和控制在 24 内 &ndash;&gt;-->
+<!--              <el-form-item label="跟进人:" class="el-form-item-ellipsis">-->
+<!--                <el-input v-model="filters.companyUserName" placeholder="请输入跟进人"></el-input>-->
+<!--              </el-form-item>-->
+<!--            </el-col>-->
+<!--            <el-col :span="8" :sm="12" :md="8">-->
+<!--              <el-form-item label="购买商品数:" class="el-form-item-ellipsis">-->
+<!--                <el-input v-model="filters.goodsCount" placeholder="请输入购买商品数"></el-input>-->
+<!--              </el-form-item>-->
+<!--            </el-col>-->
+<!--            <el-col :span="8" :sm="12" :md="8">-->
+<!--              <el-form-item label="提问数:" class="flex-container">-->
+<!--                <el-row>-->
+<!--                  <el-col :span="8" :sm="12" :md="8">-->
+<!--                    <el-input-number v-model="filters.minQuestionCount" placeholder="最小提问数" :min="0" style="width: 100%"></el-input-number>-->
+<!--                  </el-col>-->
+<!--                  <el-col :span="2" class="text-center">至</el-col>-->
+<!--                  <el-col :span="8" :sm="12" :md="8">-->
+<!--                    <el-input-number v-model="filters.maxQuestionCount" placeholder="最大提问数" :min="0" style="width: 100%"></el-input-number>-->
+<!--                  </el-col>-->
+<!--                </el-row>-->
+<!--              </el-form-item>-->
+<!--            </el-col>-->
+<!--          </el-row>-->
+
+<!--          &lt;!&ndash; 按钮组:始终显示 &ndash;&gt;-->
+<!--          <el-row>-->
+<!--            <el-col :span="24" class="button-group">-->
+<!--              <el-button type="primary" @click="getStudentData" class="custom-button">查询</el-button>-->
+<!--              <el-button @click="resetFilters" class="custom-button">重置</el-button>-->
+<!--              <el-button type="text" @click="toggleAllFilters" class="custom-button toggle-button">-->
+<!--                {{ showAllFilters ? '收起' : '展开' }}-->
+<!--                <i :class="showAllFilters ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>-->
+<!--              </el-button>-->
+<!--            </el-col>-->
+<!--          </el-row>-->
+<!--        </el-form>-->
+<!--      &lt;!&ndash;<div class="column-button-container">-->
+<!--        <el-button-->
+<!--          type="primary"-->
+<!--          @click="showColumnSettings = true"-->
+<!--          class="custom-column-button"-->
+<!--        >-->
+<!--          自定义列-->
+<!--        </el-button>-->
+<!--      </div>&ndash;&gt;-->
+<!--      &lt;!&ndash; 自定义列弹窗 &ndash;&gt;-->
+<!--      <el-drawer-->
+<!--        title="自定义列设置"-->
+<!--        :visible.sync="showColumnSettings"-->
+<!--        :before-close="handleClose"-->
+<!--        size="25%"-->
+<!--      >-->
+<!--        &lt;!&ndash; 抽屉内容区域 &ndash;&gt;-->
+<!--        &lt;!&ndash;<div style="display: flex; flex-direction: column; height: 100%;">-->
+<!--          &lt;!&ndash; 可拖拽的列设置区域 &ndash;&gt;-->
+<!--          <draggable-->
+<!--            v-model="columnOrder"-->
+<!--            group="columns"-->
+<!--            style="flex: 1; overflow-y: auto;"-->
+<!--          >-->
+<!--            <div v-for="col in columnOrder" :key="col.dataIndex" class="column-item">-->
+<!--              <el-checkbox v-model="col.status" true-label="ENABLE" false-label="DISABLE">-->
+<!--                {{ col.title }}-->
+<!--              </el-checkbox>-->
+<!--              <i class="el-icon-rank drag-handle"></i>-->
+<!--            </div>-->
+<!--          </draggable>-->
+
+<!--          &lt;!&ndash; 底部按钮区域 &ndash;&gt;-->
+<!--          <div style="padding: 12px; text-align: right; border-top: 2px solid;">-->
+<!--            <el-button @click="showColumnSettings = false" style="color: black;">取消</el-button>-->
+<!--            <el-button-->
+<!--              type="primary"-->
+<!--              @click="saveColumnsConfig"-->
+<!--              style="color: black; background-color: #409EFF; border-color: #409EFF;"-->
+<!--            >-->
+<!--              确定-->
+<!--            </el-button>-->
+<!--          </div>-->
+<!--        </div>&ndash;&gt;-->
+<!--      </el-drawer>-->
+
+
+<!--      <div style="overflow-x: auto; white-space: nowrap;">-->
+<!--        <el-table :data="liveStudentList" border style="min-width: 1200px;">-->
+<!--          &lt;!&ndash; 固定列,内容不换行 &ndash;&gt;-->
+<!--          <el-table-column prop="userName" label="客户名" fixed :style="{whiteSpace: 'nowrap',textOverflow: 'ellipsis',overflow: 'hidden',textAlign: 'center'}"></el-table-column>-->
+<!--          <el-table-column prop="liveName" label="直播间" fixed :show-overflow-tooltip="true" width=151px :min-width="'直播间'.length * 12 + 30":style="{whiteSpace: 'nowrap',textOverflow: 'ellipsis',overflow: 'hidden',textAlign: 'center'}"></el-table-column>-->
+<!--          <el-table-column prop="companyUserName" label="跟进人" fixed class="no-wrap-column"></el-table-column>-->
+<!--          <el-table-column prop="deptName" label="归属部门" width="150" show-overflow-tooltip/>-->
+<!--          <el-table-column prop="userCreateTime" label="客户创建时间" width="150" show-overflow-tooltip/>-->
+<!--          <el-table-column prop="userPhone" label="联系方式" width="150" show-overflow-tooltip/>-->
+<!--          <el-table-column prop="goodsCount" label="去下单实物商品" width="150" show-overflow-tooltip/>-->
+<!--          <el-table-column prop="shareCount" label="分享直播间次数" width="150" show-overflow-tooltip/>-->
+<!--          <el-table-column prop="questionCount" label="答题次数" width="150" show-overflow-tooltip/>-->
+
+<!--          &lt;!&ndash; 动态列 &ndash;&gt;-->
+<!--          &lt;!&ndash;<el-table-column-->
+<!--            v-for="col in filteredColumns"-->
+<!--            :key="col.dataIndex"-->
+<!--            :prop="col.dataIndex"-->
+<!--            :label="col.title"-->
+<!--            :width="col.width"-->
+<!--            :min-width="col.title.length * 12 + 30"-->
+<!--            :show-overflow-tooltip="true">-->
+<!--          </el-table-column>&ndash;&gt;-->
+
+<!--        </el-table>-->
+<!--        <pagination-->
+<!--          v-show="liveStudentTotal>0"-->
+<!--          :total="liveStudentTotal"-->
+<!--          :page.sync="filters.pageNum"-->
+<!--          :limit.sync="filters.pageSize"-->
+<!--          @pagination="getStudentData"-->
+<!--        />-->
+<!--      </div>-->
+<!--    </div>-->
+  </div>
+</template>
+
+
+<script>
+  import * as echarts from "echarts";
+  import Editor from '@/components/Editor/wang';
+  import {recentLive,liveTop,getTrendData,columns,updateColumns,queryStudentData} from "@/api/live/liveData";
+  import {selectLiveToStudent} from "@/api/live/live";
+  import { treeselect } from "@/api/company/companyDept";
+  import Treeselect from "@riophae/vue-treeselect";
+  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+  import draggable from "vuedraggable";
+  export default {
+
+    name: "LiveData",
+    components: { Editor,draggable,Treeselect },
+    data() {
+      return {
+        // 部门树选项
+        deptOptions: [],
+        liveDateRange:"",
+        liveFiltersParam:{
+          liveName:"",
+          status:"",
+          startTime:"",
+          finishTime:"",
+          pageNum: 1,
+          pageSize: 10,
+        },
+        liveList: [],
+        dialogVisible: false,
+        span:8,
+        showAllFilters: true, // 默认收起
+        showAdvancedSearch: true, // 控制表单的显示
+        // 直播间总条数
+        liveTotal: 0,
+        //学员数据总条数
+        liveStudentTotal:0,
+        dateRange: [],//存选择的日期范围
+        filters: {
+          minQuestionCount: 0,  // 大于提问数
+          maxQuestionCount: 0,  // 小于提问数
+          liveNames: [],  // 存放已选的直播名称
+          liveIds: [],
+          liveName: '',
+          userName: '',
+          userPhone: '',
+          userCreateTime: '',
+          startTime: '', // 开始时间
+          finishTime: '',
+          shareCount: '',
+          deptName: '',
+          deptId:null,
+          companyUserName: '',
+          goodsCount: '',
+          questionCount: '',
+          pageNum: 1,
+          pageSize: 2
+        },
+        selectedLives: [], // 临时存储选中的直播数据
+        showColumnSettings: false, // 控制自定义列弹窗
+        columnOrder: [],
+        tempOrderedColumns : [],  // 用于渲染表格的列顺序
+        selectedColumns: [],  // 用于控制哪些列被选中
+        liveStudentList:[],
+        top10List: [],
+        selectedRank: 'highFlow',
+        redRankTypes: [
+          { label: '高流量', value: 'highFlow' },
+          { label: '高观看', value: 'highView' },
+          /*{ label: '高时长', value: 'highTime' },*/
+        ],
+        blackRankTypes: [
+          { label: '低观看', value: 'lowView' },
+          { label: '低流量', value: 'lowFlow' },
+        ],
+        selectedTimeRange: 'day',  // 默认选择自然天
+        selectedDate: null,  // 用户选择的日期
+        datePickerType: 'date',  // 默认日期选择类型
+        weekRange: 'yyyy-ww',  // 周选择的日期格式
+        queryParams: {
+          type: 'day',  // 用来存储时间筛选方式(如 day, week, month)
+          date: new Date().toISOString().split("T")[0],  // 用来存储用户选择的日期默认今天
+          category:"page_views"
+        },
+        chart: null,
+        trendData: {}, // 直播趋势数据
+        selectedMetric: "page_views", // 默认选中浏览量
+        lives: [],
+      };
+    },
+    computed: {
+
+      filteredColumns() {
+        return this.columnOrder.filter(col => col.status === "ENABLE");
+      },
+      changeLabel() {
+        switch (this.selectedTimeRange) {
+          case 'day': return '比前一天';
+          case 'week': return '比上周';
+          case 'month': return '比上月';
+          default: return '变化';
+        }
+      },
+      displayLives() {
+        return this.lives.slice(0, 4); // 最多只显示前 4 条数据
+      },
+
+      dateFormat() {
+        return this.selectedTimeRange === "day"
+          ? "yyyy-MM-dd"
+          : this.selectedTimeRange === "week"
+            ? "yyyy-MM-dd 至 yyyy-MM-dd"
+            : "yyyy-MM-dd";
+      },
+      valueFormat() {
+        return this.selectedTimeRange === "day"
+          ? "yyyy-MM-dd"
+          : this.selectedTimeRange === "week"
+            ? "yyyy-MM-dd"
+            : "yyyy-MM-dd";
+      },
+    },
+    created() {
+      this.getRecentLive();
+      this.getLiveTop();
+      this.getTrendData();
+      //this.getColumns();
+      this.getTreeselect();
+
+    },
+    mounted() {
+      this.selectedColumns = this.columnOrder.map((col) => col.prop); // 默认全选
+      this.selectedMetric = this.trendData[0]; // 默认选中第一个
+      this.initChart(); // 初始化折线图
+      if (!this.selectedMetric) {
+        this.selectedMetric = "page_views";
+      };
+      this.updateChart();
+    },
+    watch: {
+      // 如果 columnOrder 更新,确保 orderedColumns 跟随更新
+      columnOrder(newOrder) {
+        this.tempOrderedColumns = [...newOrder];
+      },
+    },
+
+    methods: {
+      handleLiveDateChange(value) {
+        if (value) {
+          this.liveFiltersParam.startTime = value[0];
+          this.liveFiltersParam.finishTime = value[1];
+        } else {
+          this.liveFiltersParam.startTime = null;
+          this.liveFiltersParam.finishTime = null;
+        }
+        console.log("直播时间范围:", this.liveFiltersParam.startTime, this.liveFiltersParam.finishTime);
+      },
+      handleDateChange(value) {
+        if (value) {
+          this.filters.startTime = value[0];
+          this.filters.finishTime = value[1];
+        } else {
+          this.filters.startTime = '';
+          this.filters.finishTime = '';
+        }
+        console.log("用户创建时间范围:", this.filters.startTime, this.filters.finishTime);
+      },
+      getTreeselect() {
+        treeselect().then((response) => {
+          this.deptOptions = response.data;
+          console.log(this.deptOptions)
+        });
+      },
+      getLive(){
+        selectLiveToStudent(this.liveFiltersParam).then(response => {
+          this.liveList = response.rows;
+          this.liveTotal = response.total;
+        });
+      },
+      resetLiveFilters(){
+        this.liveDateRange="",
+        this.liveFiltersParam = {
+          liveName:"",
+          status:"",
+          startTime:"",
+          finishTime:""
+        }
+      },
+      // 确认选择
+      confirmSelection() {
+        this.filters.liveNames = this.selectedLives.map(item => item.liveName);
+        this.filters.liveIds = this.selectedLives.map(item => item.liveId);
+        console.log(this.filters.liveIds)
+        this.dialogVisible = false; // 关闭弹框
+      },
+      // 移除已选直播
+      removeLive(index) {
+        this.filters.liveNames.splice(index, 1);
+        this.filters.liveIds.splice(index, 1);
+      },
+      // 处理表格选中
+      handleSelectionChange(selectedRows) {
+        this.selectedLives = selectedRows; // 存储选中的直播数据
+      },
+
+      openDialog() {
+        this.getLive();
+        this.dialogVisible = true;
+      },
+      toggleAllFilters() {
+        this.showAllFilters = !this.showAllFilters;
+      },
+      getStudentData() {
+        console.log("查询条件:", this.filters);
+        queryStudentData(this.filters).then(response => {
+          console.log(response)
+          this.liveStudentList = response.rows;
+          this.liveStudentTotal = response.total;
+          console.log(response.total)
+        });
+      },
+      resetFilters() {
+        this.filters = {
+          liveName: "",
+          liveNames:[],
+          liveIds:[],
+          phoneNumber: "",
+          wechatNickname: "",
+          customerId: "",
+          visitTime: [],
+          isWinner: "",
+          department: "",
+          customerTag: "",
+        };
+      },
+      handleClose(done) {
+        this.$confirm('确认关闭?')
+          .then(_ => {
+            done();
+          })
+          .catch(_ => {});
+      },
+      saveColumnsConfig() {
+        this.tempOrderedColumns = [...this.columnOrder];  // 更新 orderedColumns
+        console.log(this.tempOrderedColumns)
+        updateColumns(this.tempOrderedColumns).then(response=>{
+          //this.getColumns()
+          location.reload()
+          this.showColumnSettings = false;
+        })
+      },
+      /*getColumns(){
+        this.loading = true;
+        columns().then(response => {
+          this.columnOrder = response.data;
+          this.selectedColumns = response.data.map((col) => col.prop);
+          console.log(this.columnOrder)
+          this.loading = false;
+        });
+      },*/
+      getTrendData(){
+        getTrendData(this.queryParams).then(response=>{
+          this.trendData = response.data
+          this.updateChart()
+        })
+      },
+      // 更新折线图
+      getMetricTitle(metricKey) {
+        const titles = {
+          page_views: "浏览量",
+          unique_visitors: "访客数",
+          streams: "创建直播数",
+          total_views: "累计观看人次",
+          unique_viewers: "累计观看人数"
+        };
+        return titles [metricKey] || "未知指标";
+      },
+
+      // 点击卡片切换指标
+      changeMetric(metric) {
+        this.selectedMetric = metric;
+        // 更新 queryParams 中的 category
+        this.queryParams.category = metric;  // 默认值为 prevViews
+        this.updateChart();  // 更新图表
+        this.getTrendData();  // 重新请求数据
+      },
+      getLiveTop() {
+
+        liveTop({ rankType: this.selectedRank })
+          .then(response => {
+
+            if (response.data) {
+              // 遍历数据并添加排名字段
+              this.top10List = response.data.map((item, index) => ({
+                ...item,
+                rank: index + 1 // 排名从 1 开始
+              }));
+            } else {
+              this.top10List = [];
+            }
+          })
+          .catch(error => {
+          });
+      },
+      getStatusText(status) {
+        if (status === 1) return "待直播";
+        if (status === 2) return "直播中";
+        return "已结束";
+      },
+      getStatusClass(status) {
+        if (status === 1) return "status-upcoming";
+        if (status === 2) return "status-live";
+        return "status-ended";
+      },
+      getRecentLive(){
+        this.loading = true;
+        recentLive().then(response => {
+          this.lives = response.data;
+          this.loading = false;
+        });
+      },
+
+      getWeekRange(selectedWeek) {
+        let date = new Date(selectedWeek);
+
+        if (isNaN(date.getTime())) {
+          return "日期错误";
+        }
+
+        let dayOfWeek = date.getDay(); // 0(星期天)- 6(星期六)
+
+        // 计算周一
+        let startDate = new Date(date); // 创建一个新的 Date 实例
+        startDate.setDate(date.getDate() - dayOfWeek + (dayOfWeek === 0 ? -6 : 1));
+
+        // 计算周日(确保 `endDate` 是新实例)
+        let endDate = new Date(startDate.getTime()); // 复制 `startDate`
+        endDate.setDate(startDate.getDate() + 6);
+
+
+        return `${this.formatDate(startDate)} 至 ${this.formatDate(endDate)}`;
+      },
+      changeDate(value) {
+        if (this.selectedTimeRange === 'week' && value) {
+          this.weekRange = this.getWeekRange(value);
+          console.log("周"+this.weekRange)
+        } else {
+          this.weekRange = '';  // 非周选择时清空周范围
+        }
+
+        // 更新 queryParams.date
+        if (value) {
+          this.queryParams.date = this.formatDate(value);
+        }
+        this.getTrendData();
+      },
+      formatDate(date) {
+        let date_ = new Date(date);
+        console.log(date_)
+        const year = date_.getFullYear();
+        const month = String(date_.getMonth() + 1).padStart(2, '0');
+        const day = String(date_.getDate()).padStart(2, '0');
+        return `${year}-${month}-${day}`;
+      },
+
+      // 获取一周的起始日期(周一)
+      getStartOfWeek(date) {
+        let parsedDate = new Date(date);
+        if (isNaN(parsedDate.getTime())) {
+          console.error("无效的日期:", date);
+          return null;
+        }
+
+        const day = parsedDate.getDay();
+        const diff = parsedDate.getDate() - day + (day === 0 ? -6 : 1); // 调整到周一
+        return new Date(parsedDate.setDate(diff));
+      },
+
+      getEndOfWeek(date) {
+        const startOfWeek = this.getStartOfWeek(date);
+        if (!startOfWeek) return null;
+
+        let endOfWeek = new Date(startOfWeek);
+        endOfWeek.setDate(startOfWeek.getDate() + 6); // 调整到周日
+        return endOfWeek;
+      },
+      computedChange(item) {
+        switch (this.selectedTimeRange) {
+          case 'day': return item.dailyChange;
+          case 'week': return item.weeklyChange;
+          case 'month': return item.monthlyChange;
+          default: return 0;
+        }
+      },
+      selectRank(type) {
+        this.selectedRank = type; // 只允许一个按钮被选中
+        this.getLiveTop();  // 重新获取排行榜数据
+      },
+      // 切换时间范围
+      changeTimeRange() {
+        // 根据选中的时间范围修改 datePicker 类型
+        if (this.selectedTimeRange === 'day') {
+          this.datePickerType = 'date';  // 自然天
+          this.weekRange = '';  // 清空周范围
+        } else if (this.selectedTimeRange === 'month') {
+          this.datePickerType = 'month';  // 自然月
+          this.weekRange = '';  // 清空周范围
+        } else if (this.selectedTimeRange === 'week') {
+          this.datePickerType = 'week';  // 自然周
+        }
+        // 立即弹出日期选择器
+        this.$nextTick(() => {
+          this.$refs.datePickerRef.focus();
+        });
+        // 重置已选日期
+        this.queryParams.type = this.selectedTimeRange;
+        this.selectedDate = null;
+        this.queryParams.date = '';  // 清空 queryParams 中的日期
+      },
+      setDefaultDate() {
+        // 如果用户没有选择日期,则使用当前日期
+        if (!this.selectedDate) {
+          this.selectedDate = this.formatDate(new Date());
+          this.queryParams.date = this.selectedDate;
+        }
+      },
+      // 切换日期时更新数据
+      updateTrendData() {
+        // 这里可以加接口请求,获取新的数据
+        this.getTrendData()
+        this.updateChart();
+      },
+      initChart() {
+        let chartDom = document.getElementById("liveChart");
+        if (!chartDom) return;
+        this.chart = echarts.init(chartDom);
+        this.updateChart();
+      },
+      // 更新折线图
+      updateChart() {
+        if (!this.chart) return;
+
+        // 获取当前选中的指标对应的数据
+        let metricKey = this.selectedMetric;
+        let metricTitle = this.getMetricTitle(metricKey); // 获取指标标题
+        let chartData = this.trendData.data || [];
+        let dates = this.trendData.dates || []; // 确保 dates 不是 null
+        let options = {
+          tooltip: {
+            trigger: "axis",
+            backgroundColor: "rgba(0, 0, 0, 0.7)",
+            textStyle: { color: "#fff" },
+            formatter: function (params) {
+              let date = params[0].name; // x 轴的日期
+              let value = params[0].value; // 对应的数值
+              return `${date}<br/>${params[0].seriesName}: ${value}`;
+            }
+          },
+          grid: {
+            left: "5%", right: "5%", bottom: "10%", top: "10%", containLabel: true
+          },
+          xAxis: {
+            type: "category",
+            data: this.trendData.dates || [],
+            axisLine: {lineStyle: {color: "#ddd"}}
+          },
+          yAxis: {
+            type: "value",
+            splitLine: {lineStyle: {type: "dashed", color: "#ddd"}}
+          },
+          series: [
+            {
+              name: metricTitle,
+              data: chartData,
+              type: "line",
+              smooth: true,
+              symbol: "circle",
+              symbolSize: 8,
+              itemStyle: {
+                color: "#007BFF",
+                borderColor: "#fff",
+                borderWidth: 2
+              },
+              lineStyle: {
+                width: 3,
+                color: "#007BFF"
+              },
+              areaStyle: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+                  {offset: 0, color: "rgba(0, 123, 255, 0.5)"},
+                  {offset: 1, color: "rgba(0, 123, 255, 0)"}
+                ])
+              },
+              emphasis: {
+                focus: "series",
+                label: {
+                  show: true,
+                  formatter: "{c}",
+                  fontSize: 14,
+                  color: "#333",
+                  backgroundColor: "#fff",
+                  padding: [4, 6]
+                }
+              },
+              animationDuration: 1200,
+              animationEasing: "quadraticOut"
+            }
+          ]
+        };
+
+        this.chart.setOption(options);
+      },
+    }
+  };
+</script>
+
+<style scoped>
+  .app-container {
+    padding: 20px;
+  }
+
+  .title {
+    font-size: 18px;
+    font-weight: bold;
+    margin-bottom: 10px;
+  }
+  .live-container {
+    display: flex;
+    gap: 15px; /* 控制卡片之间的间距 */
+    overflow-x: auto; /* 允许横向滚动 */
+    padding-bottom: 10px;
+  }
+
+  /* 卡片样式 */
+  .live-card {
+    width: 380px;
+    height: 225px;
+    background: rgb(250,250,250);
+    border-radius: 10px;
+    padding: 15px;
+    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
+    display: flex;
+    flex-direction: column;
+    align-items: flex-start;
+  }
+
+  /* 直播状态 */
+  .status {
+    background: #d3d3d3;
+    color: #333;
+    font-size: 14px;
+    padding: 4px 8px;
+    border-radius: 5px;
+    display: inline-block;
+  }
+
+  /* 不同状态颜色 */
+  .status-upcoming {
+    background: #FFC107; /* 黄色 */
+    color: #333;
+  }
+
+  .status-live {
+    background: #28A745; /* 绿色 */
+    color: white;
+  }
+
+  .status-ended {
+    background: #D3D3D3; /* 灰色 */
+    color: #333;
+  }
+  /* 直播信息部分 */
+  .content {
+    background: rgb(250,250,250);
+    display: flex;
+    gap: 10px;
+    align-items: center;
+    width: 90%;
+    margin-top: 0px;
+  }
+
+  /* 直播封面图片 */
+  .cover-image {
+    width: 70px;
+    height: 70px;
+    border-radius: 10px;
+    object-fit: cover;
+  }
+
+  /* 直播文本信息 */
+  .info {
+    flex: 1;
+  }
+
+  .live-title {
+    font-size: 16px;
+    font-weight: bold;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    max-width: 250px; /* 防止标题过长 */
+  }
+
+  .time {
+    font-size: 14px;
+    color: #666;
+  }
+
+  /* 直播数据部分 */
+  .stats {
+    display: flex;
+    justify-content: space-between;
+    width: 100%;
+    flex-shrink: 0;
+    margin-top: 10px;
+  }
+
+  .stat-item {
+    text-align: center;
+    flex: 1;
+  }
+
+  .label {
+    font-size: 14px;
+    color: #888;
+  }
+
+  .value {
+    font-size: 18px;
+    font-weight: bold;
+    color: #333;
+  }
+  /* 直播趋势 */
+  .trend-section {
+    margin-top: 30px;
+  }
+  .trend-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+  }
+  .trend-cards {
+    display: flex;
+    gap: 15px;
+  }
+  .trend-card {
+    width: 280px;
+    hight: 100px;
+    border: 1px solid #ddd;
+    border-radius: 8px;
+    padding: 16px;
+    transition: all 0.3s;
+    position: relative;
+  }
+
+  .trend-card.active {
+    border-color: #007bff; /* 选中时边框变蓝 */
+    box-shadow: 0px 0px 10px rgba(0, 123, 255, 0.3);
+  }
+
+  .trend-card.active::after {
+    content: "✔";
+    position: absolute;
+    bottom: 8px;
+    right: 8px;
+    color: white;
+    background: #007bff;
+    border-radius: 50%;
+    width: 20px;
+    height: 20px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    font-size: 14px;
+    font-weight: bold;
+  }
+  .trend-value {
+    font-size: 24px;
+    font-weight: bold;
+  }
+
+  /* 折线图 */
+  .chart {
+    width: 100%;
+    height: 300px;
+    margin-top: 20px;
+  }
+  .top10-section {
+    margin-top: 20px;
+    background: #fff;
+    padding: 16px;
+    border-radius: 8px;
+    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+  }
+  .live-name {
+    display: flex;
+    align-items: center;
+  }
+
+  .live-cover {
+    width: 80px;  /* 直播封面宽度 */
+    height: 45px; /* 直播封面高度 */
+    border-radius: 4px;
+    margin-right: 10px;
+    object-fit: cover;
+  }
+
+  .live-title {
+    font-size: 14px;
+    color: #333;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+  }
+  .ranking-tabs {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 10px 20px;
+  }
+
+  .ranking-container {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin: 10px 0;
+    border-radius: 8px;
+    overflow: hidden;
+  }
+
+  .ranking-section {
+    display: flex;
+    align-items: center;
+    width: 50%;
+    padding: 10px 15px;
+  }
+
+  .red-rank {
+    background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
+    justify-content: flex-start;
+  }
+
+  .black-rank {
+    background: linear-gradient(90deg, #4a4a4a, #6b6b6b);
+    justify-content: flex-end;
+  }
+
+  .rank-title {
+    font-size: 18px;
+    font-weight: bold;
+    color: white;
+    margin: 0 15px;
+  }
+
+  .rank-filters {
+    display: flex;
+  }
+
+  button {
+    background: rgba(255, 255, 255, 0.2);
+    border: 1px solid rgba(255, 255, 255, 0.5);
+    color: white;
+    font-size: 14px;
+    padding: 5px 12px;
+    margin: 0 5px;
+    border-radius: 15px;
+    cursor: pointer;
+    transition: all 0.3s ease;
+  }
+
+  button.active {
+    background: white;
+    color: #ff4d4f;
+  }
+  .filter-container {
+    display: flex;
+    align-items: center;
+    gap: 8px; /* 控制两个组件的间距 */
+  }
+
+  .filter-label {
+    font-weight: bold;
+    white-space: nowrap; /* 防止换行 */
+  }
+
+
+  .student-section {
+    margin-top: 20px;
+    background: #fff;
+    padding: 16px;
+    border-radius: 8px;
+    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+  }
+   .column-item {
+     display: flex;
+     align-items: center;
+     justify-content: space-between;
+     padding: 8px;
+     border: 1px solid #ddd;
+     background: #f9f9f9;
+     margin-bottom: 5px;
+     cursor: grab;
+   }
+
+  .drag-handle {
+    cursor: grab;
+  }
+  /* 自定义列按钮的样式 */
+  .column-button-container {
+    text-align: right; /* 使按钮右对齐 */
+    margin-bottom: 10px; /* 为按钮和表格之间增加间距 */
+  }
+
+  .custom-column-button {
+    background-color: #409EFF;
+    color: black;
+    padding: 10px 20px;
+    border-radius: 5px;
+    margin-right: 10px; /* 如果有多个按钮,确保按钮之间有间距 */
+  }
+
+  /* 表格区域的样式 */
+  .student-section {
+    padding: 20px;
+  }
+
+  .el-table {
+    margin-top: 20px; /* 为表格添加顶部间距 */
+  }
+
+  .el-table-column {
+    /* 让列文本超出时显示省略号 */
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+  }
+
+  .el-table-column:hover {
+    cursor: pointer;
+  }
+  .no-wrap-column .cell {
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    text-align: center; /* 使列内容居中 */
+  }
+  .advanced-search {
+    margin-bottom: 10px;
+    padding: 15px;
+  }
+  .button-group {
+    display: flex;
+    justify-content: flex-end;
+    width: 100%;
+  }
+
+  /* 让按钮默认显示 */
+  .el-button {
+    opacity: 1; /* 确保默认状态可见 */
+    color: #606266; /* 默认文字颜色 */
+    border-color: #dcdfe6; /* 默认边框颜色 */
+    background-color: #f5f7fa; /* 默认背景色 */
+    transition: all 0.3s; /* 添加动画过渡 */
+  }
+
+  /* 鼠标悬停时高亮 */
+  .el-button:hover {
+    color: #409eff !important; /* 文字变蓝 */
+    border-color: #409eff !important; /* 边框变蓝 */
+    background-color: #ecf5ff !important; /* 背景变浅蓝 */
+  }
+
+  /* “展开/收起” 按钮特殊处理 */
+  .el-button[type="text"] {
+    background: none;
+    border: none;
+    color: #606266;
+  }
+
+  /* 鼠标悬停时高亮 */
+  .el-button[type="text"]:hover {
+    color: #409eff !important;
+  }
+  .el-form-item-ellipsis .el-input__inner,
+  .el-form-item-ellipsis .el-select .el-input__inner {
+    text-align: center; /* 输入框内容居中对齐 */
+  }
+
+  /* 控制 label 长度过长时显示省略号 */
+  .el-form-item-ellipsis .el-form-item__label {
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    width: 100%; /* 确保标签可以适配宽度 */
+    text-align: right;
+    vertical-align: middle;
+    float: left;
+    font-size: 14px;
+    color: #606266;
+    line-height: 40px;
+    padding: 0 10px 0 0;
+    -webkit-box-sizing: border-box;
+    box-sizing: border-box;
+    cursor: pointer;
+  }
+
+  /* 直播信息整体布局 */
+  .live-info {
+    display: flex;
+    align-items: center;
+  }
+
+  /* 直播封面图 */
+  .live-cover {
+    width: 80px;
+    height: 80px;
+    object-fit: cover;
+    border-radius: 6px;
+    margin-right: 10px;
+  }
+
+  /* 直播名称 + 时间 */
+  .live-text {
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+  }
+
+
+  /* 直播时间 */
+  .live-time {
+    font-size: 12px;
+    color: #888;
+    margin-top: 4px;
+  }
+
+  /* 直播状态 */
+  .status-container {
+    display: flex;
+    align-items: center;
+  }
+
+  /* 状态圆点 */
+  .status-dot {
+    width: 8px;
+    height: 8px;
+    border-radius: 50%;
+    display: inline-block;
+    margin-right: 6px;
+  }
+  .live-name-input .el-input__inner {
+    white-space: normal;  /* 允许文本换行 */
+    word-wrap: break-word; /* 长文本自动换行 */
+    padding-left: 10px;
+  }
+
+  .live-name-tag {
+    margin-right: 5px;
+    display: inline-block; /* 确保标签显示为块级元素 */
+  }
+  .flex-container {
+    display: flex;
+    align-items: center;
+    gap: 10px; /* 调整 label 与输入框间距 */
+    width: 90%;
+  }
+
+  .ellipsis-label .el-form-item__label {
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    max-width: 80px; /* 你可以调整这个值 */
+    display: block;
+    padding: 0 10px 0 0;
+  }
+
+  .full-width-picker {
+    flex: 1; /* 让日期选择器填充剩余空间 */
+  }
+
+</style>
+

+ 659 - 0
src/views/live/liveData/index.vue

@@ -0,0 +1,659 @@
+<template>
+  <div class="el-container-md">
+    <!-- 数据统计指标展示区域 -->
+    <el-card class="statistics-card" shadow="never">
+      <el-row :gutter="20">
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">累计观看人数</div>
+            <div class="statistics-value">{{ statisticsData.totalViewers || 0 }}</div>
+          </div>
+        </el-col>
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">
+              累计完课人数
+              <el-popover placement="top" width="200" trigger="click">
+                <div>
+                  <el-input-number v-model="completeWatchTime" :min="0" :precision="0" placeholder="看课时长(分钟)" style="width: 100%;"></el-input-number>
+                  <el-button type="primary" size="mini" style="width: 100%; margin-top: 10px;" @click="updateCompleteWatchTime('total')">确定</el-button>
+                </div>
+                <el-button slot="reference" size="mini" type="text" icon="el-icon-setting" style="margin-left: 5px;">设置</el-button>
+              </el-popover>
+            </div>
+            <div class="statistics-value">{{ statisticsData.totalCompletedCourses || 0 }}</div>
+          </div>
+        </el-col>
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">直播观看人数</div>
+            <div class="statistics-value">{{ statisticsData.liveViewers || 0 }}</div>
+          </div>
+        </el-col>
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">
+              直播完课人数
+              <el-popover placement="top" width="200" trigger="click">
+                <div>
+                  <el-input-number v-model="liveCompleteWatchTime" :min="0" :precision="0" placeholder="看课时长(分钟)" style="width: 100%;"></el-input-number>
+                  <el-button type="primary" size="mini" style="width: 100%; margin-top: 10px;" @click="updateCompleteWatchTime('live')">确定</el-button>
+                </div>
+                <el-button slot="reference" size="mini" type="text" icon="el-icon-setting" style="margin-left: 5px;">设置</el-button>
+              </el-popover>
+            </div>
+            <div class="statistics-value">{{ statisticsData.liveCompletedCourses || 0 }}</div>
+          </div>
+        </el-col>
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">回放观看人数</div>
+            <div class="statistics-value">{{ statisticsData.playbackViewers || 0 }}</div>
+          </div>
+        </el-col>
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">
+              回放完课人数
+              <el-popover placement="top" width="200" trigger="click">
+                <div>
+                  <el-input-number v-model="replayCompleteWatchTime" :min="0" :precision="0" placeholder="看课时长(分钟)" style="width: 100%;"></el-input-number>
+                  <el-button type="primary" size="mini" style="width: 100%; margin-top: 10px;" @click="updateCompleteWatchTime('replay')">确定</el-button>
+                </div>
+                <el-button slot="reference" size="mini" type="text" icon="el-icon-setting" style="margin-left: 5px;">设置</el-button>
+              </el-popover>
+            </div>
+            <div class="statistics-value">{{ statisticsData.playbackCompletedCourses || 0 }}</div>
+          </div>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20" style="margin-top: 20px;">
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">直播峰值</div>
+            <div class="statistics-value">{{ statisticsData.livePeak || 0 }}</div>
+          </div>
+        </el-col>
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">直播平均时长</div>
+            <div class="statistics-value">{{ formatDuration(statisticsData.liveAvgDuration) }}</div>
+          </div>
+        </el-col>
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">回放平均时长</div>
+            <div class="statistics-value">{{ formatDuration(statisticsData.playbackAvgDuration) }}</div>
+          </div>
+        </el-col>
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">GMV</div>
+            <div class="statistics-value">¥{{ statisticsData.gmv || 0 }}</div>
+          </div>
+        </el-col>
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">付费人数</div>
+            <div class="statistics-value">{{ statisticsData.paidUsers || 0 }}</div>
+          </div>
+        </el-col>
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">付费单数</div>
+            <div class="statistics-value">{{ statisticsData.paidOrders || 0 }}</div>
+          </div>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20" style="margin-top: 20px;">
+        <el-col :span="4">
+          <div class="statistics-item">
+            <div class="statistics-title">销量统计</div>
+            <div class="statistics-value">{{ statisticsData.salesCount || 0 }}</div>
+          </div>
+        </el-col>
+      </el-row>
+    </el-card>
+
+    <!-- 筛选条件区域 -->
+    <el-form :model="queryParams" class="live-data-css" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
+      <el-form-item label="直播名称" prop="liveName">
+        <el-input
+          v-model="queryParams.liveName"
+          placeholder="请输入直播名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="观看类型" prop="watchType">
+        <el-select v-model="queryParams.watchType" placeholder="请选择观看类型" clearable size="small">
+          <el-option label="直播" value="live"></el-option>
+          <el-option label="回放" value="replay"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="完课状态" prop="completeStatus">
+        <el-select v-model="queryParams.completeStatus" placeholder="请选择完课状态" clearable size="small">
+          <el-option label="已完课" value="1"></el-option>
+          <el-option label="未完课" value="0"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="付费状态" prop="payStatus">
+        <el-select v-model="queryParams.payStatus" placeholder="请选择付费状态" clearable size="small">
+          <el-option label="已付费" value="1"></el-option>
+          <el-option label="未付费" value="0"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="观看时长" prop="watchDuration">
+        <el-input-number
+          v-model="queryParams.watchDuration"
+          :min="0"
+          :precision="0"
+          placeholder="观看时长(分钟)"
+          size="small"
+        ></el-input-number>
+      </el-form-item>
+      <el-form-item label="时间范围" prop="dateRange">
+        <el-date-picker
+          v-model="dateRange"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          size="small"
+          value-format="yyyy-MM-dd HH:mm:ss"
+        ></el-date-picker>
+      </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>
+
+    <!-- 操作工具栏 -->
+    <div class="selection-toolbar">
+      <el-checkbox :indeterminate="isIndeterminate" v-model="allChecked" @change="toggleSelectAll">
+        {{ multipleSelection.length > 0 ? `已选 ${multipleSelection.length} 条` : '选中本页' }}
+      </el-checkbox>
+<!--      <el-button plain size="mini" @click="handleAutoTag">自动打标签</el-button>-->
+<!--      <el-button plain size="mini" @click="handleAutoRemark">自动备注</el-button>-->
+      <el-button plain type="primary" size="mini" icon="el-icon-download" :loading="exportLoading" @click="handleExport">导出</el-button>
+    </div>
+
+    <!-- 数据表格 -->
+    <el-table
+      ref="dataTable"
+      :data="dataList"
+      style="width: 100%"
+      v-loading="loading"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="55"></el-table-column>
+      <el-table-column type="index" label="序号" width="55" align="center"></el-table-column>
+      <el-table-column prop="liveName" label="直播间名称" min-width="160" show-overflow-tooltip></el-table-column>
+      <el-table-column prop="liveType" label="直播类型" width="100" align="center">
+        <template slot-scope="scope">
+          <el-tag type="danger" v-if="scope.row.liveType == 1">直播</el-tag>
+          <el-tag type="success" v-else-if="scope.row.liveType == 2">录播</el-tag>
+          <el-tag v-else-if="scope.row.liveType == 3">直播回放</el-tag>
+          <span v-else>-</span>
+        </template>
+      </el-table-column>
+      <el-table-column prop="status" label="状态" width="100" align="center">
+        <template slot-scope="scope">
+          <el-tag type="info" v-if="scope.row.status == 1">未开始</el-tag>
+          <el-tag type="warning" v-else-if="scope.row.status == 2">进行中</el-tag>
+          <el-tag type="success" v-else-if="scope.row.status == 3">已结束</el-tag>
+          <span v-else>-</span>
+        </template>
+      </el-table-column>
+      <el-table-column prop="startTime" label="开始时间" width="180" align="center"></el-table-column>
+      <el-table-column prop="finishTime" label="结束时间" width="180" align="center"></el-table-column>
+      <el-table-column prop="totalViewers" label="累计观看" width="110" align="center"></el-table-column>
+      <el-table-column prop="liveViewers" label="直播观看" width="110" align="center"></el-table-column>
+      <el-table-column prop="playbackViewers" label="回放观看" width="110" align="center"></el-table-column>
+      <el-table-column prop="liveAvgDuration" label="直播平均时长" width="140" align="center">
+        <template slot-scope="scope">{{ formatDuration(scope.row.liveAvgDuration) }}</template>
+      </el-table-column>
+      <el-table-column prop="playbackAvgDuration" label="回放平均时长" width="140" align="center">
+        <template slot-scope="scope">{{ formatDuration(scope.row.playbackAvgDuration) }}</template>
+      </el-table-column>
+      <el-table-column prop="totalCompletedCourses" label="累计完课" width="110" align="center"></el-table-column>
+      <el-table-column prop="liveCompletedCourses" label="直播完课" width="110" align="center"></el-table-column>
+      <el-table-column prop="playbackCompletedCourses" label="回放完课" width="110" align="center"></el-table-column>
+      <el-table-column prop="gmv" label="GMV" width="120" align="center">
+        <template slot-scope="scope">¥{{ scope.row.gmv || 0 }}</template>
+      </el-table-column>
+      <el-table-column prop="paidUsers" label="付费人数" width="100" align="center"></el-table-column>
+      <el-table-column prop="paidOrders" label="付费单数" width="100" align="center"></el-table-column>
+      <el-table-column prop="salesCount" label="销量统计" width="100" align="center"></el-table-column>
+      <el-table-column label="操作" width="120" fixed="right">
+        <template slot-scope="scope">
+          <el-button type="text" size="small" @click="handleViewDetail(scope.row)">查看详情</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页组件 -->
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+      style="margin-top: 20px;"
+    />
+
+    <!-- 自动打标签弹窗 -->
+    <el-dialog
+      title="自动打标签"
+      :visible.sync="tagDialogVisible"
+      width="600px"
+      :close-on-click-modal="false"
+    >
+      <el-form :model="tagForm" label-width="120px">
+        <el-form-item label="打标签规则">
+          <el-checkbox-group v-model="tagForm.rules">
+            <el-checkbox label="liveComplete">直播完课</el-checkbox>
+            <el-checkbox label="replayComplete">回放完课</el-checkbox>
+            <el-checkbox label="pay">付费行为</el-checkbox>
+          </el-checkbox-group>
+        </el-form-item>
+        <el-form-item label="标签名称">
+          <el-input v-model="tagForm.tagName" placeholder="请输入标签名称"></el-input>
+        </el-form-item>
+        <el-form-item label="备注格式">
+          <el-radio-group v-model="tagForm.remarkFormat">
+            <el-radio label="time">时间—行为(如:2024-01-01—直播完课)</el-radio>
+            <el-radio label="simple">仅行为(如:直播完课)</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="tagDialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="confirmAutoTag">确 定</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 自动备注弹窗 -->
+    <el-dialog
+      title="自动备注"
+      :visible.sync="remarkDialogVisible"
+      width="600px"
+      :close-on-click-modal="false"
+    >
+      <el-form :model="remarkForm" label-width="120px">
+        <el-form-item label="备注规则">
+          <el-checkbox-group v-model="remarkForm.rules">
+            <el-checkbox label="liveComplete">直播完课</el-checkbox>
+            <el-checkbox label="replayComplete">回放完课</el-checkbox>
+            <el-checkbox label="pay">付费行为</el-checkbox>
+          </el-checkbox-group>
+        </el-form-item>
+        <el-form-item label="备注格式">
+          <el-radio-group v-model="remarkForm.remarkFormat">
+            <el-radio label="time">时间—行为(如:2024-01-01—直播完课)</el-radio>
+            <el-radio label="simple">仅行为(如:直播完课)</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="备注位置">
+          <el-radio-group v-model="remarkForm.position">
+            <el-radio :label="1">添加在最前面</el-radio>
+            <el-radio :label="2">添加在最后面</el-radio>
+            <el-radio :label="3">替换所有备注</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="remarkDialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="confirmAutoRemark">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveData, exportLiveData, autoTagAndRemark, dashboardData } from "@/api/live/liveData";
+import { batchUpdateExternalContactNotes } from "@/api/qw/externalContact";
+import { addTag } from "@/api/qw/externalContact";
+
+export default {
+  name: "LiveData",
+  data() {
+    return {
+      liveId: '',
+      loading: true,
+      exportLoading: false,
+      showSearch: true,
+      dataList: [],
+      total: 0,
+      multipleSelection: [],
+      allChecked: false,
+      isIndeterminate: false,
+      dateRange: [],
+      // 统计数据
+      statisticsData: {
+        gmv: 0,
+        liveAvgDuration: 0,
+        liveCompletedCourses: 0,
+        livePeak: 0,
+        liveViewers: 0,
+        paidOrders: 0,
+        paidUsers: 0,
+        playbackAvgDuration: 0,
+        playbackCompletedCourses: 0,
+        playbackViewers: 0,
+        salesCount: 0,
+        totalCompletedCourses: 0,
+        totalViewers: 1
+      },
+      // 完课时长设置
+      completeWatchTime: 0,
+      liveCompleteWatchTime: 0,
+      replayCompleteWatchTime: 0,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null,
+        liveName: null,
+        watchType: null,
+        completeStatus: null,
+        payStatus: null,
+        watchDuration: null,
+        startTime: null,
+        endTime: null
+      },
+      // 打标签弹窗
+      tagDialogVisible: false,
+      tagForm: {
+        rules: [],
+        tagName: '',
+        remarkFormat: 'time'
+      },
+      // 备注弹窗
+      remarkDialogVisible: false,
+      remarkForm: {
+        rules: [],
+        remarkFormat: 'time',
+        position: 1
+      }
+    };
+  },
+  created() {
+    this.liveId = this.$route.query.liveId;
+    this.queryParams.liveId = this.liveId;
+
+    this.getList();
+  },
+  methods: {
+    /** 获取统计数据 */
+    getStatistics() {
+      if (!this.liveId) return;
+      dashboardData(this.liveId).then(response => {
+        if (response.code === 200) {
+          this.statisticsData = response.data || {};
+        }
+      });
+    },
+    /** 获取列表数据 */
+    getList() {
+      this.loading = true;
+      // 处理时间范围
+      if (this.dateRange && this.dateRange.length === 2) {
+        this.queryParams.startTime = this.dateRange[0];
+        this.queryParams.endTime = this.dateRange[1];
+      } else {
+        this.queryParams.startTime = null;
+        this.queryParams.endTime = null;
+      }
+      listLiveData(this.queryParams).then(response => {
+        if (response.code === 200) {
+          this.statisticsData = response.data || {};
+          this.dataList = response.list || [];
+          this.total = response.total || 0;
+        }
+        this.loading = false;
+      }).catch(() => {
+        this.loading = false;
+      });
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.dateRange = [];
+      this.$refs.queryForm.resetFields();
+      this.handleQuery();
+    },
+    /** 全选或取消全选 */
+    toggleSelectAll(val) {
+      if (val) {
+        this.toggleSelection(this.dataList);
+      } else {
+        this.toggleSelection();
+      }
+    },
+    toggleSelection(rows) {
+      if (rows) {
+        rows.forEach(row => {
+          this.$refs.dataTable.toggleRowSelection(row);
+        });
+      } else {
+        this.$refs.dataTable.clearSelection();
+      }
+    },
+    /** 多选框选中数据 */
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+      this.allChecked = val.length === this.dataList.length;
+      this.isIndeterminate = val.length > 0 && val.length < this.dataList.length;
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      if (this.dateRange && this.dateRange.length === 2) {
+        this.queryParams.startTime = this.dateRange[0];
+        this.queryParams.endTime = this.dateRange[1];
+      } else {
+        this.queryParams.startTime = null;
+        this.queryParams.endTime = null;
+      }
+      this.$confirm('是否确认导出所有直播数据?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportLiveData(this.queryParams);
+      }).then(response => {
+        if (response.code === 200) {
+          this.download(response.msg);
+        }
+        this.exportLoading = false;
+      }).catch(() => {
+        this.exportLoading = false;
+      });
+    },
+    /** 自动打标签 */
+    // handleAutoTag() {
+    //   if (this.multipleSelection.length === 0) {
+    //     this.$message.warning('请选择要打标签的数据');
+    //     return;
+    //   }
+    //   this.tagDialogVisible = true;
+    // },
+    /** 确认自动打标签 */
+    confirmAutoTag() {
+      if (this.tagForm.rules.length === 0) {
+        this.$message.warning('请选择打标签规则');
+        return;
+      }
+      const userIds = this.multipleSelection.map(item => item.userId).filter(id => id);
+      if (userIds.length === 0) {
+        this.$message.warning('所选数据中没有有效的用户ID');
+        return;
+      }
+      const data = {
+        userIds: userIds,
+        rules: this.tagForm.rules,
+        tagName: this.tagForm.tagName,
+        remarkFormat: this.tagForm.remarkFormat,
+        liveId: this.liveId
+      };
+      autoTagAndRemark(data).then(response => {
+        if (response.code === 200) {
+          this.$message.success('打标签成功');
+          this.tagDialogVisible = false;
+          this.tagForm = {
+            rules: [],
+            tagName: '',
+            remarkFormat: 'time'
+          };
+          this.getList();
+        }
+      });
+    },
+    /** 自动备注 */
+    // handleAutoRemark() {
+    //   if (this.multipleSelection.length === 0) {
+    //     this.$message.warning('请选择要备注的数据');
+    //     return;
+    //   }
+    //   this.remarkDialogVisible = true;
+    // },
+    /** 确认自动备注 */
+    confirmAutoRemark() {
+      if (this.remarkForm.rules.length === 0) {
+        this.$message.warning('请选择备注规则');
+        return;
+      }
+      const userIds = this.multipleSelection.map(item => item.userId).filter(id => id);
+      if (userIds.length === 0) {
+        this.$message.warning('所选数据中没有有效的用户ID');
+        return;
+      }
+      // 生成备注内容
+      let notes = '';
+      const now = new Date();
+      const dateStr = now.getFullYear() + '-' +
+        String(now.getMonth() + 1).padStart(2, '0') + '-' +
+        String(now.getDate()).padStart(2, '0');
+
+      this.remarkForm.rules.forEach((rule, index) => {
+        let ruleText = '';
+        if (rule === 'liveComplete') {
+          ruleText = '直播完课';
+        } else if (rule === 'replayComplete') {
+          ruleText = '回放完课';
+        } else if (rule === 'pay') {
+          ruleText = '付费行为';
+        }
+
+        if (this.remarkForm.remarkFormat === 'time') {
+          notes += (index > 0 ? ';' : '') + dateStr + '—' + ruleText;
+        } else {
+          notes += (index > 0 ? ';' : '') + ruleText;
+        }
+      });
+
+      const data = {
+        userIds: userIds,
+        notes: notes,
+        type: this.remarkForm.position,
+        nameType: 3, // 不添加客户名称
+        filter: false
+      };
+
+      batchUpdateExternalContactNotes(data).then(response => {
+        if (response.code === 200) {
+          this.$message.success('备注成功');
+          this.remarkDialogVisible = false;
+          this.remarkForm = {
+            rules: [],
+            remarkFormat: 'time',
+            position: 1
+          };
+          this.getList();
+        }
+      });
+    },
+    /** 查看详情 */
+    handleViewDetail(row) {
+      // 可以跳转到详情页面或打开详情弹窗
+      this.$message.info('查看详情功能待实现');
+    },
+    /** 格式化时长 */
+    formatDuration(seconds) {
+      if (!seconds) return '00:00:00';
+      const hours = Math.floor(seconds / 3600);
+      const minutes = Math.floor((seconds % 3600) / 60);
+      const secs = seconds % 60;
+      return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
+    },
+    /** 更新完课时长设置 */
+    updateCompleteWatchTime(type) {
+      // 这里可以调用API保存设置
+      let watchTime = 0;
+      if (type === 'total') {
+        watchTime = this.completeWatchTime;
+      } else if (type === 'live') {
+        watchTime = this.liveCompleteWatchTime;
+      } else if (type === 'replay') {
+        watchTime = this.replayCompleteWatchTime;
+      }
+      // 更新查询参数并重新获取数据
+      this.queryParams.completeWatchTime = watchTime;
+      // this.getStatistics();
+      this.getList();
+      this.$message.success('设置成功');
+    }
+  }
+};
+</script>
+
+<style scoped>
+.statistics-card {
+  margin-bottom: 20px;
+}
+
+.statistics-item {
+  text-align: center;
+  padding: 15px;
+  background: #f5f7fa;
+  border-radius: 4px;
+}
+
+.statistics-title {
+  font-size: 14px;
+  color: #606266;
+  margin-bottom: 10px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.statistics-value {
+  font-size: 24px;
+  font-weight: bold;
+  color: #303133;
+}
+
+.selection-toolbar {
+  display: flex;
+  align-items: center;
+  margin-bottom: 10px;
+  padding-left: 10px;
+}
+
+.selection-toolbar .el-checkbox {
+  margin-right: 10px;
+}
+
+.live-data-css {
+  padding-left: 10px;
+  padding-top: 30px;
+}
+</style>

+ 425 - 0
src/views/live/liveGoods/index.vue

@@ -0,0 +1,425 @@
+<template>
+  <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-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="请输入直播间状态"
+          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>
+
+    <div class="selection-toolbar">
+      <el-checkbox :indeterminate="isIndeterminate" v-model="allChecked" @change="toggleSelectAll">
+        {{ multipleSelection.length > 0 ? `已选 ${multipleSelection.length} 条` : '选中本页' }}
+      </el-checkbox>
+      <el-button  plain size="mini" @click="handleShelf">上架</el-button>
+      <el-button  plain size="mini" @click="handleUnshelf">下架</el-button>
+      <el-button  plain size="mini" @click="handleDeleteSelected">删除</el-button>
+      <el-button  plain type="mini" icon="el-icon-plus" @click="handleAddLiveGoods">添加商品</el-button>
+    </div>
+    <el-table
+      ref="goodTable"
+      :data="goodsLiveList"
+      style="width: 100%"
+      v-loading="loading"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="55"></el-table-column>
+      <!-- 题干列:显示试题的主要内容 -->
+      <el-table-column
+        prop="goodsId"
+        label="商品id"
+        show-overflow-tooltip
+      ></el-table-column>
+
+      <el-table-column
+        label="商品图片"
+      >
+        <template slot-scope="scope">
+          <img
+            :src="scope.row.imgUrl"
+            style="display: block; max-width: 100%; width: 100px; height: 100px"
+          />
+        </template>
+
+      </el-table-column>
+
+      <el-table-column
+        prop="productName"
+        label="商品名称"
+      ></el-table-column>
+
+      <el-table-column
+        prop="price"
+        label="价格"
+      ></el-table-column>
+
+      <el-table-column
+        prop="stock"
+        label="库存"
+      ></el-table-column>
+
+      <el-table-column
+        prop="sales"
+        label="销量"
+      ></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 == 0">下架</el-tag>
+        </template>
+      </el-table-column>
+
+      <!-- 操作列:包含编辑和删除按钮 -->
+      <el-table-column
+        label="操作"
+        width="180"
+        fixed="right"
+      >
+        <template slot-scope="scope">
+          <el-button
+            type="text"
+            size="small"
+            style="color: #F56C6C;"
+            @click="handleGoodDelete(scope.row)"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页组件:用于分页展示试题列表 -->
+    <pagination
+      v-show="goodsLiveTotal > 0"
+      :total="goodsLiveTotal"
+      :page.sync="goodsParams.pageNum"
+      :limit.sync="goodsParams.pageSize"
+      @pagination="getLiveGoodsList"
+      style="margin-top: 20px;"
+    />
+
+    <!-- 添加商品弹窗 -->
+    <el-dialog
+      title="添加商品"
+      :visible.sync="goodsDialogVisible"
+      width="800px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
+      <div class="dialog-content">
+        <div style="text-align: right; margin-bottom: 20px;">
+          <el-input
+            v-model="searchTitle"
+            placeholder="请输入产品名称"
+            style="width: 300px;"
+            @input="handleGoodsSearch"
+          ></el-input>
+        </div>
+
+        <el-table
+          :data="goodsList"
+          style="width: 100%"
+          v-loading="goodsLoading"
+          @selection-change="handleGoodsChange"
+          @row-click="handleGoodsRowClick"
+          row-key="id"
+        >
+          <el-table-column
+            type="selection"
+            width="55"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="storeName"
+            label="商铺名称"
+            class-name="clickable-column"
+          ></el-table-column>
+          <el-table-column
+            prop="productName"
+            label="产品"
+            class-name="clickable-column"
+          ></el-table-column>
+          <el-table-column
+            prop="price"
+            label="价格"
+            class-name="clickable-column"
+          ></el-table-column>
+          <el-table-column
+            prop="stock"
+            label="库存"
+            class-name="clickable-column"
+          ></el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="goodsTotal > 0"
+          :total="goodsTotal"
+          :page.sync="queryGoodParams.pageNum"
+          :limit.sync="queryGoodParams.pageSize"
+          @pagination="getStoreProductLists"
+          style="margin-top: 20px;"
+        />
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <div style="display: flex; justify-content: space-between; align-items: center;">
+          <span class="selected-count">当前已选择 <span style="color: #00BFFF; font-style: italic;">{{ selectedGoods.length }}</span> 商品</span>
+          <div>
+            <el-button @click="goodsDialogVisible = false">取 消</el-button>
+            <el-button type="primary" @click="confirmAddGoods">确 定</el-button>
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {addLiveGoods, delLiveGoods, listLiveGoods, listStoreProduct, handleShelfOrUn, handleDeleteSelected} from "@/api/live/liveGoods";
+
+export default {
+  data() {
+    return {
+      liveId: '',
+      loading: true,
+      searchTitle: '',
+      queryGoodParams: {
+        pageNum: 1,
+        pageSize: 10,
+        productName: null,
+        liveId: null
+      },
+      // 显示搜索条件
+      showSearch: true,
+      goodsLiveList: [],
+      goodsLiveTotal: 0,
+      goodsParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null
+      },
+      goodsList: [],
+      goodsTotal: 0,
+      selectedGoods: [],
+      goodsLoading: false,
+      goodsDialogVisible: false,
+      multipleSelection: [],
+      allChecked: false,
+      isIndeterminate: false,
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        keywords: null,
+        status: null,
+        liveId: null,
+        desc: null,
+        createTime: null,
+        updateTime: null,
+      },
+    };
+  },
+  created() {
+    this.liveId = this.$route.query.liveId
+    this.goodsParams.liveId = this.liveId
+    this.queryParams.liveId = this.liveId
+    this.getLiveGoodsList();
+  },
+  methods: {
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.loading = true
+      listLiveGoods(this.queryParams).then(response => {
+        this.goodsLiveList = response.rows
+        this.goodsLiveTotal = response.total
+        this.loading = false
+      })
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.$refs.queryForm.resetFields();
+    },
+    handleShelf(){
+      this.handleShelfOrUn(1)
+    },
+    handleUnshelf(){
+      this.handleShelfOrUn(0)
+    },
+    handleShelfOrUn(type){
+      if (this.multipleSelection.length > 0) {
+        const goodsList = this.getSelectedList();
+        handleShelfOrUn({"goodsIds":goodsList,"status":type}).then(res=>{
+          this.dealResult(res)
+        })
+      } else {
+        this.$message.info("请选择下架商品!")
+      }
+    },
+    handleDeleteSelected(){
+      if (this.multipleSelection.length > 0) {
+        const goodsList = this.getSelectedList();
+        handleDeleteSelected({"goodsIds":goodsList}).then(res=>{
+          this.dealResult(res)
+        })
+      } else {
+        this.$message.info("请选择被删除的商品!")
+      }
+    },
+    dealResult(res){
+      if (res.code == 200) {
+        this.getLiveGoodsList();
+        this.$refs.goodTable.clearSelection();
+      } else {
+        this.$message.error(res.msg);
+      }
+    },
+    getSelectedList(){
+      var goodsList = []
+      this.multipleSelection.forEach(item => {
+        goodsList.push(item.goodsId);
+      })
+      return goodsList;
+    },
+    // 全选或取消全选
+    toggleSelectAll(val) {
+      this.checked = val; // 更新 checkbox 的状态
+      if (val) {
+        // 如果 checkbox 被选中,则全选
+        this.toggleSelection(this.goodsLiveList);
+      } else {
+        // 如果 checkbox 被取消选中,则取消全选
+        this.toggleSelection();
+      }
+    },
+    toggleSelection(rows) {
+      if (rows && !this.isIndeterminate) {
+        rows.forEach(row => {
+          this.$refs.goodTable.toggleRowSelection(row);
+        });
+      } else {
+        this.$refs.goodTable.clearSelection();
+      }
+    },
+    // 多选框选中数据
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+      // 根据选择项的数量更新 checkbox 的状态
+      this.allChecked = val.length === this.goodsLiveList.length;
+      this.isIndeterminate = val.length > 0 && val.length < this.goodsLiveList.length;
+    },
+
+    getLiveGoodsList() {
+      this.loading = true
+      listLiveGoods(this.goodsParams).then(response => {
+        this.goodsLiveList = response.rows
+        this.goodsLiveTotal = response.total
+        this.loading = false
+      })
+    },
+    handleAddLiveGoods(){
+      this.goodsDialogVisible = true;
+      this.getStoreProductLists()
+    },
+    handleGoodsSearch(){
+      this.queryGoodParams.pageNum = 1
+      this.queryGoodParams.productName = this.searchTitle
+      this.getStoreProductLists()
+    },
+    handleGoodsChange(goods) {
+      this.selectedGoods = goods
+    },
+    confirmAddGoods(){
+      if (this.selectedGoods.length === 0) {
+        this.$message({
+          message: '请选择要添加的商品',
+          type: 'warning'
+        })
+        return
+      }
+      addLiveGoods({
+        liveId: this.liveId,
+        productsId: this.selectedGoods.map(item => item.productId).join(',')
+      }).then(response => {
+        this.goodsDialogVisible = false
+        this.getLiveGoodsList()
+      })
+    },
+    handleGoodDelete(row){
+      delLiveGoods(row.goodsId).then(response => {
+        this.getLiveGoodsList()
+      })
+    },
+    /** 处理行点击事件 */
+    handleGoodsRowClick(row, column) {
+      // 如果点击的是复选框列,不进行处理
+      if (column.type === 'selection') {
+        return
+      }
+
+      // 获取表格实例
+      const table = this.$refs.goodsTable[0]
+      if (!table) {
+        return
+      }
+
+      // 判断当前行是否已经被选中
+      const isSelected = this.selectedGoods.some(item => item.id === row.id)
+
+      // 切换选中状态
+      table.toggleRowSelection(row, !isSelected)
+    },
+    getStoreProductLists() {
+      this.queryGoodParams.liveId = this.liveId
+      listStoreProduct(this.queryGoodParams).then(response => {
+        this.goodsList = response.rows
+        this.goodsTotal = response.total
+        this.loading = false
+      })
+    }
+
+  }
+};
+</script>
+
+<style scoped>
+.selection-toolbar {
+  display: flex;
+  align-items: center;
+  margin-bottom: 10px;
+  padding-left: 10px;
+}
+
+.selection-toolbar .el-checkbox {
+  margin-right: 10px;
+}
+
+/* 调整 checkbox 内部输入框的对齐 */
+.selection-toolbar .el-checkbox .el-checkbox__inner {
+  top: 8px; /* 根据实际需求调整 */
+}
+
+.live-goods-css {
+  padding-left: 10px;
+  padding-top: 30px;
+}
+</style>

+ 795 - 0
src/views/live/liveLotteryConf/index.vue

@@ -0,0 +1,795 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="直播间ID" prop="liveId">
+        <el-input
+          v-model="queryParams.liveId"
+          placeholder="请输入直播间ID"
+          clearable
+          size="small"
+          :disabled="canLiveId"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="参与方式" prop="require">
+        <el-select v-model="queryParams.require" placeholder="请输入参与抽奖方式">
+          <el-option v-for="(item,index) in requireOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="抽奖状态" prop="require">
+        <el-select v-model="queryParams.lottery_status" placeholder="请输入参与抽奖方式">
+          <el-option v-for="(item,index) in lotteryStatusOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="抽奖标题" prop="desc">
+        <el-input
+          v-model="queryParams.desc"
+          placeholder="请输入描述"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="创建日期" prop="createTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.createTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择创建日期">
+        </el-date-picker>
+      </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">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:liveLotteryConf:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['live:liveLotteryConf: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:liveLotteryConf:remove']"
+        >删除</el-button>
+      </el-col>-->
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveLotteryConf:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveLotteryConfList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="抽奖ID" align="center" prop="lotteryId" />
+      <el-table-column label="操作商品" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button v-if="scope.row.lotteryStatus+'' === '0'" @click="handleUpdateProduct(scope.row)">编辑商品</el-button>
+          <el-button v-else @click="handleDetailProduct(scope.row)">查看商品</el-button>
+        </template>
+      </el-table-column>
+      <el-table-column label="直播间ID" align="center" prop="liveId" />
+      <el-table-column label="参与方式" align="center" prop="require" :formatter="requireFormatter"/>
+      <el-table-column label="抽奖状态" align="center" prop="lotteryStatus" :formatter="lotteryStatusFormatter"/>
+      <el-table-column label="配置" align="center" prop="requireConf" />
+      <el-table-column label="持续时间" align="center" prop="duration" />
+      <el-table-column label="抽奖标题" align="center" prop="desc" />
+      <el-table-column label="创建日期" align="center" prop="createTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+            style="margin-left: 10px"
+          >修改</el-button>
+          <!-- 开始 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'1')"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+          >开始</el-button>
+          <!-- 暂停 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'3')"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+          >暂停</el-button>
+          <!-- 结算 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'2')"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+          >结算</el-button>
+
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播抽奖配置对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="直播间ID" prop="liveId">
+          <el-input v-model="form.liveId" placeholder="请输入直播间ID"
+                    :disabled="canLiveId"/>
+        </el-form-item>
+        <el-form-item label="参与方式" prop="require">
+          <el-select v-model="form.require" placeholder="请输入参与抽奖方式">
+            <el-option v-for="(item,index) in requireOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="方式配置" prop="requireConf">
+          <el-input v-model="form.requireConf" placeholder="请输入参与抽奖方式" />
+          <span style="font-size: 10px; font-family: Arial,serif">当参与方式选择为“送礼参与”或“下单参与”时,此处填写商品ID及数量</span>
+        </el-form-item>
+        <el-form-item label="持续时间" prop="duration">
+          <el-input v-model="form.duration" placeholder="请输入持续时间 单位:分" />
+        </el-form-item>
+        <el-form-item label="抽奖标题" prop="desc">
+          <el-input v-model="form.desc" placeholder="请输入描述" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog :title="titleProduct" :visible.sync="openProduct" width="800px" append-to-body>
+      <el-form ref="form1" :model="form1" :rules="rules1" label-width="100px" :disabled="isDetail">
+        <!-- 基础信息 -->
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="抽奖ID" prop="lotteryId">
+              <el-input v-model="form1.lotteryId" placeholder="请输入抽奖ID" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+<!--            <el-form-item label="直播间ID" prop="liveId">
+              <el-input v-model="form1.liveId" placeholder="请输入直播间ID" />
+            </el-form-item>-->
+          </el-col>
+        </el-row>
+
+        <!-- 动态奖品配置 -->
+        <el-divider content-position="left">奖品配置</el-divider>
+
+        <el-card v-for="(prize, index) in form1.prizes" :key="index" class="prize-card" shadow="hover">
+          <div slot="header" class="prize-header">
+            <span><b>奖品等级 :{{ prize.prizeLevel }}</b></span>
+            <el-button
+              v-if="form1.prizes.length > 1"
+              @click="removePrize(index)"
+              type="danger"
+              icon="el-icon-delete"
+              size="mini"
+              circle
+            ></el-button>
+          </div>
+
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item
+                label="商品ID"
+                :prop="'prizes.' + index + '.productId'"
+                :rules="[{ required: true, message: '请输入商品', trigger: 'blur' }]">
+<!--                <el-input v-model="prize.productId" placeholder="请输入商品ID" />-->
+                <el-select
+                  v-model="prize.productId"
+                  filterable
+                  clearable
+                  remote
+                reserve-keyword
+                placeholder="请输入关键字搜索"
+                :remote-method="fetchProducts"
+                :loading="loadingProducts"
+                size="small"
+                style="width: 180px"
+                >
+                <el-option
+                  v-for="product in productOptions"
+                  :key="product.goodsId"
+                  :label="product.productName"
+                  :value="product.goodsId"
+                />
+                <span style="float: left">{{ product.goodsId }}</span>
+                <span style="margin-left: 30px ;">{{product.productName}}</span>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item
+                label="奖品等级"
+                :prop="'prizes.' + index + '.prizeLevel'"
+                :rules="[{ required: true, message: '请输入奖品等级', trigger: 'blur' }]">
+                <el-input v-model="prize.prizeLevel" placeholder="请输入奖品等级" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item
+                label="单奖数量"
+                :prop="'prizes.' + index + '.perLotteryNum'"
+                :rules="[
+                { required: true, message: '请输入单次中奖数量', trigger: 'blur' },
+                { type: 'number', message: '必须为数字值' }
+              ]">
+                <el-input-number
+                  v-model="prize.perLotteryNum"
+                  :min="1"
+                  :max="100"
+                  controls-position="right"
+                  placeholder="单次中奖数量" />
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item
+                label="奖励总份数"
+                :prop="'prizes.' + index + '.totalLots'"
+                :rules="[
+                { required: true, message: '请输入奖励总份数', trigger: 'blur' },
+                { type: 'number', message: '必须为数字值' }
+              ]">
+                <el-input-number
+                  v-model="prize.totalLots"
+                  :min="1"
+                  controls-position="right"
+                  placeholder="奖励总份数" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item
+                label="实发份数"
+                :prop="'prizes.' + index + '.totalSend'"
+                >
+                <el-input-number
+                  v-model="prize.totalSend"
+                  :min="0"
+                  :max="prize.totalLots"
+                  controls-position="right"
+                  placeholder="实际发放份数"
+                  :disabled="true"/>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-card>
+
+        <div class="add-prize-btn">
+          <el-button
+            @click="addPrize"
+            type="primary"
+            icon="el-icon-plus"
+            plain
+            size="small">
+            添加奖品配置
+          </el-button>
+        </div>
+      </el-form>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancel1">取 消</el-button>
+        <el-button type="primary" @click="submitForm1">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveLotteryConf, getLiveLotteryConf, delLiveLotteryConf, addLiveLotteryConf, updateLiveLotteryConf, exportLiveLotteryConf } from "@/api/live/liveLotteryConf";
+import LiveLotteryProductConf from '@/views/live/liveLotteryProductConf/index.vue'
+import {
+  listStoreProduct,
+  updateLiveLotteryProductConf
+} from '@/api/live/liveLotteryProductConf'
+import { listLiveGoods } from '@/api/live/liveGoods'
+
+export default {
+  name: "LiveLotteryConf",
+  components: { LiveLotteryProductConf },
+  data() {
+    return {
+      //字典
+      requireOptions: [],
+      // 抽奖状态
+      lotteryStatusOptions: [],
+      //加载商品
+      loadingProducts: false,
+      //
+      productOptions: [],
+      isDetail: false,
+      canLiveId:false,
+      //parentLiveId
+      parentLiveId : null,
+      liveId: null,
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播抽奖配置表格数据
+      liveLotteryConfList: [],
+      // 弹出层标题
+      title: "",
+      titleProduct: "编辑抽奖商品",
+      // 是否显示弹出层
+      open: false,
+      openProduct: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null,
+        require: null,
+        desc: null,
+        createTime: null,
+        lottery_status: null
+      },
+      //商品信息列表
+      productList: [],
+      // 商品信息
+      product: {
+        productId: null,
+        prizeLevel: null,
+        perLotteryNum: null,
+        totalLots: null,
+        totalSend: null
+      },
+      // 表单参数
+      form:{
+        lotteryId: '',
+        liveId: '',
+        require: '',
+        requireConf: '',
+        duration: null,
+        desc: null
+      },
+      // 表单参数
+      form1: {
+        liveId: '',
+        lotteryId: '',
+        prizes: [this.getDefaultPrize()]
+      },
+      // 表单校验
+      rules: {
+        liveId: [
+          { required: true, message: "直播间ID不能为空", trigger: "blur" }
+        ],
+        require: [
+          { required: true, message: "参与抽奖方式", trigger: "blur" }
+        ],
+        //如果require为2或3,requireConf不能为空
+        requireConf: [
+          { validator: this.validRequireConf,message: "当参与方式选择为“送礼参与”或“下单参与”时,对应的配置:送礼数量/指定商品Id及数量不能为空", trigger: "blur" }
+        ],
+        duration: [
+          { required: true, message: "持续时间 单位:分不能为空", trigger: "blur" }
+        ],
+        desc: [
+          { required: true, message: "描述不能为空", trigger: "blur" }
+        ],
+      },
+      //抽奖商品表单
+      rules1: {
+        lotteryId: [
+          { required: true, message: '请输入抽奖ID', trigger: 'blur' }
+        ],
+        liveId: [
+          { required: true, message: '请输入直播间ID', trigger: 'blur' }
+        ]
+      }
+    };
+  },
+  created() {
+    this.getDicts("sys_live_lottery_require").then(response => {
+      this.requireOptions = response.data;
+    });
+    this.getDicts("sys_live_lottery_status").then(response => {
+      this.lotteryStatusOptions = response.data;
+    });
+    this.liveId = this.$route.query.liveId;
+    this.parentLiveId = this.liveId;
+    this.queryParams.liveId = this.parentLiveId;
+    if(this.queryParams.liveId){
+      this.form.liveId = this.parentLiveId;
+      //设置查询条件直播间ID不可修改
+      this.canLiveId = true;
+    }
+    this.getList();
+  },
+  mounted() {
+    this.$watch(
+      () => this.form.require,
+      (newVal) => {
+        this.$refs.form.validateField('requireConf');
+      }
+    );
+  },
+  methods: {
+    async fetchProducts(query) {
+      if (!query) {
+        this.productOptions = [];
+        return;
+      }
+      const queryParam = {
+        liveId : this.liveId,
+        keywords: query
+      }
+      this.loadingProducts = true;
+      try {
+        listLiveGoods(queryParam).then(response => {
+          this.productOptions = response.rows;
+        })
+      } catch (err) {
+        console.error('查询商品失败:', err);
+        this.productOptions = [];
+      } finally {
+        this.loadingProducts = false;
+      }
+    },
+    // 获取默认奖品配置
+    getDefaultPrize() {
+      return {
+        productId: '',
+        prizeLevel: '',
+        perLotteryNum: 1,
+        totalLots: 1,
+        totalSend: 0
+      }
+    },
+    // 添加奖品配置
+    addPrize() {
+      this.form1.prizes.push(this.getDefaultPrize())
+    },
+
+    // 删除奖品配置
+    removePrize(index) {
+      if (this.form1.prizes.length <= 1) {
+        this.$message.warning('至少需要保留一个奖品配置')
+        return
+      }
+      this.form1.prizes.splice(index, 1)
+    },
+
+    requireFormatter(row, column) {
+      return this.selectDictLabel(this.requireOptions, row.require);
+    },
+    lotteryStatusFormatter(row, column) {
+      return this.selectDictLabel(this.lotteryStatusOptions, row.lotteryStatus);
+    },
+    validRequireConf(rule, value, callback) {
+      if(this.form.require+"" === "2" || this.form.require+"" === "3"){
+        if(!value){
+          callback(new Error());
+          return false;
+        }
+      }
+      callback();
+      return true;
+    },
+    /** 查询直播抽奖配置列表 */
+    getList() {
+      this.loading = true;
+      listLiveLotteryConf(this.queryParams).then(response => {
+        this.liveLotteryConfList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 取消
+    cancel1() {
+      this.openProduct = false;
+    },
+
+    // 重置表单
+    resetForm1() {
+      this.form1 = {
+        lotteryId: '',
+        liveId: '',
+        prizes: [this.getDefaultPrize()]
+      }
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        lotteryId: null,
+        liveId: null,
+        require: null,
+        requireConf: null,
+        duration: null,
+        desc: null
+      };
+      this.resetForm("form");
+      this.checkParentLiveId();
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.checkParentLiveId();
+      this.handleQuery();
+    },
+    //判断父页面传入参数
+    checkParentLiveId(){
+      if(this.parentLiveId){
+        this.form.liveId = this.parentLiveId;
+        this.queryParams.liveId = this.parentLiveId;
+      }
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.lotteryId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播抽奖配置";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const lotteryId = row.lotteryId || this.ids
+      //只能对未开始或暂停的抽奖进行修改
+      if(row.lotteryStatus+"" !== "0" && row.lotteryStatus+"" !== "3"){
+        this.msgError("只能对未开始或暂停的抽奖进行修改");
+        return;
+      }
+      getLiveLotteryConf(lotteryId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改直播抽奖配置";
+      });
+    },
+    /** 修改按钮操作 */
+    handleUpdateProduct(row) {
+      this.form1.lotteryId = row.lotteryId;
+      //如果状态为已结束,则不能修改
+      if(row.lotteryStatus+"" === "2"){
+        this.msgError("已结束的抽奖不能修改");
+        return;
+      }
+      this.openProduct = true;
+      this.isDetail = false;
+      listStoreProduct(row.lotteryId).then(response => {
+        this.form1 = response.data;
+        if(this.form1.prizes.length === 0)
+          this.form1.prizes = [this.getDefaultPrize()]
+        this.form1.liveId = row.liveId;
+      });
+    },
+    /** 详情按钮操作 */
+    handleDetailProduct(row) {
+      this.form1.lotteryId = row.lotteryId;
+      //如果状态为已结束,则不能修改
+      if(row.status+"" === "2"){
+        this.msgError("已结束的抽奖不能修改");
+        return;
+      }
+      this.openProduct = true;
+      this.isDetail = true;
+      listStoreProduct(row.lotteryId).then(response => {
+        this.form1 = response.data;
+        this.form1.liveId = row.liveId;
+      });
+    },
+    /** 抽奖状态修改 */
+    handleStatusChange(row, status) {
+      //结束的抽奖不能进行操作
+      if(row.lotteryStatus+"" === "2"){
+        this.msgError("已结束的抽奖不能进行操作");
+        return;
+      }
+      switch (status+"") {
+        case "1":
+          //只能对未开启的抽奖进行操作
+          if(row.lotteryStatus+"" !== "0" && row.lotteryStatus+"" !== "3"){
+            this.msgError("只能对未开启或暂停的抽奖进行开始操作");
+            return;
+          }
+          break;
+        case "2":
+          //只能对进行中或暂停的抽奖进行结算
+          if(row.lotteryStatus+"" !== "1" && row.lotteryStatus+"" !== "3"){
+            this.msgError("只能对进行中或暂停的抽奖进行结算");
+            return;
+          }
+          break;
+        case "3":
+          //只能对进行中的抽奖执行暂停操作
+          if(row.lotteryStatus+"" !== "1"){
+            this.msgError("只能对进行中的抽奖执行暂停操作");
+            return;
+          }
+          break;
+        default:
+          return;
+      }
+      const doLotteryParam = {
+        lotteryId: row.lotteryId,
+        lotteryStatus: status
+      };
+      updateLiveLotteryConf(doLotteryParam).then(response => {
+        if(response.code === 200){
+          this.$store.state.liveWs[this.liveId].sendWs("lottery",response.msg, row.lotteryId,this.liveId);
+          this.getList();
+          this.msgSuccess("修改成功");
+        }else{
+          this.msgError(response.msg);
+        }
+          this.open = false;
+        });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      console.log("this.submitForm()")
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.lotteryId != null) {
+            updateLiveLotteryConf(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addLiveLotteryConf(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    submitForm1() {
+      this.$refs["form1"].validate(valid => {
+        if (valid) {
+          updateLiveLotteryProductConf(this.form1).then(response => {
+            //200 成功
+            this.msgSuccess("保存成功");
+            this.openProduct = false;
+            this.resetForm1();
+          });
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      //如果抽奖状态不为0,则不能删除
+      if(row.lotteryStatus+"" !== "0"){
+        this.msgError("只能删除未开始的抽奖配置");
+        return;
+      }
+      const lotteryIds = row.lotteryId || this.ids;
+      this.$confirm('是否确认删除直播抽奖配置编号为"' + lotteryIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveLotteryConf(lotteryIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播抽奖配置数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveLotteryConf(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>
+<style scoped>
+.prize-card {
+  margin-bottom: 20px;
+}
+
+.prize-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.add-prize-btn {
+  margin-top: 10px;
+  text-align: center;
+}
+
+.dialog-footer {
+  text-align: right;
+}
+
+</style>

+ 386 - 0
src/views/live/liveLotteryProductConf/index.vue

@@ -0,0 +1,386 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="抽奖ID" prop="lotteryId">
+        <el-input
+          v-model="queryParams.lotteryId"
+          placeholder="请输入抽奖ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="直播间ID" prop="liveId">
+        <el-input
+          v-model="queryParams.liveId"
+          placeholder="请输入直播间ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="商品ID" prop="productId">
+        <el-input
+          v-model="queryParams.productId"
+          placeholder="请输入商品ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="奖品等级" prop="prizeLevel">
+        <el-input
+          v-model="queryParams.prizeLevel"
+          placeholder="请输入奖品等级"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="单次中奖商品数量" prop="perLotteryNum">
+        <el-input
+          v-model="queryParams.perLotteryNum"
+          placeholder="请输入单次中奖商品数量"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="奖励总份数" prop="totalLots">
+        <el-input
+          v-model="queryParams.totalLots"
+          placeholder="请输入奖励总份数"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="实际发放奖励份数" prop="totalSend">
+        <el-input
+          v-model="queryParams.totalSend"
+          placeholder="请输入实际发放奖励份数"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="创建日期" prop="createTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.createTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择创建日期">
+        </el-date-picker>
+      </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">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:liveLotteryProductConf:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['live:liveLotteryProductConf: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:liveLotteryProductConf:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveLotteryProductConf:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveLotteryProductConfList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="ID" align="center" prop="id" />
+      <el-table-column label="抽奖ID" align="center" prop="lotteryId" />
+      <el-table-column label="直播间ID" align="center" prop="liveId" />
+      <el-table-column label="商品ID" align="center" prop="productId" />
+      <el-table-column label="奖品等级" align="center" prop="prizeLevel" />
+      <el-table-column label="单次中奖商品数量" align="center" prop="perLotteryNum" />
+      <el-table-column label="奖励总份数" align="center" prop="totalLots" />
+      <el-table-column label="实际发放奖励份数" align="center" prop="totalSend" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:liveLotteryProductConf:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:liveLotteryProductConf:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播抽奖记录对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="抽奖ID" prop="lotteryId">
+          <el-input v-model="form.lotteryId" placeholder="请输入抽奖ID" />
+        </el-form-item>
+        <el-form-item label="直播间ID" prop="liveId">
+          <el-input v-model="form.liveId" placeholder="请输入直播间ID" />
+        </el-form-item>
+        <el-form-item label="商品ID" prop="productId">
+          <el-input v-model="form.productId" placeholder="请输入商品ID" />
+        </el-form-item>
+        <el-form-item label="奖品等级" prop="prizeLevel">
+          <el-input v-model="form.prizeLevel" placeholder="请输入奖品等级" />
+        </el-form-item>
+        <el-form-item label="单次中奖商品数量" prop="perLotteryNum">
+          <el-input v-model="form.perLotteryNum" placeholder="请输入单次中奖商品数量" />
+        </el-form-item>
+        <el-form-item label="奖励总份数" prop="totalLots">
+          <el-input v-model="form.totalLots" placeholder="请输入奖励总份数" />
+        </el-form-item>
+        <el-form-item label="实际发放奖励份数" prop="totalSend">
+          <el-input v-model="form.totalSend" placeholder="请输入实际发放奖励份数" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveLotteryProductConf, getLiveLotteryProductConf, delLiveLotteryProductConf, addLiveLotteryProductConf, updateLiveLotteryProductConf, exportLiveLotteryProductConf } from "@/api/live/liveLotteryProductConf";
+
+export default {
+  name: "LiveLotteryProductConf",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播抽奖记录表格数据
+      liveLotteryProductConfList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        lotteryId: null,
+        liveId: null,
+        productId: null,
+        prizeLevel: null,
+        perLotteryNum: null,
+        totalLots: null,
+        totalSend: null,
+        createTime: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        lotteryId: [
+          { required: true, message: "抽奖ID不能为空", trigger: "blur" }
+        ],
+        liveId: [
+          { required: true, message: "直播间ID不能为空", trigger: "blur" }
+        ],
+        productId: [
+          { required: true, message: "商品ID不能为空", trigger: "blur" }
+        ],
+        prizeLevel: [
+          { required: true, message: "奖品等级不能为空", trigger: "blur" }
+        ],
+        perLotteryNum: [
+          { required: true, message: "单次中奖商品数量不能为空", trigger: "blur" }
+        ],
+        totalLots: [
+          { required: true, message: "奖励总份数不能为空", trigger: "blur" }
+        ],
+        totalSend: [
+          { required: true, message: "实际发放奖励份数不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询直播抽奖记录列表 */
+    getList() {
+      this.loading = true;
+      listLiveLotteryProductConf(this.queryParams).then(response => {
+        this.liveLotteryProductConfList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        lotteryId: null,
+        liveId: null,
+        productId: null,
+        prizeLevel: null,
+        perLotteryNum: null,
+        totalLots: null,
+        totalSend: null,
+        createTime: null,
+        updateTime: null,
+        createBy: null,
+        updateBy: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播抽奖记录";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getLiveLotteryProductConf(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改直播抽奖记录";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateLiveLotteryProductConf(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addLiveLotteryProductConf(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除直播抽奖记录编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveLotteryProductConf(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播抽奖记录数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveLotteryProductConf(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 301 - 0
src/views/live/liveMsg/index.vue

@@ -0,0 +1,301 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="直播ID" prop="liveId">
+        <el-input
+          v-model="queryParams.liveId"
+          placeholder="请输入直播ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="用户ID" prop="userId">
+        <el-input
+          v-model="queryParams.userId"
+          placeholder="请输入用户ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="消息" prop="msg">
+        <el-input
+          v-model="queryParams.msg"
+          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">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:liveMsg:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['live:liveMsg: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:liveMsg:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveMsg:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveMsgList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="id" align="center" prop="msgId" />
+      <el-table-column label="直播ID" align="center" prop="liveId" />
+      <el-table-column label="用户ID" align="center" prop="userId" />
+      <el-table-column label="消息" align="center" prop="msg" />
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:liveMsg:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:liveMsg:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播讨论对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="直播ID" prop="liveId">
+          <el-input v-model="form.liveId" placeholder="请输入直播ID" />
+        </el-form-item>
+        <el-form-item label="用户ID" prop="userId">
+          <el-input v-model="form.userId" placeholder="请输入用户ID" />
+        </el-form-item>
+        <el-form-item label="消息" prop="msg">
+          <el-input v-model="form.msg" placeholder="请输入消息" />
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" placeholder="请输入备注" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveMsg, getLiveMsg, delLiveMsg, addLiveMsg, updateLiveMsg, exportLiveMsg } from "@/api/live/liveMsg";
+
+export default {
+  name: "LiveMsg",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播讨论表格数据
+      liveMsgList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null,
+        userId: null,
+        msg: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询直播讨论列表 */
+    getList() {
+      this.loading = true;
+      listLiveMsg(this.queryParams).then(response => {
+        this.liveMsgList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        msgId: null,
+        liveId: null,
+        userId: null,
+        msg: null,
+        createTime: null,
+        createBy: null,
+        updateBy: null,
+        updateTime: null,
+        remark: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.msgId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播讨论";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const msgId = row.msgId || this.ids
+      getLiveMsg(msgId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改直播讨论";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.msgId != null) {
+            updateLiveMsg(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addLiveMsg(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const msgIds = row.msgId || this.ids;
+      this.$confirm('是否确认删除直播讨论编号为"' + msgIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveMsg(msgIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播讨论数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveMsg(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 339 - 0
src/views/live/liveOrder/index.vue

@@ -0,0 +1,339 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="所属部门" prop="deptId">
+        <treeselect style="width:220px" v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择所属部门" />
+      </el-form-item>
+      <el-form-item label="订单号" prop="orderSn">
+        <el-input
+          v-model="queryParams.orderCode"
+          placeholder="请输入订单号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="用户ID" prop="userId">
+        <el-input
+          v-model="queryParams.userId"
+          placeholder="请输入用户ID"
+          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="userPhone">
+        <el-input
+          v-model="queryParams.userPhone"
+          placeholder="请输入手机号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="地址" prop="userAddress">
+        <el-input
+          v-model="queryParams.userAddress"
+          placeholder="请输入地址"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="支付金额" prop="payMoney">
+        <el-input
+          v-model="queryParams.payMoney"
+          placeholder="请输入支付金额"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="订单金额" prop="orderMoney">
+        <el-input
+          v-model="queryParams.totalPrice"
+          placeholder="请输入订单金额"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="物流编号" prop="deliveryCode">
+        <el-input
+          v-model="queryParams.deliveryCode"
+          placeholder="请输入物流编号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="物流名称" prop="deliveryName">
+        <el-input
+          v-model="queryParams.deliveryName"
+          placeholder="请输入物流名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="物流单号" prop="deliverySn">
+        <el-input
+          v-model="queryParams.deliverySn"
+          placeholder="请输入物流单号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="支付时间" prop="payTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.payTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择支付时间">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="完成时间" prop="finishTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.finishTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择完成时间">
+        </el-date-picker>
+      </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">
+
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveOrder:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+    <el-tabs type="card" v-model="actName" @tab-click="handleClickX">
+      <el-tab-pane label="全部订单" name="10"></el-tab-pane>
+      <el-tab-pane v-for="(item,index) in orderOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
+    </el-tabs>
+    <el-table border v-loading="loading" :data="liveOrderList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="订单ID" align="center" prop="orderId"/>
+      <el-table-column label="订单号" align="center" prop="orderCode" />
+      <el-table-column label="用户ID" align="center" prop="userId" />
+      <el-table-column label="收货人" align="center" prop="userName" />
+      <el-table-column label="手机号" align="center" prop="userPhone" />
+      <el-table-column label="地址" align="center" prop="userAddress" />
+      <el-table-column label="支付金额" align="center" prop="payMoney" />
+      <el-table-column label="订单金额" align="center" prop="totalPrice" />
+      <el-table-column label="物流编号" align="center" prop="deliveryCode" />
+      <el-table-column label="物流名称" align="center" prop="deliveryName" />
+      <el-table-column label="物流单号" align="center" prop="deliverySn" />
+      <el-table-column label="支付时间" align="center" prop="payTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.payTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="完成时间" align="center" prop="finishTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.finishTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" align="center" prop="status" :formatter="orderStatusFormatter"/>
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handledetails(scope.row)"
+            v-hasPermi="['live:liveOrder:edit']"
+          >查看</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+    <el-drawer
+      :with-header="false"
+      size="75%"
+      :title="show.title" :visible.sync="show.open">
+      <liveOrderDetails  ref="Details" />
+    </el-drawer>
+
+  </div>
+</template>
+
+<script>
+import { listLiveOrder, exportLiveOrder } from "@/api/live/liveOrder";
+import liveOrderDetails from './liveOrderDetails.vue';
+import { treeselect } from "@/api/company/companyDept";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+
+export default {
+  name: "LiveOrder",
+  components: {Treeselect, liveOrderDetails },
+  data() {
+    return {
+      //字典
+      orderStatusOptions: [],
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 订单表格数据
+      liveOrderList: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        liveId: null,
+        pageSize: 10,
+        orderSn: null,
+        userId: null,
+        userName: null,
+        mobile: null,
+        address: null,
+        payMoney: null,
+        orderMoney: null,
+        deliveryCode: null,
+        deliveryName: null,
+        deliverySn: null,
+        payTime: null,
+        finishTime: null,
+        status: null,
+      },
+      orderOptions:[],
+      actName:"10",
+      show:{
+        title:"订单详情",
+        open:false,
+      },
+
+      // 部门树选项
+      deptOptions: undefined,
+      deptName: undefined,
+    };
+  },
+  watch: {
+    // 根据名称筛选部门树
+    deptName(val) {
+      this.$refs.tree.filter(val);
+    },
+  },
+  created() {
+    this.getTreeselect();
+    this.queryParams.liveId = this.$route.query.liveId
+    this.getList();
+    this.getDicts("sys_live_order_status").then(response => {
+      this.orderStatusOptions = response.data;
+    });
+    this.getDicts("sys_order_status").then(response => {
+      this.orderOptions = response.data;
+    });
+  },
+  methods: {
+    // 查看详情
+    getTreeselect() {
+      treeselect().then((response) => {
+        this.deptOptions = response.data;
+      });
+    },
+    handledetails(row){
+      this.show.open=true;
+      setTimeout(() => {
+        this.$refs.Details.getDetails(row.orderId,row.nickName,row.storeName);
+      }, 1);
+    },
+    // 订单tab切换
+    handleClickX(tab, event) {
+      this.orderStatus = tab.name;
+      if(tab.name=="10"){
+        this.queryParams.status=null;
+      }else{
+        this.queryParams.status=tab.name;
+      }
+      this.handleQuery();
+    },
+    /** 查询订单列表 */
+    getList() {
+      this.loading = true;
+      listLiveOrder(this.queryParams).then(response => {
+        this.liveOrderList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    orderStatusFormatter(row, column) {
+      return this.selectDictLabel(this.orderStatusOptions, row.status);
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.orderId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有订单数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveOrder(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 913 - 0
src/views/live/liveOrder/liveOrderDetails.vue

@@ -0,0 +1,913 @@
+<template>
+  <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
+    <div style="padding: 20px; background-color: #fff;">
+      订单详情
+    </div>
+    <div class="contentx" v-if="item!=null">
+      <div class="desct"></div>
+      <div class="order-status" v-if="item!=null" >
+        <el-steps  :active="item.status==4?item.status:item.status" align-center finish-status="success">
+          <el-step title="待支付"></el-step>
+          <el-step title="待发货"></el-step>
+          <el-step title="待收货"></el-step>
+          <el-step title="已完成"></el-step>
+        </el-steps>
+      </div>
+      <el-card shadow="never" style="margin-top: 15px">
+        <div class="operate-container"  v-if="item!=null">
+               <span style="margin-left: 20px" class="color-danger">订单状态:
+                  <el-tag prop="status" v-for="(ite, index) in orderOptions"    v-if="item.status==ite.dictValue">{{ite.dictLabel}}</el-tag>
+               </span>
+<!--          <div class="operate-button-container" v-if="item.status==3">-->
+<!--            <el-button size="mini" @click="finishOrder()" v-hasPermi="['his:liveOrder:good']">确认收货</el-button>-->
+<!--          </div>-->
+          <div class="operate-button-container"  v-if="item.status==2&&item.orderType==1">
+            <el-button size="mini" @click="sendVisible=true" v-hasPermi="['his:liveOrder:sendGoods']">发货</el-button>
+          </div>
+          <div class="operate-button-container"  v-if="item.status==2&&item.orderType==2">
+            <el-button size="mini" @click="tuiOrder()" v-hasPermi="['his:liveOrder:sendHisGoods']" >推送订单</el-button>
+          </div>
+<!--          <div class="operate-button-container" v-if="item.inquiryOrderId!=null&&item.inquiryOrderId!=''" v-hasPermi="['his:liveOrder:inquiry']">-->
+<!--            <el-button size="mini" @click="getInquiryOrder()" >问诊订单</el-button>-->
+<!--          </div>-->
+<!--          <div class="operate-button-container" v-if="item.packageOrderId!=null&&item.packageOrderId!=''" v-hasPermi="['his:liveOrder:package']" >-->
+<!--            <el-button size="mini" @click="getPackageOrder()" >套餐包订单</el-button>-->
+<!--          </div>-->
+          <div class="operate-button-container"   v-if="item.deliverySn!=null" v-hasPermi="['his:liveOrder:express']">
+            <el-button size="mini" @click="showExpress()" >查看物流</el-button>
+          </div>
+          <div class="operate-button-container" >
+            <el-button size="mini" @click="editDelivery()"  v-hasPermi="['his:liveOrder:updateDelivery']" >修改物流单号</el-button>
+          </div>
+
+          <div class="operate-button-container" >
+            <el-button size="mini" @click="editOrder()"  v-hasPermi="['his:liveOrder:edit']" >修改订单</el-button>
+          </div>
+<!--          <div class="operate-button-container" v-if="item.status ==2 && item.extendOrderId == null && item.deliverySn == null&&item.orderType==1"   v-hasPermi="['his:liveOrder:createErpOrder']">-->
+<!--            <el-button size="mini" @click="addErpOrder()" >创建ERP订单信息</el-button>-->
+<!--          </div>-->
+<!--          <div class="operate-button-container" v-if="item.extendOrderId!=null && item.orderType==1"  v-hasPermi="['his:liveOrder:getEroOrder']"  >-->
+<!--            <el-button size="mini" @click="showErpOrder()" >ERP订单信息</el-button>-->
+<!--          </div>-->
+<!--          <div class="operate-button-container" v-if="item.tuiMoneyStatus==0 && item.status==4"  v-hasPermi="['his:liveOrder:editTuiMoney']"  >-->
+<!--            <el-button size="mini" @click="editTuiMoney1()" >解冻</el-button>-->
+<!--          </div>-->
+<!--          <div class="operate-button-container" v-if="item.tuiMoneyStatus==1 && item.status==4"  v-hasPermi="['his:liveOrder:editTuiMoney']"  >-->
+<!--            <el-button size="mini" @click="editTuiMoney2()" >冻结</el-button>-->
+<!--          </div>-->
+<!--          <div class="operate-button-container"  v-if="item.followTime!=null&&item.followTime!=''"   v-hasPermi="['his:liveOrder:msgList']"  >-->
+<!--            <el-button size="mini" @click="followMsg()" >随访记录</el-button>-->
+<!--          </div>-->
+
+          <div class="operate-button-container" v-if="item.status>1">
+            <el-button size="mini" @click="refund()" v-hasPermi="['his:liveOrder:afterSales']">申请退款</el-button>
+          </div>
+<!--          <div class="operate-button-container" v-if="item.status== -2" >-->
+<!--            <el-button size="mini" @click="returnCost()"  v-hasPermi="['his:liveOrder:returnCost']" >成本退还</el-button>-->
+<!--          </div>-->
+<!--          <div class="operate-button-container" >-->
+<!--            <el-button size="mini" @click="sendFollowMsg()" v-if="item.status>1" v-hasPermi="['his:liveOrder:sendMsg']">发送随访消息</el-button>-->
+<!--          </div>-->
+        </div>
+        <div class="desct">
+          基本信息
+        </div>
+        <el-descriptions :column="3" border  >
+          <el-descriptions-item label="订单编号"  ><span v-if="item!=null">{{item.orderCode}}</span></el-descriptions-item>
+          <el-descriptions-item label="会员"><span v-if="item.nickName!=null">{{item.nickName}}({{item.phone}})</span></el-descriptions-item>
+          <el-descriptions-item label="会员ID"  ><span v-if="item!=null">{{item.userId}}</span></el-descriptions-item>
+          <el-descriptions-item label="支付方式"  ><dict-tag :options="PayOptions" :value="item.payType"/></el-descriptions-item>
+          <el-descriptions-item label="订单来源"  ><dict-tag :options="sourceOptions" :value="item.source"/></el-descriptions-item>
+          <el-descriptions-item label="店铺名称"  ><span v-if="item!=null">{{item.storeName}}</span></el-descriptions-item>
+          <el-descriptions-item label="收货人" >  <span v-if="item!=null">{{item.userName}}</span>  </el-descriptions-item>
+          <el-descriptions-item label="收货人电话" > <span v-if="item!=null">{{item.userPhone}}</span>
+            <el-button icon="el-icon-search" size="mini" @click="handlePhone()" style="margin-left: 20px;" circle v-hasPermi="['his:liveOrder:queryPhone']"></el-button>
+          </el-descriptions-item>
+          <el-descriptions-item label="详细地址" > <span>{{item.userAddress}}</span>  </el-descriptions-item>
+          <el-descriptions-item label="所属公司"><span v-if="item!=null">{{item.companyName}}</span></el-descriptions-item>
+          <el-descriptions-item label="员工"><span v-if="item!=null">{{item.companyUserName}}</span></el-descriptions-item>
+          <el-descriptions-item label="推广佣金" ><span v-if="item.tuiMoney!=null">{{item.tuiMoney.toFixed(2)}}</span></el-descriptions-item>
+          <el-descriptions-item label="推广佣金状态" ><span v-if="item!=null"><dict-tag :options="tuiOptions" :value="item.tuiMoneyStatus"/> </span></el-descriptions-item>
+          <el-descriptions-item label="快递公司编号" > <span v-if="item!=null">{{item.deliveryCode}}</span></el-descriptions-item>
+          <el-descriptions-item label="快递名称" ><span v-if="item!=null">{{item.deliveryName}}</span></el-descriptions-item>
+          <el-descriptions-item label="快递单号" ><span v-if="item!=null">{{item.deliverySn}}</span></el-descriptions-item>
+          <el-descriptions-item label="ERP编号" ><span v-if="item!=null">{{item.extendOrderId}}</span></el-descriptions-item>
+          <el-descriptions-item label="物流状态" ><dict-tag :options="deliveryStatusOptions" :value="item.deliveryStatus"/></el-descriptions-item>
+          <el-descriptions-item label="物流结算状态" ><dict-tag :options="deliveryPayStatusOptions" :value="item.deliveryPayStatus"/></el-descriptions-item>
+          <el-descriptions-item label="物流结算时间" ><span v-if="item!=null">{{item.deliveryPayTime}}</span></el-descriptions-item>
+          <el-descriptions-item label="物流结算金额" ><span v-if="item!=null">{{item.deliveryPayMoney}}</span></el-descriptions-item>
+          <el-descriptions-item label="物流跟踪状态" ><span v-if="item!=null"><dict-tag :options="deliveryTypeOptions" :value="item.deliveryType"/> </span></el-descriptions-item>
+          <el-descriptions-item label="用户备注" ><span v-if="item!=null">{{item.remark}}</span></el-descriptions-item>
+          <el-descriptions-item label="档期归属" >
+            <el-tag prop="scheduleId" v-for="(schedule, index) in scheduleOptions"    v-if="item!=null&&item.scheduleId==schedule.id">{{schedule.name}}
+            </el-tag>
+          </el-descriptions-item>
+          <el-descriptions-item label="订单购买类型" ><span v-if="item!=null"><dict-tag :options="orderBuyTypeOptions" :value="item.orderBuyType"/></span></el-descriptions-item>
+          <el-descriptions-item label=" 公众号/渠道" ><span v-if="item!=null">{{item.channel}}</span></el-descriptions-item>
+          <el-descriptions-item label=" 渠道" ><span v-if="item!=null"><dict-tag :options="channelOptions" :value="item.orderChannel"/></span></el-descriptions-item>
+          <el-descriptions-item label=" 企微主体" ><span v-if="item!=null"><dict-tag :options="qwSubjectOptions" :value="item.qwSubject"/></span></el-descriptions-item>
+        </el-descriptions>
+      </el-card>
+    </div>
+
+    <div class="contentx" v-if="item!=null" style="padding-bottom: 70px;">
+      <div class="desct">
+        商品信息
+      </div>
+      <el-tooltip class="item" effect="dark" :content="showList ? '显示全部' : '隐藏'" placement="top" style="float: right;">
+        <el-button size="mini" circle icon="el-icon-search" @click="showListD()" />
+      </el-tooltip>
+      <el-table border v-if="showProd!=null" :data="showProd" size="small" style="width: 100%;margin-top: 20px" >
+        <el-table-column label="商品图片" width="150" align="center">
+          <template slot-scope="scope">
+            <img :src="scope.row.imgUrl" style="height: 80px">
+          </template>
+        </el-table-column>
+        <el-table-column label="商品编码" width="300" align="center">
+          <template slot-scope="scope">
+            <p>{{scope.row.productId}}</p>
+          </template>
+        </el-table-column>
+        <el-table-column label="商品名称" width="300" align="center">
+          <template slot-scope="scope">
+            <p>{{scope.row.productName}}</p>
+          </template>
+        </el-table-column>
+        <el-table-column label="单价" width="240" align="center">
+          <template slot-scope="scope">
+            <p>¥{{scope.row.price.toFixed(2)}}</p>
+          </template>
+        </el-table-column>
+        <el-table-column label="市场价" width="240" align="center">
+          <template slot-scope="scope">
+            {{scope.row.otPrice}}
+          </template>
+        </el-table-column>
+<!--        <el-table-column label="数量" width="180" align="center">-->
+<!--          <template slot-scope="scope">-->
+<!--            {{scope.row.num}}-->
+<!--          </template>-->
+<!--        </el-table-column>-->
+<!--        <el-table-column label="小计"  align="center">-->
+<!--          <template slot-scope="scope" >-->
+<!--            ¥{{(scope.row.num*scope.row.price).toFixed(2)}}-->
+<!--          </template>-->
+<!--        </el-table-column>-->
+      </el-table>
+      <div style="float: right;margin: 20px" v-if="item.totalPrice!=null">
+        合计:<span class="color-danger">¥{{item.totalPrice.toFixed(2)}}</span>
+      </div>
+    </div>
+
+
+    <el-dialog :title="edit.title" :visible.sync="edit.open" width="600px" append-to-body>
+      <el-form ref="editForm" :model="editForm" :rules="editRules" label-width="100px">
+
+        <el-form-item label="订单状态" prop="status" >
+          <el-select v-model="editForm.status" placeholder="请选择状态" clearable size="small" filterable>
+            <el-option
+              v-for="dict in orderOptions "
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="物流状态" prop="deliveryStatus" >
+          <el-select v-model="editForm.deliveryStatus" placeholder="请选择物流状态" clearable size="small" filterable>
+            <el-option
+              v-for="dict in deliveryStatusOptions "
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="物流跟踪状态" prop="deliveryType" >
+          <el-select v-model="editForm.deliveryType" placeholder="请选择状态" clearable size="small" filterable>
+            <el-option
+              v-for="dict in deliveryTypeOptions "
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="详情地址" prop="userAddress"  >
+          <el-input v-model="editForm.userAddress" placeholder="请输入" />
+        </el-form-item>
+        <el-form-item label="备注" prop="remark"  >
+          <el-input v-model="editForm.remark" placeholder="请输入备注" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitEditForm">确 定</el-button>
+      </div>
+    </el-dialog>
+
+
+    <el-dialog :title="editDy.title" :visible.sync="editDy.open" width="600px" append-to-body>
+      <el-form ref="editDyForm" :model="editDyForm" :rules="editDyRules" label-width="100px">
+        <div  v-hasPermi="['his:liveOrder:updateErpOrder']"  style="margin-bottom: 20px;" >
+          <el-button size="mini" @click="updateErpOrder" >同步物流单号信息</el-button>
+        </div>
+        <el-form-item label="物流公司" prop="deliveryCode" >
+          <el-select style="width:220px" v-model="editDyForm.deliveryCode" placeholder="请选择" clearable size="small">
+            <el-option key="SF"  label="顺丰" value="SF" />
+            <el-option key="EMS"  label="邮政" value="EMS" />
+            <el-option key="ZTO"  label="中通" value="ZTO" />
+            <el-option key="JD"  label="京东" value="JD" />
+            <el-option key="DBL"  label="德邦" value="DBL" />
+            <el-option key="YD"  label="韵达" value="YD" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="物流单号" prop="deliverySn"  >
+          <el-input v-model="editDyForm.deliverySn" placeholder="请输入物流单号" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitEditDyForm">确 定</el-button>
+        <el-button @click="editDy.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog :title="expressDialog.title" :visible.sync="expressDialog.open" width="600px" append-to-body>
+      <div  v-hasPermi="['his:storeOrder:syncExpress']"  >
+        <el-button size="mini" @click="syncExpress()" >同步快递鸟物流状态</el-button>
+      </div>
+      <el-table style="margin-top: 20px;width: 100%"
+                ref="orderHistoryTable"
+                :data="traces" border>
+        <el-table-column label="操作时间"  width="160" align="center">
+          <template slot-scope="scope">
+            {{scope.row.AcceptTime}}
+          </template>
+        </el-table-column>
+        <el-table-column label="位置" align="center">
+          <template slot-scope="scope">
+            {{scope.row.Location}}
+          </template>
+        </el-table-column>
+        <el-table-column label="描述" align="center">
+          <template slot-scope="scope">
+            {{scope.row.AcceptStation}}
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-dialog>
+
+
+  </div>
+</template>
+
+
+<script>
+import {getLiveOrder, syncExpress, updateLiveOrder, updateErp, getExpress, listOrderitem, tuiOrder} from "@/api/live/liveOrder";
+
+
+export default {
+  props:["data"],
+  data() {
+    return {
+      expressDialog:{
+        title:"物流信息",
+        open:false,
+      },
+      editDy:{
+        title:"修改物流单号",
+        open:false,
+      },
+      sourceOptions:[],
+      followDialogVisible:false,
+      dialogVisible:false,
+      total: 0,
+      msgForm:{
+        pageNum: 1,
+        pageSize: 10,
+        userId:null,
+        followDoctorId:null,
+      },
+      editDyForm:{
+        orderId:null,
+        deliveryId:null,
+        deliveryCode:null,
+      },
+      showList:true,
+      edit:{
+        title:"修改订单",
+        open:false,
+      },
+      erpDialog:{
+        title:"ERP订单信息",
+        open:false,
+      },
+      show:{
+        title:"问诊详情",
+        open:false,
+      },
+      pack:{
+        title:"套餐包",
+        open:false,
+      },
+      followList:[],
+      money:null,
+      moneyVisible:false,
+      rules:{},
+      sendVisible:false,
+      logs:[],
+      pay:[],
+      nickName:null,
+      storeName:null,
+      PayOptions:[],
+      orderOptions:[],
+      payStatusOptions:[],
+      express:null,
+      traces:[],
+      msg:[],
+      sexOptions:[],
+      refundOptions:[],
+      channelOptions:[],
+      qwSubjectOptions:[],
+      tuiOptions:[],
+      orOptions:[],
+      storeOPtions:[],
+      deliveryStatusOptions:[],
+      deliveryPayStatusOptions:[],
+      deliveryTypeOptions:[],
+      orderTypeOptions:[],
+      orderBuyTypeOptions:[],
+      scheduleOptions:[],
+      item:null,
+      tuiMoneyLogs:[],
+      erpOrder:null,
+      prod:null,
+      showProd:null,
+      editForm:{
+        orderId:null,
+        status:null,
+        userAddress:null,
+        deliveryStatus:null,
+        deliveryType:null,
+        remark:"",
+      },
+      editDyRules:{
+        deliverySn: [
+          { required: true, message: "物流单号不能为空", trigger: "blur" }
+        ],
+        deliveryCode: [
+          { required: true, message: "物流公司不能为空", trigger: "blur" }
+        ],
+      },
+      editRules:{
+        userAddress: [
+          { required: true, message: "收货地址不能为空", trigger: "blur" }
+        ],
+      },
+      mrules:{
+      },
+      form: {
+        deliveryCode: null,
+        deliveryName:null,
+        deliverySn:null,
+        orderId:null,
+      }
+    }
+  },
+
+  created() {
+    this.getDicts("sys_store_pay_type").then(response => {
+      this.PayOptions = response.data;
+    });
+    this.getDicts("sys_order_status").then(response => {
+      this.orderOptions = response.data;
+    });
+    this.getDicts("sys_order_pay").then(response => {
+      this.payStatusOptions = response.data;
+    });
+    this.getDicts("sys_order_source").then(response => {
+      this.sourceOptions = response.data;
+    });
+    this.getDicts("sys_store_order_type").then(response => {
+      this.orderTypeOptions = response.data;
+    });
+    this.getDicts("sys_store_order_buy_type").then(response => {
+      this.orderBuyTypeOptions = response.data;
+    });
+    this.getDicts("sys_refund_status").then(response => {
+      this.refundOptions = response.data;
+    });
+    this.getDicts("sys_store_channel").then(response => {
+      this.channelOptions = response.data;
+    });
+    this.getDicts("sys_store_qw_subject").then(response => {
+      this.qwSubjectOptions = response.data;
+    });
+    this.getDicts("sys_tui_money_status").then(response => {
+      this.tuiOptions = response.data;
+    });
+    this.getDicts("sys_company_or").then(response => {
+      this.orOptions = response.data;
+    });
+    this.getDicts("sys_patient_sex").then(response => {
+      this.sexOptions = response.data;
+    });
+    this.getDicts("sys_store_delivery_pay_status").then(response => {
+      this.deliveryPayStatusOptions = response.data;
+    });
+    this.getDicts("sys_store_order_delivery_status").then(response => {
+      this.deliveryStatusOptions = response.data;
+    });
+    this.getDicts("sys_delivery_type").then(response => {
+      this.deliveryTypeOptions = response.data;
+    });
+  },
+  methods: {
+
+    followMsg(row){
+      const userId = this.item.userId;
+      const followDoctorId =this.item.followDoctorId;
+      const doctorName = this.item.doctorName;
+      const patientName = this.item.patientName;
+
+      setTimeout(() => {
+        this.$refs.msgDetails.getDetails(userId,followDoctorId,doctorName,patientName);
+      }, 500);
+      this.dialogVisible = true;
+    },
+    msgDialogClose(){
+      this.dialogVisible = false;
+    },
+    handlePhone(){
+      const orderId = this.item.orderId;
+      getOrderUserPhone(orderId).then(response =>{
+        this.item.userPhone = response.userPhone;
+      })
+    },
+    editDelivery(){
+      this.editDy.open = true;
+      this.editDyForm.orderId = this.item.orderId;
+
+    },
+    showListD(){
+      if(this.showList){
+        this.showProd=this.prod
+      }else{
+        this.showProd=[this.prod[0]]
+      }
+      this.showList=this.showList?false:true;
+    },
+
+    showExpress(){
+      this.expressDialog.open=true;
+      getExpress(this.item.orderId).then(response => {
+        this.express = response.data;
+        if(this.express!=null&&this.express.Traces!=null){
+          this.traces=this.express.Traces
+        }
+      });
+    },
+    updateErpOrder(){
+      var that=this;
+      this.$confirm('确定同步物流单号信息吗', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        var data={orderId:that.item.orderId}
+        return updateErp(data);
+      }).then(() => {
+        this.msgSuccess("操作成功");
+        getLiveOrder(this.item.orderId).then(response => {
+          this.item=response.data
+          that.getlogList(this.item.orderId);
+          that.$parent.$parent.getList();
+        });
+        this.editDy.open = false
+      }).catch(function() {});
+
+    },
+    sendFollowMsg(){
+      var that=this;
+      this.$confirm('是否确认发送消息?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return sendMsg(that.item.orderId);
+      }).then(() => {
+        this.msgSuccess("操作成功");
+      }).catch(function() {});
+    },
+    handleClose1(){
+      this.dialogVisible=false;
+    },
+    handleClose2(){
+      this.followDialogVisible=false;
+    },
+    follow(row){
+      getMsgFollow(row).then(response => {
+        if(response.data.formJson!=null&&response.data.formJson!=''&&response.data.writeStatus==1){
+          this.messageFollowList=JSON.parse(response.data.formJson );
+          this.followDialogVisible=true;
+        }else{
+          this.$message({
+            message: '未填写随访单',
+            type: 'info'
+          });
+          return
+        }
+      });
+    },
+
+    //修改订单状态
+    submitEditForm(){
+      this.$refs["editForm"].validate(valid => {
+        if (valid) {
+          updateLiveOrder(this.editForm).then(response => {
+            if (response.code === 200) {
+              this.msgSuccess("操作成功");
+              this.edit.open = false;
+              getLiveOrder(this.item.orderId).then(response => {
+                this.item=response.data
+                that.getlogList(this.item.orderId);
+                that.$parent.$parent.getList();
+              });
+            }
+          });
+        }
+      });
+    },
+    editOrder(){
+      this.edit.open=true;
+      this.editForm.orderId=this.item.orderId;
+      this.editForm.remark=this.item.remark;
+      this.editForm.userAddress = this.item.userAddress == null ? '' : this.item.userAddress.toString();
+      this.editForm.status = this.item.status == null ? '' : this.item.status.toString();
+      this.editForm.deliveryType = this.item.deliveryType == null ? '' : this.item.deliveryType.toString();
+      this.editForm.deliveryStatus = this.item.deliveryStatus == null ? '' : this.item.deliveryStatus.toString();
+
+    },
+    updateExpress(){
+      var that=this;
+      this.$confirm('定同步物流信息吗,同步后将自动发货?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        var data=that.item.orderId
+        return updateExpress(data);
+      }).then(() => {
+        this.msgSuccess("操作成功");
+        getLiveOrder(this.item.orderId).then(response => {
+          this.item=response.data
+          that.getlogList(this.item.orderId);
+          that.$parent.$parent.getList();
+        });
+      }).catch(function() {});
+    },
+    addErpOrder(){
+      var that=this;
+      this.$confirm('是否确认推送管易?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        var data=that.item.orderId
+        return createErpOrder(data);
+      }).then(() => {
+        this.msgSuccess("操作成功");
+        getLiveOrder(this.item.orderId).then(response => {
+          this.item=response.data
+          that.getlogList(this.item.orderId);
+          that.$parent.$parent.getList();
+        });
+      }).catch(function() {});
+    },
+    showErpOrder(){
+      this.erpDialog.open=true;
+      var data=this.item.extendOrderId;
+      getEroOrder(data).then(response => {
+        this.erp = response.data;
+        if(response.data.orders!=null&&response.data.orders.length==1){
+          this.erpOrder=response.data.orders[0]
+        }
+      });
+    },
+
+    editTuiMoney1(){
+      var that=this;
+      this.$confirm('是否解冻此订单推广佣金吗?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        var data=that.item.orderId;
+        return editTuiMoney(data);
+      }).then(() => {
+        this.msgSuccess("操作成功");
+        getLiveOrder(this.item.orderId).then(response => {
+          this.item=response.data
+          that.getlogList(this.item.orderId);
+          that.$parent.$parent.getList();
+        });
+      }).catch(function() {});
+    },
+    editTuiMoney2(){
+      var that=this;
+      this.$confirm('是否冻结此订单推广佣金吗?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        var data=that.item.orderId;
+        return editTuiMoney(data);
+      }).then(() => {
+        this.msgSuccess("操作成功");
+        getLiveOrder(this.item.orderId).then(response => {
+          this.item=response.data
+          that.getlogList(this.item.orderId);
+          that.$parent.$parent.getList();
+        });
+      }).catch(function() {});
+    },
+    returnCost(){
+      var that=this;
+      this.$confirm('是否退还此订单成本吗?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        var data=that.item.orderId;
+        return returnCost(data);
+      }).then(() => {
+        this.msgSuccess("操作成功");
+        this.getDetails(this.item.orderId,null,null)
+      }).catch(function() {});
+    },
+    moneyCancel(){
+      this.money=null;
+      this.moneyVisible=false;
+    },
+    refund(){
+      var that=this;
+      this.$confirm('是否确认申请退款?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        var data={
+          orderId:that.item.orderId
+        }
+        return afterSales(data);
+      }).then(() => {
+        this.msgSuccess("操作成功");
+        getLiveOrder(this.item.orderId).then(response => {
+          this.item = response.data;
+          this.getlogList(this.item.orderId);
+          this.$parent.$parent.getList();
+        });
+      }).catch(function() {});
+    },
+    finishOrder(){
+      var that=this;
+      this.$confirm('是否确认客户已收货?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        var data={
+          orderId:that.item.orderId
+        }
+        return getGoods(data);
+      }).then(() => {
+        this.msgSuccess("操作成功");
+        getLiveOrder(this.item.orderId).then(response => {
+          this.item = response.data;
+          this.getlistOrderitem(this.item.orderId);
+          // this.getlogList(this.item.orderId);
+          this.$parent.$parent.getList();
+        });
+      }).catch(function() {});
+    },
+
+
+    syncExpress(){
+      var that=this;
+      this.$confirm('确定同步物流状态吗', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        var data=that.item.orderId
+        return syncExpress(data);
+      }).then(() => {
+        this.msgSuccess("操作成功");
+        this.expressDialog.open=false
+        getLiveOrder(this.item.orderId).then(response => {
+          this.item=response.data
+          that.getlogList(this.item.orderId);
+          that.$parent.$parent.getList();
+        });
+      }).catch(function() {});
+    },
+    getInquiryOrder(){
+
+      this.show.open=true;
+      setTimeout(() => {
+        this.$refs.Details.getDetails(this.item.inquiryOrderId);
+      }, 1);
+    },
+    getPackageOrder(){
+      this.pack.open=true;
+      console.log(this.item.packageOrderId)
+      setTimeout(() => {
+        this.$refs.packDetails.getDetails(this.item.packageOrderId);
+      }, 1);
+    },
+    tuiOrder(){
+      var that=this;
+      this.$confirm('是否确认推送订单?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        var data={
+          orderId:that.item.orderId
+        }
+        return tuiOrder(data);
+      }).then(() => {
+        this.msgSuccess("操作成功");
+        getLiveOrder(this.item.orderId).then(response => {
+          this.item = response.data;
+          this.getlogList(this.item.orderId);
+          this.$parent.$parent.getList();
+        });
+      }).catch(function() {});
+    },
+    getDetails(orderId,nickName,storeName) {
+      this.nickName=nickName;
+      this.storeName=storeName;
+      this.item=null;
+      this.tuiMoneyLogs=null;
+      getLiveOrder(orderId).then(response => {
+        this.item = response.data;
+        this.tuiMoneyLogs = response.tuiMoneyLogs;
+        // this.getlogList(orderId);
+        // this.getPayment(orderId);
+        this.msgForm.userId=response.data.userId;
+        this.msgForm.followDoctorId=response.data.followDoctorId;
+        this.getlistOrderitem(this.item.orderId);
+      });
+    },
+    getOrder(){
+      getLiveOrder(this.item.orderId).then(response => {
+        this.item = response.data;
+        this.getlistOrderitem(this.item.orderId);
+        // this.getlogList(this.item.orderId);
+        // this.getPayment(this.item.orderId);
+      });
+    },
+    submitEditDyForm(){
+      this.$refs["editDyForm"].validate(valid => {
+        if (valid) {
+          console.log(this.editDyForm)
+          updateLiveOrder(this.editDyForm).then(response => {
+            if (response.code === 200) {
+              this.msgSuccess("操作成功");
+              this.editDy.open = false;
+              getLiveOrder(this.item.orderId).then(response => {
+                this.item = response.data;
+                // this.getlogList(this.item.orderId);
+                this.$parent.$parent.getList();
+              });
+            }
+          });
+        }
+      });
+    },
+
+    getlistOrderitem(orderId){
+      this.prod = null
+      this.showProd=[]
+      this.showList = true
+      listOrderitem(orderId).then(response => {
+        this.prod = response.rows;
+        if (this.prod.length > 0) {
+          this.showProd=[this.prod[0]];
+        }
+      });
+    },
+    // getlogList(orderId){
+    //   logList(orderId).then(response => {
+    //     this.logs = response.rows;
+    //   });
+    // },
+    // getPayment(orderId){
+    //   payment(orderId).then(response => {
+    //     console.log(response)
+    //     this.pay = response.data;
+    //   });
+    // }
+  },
+}
+
+</script>
+
+
+<style scoped>
+.content{
+  height: 100%;
+  background-color: #fff;
+  padding: 0px 20px;
+
+}
+.contentx{
+  height: 100%;
+  background-color: #fff;
+  padding: 0px 20px 20px;
+
+
+  margin: 20px;
+}
+.el-descriptions-item__label.is-bordered-label{
+  font-weight: normal;
+}
+.el-descriptions-item__content {
+  max-width: 150px;
+  min-width: 100px;
+}
+.desct{
+  padding-top: 20px;
+  padding-bottom: 20px;
+  color: #524b4a;
+  font-weight: bold;
+}
+
+.order-content{
+  margin: 10px;
+
+}
+
+.operate-container {
+  background: #F2F6FC;
+  height: 60px;
+  margin: -20px -20px 0;
+  line-height: 60px;
+}
+
+.operate-button-container {
+  float: right;
+  margin-right: 20px
+}
+</style>
+
+<style scoped>
+.chat-records {
+
+  overflow-y: auto;
+}
+.timestamp {
+  font-size: 12px;
+  color: #A9A9A9;
+}
+.chat-record {
+  margin: 10px;
+  flex-direction: column;
+  align-items: flex-start;
+}
+.sent {
+  background-color: #fbfdff;
+  color: #000839;
+}
+.sent .timestamp {
+  float: right;
+}
+.right{
+  float: right;
+}
+.received {
+  background-color: #fbfdff;
+  color: #000000;
+}
+
+.el-descriptions-item__content {
+  max-width: 150px;
+  min-width: 100px;
+}
+.order-content{
+  margin: 10px;
+
+}
+
+.operate-container {
+  background: #F2F6FC;
+  height: 60px;
+  margin: -20px -20px 0;
+  line-height: 60px;
+}
+
+.operate-button-container {
+  float: right;
+  margin-right: 20px
+}
+</style>

+ 358 - 0
src/views/live/liveOrderitems/index.vue

@@ -0,0 +1,358 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="商品ID" prop="goodsId">
+        <el-input
+          v-model="queryParams.goodsId"
+          placeholder="请输入商品ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="订单ID" prop="orderId">
+        <el-input
+          v-model="queryParams.orderId"
+          placeholder="请输入订单ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="商品名" prop="goodsName">
+        <el-input
+          v-model="queryParams.goodsName"
+          placeholder="请输入商品名"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="单价" prop="price">
+        <el-input
+          v-model="queryParams.price"
+          placeholder="请输入单价"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="数量" prop="num">
+        <el-input
+          v-model="queryParams.num"
+          placeholder="请输入数量"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
+          <el-option v-for="(item,index) in orderGoodsStatusOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </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>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:liveOrderitems:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['live:liveOrderitems: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:liveOrderitems:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveOrderitems:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveOrderitemsList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="ID" align="center" prop="id" />
+      <el-table-column label="商品ID" align="center" prop="goodsId" />
+      <el-table-column label="订单ID" align="center" prop="orderId" />
+      <el-table-column label="商品JSON" align="center" prop="goodsJson" />
+      <el-table-column label="商品名" align="center" prop="goodsName" />
+      <el-table-column label="单价" align="center" prop="price" />
+      <el-table-column label="数量" align="center" prop="num" />
+      <el-table-column label="状态" align="center" prop="status" :formatter="orderGoodsStatusFormatter"/>
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:liveOrderitems:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:liveOrderitems:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改订单商品对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="商品ID" prop="goodsId">
+          <el-input v-model="form.goodsId" placeholder="请输入商品ID" />
+        </el-form-item>
+        <el-form-item label="订单ID" prop="orderId">
+          <el-input v-model="form.orderId" placeholder="请输入订单ID" />
+        </el-form-item>
+        <el-form-item label="商品JSON" prop="goodsJson">
+          <el-input v-model="form.goodsJson" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+        <el-form-item label="商品名" prop="goodsName">
+          <el-input v-model="form.goodsName" placeholder="请输入商品名" />
+        </el-form-item>
+        <el-form-item label="单价" prop="price">
+          <el-input v-model="form.price" placeholder="请输入单价" />
+        </el-form-item>
+        <el-form-item label="数量" prop="num">
+          <el-input v-model="form.num" placeholder="请输入数量" />
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-radio-group v-model="form.status">
+            <el-radio :label="item.dictValue" v-for="item in orderGoodsStatusOptions" >{{item.dictLabel}}</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" placeholder="请输入备注" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveOrderitems, getLiveOrderitems, delLiveOrderitems, addLiveOrderitems, updateLiveOrderitems, exportLiveOrderitems } from "@/api/live/liveOrderitems";
+
+export default {
+  name: "LiveOrderitems",
+  data() {
+    return {
+      //字典
+      orderGoodsStatusOptions: [],
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 订单商品表格数据
+      liveOrderitemsList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        goodsId: null,
+        orderId: null,
+        goodsJson: null,
+        goodsName: null,
+        price: null,
+        num: null,
+        status: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+    this.getDicts("sys_live_order_goods_status").then(response => {
+      this.orderGoodsStatusOptions = response.data;
+    });
+  },
+  methods: {
+    /** 查询订单商品列表 */
+    getList() {
+      this.loading = true;
+      listLiveOrderitems(this.queryParams).then(response => {
+        this.liveOrderitemsList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    orderGoodsStatusFormatter(row, column) {
+      return this.selectDictLabel(this.orderGoodsStatusOptions, row.status);
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        goodsId: null,
+        orderId: null,
+        goodsJson: null,
+        goodsName: null,
+        price: null,
+        num: null,
+        status: 0,
+        createTime: null,
+        createBy: null,
+        updateBy: null,
+        updateTime: null,
+        remark: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加订单商品";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getLiveOrderitems(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改订单商品";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateLiveOrderitems(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addLiveOrderitems(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除订单商品编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveOrderitems(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有订单商品数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveOrderitems(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

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

@@ -0,0 +1,193 @@
+<template>
+  <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-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="请输入直播间状态"
+          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>
+
+<!--    <div class="selection-toolbar">-->
+<!--      <el-checkbox :indeterminate="isIndeterminate" v-model="allChecked" @change="toggleSelectAll">-->
+<!--        {{ multipleSelection.length > 0 ? `已选 ${multipleSelection.length} 条` : '选中本页' }}-->
+<!--      </el-checkbox>-->
+<!--      <el-button  plain size="mini" @click="handleShelf">上架</el-button>-->
+<!--      <el-button  plain size="mini" @click="handleUnshelf">下架</el-button>-->
+<!--      <el-button  plain size="mini" @click="handleDeleteSelected">删除</el-button>-->
+<!--      <el-button  plain type="mini" icon="el-icon-plus" @click="handleAddLiveGoods">添加商品</el-button>-->
+<!--    </div>-->
+    <el-table
+      ref="dataTable"
+      :data="dataList"
+      style="width: 100%"
+      v-loading="loading"
+    >
+      <!-- 题干列:显示试题的主要内容 -->
+      <el-table-column
+        prop="orderId"
+        label="订单id"
+        show-overflow-tooltip
+      ></el-table-column>
+
+      <el-table-column
+        prop="orderCode"
+        label="订单号"
+      >
+      </el-table-column>
+
+      <el-table-column
+        prop="userName"
+        label="用户名称"
+      ></el-table-column>
+
+      <el-table-column
+        prop="userPhone"
+        label="用户电话"
+      ></el-table-column>
+
+      <el-table-column
+        prop="totalPrice"
+        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>
+
+
+
+    </el-table>
+
+    <!-- 分页组件:用于分页展示试题列表 -->
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+      style="margin-top: 20px;"
+    />
+
+
+  </div>
+  </div>
+</template>
+
+<script>
+import {liveProfitList} from '@/api/live/liveProfit';
+export default {
+  data() {
+    return {
+      loading: true,
+      // 查询条件
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        keywords: null,
+        status: null,
+        liveId: null,
+        desc: null,
+        createTime: null,
+        updateTime: null,
+      },
+      // 数据列表
+      dataList:[],
+      total:0,
+      // 显示搜索条件
+      showSearch: true,
+    }
+  },
+  created(){
+    this.getList();
+  },
+  mounted() {
+    this.loading = false;
+  },
+  methods: {
+    getList(){
+      liveProfitList(this.queryParams).then(res=>{
+        this.dataList = res.rows;
+        this.total = res.total;
+      })
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.loading = true
+      // listLiveGoods(this.queryParams).then(response => {
+      //   this.goodsLiveList = response.rows
+      //   this.goodsLiveTotal = response.total
+      //   this.loading = false
+      // })
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.$refs.queryForm.resetFields();
+    },
+  },
+}
+</script>
+
+
+
+<style scoped lang="scss">
+
+</style>

+ 324 - 0
src/views/live/liveQuestion/index.vue

@@ -0,0 +1,324 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="用户ID" prop="userId">
+        <el-input
+          v-model="queryParams.userId"
+          placeholder="请输入用户ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="问题内容" prop="question">
+        <el-input
+          v-model="queryParams.question"
+          placeholder="请输入问题内容"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="回复" prop="reply">
+        <el-input
+          v-model="queryParams.reply"
+          placeholder="请输入回复"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="回复时间" prop="replyTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.replyTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择回复时间">
+        </el-date-picker>
+      </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">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:liveQuestion:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['live:liveQuestion: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:liveQuestion:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveQuestion:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveQuestionList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="ID" align="center" prop="questionId" />
+      <el-table-column label="用户ID" align="center" prop="userId" />
+      <el-table-column label="问题内容" align="center" prop="question" />
+      <el-table-column label="回复" align="center" prop="reply" />
+      <el-table-column label="回复时间" align="center" prop="replyTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.replyTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:liveQuestion:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:liveQuestion:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改问答对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="用户ID" prop="userId">
+          <el-input v-model="form.userId" placeholder="请输入用户ID" />
+        </el-form-item>
+        <el-form-item label="问题内容" prop="question">
+          <el-input v-model="form.question" placeholder="请输入问题内容" />
+        </el-form-item>
+        <el-form-item label="回复" prop="reply">
+          <el-input v-model="form.reply" placeholder="请输入回复" />
+        </el-form-item>
+        <el-form-item label="回复时间" prop="replyTime">
+          <el-date-picker clearable size="small"
+            v-model="form.replyTime"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="选择回复时间">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" placeholder="请输入备注" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveQuestion, getLiveQuestion, delLiveQuestion, addLiveQuestion, updateLiveQuestion, exportLiveQuestion } from "@/api/live/liveQuestion";
+
+export default {
+  name: "LiveQuestion",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 问答表格数据
+      liveQuestionList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        userId: null,
+        question: null,
+        reply: null,
+        replyTime: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询问答列表 */
+    getList() {
+      this.loading = true;
+      listLiveQuestion(this.queryParams).then(response => {
+        this.liveQuestionList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        questionId: null,
+        userId: null,
+        question: null,
+        reply: null,
+        replyTime: null,
+        createTime: null,
+        createBy: null,
+        updateBy: null,
+        updateTime: null,
+        remark: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.questionId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加问答";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const questionId = row.questionId || this.ids
+      getLiveQuestion(questionId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改问答";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.questionId != null) {
+            updateLiveQuestion(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addLiveQuestion(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const questionIds = row.questionId || this.ids;
+      this.$confirm('是否确认删除问答编号为"' + questionIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveQuestion(questionIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有问答数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveQuestion(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 552 - 0
src/views/live/liveQuestionBank/index.vue

@@ -0,0 +1,552 @@
+<template>
+  <div class="live-question-bank-container">
+    <div class="question-bank-container">
+        <div class="question-bank-header">
+            <el-button
+              type="primary"
+              icon="el-icon-plus"
+              v-hasPermi="['live:liveQuestionBank:add']"
+              @click="handleAdd"
+            >添加试题</el-button>
+            <div class="actions">
+                <el-input
+                v-model="queryParams.title"
+                @input="handleSearch"
+                placeholder="请输入搜索内容"
+                style="width: 300px;"
+                />
+            </div>
+        </div>
+
+        <el-table :data="questionBankList" style="width: 100%; margin-top: 20px;" v-loading="loading">
+            <el-table-column prop="title" label="题干内容" width="500"></el-table-column>
+            <el-table-column label="题型" width="100">
+              <template slot-scope="scope">
+                {{ formatType(scope.row) }}
+              </template>
+            </el-table-column>
+            <el-table-column prop="createBy" label="创建人"></el-table-column>
+            <el-table-column prop="updateTime" label="最后更新时间"></el-table-column>
+            <el-table-column label="操作" width="150" fixed="right">
+                <template slot-scope="scope">
+                <el-button
+                  type="text"
+                  size="small"
+                  style="color: #00CC66;"
+                  @click="handleEdit(scope.row)"
+                >编辑</el-button>
+                <el-button
+                  type="text"
+                  size="small"
+                  style="color: #F56C6C;"
+                  @click="handleDelete(scope.row)"
+                >删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="total>0"
+          :total="total"
+          :page.sync="queryParams.pageNum"
+          :limit.sync="queryParams.pageSize"
+          @pagination="getQuestionBankList"
+        />
+
+        <!-- 添加试题弹窗 -->
+        <el-dialog
+          :title="dialogTitle"
+          :visible.sync="dialogVisible"
+          :close-on-click-modal="false"
+          :close-on-press-escape="false"
+        >
+          <el-form :model="form" ref="form" :rules="dynamicRules" label-width="80px">
+            <el-form-item label="题型" prop="type">
+              <el-select v-model="form.type" placeholder="请选择题型" style="width: 100%">
+                <el-option
+                  v-for="item in questionTypes"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="题干" prop="title">
+              <el-input
+                type="textarea"
+                v-model="form.title"
+                placeholder="请输入题干"
+                :autosize="{ minRows: 4 }"
+              ></el-input>
+            </el-form-item>
+            <!-- 动态渲染选项 -->
+            <el-form-item
+              v-for="(option, index) in form.options"
+              :key="index"
+              :label="`选项${option.label}`"
+              :prop="`options.${index}.content`"
+            >
+              <el-input
+                type="textarea"
+                v-model="option.content"
+                placeholder="请输入选项内容"
+                :autosize="{ minRows: 4 }"
+              ></el-input>
+              <div class="option-helper">
+                <el-checkbox
+                  v-model="option.isCorrect"
+                  @change="() => handleCorrectChange(option)"
+                >设为正确答案</el-checkbox>
+                <el-link type="primary" style="margin-left: auto;" @click="removeOption(index)">删除</el-link>
+              </div>
+            </el-form-item>
+            <!-- 添加选项按钮 -->
+            <el-form-item>
+              <el-button type="text" @click="addOption" icon="el-icon-plus">添加选项</el-button>
+            </el-form-item>
+            <el-form-item label="答案" prop="analysis">
+              <el-input
+                type="text"
+                v-model="form.analysis"
+                style="width: 150px"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-form>
+          <div slot="footer" class="dialog-footer">
+            <el-button @click="dialogVisible = false">取 消</el-button>
+            <el-button type="primary" @click="submitForm">保 存</el-button>
+            <el-button
+              v-if="!isEdit"
+              type="success"
+              @click="submitAndContinue"
+            >保存并继续添加</el-button>
+          </div>
+        </el-dialog>
+    </div>
+  </div>
+</template>
+
+<script>
+import { listLiveQuestionBank, addLiveQuestionBank, updateLiveQuestionBank, deleteLiveQuestionBank } from '@/api/live/liveQuestionBank'
+export default {
+  name: 'LiveQuestionBank',
+  data() {
+    return {
+      total: 0,
+      loading: true,
+      queryParams: {
+        title: null,
+        pageNum: 1,
+        pageSize: 10
+      },
+      questionBankList: [],
+      dialogVisible: false,
+      dialogTitle: '添加试题',
+      isEdit: false,
+      form: {
+        id: null,
+        title: '',
+        type: 1,
+        options: [
+          { label: 'A', content: '', isCorrect: false },
+          { label: 'B', content: '', isCorrect: false },
+          { label: 'C', content: '', isCorrect: false },
+          { label: 'D', content: '', isCorrect: false }
+        ],
+        analysis: ''
+      },
+      questionTypes: [
+        { label: '单选题', value: 1 },
+        { label: '多选题', value: 2 }
+      ]
+    }
+  },
+  computed: {
+    dynamicRules() {
+      const rules = {
+        title: [{ required: true, message: '请输入题干', trigger: 'blur' }],
+        type: [{ required: true, message: '请选择题型', trigger: 'change' }],
+        analysis: [{ required: true, message: '请设置正确答案', trigger: 'change' }]
+      }
+
+      // 动态添加选项验证规则
+      this.form.options.forEach((_, index) => {
+        rules[`options.${index}.content`] = [{ required: true, message: '请输入选项内容', trigger: 'blur' }]
+      })
+
+      return rules
+    }
+  },
+  created() {
+    this.getQuestionBankList()
+  },
+  watch: {
+    'form.options': {
+      handler(options) {
+        const correctLabels = options
+          .filter(option => option.isCorrect)
+          .map(option => option.label)
+          .join(',')
+        this.form.analysis = correctLabels
+      },
+      deep: true
+    },
+    'form.type'() {
+      this.handleTypeChange()
+    }
+  },
+  methods: {
+    getQuestionBankList() {
+      this.loading = true;
+      listLiveQuestionBank(this.queryParams).then(response => {
+        this.questionBankList = response.rows
+        this.total = response.total;
+        this.loading = false;
+      })
+    },
+    handleSearch() {
+      this.getQuestionBankList()
+    },
+    handleAdd() {
+      this.dialogTitle = '添加试题'
+      this.isEdit = false
+      this.dialogVisible = true
+      this.resetForm()
+    },
+    handleEdit(row) {
+      this.dialogTitle = '编辑试题'
+      this.isEdit = true
+      this.dialogVisible = true
+
+      // 先设置基础数据
+      this.form.id = row.id
+      this.form.title = row.title
+
+      // 先回显选项数据
+      let options = JSON.parse(row.content)
+      const answerArray = row.answer.split(',')
+      this.form.options = options.map(option => ({
+        label: option.label,
+        content: option.content,
+        isCorrect: answerArray.includes(option.label)
+      }))
+
+      // 最后设置题型和答案,因为设置题型会触发handleTypeChange
+      this.form.type = row.type
+      this.form.analysis = row.answer
+    },
+    submitForm() {
+      this.$refs.form.validate(valid => {
+        if (!valid) {
+          this.$message({
+            message: '请检查表单填写是否正确',
+            type: 'warning'
+          })
+          return
+        }
+
+        // 验证是否有正确答案
+        if (!this.form.analysis) {
+          this.$message({
+            message: '请设置正确答案',
+            type: 'warning'
+          })
+          return
+        }
+
+        // 验证答案数量
+        const correctCount = this.form.options.filter(option => option.isCorrect).length
+        if (this.form.type === 1 && correctCount !== 1) {
+          this.$message({
+            message: '单选题必须设置一个正确答案',
+            type: 'warning'
+          })
+          return
+        }
+        if (this.form.type === 2 && correctCount < 2) {
+          this.$message({
+            message: '多选题至少需要设置两个正确答案',
+            type: 'warning'
+          })
+          return
+        }
+
+        // 构造提交的参数
+        let params = {
+          id: this.isEdit ? this.form.id : null,
+          title: this.form.title,
+          type: this.form.type,
+          content: JSON.stringify(this.form.options),
+          answer: this.form.analysis
+        }
+
+        // TODO: 根据isEdit判断调用添加还是更新接口
+        if (this.isEdit) {
+          // 调用更新接口
+          updateLiveQuestionBank(params).then(response => {
+            this.msgSuccess("更新成功");
+            this.getQuestionBankList();
+          })
+        } else {
+          // 调用添加接口
+          addLiveQuestionBank(params).then(response => {
+            this.msgSuccess("新增成功");
+            this.getQuestionBankList();
+          })
+        }
+
+        this.dialogVisible = false
+        this.resetForm()
+      })
+    },
+    submitAndContinue() {
+      this.$refs.form.validate(valid => {
+        if (!valid) {
+          this.$message({
+            message: '请检查表单填写是否正确',
+            type: 'warning'
+          })
+          return
+        }
+
+        // 验证是否有正确答案
+        if (!this.form.analysis) {
+          this.$message({
+            message: '请设置正确答案',
+            type: 'warning'
+          })
+          return
+        }
+
+        // 验证答案数量
+        const correctCount = this.form.options.filter(option => option.isCorrect).length
+        if (this.form.type === 1 && correctCount !== 1) {
+          this.$message({
+            message: '单选题必须设置一个正确答案',
+            type: 'warning'
+          })
+          return
+        }
+        if (this.form.type === 2 && correctCount < 2) {
+          this.$message({
+            message: '多选题至少需要设置两个正确答案',
+            type: 'warning'
+          })
+          return
+        }
+
+        // 构造提交的参数
+        let params = {
+          title: this.form.title,
+          type: this.form.type,
+          content: JSON.stringify(this.form.options),
+          answer: this.form.analysis
+        }
+        // 保存逻辑
+        addLiveQuestionBank(params).then(response => {
+            this.msgSuccess("新增成功");
+            this.getQuestionBankList();
+          })
+        this.resetForm()
+      })
+    },
+    addOption() {
+      if (this.form.options.length >= 6) {
+        this.$message({
+          message: '最多只能添加6个选项',
+          type: 'warning'
+        })
+        return
+      }
+      const nextLabel = String.fromCharCode('A'.charCodeAt(0) + this.form.options.length)
+      this.form.options.push({
+        label: nextLabel,
+        content: '',
+        isCorrect: false
+      })
+    },
+    removeOption(index) {
+      if (this.form.options.length <= 2) {
+        this.$message({
+          message: '至少需要保持两个选项',
+          type: 'warning'
+        })
+        return
+      }
+      this.form.options.splice(index, 1)
+      // 重新排列选项标签
+      this.form.options.forEach((option, idx) => {
+        option.label = String.fromCharCode('A'.charCodeAt(0) + idx)
+      })
+    },
+    resetForm() {
+      if (this.$refs.form) {
+        this.$refs.form.resetFields()
+      }
+      // 重置表单数据
+      this.form = {
+        id: null,
+        title: '',
+        type: 1,
+        options: [
+          { label: 'A', content: '', isCorrect: false },
+          { label: 'B', content: '', isCorrect: false },
+          { label: 'C', content: '', isCorrect: false },
+          { label: 'D', content: '', isCorrect: false }
+        ],
+        analysis: ''
+      }
+      this.isEdit = false
+    },
+    handleCorrectChange(currentOption) {
+      const correctCount = this.form.options.filter(option => option.isCorrect).length
+
+      if (this.form.type === 1) { // 单选题
+        // 如果当前选项被选中,则取消其他选项的选中状态
+        if (currentOption.isCorrect) {
+          this.form.options.forEach(option => {
+            if (option !== currentOption) {
+              option.isCorrect = false
+            }
+          })
+        }
+      } else { // 多选题
+        // 如果取消选中会导致正确答案少于2个,阻止操作
+        if (!currentOption.isCorrect && correctCount < 2) {
+          currentOption.isCorrect = true
+          this.$message({
+            message: '多选题至少需要2个正确答案',
+            type: 'warning'
+          })
+        }
+      }
+    },
+    handleTypeChange() {
+      // 如果是编辑状态,不重置答案
+      if (!this.isEdit) {
+        // 重置所有选项的正确答案状态
+        this.form.options.forEach(option => {
+          option.isCorrect = false
+        })
+        this.form.analysis = ''
+      }
+    },
+    handleDelete(row) {
+      this.$confirm('是否确认删除该试题?', '警告', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        deleteLiveQuestionBank(row.id).then(response => {
+          this.msgSuccess("删除成功");
+          this.getQuestionBankList();
+        })
+      }).catch(() => {
+        // 取消删除,不做任何操作
+      })
+    },
+    // 添加获取题型值的方法
+    getQuestionTypeName(type) {
+      const found = this.questionTypes.find(item => item.value === type)
+      return found ? found.label : ''
+    },
+
+    // 修改表格列的显示
+    formatType(row) {
+      return this.getQuestionTypeName(row.type)
+    }
+  }
+}
+</script>
+
+<style scoped>
+.live-question-bank-container {
+  padding: 10px 20px;
+  height: calc(100vh - 84px); /* 减去头部导航的高度 */
+}
+.question-bank-container {
+    background-color: #fff;
+    padding: 10px 20px;
+    border-radius: 4px;
+    height: 100%;
+}
+
+.question-bank-header {
+  margin-top: 20px;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.title {
+  font-size: 16px;
+  font-weight: bold;
+}
+
+.actions {
+  display: flex;
+  align-items: center;
+}
+
+/* 修改表格行高 */
+::v-deep .el-table td {
+  padding: 12px 0;
+}
+
+/* 修改表格hover颜色 */
+::v-deep .el-table tbody tr:hover > td {
+  background-color: #F5F7FA;
+}
+
+.option-helper {
+  display: flex;
+  align-items: center;
+  margin-top: 8px;
+}
+
+/* 修改弹窗样式 */
+::v-deep .el-dialog {
+  height: 100%;
+  margin: 0 !important;
+  display: flex;
+  flex-direction: column;
+}
+
+::v-deep .el-dialog__body {
+  flex: 1;
+  padding: 30px 40px;
+  overflow-y: auto;
+  margin-bottom: 80px;  /* 给底部按钮预留空间 */
+}
+
+::v-deep .el-dialog__header {
+  padding: 20px 40px;
+  border-bottom: 1px solid #e4e7ed;
+}
+
+::v-deep .el-dialog__footer {
+  padding: 20px 40px;
+  border-top: 1px solid #e4e7ed;
+  position: fixed;
+  bottom: 0;
+  width: 100%;
+  background: #fff;
+  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.12);
+  z-index: 1;
+}
+
+::v-deep .el-form-item__label {
+  font-weight: normal;
+}
+
+::v-deep .el-textarea__inner {
+  background-color: #fff;
+  resize: none;
+}
+
+.dialog-footer {
+  text-align: center;
+  padding-top: 10px;
+}
+</style>

+ 477 - 0
src/views/live/liveRedConf/index.vue

@@ -0,0 +1,477 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="红包状态" prop="redStatus">
+        <el-select v-model="queryParams.redStatus" placeholder="请选择红包状态" clearable size="small">
+          <el-option v-for="(item,index) in redStatusOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="红包类型" prop="redType">
+        <el-select v-model="queryParams.redType" placeholder="请选择红包类型" clearable size="small">
+          <el-option v-for="(item,index) in redTypeOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="直播间ID" prop="liveId" >
+        <el-input
+          v-model="queryParams.liveId"
+          placeholder="请输入直播间ID"
+          clearable
+          size="small"
+          :disabled="canLiveId"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="红包标题" prop="desc">
+        <el-input
+          v-model="queryParams.desc"
+          placeholder="请输入描述"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="创建日期" prop="createTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.createTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择创建日期">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="修改日期" prop="updateTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.updateTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择修改日期">
+        </el-date-picker>
+      </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">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:liveRedConf:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['live:liveRedConf:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveRedConf:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveRedConfList" @selection-change="handleSelectionChange">
+      <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="有效时间 单位:分" align="center" prop="duration" />
+      <el-table-column label="红包类型" align="center" prop="redType" :formatter="redTypeFormatter"/>
+      <el-table-column label="直播间ID" align="center" prop="liveId" />
+      <el-table-column label="芳华币数量" align="center" prop="redNum" />
+      <el-table-column label="可中奖份量" align="center" prop="totalLots" />
+      <el-table-column label="实际发放奖励份量" align="center" prop="totalSend" />
+      <el-table-column label="红包标题" align="center" prop="desc" />
+      <el-table-column label="创建日期" align="center" prop="createTime" width="120">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="修改日期" align="center" prop="updateTime" width="120">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:liveRedConf:edit']"
+            style="margin-left: 10px"
+          >修改</el-button>
+          <!-- 开始 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'1')"
+            v-hasPermi="['live:liveRedConf:edit']"
+          >开始</el-button>
+          <!-- 暂停 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'3')"
+            v-hasPermi="['live:liveRedConf:edit']"
+          >暂停</el-button>
+          <!-- 结算 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'2')"
+            v-hasPermi="['live:liveRedConf:edit']"
+          >结算</el-button>
+
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:liveRedConf:edit']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播红包记录配置对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="持续时间" prop="duration">
+          <el-input v-model="form.duration" placeholder="请输入红包有效时间 单位:分" />
+        </el-form-item>
+<!--        <el-form-item label="红包类型" prop="redType">
+          <el-select v-model="form.redType" placeholder="请选择红包类型">
+            <el-option v-for="(item,index) in redTypeOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+          </el-select>
+        </el-form-item>-->
+        <el-form-item label="直播间ID" prop="liveId">
+          <el-input v-model="form.liveId" placeholder="请输入直播间ID" :disabled="canLiveId"/>
+        </el-form-item>
+        <el-form-item label="芳华币数" prop="redNum">
+          <el-input v-model="form.redNum" placeholder="请输入芳华币数量" />
+        </el-form-item>
+        <el-form-item label="中奖份量" prop="totalLots">
+          <el-input v-model="form.totalLots" placeholder="请输入可中奖份量" />
+        </el-form-item>
+        <el-form-item label="红包标题" prop="desc">
+          <el-input v-model="form.desc" placeholder="请输入红包描述" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveRedConf, getLiveRedConf, delLiveRedConf, addLiveRedConf, updateLiveRedConf, exportLiveRedConf } from "@/api/live/liveRedConf";
+
+export default {
+  name: "LiveRedConf",
+  data() {
+    return {
+      //字典
+      redStatusOptions: [],
+      redTypeOptions: [],
+      canLiveId:false,
+      //parentLiveId
+      parentLiveId : null,
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播红包记录配置表格数据
+      liveRedConfList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        redStatus: null,
+        redType: null,
+        liveId: null,
+        desc: null,
+        createTime: null,
+        updateTime: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        duration: [
+          { required: true, message: "有效时间 单位:分不能为空", trigger: "blur" }
+        ],
+        /* redType: [
+          { required: true, message: "红包类型不能为空", trigger: "change" }
+        ], */
+        liveId: [
+          { required: true, message: "直播间ID不能为空", trigger: "blur" }
+        ],
+        redNum: [
+          { required: true, message: "芳华币数量不能为空", trigger: "blur" }
+        ],
+        totalLots: [
+          { required: true, message: "可中奖份量不能为空", trigger: "blur" }
+        ],
+        desc: [
+          { required: true, message: "描述不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getDicts("sys_live_red_status").then(response => {
+      this.redStatusOptions = response.data;
+    });
+    this.getDicts("sys_live_red_type").then(response => {
+      this.redTypeOptions = response.data;
+    });
+    this.parentLiveId = this.liveId;
+    this.queryParams.liveId = this.parentLiveId;
+    if(this.queryParams.liveId){
+      this.form.liveId = this.parentLiveId;
+      //设置查询条件直播间ID不可修改
+      this.canLiveId = true;
+    }
+    this.getList();
+  },
+  computed: {
+    liveId() {
+      return this.$route.params.liveId;
+    }
+  },
+  methods: {
+    handleStatusChange(row, status) {
+      //结束的抽奖不能进行操作
+      if(row.redStatus+"" === "2"){
+        this.msgError("已结束的红包不能进行操作");
+        return;
+      }
+      switch (status+"") {
+        case "1":
+          //只能对未开启的抽奖进行操作
+          if(row.redStatus+"" !== "0" && row.redStatus+"" !== "3"){
+            this.msgError("只能对未开启或暂停的红包进行开始操作");
+            return;
+          }
+          break;
+        case "2":
+          //只能对进行中或暂停的红包进行结算
+          if(row.redStatus+"" !== "1" && row.redStatus+"" !== "3"){
+            this.msgError("只能对进行中或暂停的红包进行结算");
+            return;
+          }
+          break;
+        case "3":
+          //只能对进行中的抽奖执行暂停操作
+          if(row.redStatus+"" !== "1"){
+            this.msgError("只能对进行中的红包执行暂停操作");
+            return;
+          }
+          break;
+        default:
+          return;
+      }
+      const doRedParam = {
+        redId: row.redId,
+        redStatus: status
+      };
+      updateLiveRedConf(doRedParam).then(response => {
+        if(response.code === 200){
+          this.$store.state.liveWs[this.liveId].sendWs("red",response.msg, row.redId,this.liveId);
+          this.getList();
+          this.msgSuccess("修改成功");
+        }else{
+          this.msgError(response.msg);
+        }
+        this.open = false;
+      });
+    },
+    redStatusFormatter(row, column) {
+      return this.selectDictLabel(this.redStatusOptions, row.redStatus);
+    },
+    redTypeFormatter(row, column) {
+      return this.selectDictLabel(this.redTypeOptions, row.redType);
+    },
+    /** 查询直播红包记录配置列表 */
+    getList() {
+      this.loading = true;
+      listLiveRedConf(this.queryParams).then(response => {
+        this.liveRedConfList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        redId: null,
+        redStatus: null,
+        duration: null,
+        //redType: null,
+        liveId: null,
+        redNum: null,
+        totalLots: null,
+        totalSend: null,
+        desc: null,
+        createTime: null,
+        updateTime: null,
+        createBy: null,
+        updateBy: null
+      };
+      this.resetForm("form");
+      this.checkParentLiveId();
+    },
+    //判断父页面传入参数
+    checkParentLiveId(){
+      if(this.parentLiveId){
+        this.form.liveId = this.parentLiveId;
+        this.queryParams.liveId = this.parentLiveId;
+      }
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.checkParentLiveId();
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.redId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播红包记录配置";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      //只能对未开始或暂停的抽奖进行修改
+      if(row.redStatus+"" !== "0" && row.redStatus+"" !== "3"){
+        this.msgError("只能对未开始或暂停的红包进行修改");
+        return;
+      }
+      this.reset();
+      const redId = row.redId || this.ids
+      getLiveRedConf(redId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改直播红包记录配置";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.redId != null) {
+            updateLiveRedConf(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            this.form.redType = 1;
+            addLiveRedConf(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      //如果状态不为0,则不能删除
+      if (row.redStatus+"" !== "0") {
+        this.msgError("只能删除未发放的红包");
+        return;
+      }
+      const redIds = row.redId || this.ids;
+      this.$confirm('是否确认删除直播红包记录配置编号为"' + redIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveRedConf(redIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播红包记录配置数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveRedConf(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 147 - 0
src/views/live/liveRewardRecord/index.vue

@@ -0,0 +1,147 @@
+<template>
+  <div class="app-container">
+    <div class="reward-container">
+      <!-- 时间步长选择 -->
+      <span class="demonstration">月份选择(可多选)</span>
+      <el-date-picker
+        type="month"
+        v-model="selectedTimeStep"
+        format="yyyy-MM"
+        @change="handleTimeStepChange"
+        placeholder="选择一个或多个日期">
+      </el-date-picker>
+
+      <el-button
+        type="warning"
+        plain
+        icon="el-icon-download"
+        size="mini"
+        :loading="exportLoading"
+        @click="handleExport"
+        style="margin-left: 10px"
+        v-hasPermi="['live:liveRewardRecord:export']"
+      >导出</el-button>
+
+
+
+    </div>
+
+    <!-- 直播间数据表格 + 总消耗 -->
+    <div style="margin-top: 24px;">
+      <h3 style="font-size: 16px; font-weight: 600; margin-bottom: 12px;">直播间积分消耗明细</h3>
+      <el-table
+        :data="tableData"
+        border
+        show-summary
+        stripe
+        style="width: 100%; margin-bottom: 12px;"
+      >
+        <el-table-column label="直播名称" prop="liveNameAndId" width="100" align="center" />
+        <el-table-column
+          v-for="(date, index) in timeSeries"
+          :key="index"
+          :label="date"
+          align="center"
+        >
+          <template #default="scope">
+            {{ scope.row.dailyData[index] || '-' }}
+          </template>
+        </el-table-column>
+        <el-table-column label="单直播间总计" prop="total" width="120" align="center" />
+      </el-table>
+    </div>
+  </div>
+</template>
+
+<script>
+import { statistics,exportLiveIntegral } from '@/api/live/liveRewardRecord'
+
+export default {
+  name: 'liveRewardRecord',
+  data() {
+    return {
+      exportLoading: false,
+      selectedTimeStep: [],
+      tableData: [],
+      chartSeries: [],
+      timeSeries: [],
+      colorList: [
+        '#34a853', '#fbbc05', '#4285f4', '#ea4335', '#9c27b0',
+        '#ff9800', '#673ab7', '#e91e63', '#00bcd4', '#8bc34a'
+      ]
+    }
+  },
+  computed: {
+  },
+  mounted() {
+    this.selectedTimeStep.push(new Date())
+    this.initData(this.selectedTimeStep)
+  },
+  methods: {
+    handleExport(){
+      if(this.selectedTimeStep == null || this.selectedTimeStep.length < 1) {
+        this.$message.error('请选择导出月份')
+        return
+      }
+      var date = []
+      if (this.selectedTimeStep == null || this.selectedTimeStep.length === 0) {
+        date.push(new Date());
+      } else {
+        date = this.selectedTimeStep
+      }
+      this.$confirm('是否确认导出所有直播积分记录?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportLiveIntegral({ 'step': date, companyId:0});
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {});
+    },
+    initData(date) {
+      statistics({ 'step': date, companyId:0}).then(res => {
+        this.timeSeries = res.timeSeries || []
+        this.tableData = res.data || []
+
+
+        this.processTableData()
+      }).catch(err => {
+        console.error('数据加载失败:', err)
+        this.$message.error('数据加载失败,请重试')
+      })
+    },
+    processTableData() {
+      const liveList = this.tableData
+      this.tableData = liveList.map(liveItem => {
+        const dailyData = liveItem.dataList || []
+        const total = dailyData.reduce((sum, num) => sum + (num || 0), 0)
+        return { liveNameAndId: liveItem.liveNameAndId, dailyData, total }
+      })
+    },
+    handleTimeStepChange() {
+      const date = [];
+      date.push(this.selectedTimeStep)
+      this.initData(date)
+    },
+  }
+}
+</script>
+
+<style>
+/* 基础布局样式 */
+.reward-container {
+  padding: 20px;
+  background-color: #fff;
+}
+.charts-container {
+  display: flex;
+  gap: 24px;
+  margin-bottom: 24px;
+}
+.chart-wrapper {
+  flex: 1;
+}
+</style>

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

@@ -0,0 +1,301 @@
+<template>
+  <div class="app-container">
+
+<!--    <el-row :gutter="10" class="mb8">-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="primary"-->
+<!--          plain-->
+<!--          icon="el-icon-plus"-->
+<!--          size="mini"-->
+<!--          @click="handleAdd"-->
+<!--          v-hasPermi="['live:liveVideo:add']"-->
+<!--        >新增</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:liveVideo:remove']"-->
+<!--        >删除</el-button>-->
+<!--      </el-col>-->
+<!--      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
+<!--    </el-row>-->
+
+    <el-table border v-loading="loading" :data="liveVideoList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="编号" align="center" prop="videoId" />
+      <el-table-column label="视频名称" align="center" prop="remark" />
+      <el-table-column label="视频地址" align="center" prop="videoUrl">
+        <template slot-scope="scope">
+          <video
+            :src="scope.row.videoUrl"
+            controls
+            controlsList="nodownload"
+            class="video-player"
+            @contextmenu.prevent
+          ></video>
+        </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
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播视频对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <live-video-upload
+          :type = "1"
+          :isPrivate = "isPrivate"
+          :fileKey.sync = "form.fileKey"
+          :fileSize.sync = "form.fileSize"
+          :videoUrl.sync="form.videoUrl"
+          :fileName.sync="form.fileName"
+          :line_1.sync="form.lineOne"
+          :thumbnail.sync="form.thumbnail"
+          :uploadType.sync="form.uploadType"
+          :isTranscode.sync="form.isTranscode"
+          :transcodeFileKey.sync="form.transcodeFileKey"
+          @video-duration="handleVideoDuration"
+          @change="handleVideoChange"
+          ref="videoUpload"
+          append-to-body
+        />
+
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveVideo, getLiveVideo, delLiveVideo, addLiveVideo, updateLiveVideo, exportLiveVideo } from "@/api/live/liveVideo";
+import LiveVideoUpload from "@/components/LiveVideoUpload/index.vue";
+
+export default {
+  name: "LiveVideo",
+  components: { LiveVideoUpload },
+  data() {
+    return {
+      //字典
+      videoTypeOptions: [],
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播视频表格数据
+      liveVideoList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: -1,
+        videoUrl: null,
+        videoType: -1,
+        sort: null,
+      },
+      // 表单参数
+      form: {
+        uploadType: 1,
+        isTranscode:0,
+        transcodeFileKey:null
+      },
+      // 表单校验
+      rules: {
+      },
+      isPrivate:null,
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    handleVideoDuration(duration) {
+      this.form.duration = duration;
+    },
+    handleVideoChange(videoUrl,lineOne){
+      this.videoUrl = videoUrl;
+      this.form.videoUrl = videoUrl;
+      console.log(this.videoUrl)
+    },
+    // 操作日志类型字典翻译
+    formatDuration(row, column) {
+      if(row.duration == null) return "00:00"
+      const h = Math.floor(row.duration / 3600);
+      const m = Math.floor((row.duration % 3600) / 60);
+      const s = Math.floor(row.duration % 60);
+
+      // 补零处理
+      const format = (num) => num.toString().padStart(2, '0');
+
+      return h > 0
+        ? `${h}:${format(m)}:${format(s)}`
+        : `${format(m)}:${format(s)}`;
+    },
+    /** 查询直播视频列表 */
+    getList() {
+      this.loading = true;
+      listLiveVideo(this.queryParams).then(response => {
+        this.liveVideoList = response.rows;
+        this.liveVideoList.forEach(item => {
+          item.videoUrl = item.videoUrl.replace(".m3u8", ".mp4");
+        });
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    videoTypeFormatter(row, column) {
+      return this.selectDictLabel(this.videoTypeOptions, row.status);
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        videoId: null,
+        liveId: null,
+        videoUrl: null,
+        videoType: null,
+        sort: null,
+        createTime: null,
+        createBy: null,
+        updateBy: null,
+        updateTime: null,
+        remark: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.videoId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播视频";
+      setTimeout(() => {
+        this.$refs.videoUpload.reset();
+      }, 500);
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const videoId = row.videoId || this.ids
+      getLiveVideo(videoId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改直播视频";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          this.form.videoType = -1;
+          this.form.liveId = -1;
+          this.form.remark = this.form.fileName;
+          if(this.form.videoUrl == null || this.form.videoUrl == "") {
+            this.msgError("请上传视频");
+            return;
+          }
+          addLiveVideo(this.form).then(response => {
+            this.msgSuccess("新增成功");
+            this.open = false;
+            this.getList();
+            this.reset();
+          });
+
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const videoIds = row.videoId || this.ids;
+      this.$confirm('是否确认删除直播视频编号为"' + videoIds + '"的数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return delLiveVideo(videoIds);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播视频数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportLiveVideo(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {});
+    }
+  }
+};
+</script>
+
+<style scoped>
+.video-player {
+  width: 100%;
+  height: 100%;
+  object-fit: cover;
+}
+</style>

+ 51 - 0
src/views/live/liveWatchUser/index.vue

@@ -0,0 +1,51 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="直播ID" prop="liveId">
+        <el-input
+          v-model="queryParams.liveId"
+          placeholder="请输入直播ID"
+          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>
+  </div>
+</template>
+
+<script>
+
+export default {
+  name: 'LiveWatchUser',
+  data() {
+    return {
+      showSearch: true,
+      queryForm: null,
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10
+      }
+    }
+  },
+  created() {
+
+  },
+  methods: {
+    handleQuery() {
+      console.log(this.queryParams);
+    },
+    resetQuery() {
+      console.log(this.queryParams);
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 35 - 0
src/views/live/talentLiveInfo/index.vue

@@ -0,0 +1,35 @@
+
+<template>
+  <div>
+    <h1>个人设置</h1>
+    <form @submit.prevent="updateProfile">
+      <div>
+        <label>用户名:</label>
+        <input type="text" v-model="userProfile.username" required />
+      </div>
+      <div>
+        <label>邮箱:</label>
+        <input type="email" v-model="userProfile.email" required />
+      </div>
+      <button type="submit">更新</button>
+    </form>
+  </div>
+</template>
+
+<script>export default {
+  data() {
+    return {
+      userProfile: {
+        username: '用户1',
+        email: 'user@example.com'
+      }
+    };
+  },
+  methods: {
+    updateProfile() {
+      // 更新个人资料的逻辑
+      console.log('更新后的信息:', this.userProfile);
+    }
+  }
+};
+</script>

+ 280 - 0
src/views/live/words/index.vue

@@ -0,0 +1,280 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
+      <el-form-item label="敏感词" prop="word">
+        <el-input
+          v-model="queryParams.word"
+          placeholder="请输入需要过滤的敏感词"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="敏感词添加时间" prop="createTime" label-width="120px">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.createTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择敏感词添加时间">
+        </el-date-picker>
+      </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">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:words:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['live:words: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:words:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:words:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="wordsList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="敏感词唯一标识" align="center" prop="wordId" />
+      <el-table-column label="需要过滤的敏感词" align="center" prop="word" />
+      <el-table-column label="敏感词添加时间" align="center" prop="createTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:words:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:words:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播间敏感词过滤对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+        <el-form-item label="敏感词" prop="word">
+          <el-input v-model="form.word" placeholder="请输入需要过滤的敏感词" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {listWords, getWords, delWords, addWords, updateWords, exportWords} from "@/api/live/words";
+
+export default {
+  name: "Words",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播间敏感词过滤表格数据
+      wordsList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        word: null,
+        createTime: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        word: [
+          { required: true, message: "需要过滤的敏感词不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询直播间敏感词过滤列表 */
+    getList() {
+      this.loading = true;
+      listWords(this.queryParams).then(response => {
+        this.wordsList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        wordId: null,
+        word: null,
+        createTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.wordId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播间敏感词过滤";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const wordId = row.wordId || this.ids
+      getWords(wordId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改直播间敏感词过滤";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.wordId != null) {
+            updateWords(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addWords(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const wordIds = row.wordId || this.ids;
+      this.$confirm('是否确认删除直播间敏感词过滤编号为"' + wordIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delWords(wordIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播间敏感词过滤数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportWords(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 3 - 2
src/views/qw/QwWorkTaskNew/qwWorkTask.vue

@@ -21,8 +21,8 @@
 	      <el-option
 	        v-for="item in companyUserOptions"
 	        :key="item.value"
-	        :label="item.label"
-	        :value="item.value">
+	        :label="item.dictLabel"
+	        :value="item.dictValue">
 	      </el-option>
 	    </el-select>
 	  </el-form-item>
@@ -534,6 +534,7 @@ export default {
 	getCompanyUserListLikeName() {
 	  getCompanyUserListLikeName(this.companyUserOptionsParams).then(response => {
 	    this.companyUserOptions = [...this.companyUserOptions, ...response.data.list]
+		console.log(this.companyUserOptions);
 	    this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
 	    this.companyUserOptionsLoading = false;
 	  });

+ 12 - 11
src/views/qw/externalContact/myExternalContact.vue

@@ -232,17 +232,18 @@
           v-hasPermi="['qw:externalContact:add']"
         >同步</el-button>
       </el-col> -->
-      <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-
-        >修改备注</el-button>
-      </el-col>
+      <!--   去掉此按钮,此按钮也是单选修改备注,列表上已经存在此按钮了   -->
+      <!--      <el-col :span="1.5">-->
+      <!--        <el-button-->
+      <!--          type="success"-->
+      <!--          plain-->
+      <!--          icon="el-icon-edit"-->
+      <!--          size="mini"-->
+      <!--          :disabled="single"-->
+      <!--          @click="handleUpdate"-->
+
+      <!--        >修改备注</el-button>-->
+      <!--      </el-col>-->
       <el-col :span="1.5">
         <el-button
           type="warning"

+ 3 - 3
src/views/qw/sop/addSop.vue

@@ -388,7 +388,7 @@
         </el-form-item>
 
         <el-form-item label="模板" prop="tempId">
-          <div @click="selectListSopTemp(form.sendType)"
+          <div @click="selectListSopTemp(form.sendType,formType)"
                style="cursor: pointer; border: 1px solid #e6e6e6; background-color: white; overflow: hidden; flex-grow: 1;">
             <el-tag v-if="form.tempId" type="success" style="margin: 3px;">
               {{ form.tempName }}
@@ -842,13 +842,13 @@ export default {
       }
     },
     //查询模板
-    selectListSopTemp(type) {
+    selectListSopTemp(type,formType) {
       if(this.form.filterMode == 2){
         type = 11;
       }
       this.tempOpen = true;
       setTimeout(() => {
-        this.$refs.SopTempComments.getList(type, undefined, this.form.type == 3);
+        this.$refs.SopTempComments.getList(type, undefined, this.form.type == 3,formType);
       }, 200);
 
     },

+ 1 - 1
src/views/qw/sop/deptSop.vue

@@ -1117,7 +1117,7 @@ export default {
     handleCampSendMsg(){
 
       setTimeout(() => {
-        this.$refs.sendMsgSopOpenTool.oneClickGroupSending(this.ids,2,this.queryParams.corpId);
+        this.$refs.sendMsgSopOpenTool.oneClickGroupSending(this.ids,2,this.queryParams.corpId,0);
       }, 500);
 
     },

+ 1 - 1
src/views/qw/sop/mySop.vue

@@ -1116,7 +1116,7 @@ export default {
     handleCampSendMsg(){
 
       setTimeout(() => {
-        this.$refs.sendMsgSopOpenTool.oneClickGroupSending(this.ids,2,this.queryParams.corpId);
+        this.$refs.sendMsgSopOpenTool.oneClickGroupSending(this.ids,2,this.queryParams.corpId,1);
       }, 500);
 
     },

+ 1 - 1
src/views/qw/sop/sop.vue

@@ -1118,7 +1118,7 @@ export default {
     handleCampSendMsg(){
 
       setTimeout(() => {
-        this.$refs.sendMsgSopOpenTool.oneClickGroupSending(this.ids,2,this.queryParams.corpId);
+        this.$refs.sendMsgSopOpenTool.oneClickGroupSending(this.ids,2,this.queryParams.corpId,0);
       }, 500);
 
     },

+ 67 - 1
src/views/qw/sop/updateSop.vue

@@ -103,6 +103,54 @@
               </el-tag>
             </div>
           </el-form-item>
+          <el-form-item label="是否自动创建群" prop="autoGroup" v-if="form.filterMode == 2">
+            <el-radio-group v-model="form.autoGroup">
+              <el-radio
+                :label="0"
+              >否
+              </el-radio>
+              <el-radio
+                :label="1"
+              >是
+              </el-radio>
+            </el-radio-group>
+            <div style="color: #999;font-size: 14px;display: flex;align-items: center;">
+              <i class="el-icon-info"></i>
+              选择的企业微信员工下面的群聊
+            </div>
+          </el-form-item>
+          <el-form-item label="是否注册用户" prop="autoGroup" v-if="form.filterMode == 2 && form.autoGroup == 1">
+            <el-radio-group v-model="form.autoUserReg">
+              <el-radio
+                :label="0"
+              >否
+              </el-radio>
+              <el-radio
+                :label="1"
+              >是
+              </el-radio>
+            </el-radio-group>
+            <div style="color: #999;font-size: 14px;display: flex;align-items: center;">
+              <i class="el-icon-info"></i>
+              筛选是否注册的用户
+            </div>
+          </el-form-item>
+          <el-form-item label="创建群聊评级" prop="chatIds" v-if="form.filterMode == 2 && form.autoGroup == 1">
+            <el-select multiple filterable clearable v-model="form.autoGroupLevelArray">
+              <el-option v-for="item in levelList" :key="item.value" :label="item.label" :value="item.value"/>
+            </el-select>
+            <div style="color: #999;font-size: 14px;display: flex;align-items: center;">
+              <i class="el-icon-info"></i>
+              选择需要拉取的客户评级
+            </div>
+          </el-form-item>
+          <el-form-item label="群聊名称" prop="chatIds" v-if="form.filterMode == 2 && form.autoGroup == 1">
+            <el-input v-model="form.groupName" maxlength="10" placeholder="请输入群聊名称" />
+            <div style="color: #999;font-size: 14px;display: flex;align-items: center;">
+              <i class="el-icon-info"></i>
+              创建群聊的名称(如有重复自动加数字区分)
+            </div>
+          </el-form-item>
           <el-form-item label="标签规则" prop="filterType">
             <el-radio-group v-model="form.filterType">
               <el-radio
@@ -342,7 +390,7 @@ import ImageUpload from "@/views/qw/sop/ImageUpload";
 import CustomerGroupDetails from '@/views/qw/groupMsg/customerGroupDetails.vue'
 import sopLogsDetails from '@/views/qw/sopLogs/sopLogsList.vue'
 import { listTag, getTag, } from "@/api/qw/tag";
-import { getMyQwUserList,getMyQwCompanyList } from "@/api/qw/user";
+import {getMyQwUserList, getMyQwCompanyList, getQwUserByIds} from "@/api/qw/user";
 import {sopListWxUserGroup} from "@/api/wxUser/wxUserGroup";
 import source from "echarts/src/data/Source";
 import SopTemp from "@/views/qw/sopTemp/sopTemp.vue";
@@ -353,6 +401,14 @@ export default {
   components: {Tip, SopTemp, CustomerGroupDetails, qwUserList,ImageUpload,sopLogsDetails},
   data() {
     return {
+      levelList: [
+        {value: 1, label: "A"},
+        {value: 2, label: "B"},
+        {value: 3, label: "C"},
+        {value: 4, label: "D"},
+        {value: 5, label: "E"},
+        {value: -1, label: "未评级"},
+      ],
       updateQwUserDialog:{
         title:"修改成员",
         open:false
@@ -410,6 +466,7 @@ export default {
         status: 1,
         sendType:2,
         type: 2,
+        autoGroupLevelArray:[],
         filterType:2,
         autoSopTime:{},
       },
@@ -645,6 +702,14 @@ export default {
         if (this.form.setting!=null){
           this.setting=JSON.parse(this.form.setting);
         }
+        if(this.form.autoGroupLevel != null){
+          this.form.autoGroupLevelArray = this.form.autoGroupLevel.split(",").map(Number);
+        }
+        if(this.form.qwUserIds != null){
+          getQwUserByIds(this.form.qwUserIds).then(res => {
+            this.companyQwUserList = res.data;
+          })
+        }
 
         listSopTemp({id:this.form.tempId}).then(response => {
           this.tempList = response.rows;
@@ -667,6 +732,7 @@ export default {
         type: 2,
         filterType:2,
         qwUserIds: null,
+        autoGroupLevelArray:[],
         corpId: null,
         setting: null,
         createBy: null,

+ 934 - 0
src/views/qw/sopTemp/deptIndex.vue

@@ -0,0 +1,934 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="模板标题" prop="name">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="请输入模板标题"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
+          <el-option
+            v-for="dict in statusOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="模板类型" prop="sendType">
+        <el-select v-model="queryParams.sendType" placeholder="请选择类型" clearable size="small">
+          <el-option
+            v-for="dict in sysQwSopType"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="排序" prop="sort">
+        <el-input
+          v-model="queryParams.sort"
+          placeholder="请输入排序"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="所属销售" prop="createBy">
+        <el-select v-model="queryParams.createBy" clearable filterable remote
+                   placeholder="请输入关键词" :remote-method="loadCompanyUserOptions"
+                   v-select-load-more="loadMoreCompanyUserOptions"
+                   :loading="companyUserOptionsLoading"
+                   @change="handleCompanyUserChange"
+                   @visible-change="handleCompanyUserDropdownVisible">
+          <el-option
+            v-for="item in companyUserOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue">
+          </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>
+      </el-form-item>
+    </el-form>
+
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-dropdown
+          v-hasPermi="['qw:sopTemp:deptAdd']"
+          @command="handleCommand"
+          trigger="click"
+          placement="bottom-start"
+        >
+          <el-dropdown-menu slot="dropdown" style="width: 120px;">
+            <el-dropdown-item
+              v-for="option in sysQwSopType"
+              :key="option.dictValue"
+              :command="option.dictValue"
+            >
+              <i :class="option.iconClass" style="margin-right: 10px;"></i>
+              {{ option.dictLabel }}
+            </el-dropdown-item>
+          </el-dropdown-menu>
+          <span class="el-dropdown-link">
+              <el-button type="primary" icon="el-icon-plus" plain size="mini">
+                新增模板
+              </el-button>
+            </span>
+        </el-dropdown>
+      </el-col>
+
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['qw:sopTemp:deptRemove']"
+        >删除
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['qw:sopTemp:deptExport']"
+        >导出
+        </el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" border :data="sopTempList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column label="模板编号" align="center" prop="id"/>
+      <el-table-column label="公司名称" align="center">
+        <template slot-scope="scope">
+          <el-tag v-for="item in companys" v-if="scope.row.companyId == item.companyId">{{item.companyName}}</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="模板标题" align="center" prop="name"/>
+      <el-table-column label="模板类型" align="center" prop="sendType">
+        <template slot-scope="scope">
+          <dict-tag :options="sysQwSopType" :value="scope.row.sendType"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="间隔天数" align="center" prop="gap"/>
+      <el-table-column label="状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="创建时间" align="center" prop="createTime"/>
+      <el-table-column label="创建人" align="center" prop="createByName"/>
+      <el-table-column label="创建部门" align="center" prop="createByDeptName"/>
+      <el-table-column label="修改时间" align="center" prop="updateTime"/>
+      <el-table-column label="排序" align="center" prop="sort"/>
+
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-connection"
+
+            @click="copyTemplate(scope.row)"
+            v-hasPermi="['qw:sopTemp:deptEdit']"
+          >复制模板
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-share"
+            @click="shareTemplate(scope.row)"
+            v-hasPermi="['qw:sopTemp:deptShare']"
+          >分享模板</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-s-promotion"
+            @click="handleQueryDetails(scope.row)"
+            v-hasPermi="['qw:sopTemp:deptList']"
+          >详情
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['qw:sopTemp:deptEdit']"
+          >修改
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate2(scope.row)"
+            v-hasPermi="['qw:sopTemp:deptEdit']"
+          >管理规则
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdateRed(scope.row)"
+            v-if="scope.row.sendType == 5"
+            v-hasPermi="['qw:sopTemp:deptEdit']"
+          >红包设置
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['qw:sopTemp:deptRemove']"
+          >删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="名称" prop="name">
+          <el-input v-model="form.name" placeholder="请输入模板标题"/>
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-radio-group v-model="form.status">
+            <el-radio
+              v-for="dict in statusOptions"
+              :key="dict.dictValue"
+              :label="dict.dictValue"
+            >{{ dict.dictLabel }}
+            </el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="所属项目" prop="project" v-if="form.sendType != 5">
+          <el-select v-model="form.project" placeholder="请选择项目" filterable clearable size="small">
+            <el-option
+              v-for="dict in projectOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            />
+          </el-select>
+        </el-form-item>
+
+        <el-form-item label="归属部门" prop="createByDept">
+          <treeselect
+            style="width: 220px"
+            :clearable="false"
+            v-model="form.createByDept"
+            :options="deptOptions"
+            clearable
+            :show-count="true"
+            placeholder="请选择归属部门"
+          />
+        </el-form-item>
+        <el-form-item label="课程" prop="courseId" v-if="form.sendType == 11 && !form.id">
+          <el-select v-model="form.courseId"placeholder="请选择课程" style=" margin-right: 10px;" size="mini" filterable>
+            <el-option
+              v-for="dict in courseList"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="parseInt(dict.dictValue)"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="间隔天数" prop="gap">
+          <el-input-number v-model="form.gap" :min="1" label="间隔天数"></el-input-number>
+        </el-form-item>
+        <el-form-item label="排序" prop="sort">
+          <el-input-number v-model="form.sort" :min="0" label="排序"></el-input-number>
+        </el-form-item>
+        <el-form-item label="是否开启官方群发" v-if="form.sendType == 11 && (form.id === null || form.id === undefined)">
+          <el-radio-group v-model="form.openOfficial">
+            <el-radio
+              v-for="dict in openOfficialOptions"
+              :key="dict.dictValue"
+              :label="dict.dictValue"
+            >{{ dict.dictLabel }}
+            </el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="内容" prop="modeContent">
+          <el-input v-model="form.modeContent" placeholder="请输入文字内容"  type="textarea" :rows="3"/>
+        </el-form-item>
+        <el-form-item label="发课时间" prop="time" v-if="form.sendType == 11 && !form.id">
+          <el-time-picker
+            class="custom-input"
+            v-model="form.time"
+            value-format="HH:mm"
+            format="HH:mm"
+            placeholder="时间"
+            style="width: 200px;height: 20px;margin-left: 10px;margin-top: 10px">
+          </el-time-picker>
+        </el-form-item>
+        <el-form-item label="每天催课次数" prop="num" v-if="form.sendType == 11 && !form.id">
+          <el-input-number v-model="form.num" :min="0" label="每天催课次数" @change="sendNumChange"></el-input-number>
+        </el-form-item>
+        <el-form-item label="催课时间" v-if="form.sendType == 11 && !form.id && form.num > 0">
+          <div v-for="(item, index) in form.timeList" :key="index" style="margin-bottom: 10px;">
+            <el-time-picker
+              class="custom-input"
+              v-model="item.value"
+              value-format="HH:mm"
+              format="HH:mm"
+              :picker-options="{ selectableRange: startTimeRange }"
+              placeholder="时间"
+              style="width: 150px; height: 20px; margin-left: 10px; margin-top: 10px">
+            </el-time-picker>
+
+            <el-input
+              v-model="item.desc"
+              placeholder="催课内容"
+              type="textarea" :rows="2"
+              style="width: 500px; margin-left: 10px; margin-top: 10px;">
+            </el-input>
+          </div>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer" style="display: flex;justify-content: flex-end;">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog title="课程红包" :visible.sync="redData.open" width="900px" append-to-body>
+      <el-table v-loading="redData.loading" border :data="redData.list" height="500px">
+        <el-table-column label="小节" align="left" prop="videoName"/>
+        <el-table-column label="金额" align="center">
+          <template slot-scope="scope">
+            <el-input-number v-model="scope.row.redPacketMoney" :min="0.01" step="0.01" label="红包金额"></el-input-number>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div slot="footer" class="dialog-footer" style="display: flex;justify-content: flex-end;">
+        <el-button type="primary" @click="updateRedData" :disabled="redData.loading">保 存</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog :title="shareOptions.title" :visible.sync="shareOptions.open" width="800px" append-to-body>
+
+      <el-form :model="queryCompanyParams" ref="queryCompanyForm" :inline="true" v-show="showSearch" label-width="68px">
+        <el-form-item label="公司名称" prop="companyName">
+          <el-input
+            style="width: 220px"
+            v-model="queryCompanyParams.companyName"
+            placeholder="请输入企业名称"
+            clearable
+            size="small"
+            @keyup.enter.native="handleCompanyQuery"
+          />
+        </el-form-item>
+
+        <el-form-item label="状态" prop="status">
+          <el-select style="width: 220px" v-model="queryCompanyParams.status" placeholder="请选择状态" clearable size="small">
+            <el-option
+              v-for="dict in statusOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleCompanyQuery">搜索</el-button>
+          <el-button icon="el-icon-refresh" size="mini" @click="resetCompanyQuery">重置</el-button>
+        </el-form-item>
+      </el-form>
+      <el-row :gutter="10" class="mb8">
+        <el-col :span="1.5">
+          <el-button
+            plain
+            type="primary"
+            icon="el-icon-connection"
+            size="mini"
+            :disabled="multiple"
+            @click="handleShareTemplate"
+            v-hasPermi="['qw:sopTemp:myShare']"
+          >分享模板</el-button>
+        </el-col>
+      </el-row>
+      <el-table v-loading="companysloading" border :data="companyList" @selection-change="handleSelectionCompany">
+        <el-table-column type="selection" width="55" align="center" />
+        <el-table-column label="公司编号" align="center" prop="companyId" />
+                <el-table-column label="企业名" align="center" prop="companyName" />
+        <!--        <el-table-column label="备注" align="center" prop="remark"/>-->
+        <el-table-column label="状态" align="center" prop="status" >
+          <template slot-scope="scope">
+            <el-tag prop="status" v-for="(item, index) in statusOptions"  :type="scope.row.status==1?'success':'danger'"  v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="companyTotal>0"
+        :total="companyTotal"
+        :page.sync="queryCompanyParams.pageNum"
+        :limit.sync="queryCompanyParams.pageSize"
+        @pagination="getCompanyList"
+      />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  addTemp,
+  copyTemplate,
+  delSopTemp,
+  exportSopTemp,
+  getSopTemp,
+  listSopTemp,
+  getSelectableRange,
+  redList,
+  shareSopTemp,
+  updateRedPackage,
+  updateTemp, listSopTempDeptList
+} from "../../../api/qw/sopTemp";
+import { getCompanyList, listCompany } from '@/api/company/company'
+import {courseList, getRoles} from "@/api/qw/sop";
+import {treeselect} from "../../../api/company/companyDept";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import {getCompanyUserListLikeNameByDept} from "../../../api/company/companyUser";
+export default {
+  name: "SopTemp",
+  components: {Treeselect},
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      companysloading: false,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      courseList: [],
+      roles: [],
+      //选中的公司
+      companys: [],
+      deptOptions: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      companyTotal: 0,
+      total: 0,
+      sendType: 0,
+      // sop模板表格数据
+      sopTempList: [],
+      sysQwSopType: [],
+      companyList: [],
+      projectOptions: [],
+      startTimeRange: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      command: 0,
+      // 状态字典
+      statusOptions: [],
+      openOfficialOptions: [],
+
+      shareOptions: {
+        title: '分享模板',
+        open: false,
+        templateId: null,
+      },
+      redData: {
+        open: false,
+        loading: true,
+        list: [],
+      },
+      queryCompanyParams: {
+        pageNum: 1,
+        pageSize: 10,
+        companyName: null,
+        status: null,
+      },
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: null,
+        setting: null,
+        status: '1',
+        sort: null,
+        companyId: null,
+        createBy: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        name: [
+          {required: true, message: '名称不能为空', trigger: 'blur'}
+        ],
+        status: [
+          {required: true, message: '状态不能为空', trigger: 'blur'}
+        ],
+        sort: [
+          {required: true, message: '排序不能为空', trigger: 'blur'}
+        ],
+        gap: [
+          {required: true, message: '间隔天数不能为空', trigger: 'blur'}
+        ],
+        time:[{
+          required: true, message: '发课时间不能为空', trigger: 'blur'
+        }],
+        courseId:[{
+          required: true, message: '课程不能为空', trigger: 'blur'
+        }],
+        companyId:[{
+          required: true, message: '销售公司不能为空', trigger: 'blur'
+        }],
+        project:[{
+          required: true, message: '所属项目不能为空', trigger: 'blur'
+        }],
+        createByDept:[
+          { required: true, message: '归属部门不能为空', trigger: 'blur' }
+        ]
+      },
+      contentRules: {
+        time: [{required: true, message: '时间不能为空', trigger: 'blur'}],
+      },
+      // 员工选项列表
+      companyUserOptionsParams: {
+        name: undefined,
+        hasNextPage: false,
+        pageNum: 1,
+        pageSize: 10
+      },
+      companyUserOptionsByAll: [],
+      companyUserOptions: [],
+      companyUserOptionsLoading: false,
+      companyUserFirstLoad: true, // 首次加载标志
+      companyUserDropdownVisible: false, // 下拉框显示状态
+
+    };
+  },
+  created() {
+    this.getList();
+
+    this.getDeptTreeSelect();
+
+    getRoles().then(res => {
+      this.roles = res.data;
+    })
+    this.getDicts("sys_company_status").then(response => {
+      this.statusOptions = response.data;
+    });
+
+    this.getDicts("sys_company_or").then(response => {
+      this.openOfficialOptions = response.data;
+    });
+
+    getSelectableRange().then(e => {
+      this.startTimeRange = e.data;
+    })
+    this.getDicts("sys_course_project").then(response => {
+      this.projectOptions = response.data;
+    });
+
+    this.getDicts("sys_qw_sop_type").then(response => {
+      this.sysQwSopType = response.data;
+    });
+
+    courseList().then(response => {
+      this.courseList = response.list;
+    });
+
+    this.getCompanyList();
+
+    getCompanyList().then(response => {
+      this.companys = response.data;
+    });
+  },
+  methods: {
+
+    handleCompanyUserChange(value) {
+      // 当清空选择时,将空字符串转为 null
+      this.queryParams.createBy = value === '' ? null : value;
+
+    },
+
+    /**
+     * 处理所属销售下拉框显示状态变化
+     */
+    handleCompanyUserDropdownVisible(visible) {
+      this.companyUserDropdownVisible = visible;
+      if (visible && this.companyUserFirstLoad) {
+        // 首次展开下拉框时加载数据
+        this.companyUserFirstLoad = false;
+        this.loadCompanyUserOptions('');
+      } else if (visible && this.companyUserOptions.length === 0) {
+        // 下拉框显示但无数据时重新加载
+        this.loadCompanyUserOptions('');
+      }
+    },
+
+    /**
+     * 加载更多员工选项
+     */
+    loadMoreCompanyUserOptions() {
+      if (!this.companyUserOptionsParams.hasNextPage) {
+        return;
+      }
+
+      this.companyUserOptionsParams.pageNum += 1
+      this.getCompanyUserListLikeName()
+    },
+
+    /**
+     * 根据名称模糊查询用户列表
+     * @param query 参数
+     */
+    loadCompanyUserOptions(query) {
+      this.companyUserOptions = [];
+      if (query === '') {
+        return;
+      }
+
+      this.companyUserOptionsParams.pageNum = 1
+      this.companyUserOptionsParams.name = query
+      this.companyUserOptionsLoading = true;
+      this.getCompanyUserListLikeName()
+    },
+
+    /**
+     * 获取员工列表
+     */
+    getCompanyUserListLikeName(isAll) {
+
+      if (isAll){
+        this.companyUserOptionsParams.pageSize = 200;
+        getCompanyUserListLikeNameByDept(this.companyUserOptionsParams).then(response => {
+          this.companyUserOptionsByAll = [...this.companyUserOptions, ...response.data.list]
+          this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
+          this.companyUserOptionsLoading = false;
+        });
+      }else {
+        this.companyUserOptionsParams.pageSize = 10;
+        getCompanyUserListLikeNameByDept(this.companyUserOptionsParams).then(response => {
+          this.companyUserOptions = [...this.companyUserOptions, ...response.data.list]
+          this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
+          this.companyUserOptionsLoading = false;
+        });
+      }
+
+    },
+
+    handleCompanyQuery() {
+      this.queryCompanyParams.pageNum = 1;
+    },
+    resetCompanyQuery() {
+      this.resetForm("queryCompanyForm");
+      this.handleCompanyQuery();
+    },
+
+    getDeptTreeSelect() {
+      treeselect().then((response) => {
+        this.deptOptions = response.data;
+      });
+    },
+
+    /** 查询企业列表 */
+    getCompanyList() {
+      this.companysloading = true;
+      listCompany(this.queryCompanyParams).then(response => {
+        this.companyList = response.rows;
+        this.companyTotal = response.total;
+        this.companysloading = false;
+      });
+    },
+    /** 查询sop模板列表 */
+    getList() {
+      this.loading = true;
+      listSopTempDeptList(this.queryParams).then(response => {
+        this.sopTempList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        gap: 1,
+        sendType: this.sendType,
+        sort: 0,
+        openOfficial: "1",
+        time: "",
+        num: 1,
+        timeList: [{value: "",desc:""}],
+        status: "1",
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+
+    handleCommand(command) {
+      // if (command==4) {
+      //   this.$router.push('/qw/sopTemp/addAiChatTemp')
+      // }else{
+      this.sendType = command;
+      this.title = "新增";
+      this.reset();
+      this.open = true;
+      // this.$router.push('/qw/sopTemp/addTemp/'+command)
+      // }
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    //销售公司多选
+    handleSelectionCompany(selection) {
+      this.companys = selection.map(item => item.companyId)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    // handleAdd() {
+    //   this.$router.push('/qw/sopTemp/addSopTemp')
+    // },
+    /**
+     * 查看详情
+     */
+    handleQueryDetails(row) {
+      // if (row.sendType==4) {
+      //   this.$router.push(`/qw/sopTemp/updateAiChatTemp/${row.id}/3`)
+      // }else{
+      this.$router.push(`/qw/sopTemp/updateSopTemp/${row.id}/3`)
+      // }
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      // if (row.sendType==4) {
+      //   this.$router.push(`/qw/sopTemp/updateAiChatTemp/${row.id}/1`)
+      // }else{
+      this.getInfo(row.id, 1);
+      // this.$router.push(`/qw/sopTemp/updateTemp/${row.id}/1`)
+      // }
+
+    },
+    /** 修改按钮操作 */
+    handleUpdate2(row) {
+      // if (row.sendType==4) {
+      //   this.$router.push(`/qw/sopTemp/updateAiChatTemp/${row.id}/1`)
+      // }else{
+      let url = `/qw/sopTemp/updateSopTemp/${row.id}/1`;
+      console.info(url)
+      this.$router.push(url)
+      // }
+    },
+    /** 修改按钮操作 */
+    handleUpdateRed(row) {
+      this.redData.open = true;
+      redList(row.id).then(e => {
+        this.redData.loading = false;
+        this.redData.list = e.data;
+      })
+    },
+    /** 修改按钮操作 */
+    updateRedData() {
+      this.redData.loading = true;
+      updateRedPackage({list: this.redData.list}).then(e => {
+        this.redData.open = false;
+        this.getList();
+      }).catch(() => {
+        this.redData.loading = false;
+      });
+    },
+
+    /** 分享模板 */
+    shareTemplate(row) {
+      this.shareOptions.open = true;
+      this.shareOptions.templateId = row.id;
+    },
+    /**
+     * 复制模板
+     */
+    copyTemplate(row) {
+      // if(row.sendType==4){
+      //   this.$router.push(`/qw/sopTemp/updateAiChatTemp/${row.id}/2`)
+      // }else{
+      this.getInfo(row.id, 2);
+      // this.$router.push(`/qw/sopTemp/updateSopTemp/${row.id}/2`)
+      // }
+    },
+    getInfo(id, command) {
+      getSopTemp(id).then(response => {
+        this.command = command;
+        if (command == 2) {
+          this.title = "复制";
+        }
+        if (command == 1) {
+          this.title = "修改";
+        }
+        this.form = response.data;
+        this.open = true;
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      delete this.form.rules
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+
+          if (this.command != 2 && this.form.id == null && this.form.sendType == 11){
+
+            const hasEmptyFields = this.form.timeList.some(item => {
+              return !item.value || !item.desc;
+            });
+
+            if (hasEmptyFields) {
+              this.$message.error("请填写【催课时间】和【催课内容】!");
+              return; // 阻止提交
+            }
+
+          }
+
+          let f = JSON.parse(JSON.stringify(this.form));
+          if (f.timeList && f.timeList.length > 0) {
+            f.timeDesc = f.timeList.map(item => item.desc);
+            f.timeList = f.timeList.map(item => item.value);
+          }
+
+          console.log("f-----------",f)
+          const loading = this.$loading({
+            lock: true,
+            text: 'Loading',
+            spinner: 'el-icon-loading',
+            background: 'rgba(0, 0, 0, 0.7)'
+          });
+          if (this.command == 2) {
+            copyTemplate(f).then(response => {
+              this.msgSuccess("复制成功");
+              this.open = false;
+              loading.close();
+              this.getList();
+            });
+          } else {
+            if (f.id != null) {
+              updateTemp(f).then(response => {
+                this.msgSuccess("修改成功");
+                this.open = false;
+                loading.close();
+                this.getList();
+              });
+            } else {
+              addTemp(f).then(response => {
+                this.msgSuccess("新增成功");
+                this.open = false;
+                loading.close();
+                this.getList();
+              });
+            }
+          }
+        }
+      });
+    },
+
+    handleShareTemplate() {
+      const companyIds = this.companys;
+      let templateId = this.shareOptions.templateId;
+      this.$confirm("确定将模板分享给 公司编号为:" + companyIds + "的公司?", "提醒", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function () {
+        return shareSopTemp({companyIds: companyIds, templeId: templateId});
+      }).then(() => {
+        this.companys = [];
+        this.shareOptions.open = false;
+        this.getList();
+        this.msgSuccess("分享成功");
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除当前所选模板?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function () {
+        return delSopTemp(ids);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess("删除成功");
+      }).catch(() => {
+      });
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有sop模板数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportSopTemp(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {
+      });
+    },
+    sendNumChange(val, old) {
+      if (val > old) {
+        for (let i = 0; i < val - old; i++) {
+          this.form.timeList.push({value: "",desc:""});
+        }
+      } else {
+        let len = old - val;
+        this.form.timeList.splice(Math.max(this.form.timeList.length - len, 0), len);
+      }
+    }
+  }
+};
+</script>

+ 104 - 2
src/views/qw/sopTemp/index.vue

@@ -39,6 +39,21 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
+      <el-form-item label="所属销售" prop="createBy">
+        <el-select v-model="queryParams.createBy" clearable filterable remote
+                   placeholder="请输入关键词" :remote-method="loadCompanyUserOptions"
+                   v-select-load-more="loadMoreCompanyUserOptions"
+                   :loading="companyUserOptionsLoading"
+                   @change="handleCompanyUserChange"
+                   @visible-change="handleCompanyUserDropdownVisible">
+          <el-option
+            v-for="item in companyUserOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue">
+          </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>
@@ -129,6 +144,8 @@
         </template>
       </el-table-column>
       <el-table-column label="创建时间" align="center" prop="createTime"/>
+      <el-table-column label="创建人" align="center" prop="createByName"/>
+      <el-table-column label="创建部门" align="center" prop="createByDeptName"/>
       <el-table-column label="修改时间" align="center" prop="updateTime"/>
       <el-table-column label="排序" align="center" prop="sort"/>
 
@@ -406,6 +423,7 @@ import {courseList, getRoles} from "@/api/qw/sop";
 import {treeselect} from "../../../api/company/companyDept";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import {getCompanyUserListLikeName} from "../../../api/company/companyUser";
 export default {
   name: "SopTemp",
   components: {Treeselect},
@@ -472,7 +490,8 @@ export default {
         setting: null,
         status: '1',
         sort: null,
-        companyId: null
+        companyId: null,
+        createBy: null
       },
       // 表单参数
       form: {},
@@ -508,7 +527,19 @@ export default {
       },
       contentRules: {
         time: [{required: true, message: '时间不能为空', trigger: 'blur'}],
-      }
+      },
+      // 员工选项列表
+      companyUserOptionsParams: {
+        name: undefined,
+        hasNextPage: false,
+        pageNum: 1,
+        pageSize: 10
+      },
+      companyUserOptionsByAll: [],
+      companyUserOptions: [],
+      companyUserOptionsLoading: false,
+      companyUserFirstLoad: true, // 首次加载标志
+      companyUserDropdownVisible: false, // 下拉框显示状态
     };
   },
   created() {
@@ -550,6 +581,77 @@ export default {
   },
   methods: {
 
+    handleCompanyUserChange(value) {
+      // 当清空选择时,将空字符串转为 null
+      this.queryParams.createBy = value === '' ? null : value;
+
+    },
+
+    /**
+     * 处理所属销售下拉框显示状态变化
+     */
+    handleCompanyUserDropdownVisible(visible) {
+      this.companyUserDropdownVisible = visible;
+      if (visible && this.companyUserFirstLoad) {
+        // 首次展开下拉框时加载数据
+        this.companyUserFirstLoad = false;
+        this.loadCompanyUserOptions('');
+      } else if (visible && this.companyUserOptions.length === 0) {
+        // 下拉框显示但无数据时重新加载
+        this.loadCompanyUserOptions('');
+      }
+    },
+
+    /**
+     * 加载更多员工选项
+     */
+    loadMoreCompanyUserOptions() {
+      if (!this.companyUserOptionsParams.hasNextPage) {
+        return;
+      }
+
+      this.companyUserOptionsParams.pageNum += 1
+      this.getCompanyUserListLikeName()
+    },
+
+    /**
+     * 根据名称模糊查询用户列表
+     * @param query 参数
+     */
+    loadCompanyUserOptions(query) {
+      this.companyUserOptions = [];
+      if (query === '') {
+        return;
+      }
+
+      this.companyUserOptionsParams.pageNum = 1
+      this.companyUserOptionsParams.name = query
+      this.companyUserOptionsLoading = true;
+      this.getCompanyUserListLikeName()
+    },
+
+    /**
+     * 获取员工列表
+     */
+    getCompanyUserListLikeName(isAll) {
+
+      if (isAll){
+        this.companyUserOptionsParams.pageSize = 200;
+        getCompanyUserListLikeName(this.companyUserOptionsParams).then(response => {
+          this.companyUserOptionsByAll = [...this.companyUserOptions, ...response.data.list]
+          this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
+          this.companyUserOptionsLoading = false;
+        });
+      }else {
+        this.companyUserOptionsParams.pageSize = 10;
+        getCompanyUserListLikeName(this.companyUserOptionsParams).then(response => {
+          this.companyUserOptions = [...this.companyUserOptions, ...response.data.list]
+          this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
+          this.companyUserOptionsLoading = false;
+        });
+      }
+
+    },
     handleCompanyQuery() {
       this.queryCompanyParams.pageNum = 1;
     },

+ 830 - 0
src/views/qw/sopTemp/myIndex.vue

@@ -0,0 +1,830 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="模板标题" prop="name">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="请输入模板标题"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
+          <el-option
+            v-for="dict in statusOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="模板类型" prop="sendType">
+        <el-select v-model="queryParams.sendType" placeholder="请选择类型" clearable size="small">
+          <el-option
+            v-for="dict in sysQwSopType"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="排序" prop="sort">
+        <el-input
+          v-model="queryParams.sort"
+          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">
+      <el-col :span="1.5">
+        <el-dropdown
+          v-hasPermi="['qw:sopTemp:myAdd']"
+          @command="handleCommand"
+          trigger="click"
+          placement="bottom-start"
+        >
+          <el-dropdown-menu slot="dropdown" style="width: 120px;">
+            <el-dropdown-item
+              v-for="option in sysQwSopType"
+              :key="option.dictValue"
+              :command="option.dictValue"
+            >
+              <i :class="option.iconClass" style="margin-right: 10px;"></i>
+              {{ option.dictLabel }}
+            </el-dropdown-item>
+          </el-dropdown-menu>
+          <span class="el-dropdown-link">
+              <el-button type="primary" icon="el-icon-plus" plain size="mini">
+                新增模板
+              </el-button>
+            </span>
+        </el-dropdown>
+      </el-col>
+
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['qw:sopTemp:myRemove']"
+        >删除
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['qw:sopTemp:myExport']"
+        >导出
+        </el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getMyList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" border :data="sopTempList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column label="模板编号" align="center" prop="id"/>
+      <el-table-column label="公司名称" align="center">
+        <template slot-scope="scope">
+          <el-tag v-for="item in companys" v-if="scope.row.companyId == item.companyId">{{item.companyName}}</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="模板标题" align="center" prop="name"/>
+      <el-table-column label="模板类型" align="center" prop="sendType">
+        <template slot-scope="scope">
+          <dict-tag :options="sysQwSopType" :value="scope.row.sendType"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="间隔天数" align="center" prop="gap"/>
+      <el-table-column label="状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="创建时间" align="center" prop="createTime"/>
+      <el-table-column label="修改时间" align="center" prop="updateTime"/>
+      <el-table-column label="排序" align="center" prop="sort"/>
+
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-connection"
+
+            @click="copyTemplate(scope.row)"
+            v-hasPermi="['qw:sopTemp:myEdit']"
+          >复制模板
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-share"
+            @click="shareTemplate(scope.row)"
+            v-hasPermi="['qw:sopTemp:myShare']"
+          >分享模板</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-s-promotion"
+            @click="handleQueryDetails(scope.row)"
+            v-hasPermi="['qw:sopTemp:myList']"
+          >详情
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['qw:sopTemp:myEdit']"
+          >修改
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate2(scope.row)"
+            v-hasPermi="['qw:sopTemp:myEdit']"
+          >管理规则
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdateRed(scope.row)"
+            v-if="scope.row.sendType == 5"
+            v-hasPermi="['qw:sopTemp:myEdit']"
+          >红包设置
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['qw:sopTemp:myRemove']"
+          >删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getMyList"
+    />
+
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="名称" prop="name">
+          <el-input v-model="form.name" placeholder="请输入模板标题"/>
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-radio-group v-model="form.status">
+            <el-radio
+              v-for="dict in statusOptions"
+              :key="dict.dictValue"
+              :label="dict.dictValue"
+            >{{ dict.dictLabel }}
+            </el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="所属项目" prop="project" v-if="form.sendType != 5">
+          <el-select v-model="form.project" placeholder="请选择项目" filterable clearable size="small">
+            <el-option
+              v-for="dict in projectOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            />
+          </el-select>
+        </el-form-item>
+
+        <el-form-item label="归属部门" prop="createByDept">
+          <treeselect
+            style="width: 220px"
+            :clearable="false"
+            v-model="form.createByDept"
+            :options="deptOptions"
+            clearable
+            :show-count="true"
+            placeholder="请选择归属部门"
+          />
+        </el-form-item>
+        <el-form-item label="课程" prop="courseId" v-if="form.sendType == 11 && !form.id">
+          <el-select v-model="form.courseId"placeholder="请选择课程" style=" margin-right: 10px;" size="mini" filterable>
+            <el-option
+              v-for="dict in courseList"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="parseInt(dict.dictValue)"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="间隔天数" prop="gap">
+          <el-input-number v-model="form.gap" :min="1" label="间隔天数"></el-input-number>
+        </el-form-item>
+        <el-form-item label="排序" prop="sort">
+          <el-input-number v-model="form.sort" :min="0" label="排序"></el-input-number>
+        </el-form-item>
+        <el-form-item label="是否开启官方群发" v-if="form.sendType == 11 && (form.id === null || form.id === undefined)">
+          <el-radio-group v-model="form.openOfficial">
+            <el-radio
+              v-for="dict in openOfficialOptions"
+              :key="dict.dictValue"
+              :label="dict.dictValue"
+            >{{ dict.dictLabel }}
+            </el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="内容" prop="modeContent">
+          <el-input v-model="form.modeContent" placeholder="请输入文字内容"  type="textarea" :rows="3"/>
+        </el-form-item>
+        <el-form-item label="发课时间" prop="time" v-if="form.sendType == 11 && !form.id">
+          <el-time-picker
+            class="custom-input"
+            v-model="form.time"
+            value-format="HH:mm"
+            format="HH:mm"
+            placeholder="时间"
+            style="width: 200px;height: 20px;margin-left: 10px;margin-top: 10px">
+          </el-time-picker>
+        </el-form-item>
+        <el-form-item label="每天催课次数" prop="num" v-if="form.sendType == 11 && !form.id">
+          <el-input-number v-model="form.num" :min="0" label="每天催课次数" @change="sendNumChange"></el-input-number>
+        </el-form-item>
+        <el-form-item label="催课时间" v-if="form.sendType == 11 && !form.id && form.num > 0">
+          <div v-for="(item, index) in form.timeList" :key="index" style="margin-bottom: 10px;">
+            <el-time-picker
+              class="custom-input"
+              v-model="item.value"
+              value-format="HH:mm"
+              format="HH:mm"
+              :picker-options="{ selectableRange: startTimeRange }"
+              placeholder="时间"
+              style="width: 150px; height: 20px; margin-left: 10px; margin-top: 10px">
+            </el-time-picker>
+
+            <el-input
+              v-model="item.desc"
+              placeholder="催课内容"
+              type="textarea" :rows="2"
+              style="width: 500px; margin-left: 10px; margin-top: 10px;">
+            </el-input>
+          </div>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer" style="display: flex;justify-content: flex-end;">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog title="课程红包" :visible.sync="redData.open" width="900px" append-to-body>
+      <el-table v-loading="redData.loading" border :data="redData.list" height="500px">
+        <el-table-column label="小节" align="left" prop="videoName"/>
+        <el-table-column label="金额" align="center">
+          <template slot-scope="scope">
+            <el-input-number v-model="scope.row.redPacketMoney" :min="0.01" step="0.01" label="红包金额"></el-input-number>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div slot="footer" class="dialog-footer" style="display: flex;justify-content: flex-end;">
+        <el-button type="primary" @click="updateRedData" :disabled="redData.loading">保 存</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog :title="shareOptions.title" :visible.sync="shareOptions.open" width="800px" append-to-body>
+
+      <el-form :model="queryCompanyParams" ref="queryCompanyForm" :inline="true" v-show="showSearch" label-width="68px">
+        <el-form-item label="公司名称" prop="companyName">
+          <el-input
+            style="width: 220px"
+            v-model="queryCompanyParams.companyName"
+            placeholder="请输入企业名称"
+            clearable
+            size="small"
+            @keyup.enter.native="handleCompanyQuery"
+          />
+        </el-form-item>
+
+        <el-form-item label="状态" prop="status">
+          <el-select style="width: 220px" v-model="queryCompanyParams.status" placeholder="请选择状态" clearable size="small">
+            <el-option
+              v-for="dict in statusOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleCompanyQuery">搜索</el-button>
+          <el-button icon="el-icon-refresh" size="mini" @click="resetCompanyQuery">重置</el-button>
+        </el-form-item>
+      </el-form>
+      <el-row :gutter="10" class="mb8">
+        <el-col :span="1.5">
+          <el-button
+            plain
+            type="primary"
+            icon="el-icon-connection"
+            size="mini"
+            :disabled="multiple"
+            @click="handleShareTemplate"
+            v-hasPermi="['qw:sopTemp:myShare']"
+          >分享模板</el-button>
+        </el-col>
+      </el-row>
+      <el-table v-loading="companysloading" border :data="companyList" @selection-change="handleSelectionCompany">
+        <el-table-column type="selection" width="55" align="center" />
+        <el-table-column label="公司编号" align="center" prop="companyId" />
+                <el-table-column label="企业名" align="center" prop="companyName" />
+        <!--        <el-table-column label="备注" align="center" prop="remark"/>-->
+        <el-table-column label="状态" align="center" prop="status" >
+          <template slot-scope="scope">
+            <el-tag prop="status" v-for="(item, index) in statusOptions"  :type="scope.row.status==1?'success':'danger'"  v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="companyTotal>0"
+        :total="companyTotal"
+        :page.sync="queryCompanyParams.pageNum"
+        :limit.sync="queryCompanyParams.pageSize"
+        @pagination="getCompanyList"
+      />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  addTemp,
+  copyTemplate,
+  delSopTemp,
+  exportSopTemp,
+  getSopTemp,
+  listSopTemp,
+  getSelectableRange,
+  redList,
+  shareSopTemp,
+  updateRedPackage,
+  updateTemp, listSopTempMyList
+} from "../../../api/qw/sopTemp";
+import { getCompanyList, listCompany } from '@/api/company/company'
+import {courseList, getRoles} from "@/api/qw/sop";
+import {treeselect} from "../../../api/company/companyDept";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+export default {
+  name: "SopTemp",
+  components: {Treeselect},
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      companysloading: false,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      courseList: [],
+      roles: [],
+      //选中的公司
+      companys: [],
+      deptOptions: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      companyTotal: 0,
+      total: 0,
+      sendType: 0,
+      // sop模板表格数据
+      sopTempList: [],
+      sysQwSopType: [],
+      companyList: [],
+      projectOptions: [],
+      startTimeRange: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      command: 0,
+      // 状态字典
+      statusOptions: [],
+      openOfficialOptions: [],
+
+      shareOptions: {
+        title: '分享模板',
+        open: false,
+        templateId: null,
+      },
+      redData: {
+        open: false,
+        loading: true,
+        list: [],
+      },
+      queryCompanyParams: {
+        pageNum: 1,
+        pageSize: 10,
+        companyName: null,
+        status: null,
+      },
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: null,
+        setting: null,
+        status: '1',
+        sort: null,
+        companyId: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        name: [
+          {required: true, message: '名称不能为空', trigger: 'blur'}
+        ],
+        status: [
+          {required: true, message: '状态不能为空', trigger: 'blur'}
+        ],
+        sort: [
+          {required: true, message: '排序不能为空', trigger: 'blur'}
+        ],
+        gap: [
+          {required: true, message: '间隔天数不能为空', trigger: 'blur'}
+        ],
+        time:[{
+          required: true, message: '发课时间不能为空', trigger: 'blur'
+        }],
+        courseId:[{
+          required: true, message: '课程不能为空', trigger: 'blur'
+        }],
+        companyId:[{
+          required: true, message: '销售公司不能为空', trigger: 'blur'
+        }],
+        project:[{
+          required: true, message: '所属项目不能为空', trigger: 'blur'
+        }],
+        createByDept:[
+          { required: true, message: '归属部门不能为空', trigger: 'blur' }
+        ]
+      },
+      contentRules: {
+        time: [{required: true, message: '时间不能为空', trigger: 'blur'}],
+      }
+    };
+  },
+  created() {
+    this.getMyList();
+
+    this.getDeptTreeSelect();
+
+    getRoles().then(res => {
+      this.roles = res.data;
+    })
+    this.getDicts("sys_company_status").then(response => {
+      this.statusOptions = response.data;
+    });
+
+    this.getDicts("sys_company_or").then(response => {
+      this.openOfficialOptions = response.data;
+    });
+
+    getSelectableRange().then(e => {
+      this.startTimeRange = e.data;
+    })
+    this.getDicts("sys_course_project").then(response => {
+      this.projectOptions = response.data;
+    });
+
+    this.getDicts("sys_qw_sop_type").then(response => {
+      this.sysQwSopType = response.data;
+    });
+
+    courseList().then(response => {
+      this.courseList = response.list;
+    });
+
+    this.getCompanyList();
+
+    getCompanyList().then(response => {
+      this.companys = response.data;
+    });
+  },
+  methods: {
+
+    handleCompanyQuery() {
+      this.queryCompanyParams.pageNum = 1;
+    },
+    resetCompanyQuery() {
+      this.resetForm("queryCompanyForm");
+      this.handleCompanyQuery();
+    },
+
+    getDeptTreeSelect() {
+      treeselect().then((response) => {
+        this.deptOptions = response.data;
+      });
+    },
+
+    /** 查询企业列表 */
+    getCompanyList() {
+      this.companysloading = true;
+      listCompany(this.queryCompanyParams).then(response => {
+        this.companyList = response.rows;
+        this.companyTotal = response.total;
+        this.companysloading = false;
+      });
+    },
+    /** 查询sop模板列表 */
+    getMyList() {
+      this.loading = true;
+      listSopTempMyList(this.queryParams).then(response => {
+        this.sopTempList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        gap: 1,
+        sendType: this.sendType,
+        sort: 0,
+        openOfficial: "1",
+        time: "",
+        num: 1,
+        timeList: [{value: "",desc:""}],
+        status: "1",
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getMyList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+
+    handleCommand(command) {
+      // if (command==4) {
+      //   this.$router.push('/qw/sopTemp/addAiChatTemp')
+      // }else{
+      this.sendType = command;
+      this.title = "新增";
+      this.reset();
+      this.open = true;
+      // this.$router.push('/qw/sopTemp/addTemp/'+command)
+      // }
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    //销售公司多选
+    handleSelectionCompany(selection) {
+      this.companys = selection.map(item => item.companyId)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    // handleAdd() {
+    //   this.$router.push('/qw/sopTemp/addSopTemp')
+    // },
+    /**
+     * 查看详情
+     */
+    handleQueryDetails(row) {
+      // if (row.sendType==4) {
+      //   this.$router.push(`/qw/sopTemp/updateAiChatTemp/${row.id}/3`)
+      // }else{
+      this.$router.push(`/qw/sopTemp/updateSopTemp/${row.id}/3`)
+      // }
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      // if (row.sendType==4) {
+      //   this.$router.push(`/qw/sopTemp/updateAiChatTemp/${row.id}/1`)
+      // }else{
+      this.getInfo(row.id, 1);
+      // this.$router.push(`/qw/sopTemp/updateTemp/${row.id}/1`)
+      // }
+
+    },
+    /** 修改按钮操作 */
+    handleUpdate2(row) {
+      // if (row.sendType==4) {
+      //   this.$router.push(`/qw/sopTemp/updateAiChatTemp/${row.id}/1`)
+      // }else{
+      let url = `/qw/sopTemp/updateSopTemp/${row.id}/1`;
+      console.info(url)
+      this.$router.push(url)
+      // }
+    },
+    /** 修改按钮操作 */
+    handleUpdateRed(row) {
+      this.redData.open = true;
+      redList(row.id).then(e => {
+        this.redData.loading = false;
+        this.redData.list = e.data;
+      })
+    },
+    /** 修改按钮操作 */
+    updateRedData() {
+      this.redData.loading = true;
+      updateRedPackage({list: this.redData.list}).then(e => {
+        this.redData.open = false;
+        this.getMyList();
+      }).catch(() => {
+        this.redData.loading = false;
+      });
+    },
+
+    /** 分享模板 */
+    shareTemplate(row) {
+      this.shareOptions.open = true;
+      this.shareOptions.templateId = row.id;
+    },
+    /**
+     * 复制模板
+     */
+    copyTemplate(row) {
+      // if(row.sendType==4){
+      //   this.$router.push(`/qw/sopTemp/updateAiChatTemp/${row.id}/2`)
+      // }else{
+      this.getInfo(row.id, 2);
+      // this.$router.push(`/qw/sopTemp/updateSopTemp/${row.id}/2`)
+      // }
+    },
+    getInfo(id, command) {
+      getSopTemp(id).then(response => {
+        this.command = command;
+        if (command == 2) {
+          this.title = "复制";
+        }
+        if (command == 1) {
+          this.title = "修改";
+        }
+        this.form = response.data;
+        this.open = true;
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      delete this.form.rules
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+
+          if (this.command != 2 && this.form.id == null && this.form.sendType == 11){
+
+            const hasEmptyFields = this.form.timeList.some(item => {
+              return !item.value || !item.desc;
+            });
+
+            if (hasEmptyFields) {
+              this.$message.error("请填写【催课时间】和【催课内容】!");
+              return; // 阻止提交
+            }
+
+          }
+
+          let f = JSON.parse(JSON.stringify(this.form));
+          if (f.timeList && f.timeList.length > 0) {
+            f.timeDesc = f.timeList.map(item => item.desc);
+            f.timeList = f.timeList.map(item => item.value);
+          }
+
+          console.log("f-----------",f)
+          const loading = this.$loading({
+            lock: true,
+            text: 'Loading',
+            spinner: 'el-icon-loading',
+            background: 'rgba(0, 0, 0, 0.7)'
+          });
+          if (this.command == 2) {
+            copyTemplate(f).then(response => {
+              this.msgSuccess("复制成功");
+              this.open = false;
+              loading.close();
+              this.getMyList();
+            });
+          } else {
+            if (f.id != null) {
+              updateTemp(f).then(response => {
+                this.msgSuccess("修改成功");
+                this.open = false;
+                loading.close();
+                this.getMyList();
+              });
+            } else {
+              addTemp(f).then(response => {
+                this.msgSuccess("新增成功");
+                this.open = false;
+                loading.close();
+                this.getMyList();
+              });
+            }
+          }
+        }
+      });
+    },
+
+    handleShareTemplate() {
+      const companyIds = this.companys;
+      let templateId = this.shareOptions.templateId;
+      this.$confirm("确定将模板分享给 公司编号为:" + companyIds + "的公司?", "提醒", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function () {
+        return shareSopTemp({companyIds: companyIds, templeId: templateId});
+      }).then(() => {
+        this.companys = [];
+        this.shareOptions.open = false;
+        this.getMyList();
+        this.msgSuccess("分享成功");
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除当前所选模板?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function () {
+        return delSopTemp(ids);
+      }).then(() => {
+        this.getMyListgetMyList();
+        this.msgSuccess("删除成功");
+      }).catch(() => {
+      });
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有sop模板数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportSopTemp(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {
+      });
+    },
+    sendNumChange(val, old) {
+      if (val > old) {
+        for (let i = 0; i < val - old; i++) {
+          this.form.timeList.push({value: "",desc:""});
+        }
+      } else {
+        let len = old - val;
+        this.form.timeList.splice(Math.max(this.form.timeList.length - len, 0), len);
+      }
+    }
+  }
+};
+</script>

+ 36 - 14
src/views/qw/sopTemp/sopTemp.vue

@@ -34,7 +34,7 @@
             plain
             icon="el-icon-edit"
             @click="handleSopTemp(scope.row)"
-            v-hasPermi="['qw:sopTemp:edit']"
+            v-hasPermi="['qw:sopTemp:edit', 'qw:sopTemp:myEdit', 'qw:sopTemp:deptEdit']"
           >选择此模板</el-button>
         </template>
       </el-table-column>
@@ -51,7 +51,7 @@
 </template>
 
 <script>
-import { listSopTemp } from "@/api/qw/sopTemp";
+import { listSopTemp,listSopTempDeptList,listSopTempMyList } from "../../../api/qw/sopTemp";
 
 export default {
   name: "SopTempComments",
@@ -90,6 +90,7 @@ export default {
         sendType:null,
         status:1,
       },
+      formType:null,
       // 表单参数
       form: {},
       // 表单校验
@@ -109,30 +110,51 @@ export default {
   },
   methods: {
     /** 查询sop模板列表 */
-    getList(sendType,isUpdate,cuoser) {
+    getList(sendType,isUpdate,cuoser,formType) {
+
+      console.log("formType",formType)
+
       if(cuoser == null){
         cuoser = false;
       }
-      console.log(isUpdate)
       this.isUpdateSop = isUpdate;
       this.cuoser = cuoser;
       this.loading = true;
       this.queryParams.sendType= sendType;
       this.queryParams.cuoser= cuoser;
-      listSopTemp(this.queryParams).then(response => {
-        this.sopTempList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
+      this.formType= formType;
+
+      if (formType==2 || formType==3) {
+        listSopTempDeptList(this.queryParams).then(response => {
+          this.sopTempList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+        });
+      } else {
+        listSopTemp(this.queryParams).then(response => {
+          this.sopTempList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+        });
+      }
     },
 
     getResetList(){
       this.loading = true;
-      listSopTemp(this.queryParams).then(response => {
-        this.sopTempList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
+      console.log("this.formType",this.formType)
+      if (this.formType==2 || this.formType==3) {
+        listSopTempDeptList(this.queryParams).then(response => {
+          this.sopTempList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+        });
+      } else {
+        listSopTemp(this.queryParams).then(response => {
+          this.sopTempList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+        });
+      }
     },
     // 取消按钮
     cancel() {

+ 16 - 12
src/views/qw/sopUserLogs/sopUserLogsSchedule.vue

@@ -84,17 +84,17 @@
         </el-tooltip>
       </el-col>
 
-      <el-col :span="1.5">
-        <el-tooltip class="item" effect="dark" content="修改选择的群聊营期时间" placement="top">
-          <el-button
-            type="danger"
-            icon="el-icon-edit"
-            size="medium"
-            :disabled="multiple"
-            @click="updateGroupTime"
-          >批量修改营期时间</el-button>
-        </el-tooltip>
-      </el-col>
+<!--      <el-col :span="1.5">-->
+<!--        <el-tooltip class="item" effect="dark" content="修改选择的群聊营期时间" placement="top">-->
+<!--          <el-button-->
+<!--            type="danger"-->
+<!--            icon="el-icon-edit"-->
+<!--            size="medium"-->
+<!--            :disabled="multiple"-->
+<!--            @click="updateGroupTime"-->
+<!--          >批量修改营期时间</el-button>-->
+<!--        </el-tooltip>-->
+<!--      </el-col>-->
 
       <el-col :span="1.5">
         <el-tooltip class="item" effect="dark" content="删除营期之后,将不会在给原营期的客户发送消息,ps:删除之后不可恢复" placement="top">
@@ -625,7 +625,11 @@ export default {
         date: this.updateTimeData.form.date,
         ids: this.ids,
       }
-      updateLogDate(form).then(e => {
+      updateLogDate(form).then(response => {
+        if (response.data!=null){
+          this.msgInfo("部分时间已有营期:"+response.data);
+        }
+
         this.updateTimeData.open = false;
         this.getList();
       });

+ 2 - 1
src/views/qw/sopUserLogsInfo/sendMsgSopOpenTool.vue

@@ -408,12 +408,13 @@ export default {
       this.videoNumOptions.open = false;
 
     },
-    oneClickGroupSending(val,type,corpId){
+    oneClickGroupSending(val,type,corpId,isMine){
 
       this.sendMsgOpen.open= true;
       this.msgForm.sopIds = val;
       this.msgForm.type = type;
       this.msgForm.corpId = corpId;
+      this.msgForm.isMine = isMine;
 
     },
     courseChange() {