Browse Source

销售直播代码 修改直播间 样式

yuhongqi 1 tháng trước cách đây
mục cha
commit
e25c811dfb

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

@@ -98,3 +98,21 @@ export function handleDeleteSelected(data) {
     data: data
   })
 }
+
+// 结束录播直播间
+export function finishLive(data) {
+  return request({
+    url: '/live/live/finishLive',
+    method: 'get',
+    params: data
+  })
+}
+
+// 结束录播直播间
+export function startLive(data) {
+  return request({
+    url: '/live/live/startLive',
+    method: 'get',
+    params: data
+  })
+}

+ 51 - 3
src/api/live/liveOrder.js

@@ -12,7 +12,7 @@ export function listLiveOrder(query) {
 // 查询订单详细
 export function getLiveOrder(orderId) {
   return request({
-    url: '/live/liveOrder/' + orderId,
+    url: '/live/liveOrder/info/' + orderId,
     method: 'get'
   })
 }
@@ -29,7 +29,7 @@ export function addLiveOrder(data) {
 // 修改订单
 export function updateLiveOrder(data) {
   return request({
-    url: '/live/liveOrder',
+    url: '/live/liveOrder/update',
     method: 'put',
     data: data
   })
@@ -50,4 +50,52 @@ export function exportLiveOrder(query) {
     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
+  })
+}

BIN
src/assets/images/videoIsAudit.png


BIN
src/assets/images/videoNotStart.png


+ 13 - 0
src/router/index.js

@@ -269,6 +269,19 @@ export const constantRoutes = [
       // 其他子路由可以根据需要添加
     ]
   },
+  {
+    path: '/live',
+    component: Layout,
+    hidden: true,
+    children: [
+      {
+        path: 'LiveConsole/:liveId', // 动态路由参数
+        component: () => import('@/views/live/liveConsole'), // 使用 import 动态加载
+        name: 'LiveConsole',
+        meta: { title: '直播中控台', activeMenu: '/live/liveConsole' }
+      }
+    ]
+  }
 
 
 

+ 81 - 13
src/views/live/live/index.vue

@@ -68,11 +68,11 @@
 <!--        </el-dropdown-menu>-->
 <!--      </el-dropdown>-->
     </div>
-    <el-table ref="liveTable" v-loading="loading" :data="liveList" @selection-change="handleSelectionChange">
+    <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: 180px;" :src="scope.row.liveImgUrl" mode="aspectFill" :preview-src-list="[scope.row.liveImgUrl]" />
+          <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" />
@@ -89,7 +89,7 @@
           <el-tag v-if="scope.row.status == 3">已结束</el-tag>
         </template>
       </el-table-column>
-      <el-table-column label="主播ID" align="center" prop="anchorId" />
+      <el-table-column label="主播ID" align="center" prop="talentId" />
       <el-table-column label="直播类型" align="center" prop="liveType">
         <template slot-scope="scope">
           <el-tag v-if="scope.row.liveType == 1">直播</el-tag>
@@ -116,21 +116,38 @@
           <el-button
             size="mini"
             type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
+            icon="el-icon-setting"
+            @click="handleConfig(scope.row)"
+            v-hasPermi="['live:config:list']"
+          >配置</el-button>
+          <el-button
+            v-if="scope.row.status == 2 && scope.row.liveType == 1"
+            size="mini"
+            type="text"
+            icon="el-icon-set-up"
+            @click="showLivingUrl(scope.row)"
             v-hasPermi="['live:live:remove']"
-          >删除</el-button>
+          >推流码</el-button>
           <el-button
+            v-if="scope.row.status == 2"
             size="mini"
             type="text"
-            icon="el-icon-monitor"
-            @click="handleConfig(scope.row)"
-            v-hasPermi="['live:config:list']"
-          >管理</el-button>
+            icon="el-icon-switch-button"
+            @click="handleEnded(scope.row)"
+            v-hasPermi="['live:config:edit']"
+          >结束</el-button>
           <el-button
+            v-else
             size="mini"
             type="text"
             icon="el-icon-monitor"
+            @click="handleStart(scope.row)"
+            v-hasPermi="['live:config:edit']"
+          >去直播</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-service"
             @click="handleManage(scope.row)"
             v-hasPermi="['live:console:list']"
           >进入直播间</el-button>
@@ -159,7 +176,7 @@
           </el-radio-group>
         </el-form-item>
         <el-form-item label="直播类型" prop="liveType">
-          <el-radio-group disabled v-model="form.liveType">
+          <el-radio-group v-model="form.liveType">
             <el-radio :label="1">直播</el-radio>
             <el-radio :label="2">录播</el-radio>
           </el-radio-group>
@@ -178,7 +195,7 @@
           <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">
+        <el-form-item label="录播视屏" prop="videoUrl" v-if="form.liveType == 2">
           <file-upload v-model="form.videoUrl" :limit="1" :file-size="3" :file-type="['mp4']" />
           <el-button @click="getVideoDuration" v-loading="timeLoading">读取视屏时长</el-button>
           <p style="margin: 0;padding: 0;" v-loading="timeLoading">视屏时长:<span style="color: #ff4949;">{{form.durationTime}}</span></p>
@@ -216,11 +233,34 @@
         <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 } from "@/api/live/live";
+import {
+  listLive,
+  getLive,
+  delLive,
+  addLive,
+  updateLive,
+  exportLive,
+  selectCompanyTalent,
+  handleShelfOrUn,
+  handleDeleteSelected,
+  finishLive,
+  startLive
+} from "@/api/live/live";
 import Editor from '@/components/Editor/wang';
 import user from '@/store/modules/user';
 
@@ -304,6 +344,9 @@ export default {
       multipleSelection: [],
       allChecked: false,
       isIndeterminate: false,
+      rtmpUrlVisible:false,
+      serverName: '',
+      livingCode:'',
     };
   },
   created() {
@@ -561,6 +604,31 @@ export default {
     handleManage(row) {
       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(() => {});
+    },
+    handleStart(row){
+      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;

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

@@ -173,7 +173,6 @@
 import {addLiveGoods, delLiveGoods, listLiveGoods, listStoreProduct, handleShelfOrUn, handleDeleteSelected} from "@/api/live/liveGoods";
 
 export default {
-
   data() {
     return {
       liveId: '',

+ 2 - 1
src/views/live/liveConfig/liveLotteryConf.vue

@@ -458,7 +458,8 @@ export default {
     this.getDicts("sys_live_lottery_status").then(response => {
       this.lotteryStatusOptions = response.data;
     });
-    this.liveId = this.$route.query.liveId;
+
+    this.liveId = this.$route.params.liveId;
     this.parentLiveId = this.liveId;
     this.queryParams.liveId = this.parentLiveId;
     if(this.queryParams.liveId){

+ 3 - 2
src/views/live/liveConfig/watchReward.vue

@@ -252,15 +252,16 @@ export default {
   },
   created() {
     this.liveId = this.$route.params.liveId
+    this.watchRewardForm.liveId = this.liveId
     this.getLiveConfig();
   },
   methods: {
     getLiveConfig(){
       getConfig(this.liveId).then(response => {
-        if(response.code === 200){
+        if(response.code === 200 && response.data != null){
           this.watchRewardForm = JSON.parse(response.data)
-          this.loading = false
         }
+        this.loading = false
       })
     },
     saveWatchReward() {

+ 308 - 111
src/views/live/liveConsole/index.vue

@@ -1,10 +1,148 @@
 <template>
   <!-- 直播中控台 start -->
   <el-row type="flex" justify="center" class="live-console" :gutter="10">
+    <!-- 聊天 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>
+                    </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="livingUrl.length > 0">
+          <video
+            controls
+            ref="livingPlayer"
+            autoplay
+            width="100%"
+            style="display: block; background: #000; height: 45vh;"
+          ></video>
+        </div>
+        <div style="border-radius: 5px; overflow: hidden;" v-else-if="videoUrl.length > 0">
+          <video
+            controls
+            ref="videoPlayer"
+            loop
+            autoplay
+            width="100%"
+            :src="videoUrl"
+            @click.prevent
+            @contextmenu.prevent
+            class="custom-video"
+            style="display: block; background: #000; height: 45vh;"
+          ></video>
+        </div>
+        <div style="border-radius: 5px; overflow: hidden;" v-else-if="!isAudit">
+          <img :src="require('@/assets/images/videoIsAudit.png')" style="width: 100%; height: 45vh;">
+        </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>
+      <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="5">
-      <el-tabs class="live-console-tab-left" v-model="tabLeft.activeName" @tab-click="handleClick" :stretch="true">
+    <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 onlineUserList">
@@ -71,107 +209,6 @@
       </el-tabs>
     </el-col>
     <!-- 用户列表 end -->
-
-    <!-- 直播/视频 start -->
-    <el-col class="live-console-col" :span="11">
-      <div style="background: #000; border-radius: 5px; overflow: hidden; margin: 10px 5px;">
-        <div style="border-radius: 5px; overflow: hidden;">
-          <video
-            controls
-            ref="videoPlayer"
-            autoplay
-            width="100%"
-            style="display: block; background: #000;"
-          ></video>
-        </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;">-->
-<!--            <i class="el-icon-microphone" 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;">-->
-<!--            <i class="el-icon-video-camera" 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;">-->
-<!--            <i class="el-icon-share" 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;">-->
-<!--            <i class="el-icon-message" 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;">-->
-<!--            <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;">-->
-<!--            <i class="el-icon-menu" style="font-size: 20px;"></i>-->
-<!--            <span style="font-size: 12px; margin-top: 4px;">工具箱</span>-->
-<!--          </div>-->
-<!--        </div>-->
-    </el-col>
-    <!-- 直播/视频 end -->
-
-    <!-- 聊天 start -->
-    <el-col class="live-console-col" :span="5">
-      <el-tabs class="live-console-tab-right" v-model="tabRight.activeName" @tab-click="handleClick">
-        <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>
-                    </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 -->
   </el-row>
   <!-- 直播中控台  end -->
 </template>
@@ -179,12 +216,20 @@
 <script>
 import { changeUserStatus, watchUserList } from '@/api/live/liveWatchUser'
 import { getLiveVideoByLiveId } from '@/api/live/liveVideo'
-import { getLivingUrl } from '@/api/live/live'
+import { getLivingUrl,getLive } from '@/api/live/live'
+import { getLiveOrderTimeGranularity } from '@/api/live/liveOrder'
 import { listLiveMsg } from '@/api/live/liveMsg'
 import Hls from 'hls.js';
+import LiveLotteryConf from '@/views/live/liveLotteryConf/index.vue'
+import LiveRedConf from '@/views/live/liveRedConf/index.vue'
+import LiveGoods from '@/views/live/liveGoods/index.vue'
+import LiveOrder from '@/views/live/liveOrder/index.vue'
+import echarts from 'echarts'
+
 
 export default {
   name: "LiveConsole",
+  components: { LiveLotteryConf,LiveRedConf,LiveGoods },
   data() {
     return {
       tabLeft: {
@@ -193,7 +238,9 @@ export default {
       tabRight: {
         activeName: "talk",
       },
-      livingUrl:"",
+      livingUrl: "",
+      videoUrl: "",
+      status: 0,
       loadMsgMaxPage: 2,
       his: null,
       liveVideo: {},
@@ -211,14 +258,30 @@ export default {
       },
       userList: [],
       msgList: [],
-      newMsg: ''
+      newMsg: '',
+      isAudit: false,
+      myChart: null, // 用于存储 ECharts 实例
+      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'},
+      ],
     }
   },
   created() {
     // this.getLiveVideo()
     this.getList()
     this.connectWebSocket()
-    this.getLiveUrl()
+    this.getLive()
+    this.searchQuery.liveId = this.liveId
   },
   computed: {
     liveId() {
@@ -258,7 +321,87 @@ export default {
       return '禁言'
     }
   },
+  mounted() {
+    this.getEchartsTables();
+    if (this.videoUrl.length > 0) {
+      const video = this.$refs.videoPlayer;
+      video.play()
+    }
+
+  },
   methods: {
+    // 切换音量状态
+    toggleVolume() {
+      const video = this.$refs.videoPlayer;
+      if (video.volume > 0) {
+        // 保存当前音量并静音
+        this.lastVolume = video.volume;
+        video.volume = 0;
+        this.isMuted = true;
+      } else {
+        // 恢复之前的音量
+        video.volume = this.lastVolume || this.initialVolume;
+        this.isMuted = false;
+      }
+    },
+    getLive(){
+      getLive(this.liveId).then(res => {
+        if (res.code == 200) {
+          if (res.data.isAudit != 1) {
+            this.$message.error("当前直播间未经审核");
+            return
+          }
+          this.isAudit = true
+          this.status = res.data.status
+          if (res.data.status != 2) {
+            this.$message.error("当前直播间未直播");
+            return
+          }
+          if (res.data.liveType == 1) {
+            this.getLiveUrl();
+          } else {
+            this.videoUrl = res.data.videoUrl;
+          }
+        } else {
+          this.$message.error(res.msg)
+        }
+        this.liveInfo = res.data
+      })
+    },
+    // ... 其他方法 ...
+    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);
+    },
     getLiveUrl(){
       getLivingUrl(this.liveId).then(res=>{
         if(res.code === 200) {
@@ -269,11 +412,44 @@ export default {
         }
       })
     },
+
+    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 (Hls.isSupported() && !isUrl) {
-        const videoElement = this.$refs.videoPlayer
-        this.hls = new Hls(config);
+        const videoElement = this.$refs.livingPlayer
+        this.hls = new Hls();
         this.hls.attachMedia(videoElement);
         this.hls.on(Hls.Events.MEDIA_ATTACHED, () => {
           this.hls.loadSource(this.livingUrl);
@@ -284,8 +460,7 @@ export default {
       }
     },
     handleClick(tab) {
-      console.log("click",tab.name)
-      console.log("liveId", this.liveId)
+
     },
     getLiveVideo() {
       getLiveVideoByLiveId(this.liveId).then(res => {
@@ -422,6 +597,7 @@ export default {
         liveId: this.liveId,
         userId: this.userId
       })
+      this.socket = this.$store.state.liveWs
       this.socket.onmessage = (event) => this.handleWsMessage(event)
     },
     handleWsMessage(event) {
@@ -492,6 +668,7 @@ export default {
   .live-console {
     width: 90vw;
     padding: 10px 0;
+    background-color: #f5f4f4;
   }
   .live-console .live-console-col {
     height: 88vh;
@@ -531,5 +708,25 @@ export default {
     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; /* 完全禁止鼠标交互,避免悬停时显示工具栏 */
+}
 
 </style>

+ 352 - 322
src/views/live/liveGoods/index.vue

@@ -1,78 +1,20 @@
 <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="商品名称" prop="goodsName">
+  <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.goodsName"
+          v-model="queryParams.keywords"
           placeholder="请输入商品名称"
           clearable
           size="small"
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="描述" prop="goodsDesc">
-        <el-input
-          v-model="queryParams.goodsDesc"
-          placeholder="请输入描述"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="封图" prop="imgUrl">
-        <el-input
-          v-model="queryParams.imgUrl"
-          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="opPrice">
-        <el-input
-          v-model="queryParams.opPrice"
-          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 label="库存表" prop="stock">
+      <el-form-item label="上下架" prop="status" >
         <el-input
-          v-model="queryParams.stock"
-          placeholder="请输入库存表"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="排序号" prop="sort">
-        <el-input
-          v-model="queryParams.sort"
-          placeholder="请输入排序号"
+          v-model="queryParams.status"
+          placeholder="请输入直播间状态"
           clearable
           size="small"
           @keyup.enter.native="handleQuery"
@@ -84,312 +26,400 @@
       </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:liveGoods: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:liveGoods: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:liveGoods: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:liveGoods:export']"
-        >导出</el-button>
-      </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
+    <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 border v-loading="loading" :data="liveGoodsList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="ID" align="center" prop="goodsId" />
-      <el-table-column label="直播ID" align="center" prop="liveId" />
-      <el-table-column label="商品名称" align="center" prop="goodsName" />
-      <el-table-column label="描述" align="center" prop="goodsDesc" />
-      <el-table-column label="封图" align="center" prop="imgUrl" />
-      <el-table-column label="组图" align="center" prop="images" />
-      <el-table-column label="单价" align="center" prop="price" />
-      <el-table-column label="原价" align="center" prop="opPrice" />
-      <el-table-column label="状态 1上架 0下架" align="center" prop="status" />
-      <el-table-column label="库存表" align="center" prop="stock" />
-      <el-table-column label="排序号" align="center" prop="sort" />
-      <el-table-column label="备注" align="center" prop="remark" />
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <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
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['live:liveGoods:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
             type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['live:liveGoods:remove']"
+            size="small"
+            style="color: #F56C6C;"
+            @click="handleGoodDelete(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"
+      v-show="goodsLiveTotal > 0"
+      :total="goodsLiveTotal"
+      :page.sync="goodsParams.pageNum"
+      :limit.sync="goodsParams.pageSize"
+      @pagination="getLiveGoodsList"
+      style="margin-top: 20px;"
     />
 
-    <!-- 添加或修改直播商品对话框 -->
-    <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="商品名称" prop="goodsName">
-          <el-input v-model="form.goodsName" placeholder="请输入商品名称" />
-        </el-form-item>
-        <el-form-item label="描述" prop="goodsDesc">
-          <el-input v-model="form.goodsDesc" placeholder="请输入描述" />
-        </el-form-item>
-        <el-form-item label="封图" prop="imgUrl">
-          <el-input v-model="form.imgUrl" placeholder="请输入封图" />
-        </el-form-item>
-        <el-form-item label="组图" prop="images">
-          <el-input v-model="form.images" type="textarea" 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="opPrice">
-          <el-input v-model="form.opPrice" 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="stock">
-          <el-input v-model="form.stock" placeholder="请输入库存表" />
-        </el-form-item>
-        <el-form-item label="排序号" prop="sort">
-          <el-input v-model="form.sort" placeholder="请输入排序号" />
-        </el-form-item>
-        <el-form-item label="备注" prop="remark">
-          <el-input v-model="form.remark" placeholder="请输入备注" />
-        </el-form-item>
-      </el-form>
+    <!-- 添加商品弹窗 -->
+    <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">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
+        <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 { listLiveGoods, getLiveGoods, delLiveGoods, addLiveGoods, updateLiveGoods, exportLiveGoods } from "@/api/live/liveGoods";
+import {addLiveGoods, delLiveGoods, listLiveGoods, listStoreProduct, handleShelfOrUn, handleDeleteSelected} from "@/api/live/liveGoods";
 
 export default {
-  name: "LiveGoods",
   data() {
     return {
-      // 遮罩层
+      liveId: '',
       loading: true,
-      // 导出遮罩层
-      exportLoading: false,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
+      searchTitle: '',
+      queryGoodParams: {
+        pageNum: 1,
+        pageSize: 10,
+        productName: null,
+        liveId: null
+      },
       // 显示搜索条件
       showSearch: true,
-      // 总条数
-      total: 0,
-      // 直播商品表格数据
-      liveGoodsList: [],
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 查询参数
+      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,
-        liveId: null,
-        goodsName: null,
-        goodsDesc: null,
-        imgUrl: null,
-        images: null,
-        price: null,
-        opPrice: null,
+        keywords: null,
         status: null,
-        stock: null,
-        sort: null,
+        liveId: null,
+        desc: null,
+        createTime: null,
+        updateTime: null,
       },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {
-      }
     };
   },
   created() {
-    this.getList();
+    this.liveId = this.$route.query.liveId
+    this.goodsParams.liveId = this.liveId
+    this.queryParams.liveId = this.liveId
+    this.getLiveGoodsList();
   },
   methods: {
-    /** 查询直播商品列表 */
-    getList() {
-      this.loading = true;
-      listLiveGoods(this.queryParams).then(response => {
-        this.liveGoodsList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        goodsId: null,
-        liveId: null,
-        goodsName: null,
-        goodsDesc: null,
-        imgUrl: null,
-        images: null,
-        price: null,
-        opPrice: null,
-        status: 0,
-        stock: null,
-        sort: null,
-        createTime: null,
-        createBy: null,
-        updateBy: null,
-        updateTime: null,
-        remark: null
-      };
-      this.resetForm("form");
-    },
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
-      this.getList();
+      this.loading = true
+      listLiveGoods(this.queryParams).then(response => {
+        this.goodsLiveList = response.rows
+        this.goodsLiveTotal = response.total
+        this.loading = false
+      })
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
+      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(selection) {
-      this.ids = selection.map(item => item.goodsId)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
+    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
+      })
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加直播商品";
+    handleAddLiveGoods(){
+      this.goodsDialogVisible = true;
+      this.getStoreProductLists()
     },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const goodsId = row.goodsId || this.ids
-      getLiveGoods(goodsId).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改直播商品";
-      });
+    handleGoodsSearch(){
+      this.queryGoodParams.pageNum = 1
+      this.queryGoodParams.productName = this.searchTitle
+      this.getStoreProductLists()
     },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.goodsId != null) {
-            updateLiveGoods(this.form).then(response => {
-              this.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addLiveGoods(this.form).then(response => {
-              this.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
+    handleGoodsChange(goods) {
+      this.selectedGoods = goods
     },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const goodsIds = row.goodsId || this.ids;
-      this.$confirm('是否确认删除直播商品编号为"' + goodsIds + '"的数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delLiveGoods(goodsIds);
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        }).catch(() => {});
+    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()
+      })
     },
-    /** 导出按钮操作 */
-    handleExport() {
-      const queryParams = this.queryParams;
-      this.$confirm('是否确认导出所有直播商品数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(() => {
-          this.exportLoading = true;
-          return exportLiveGoods(queryParams);
-        }).then(response => {
-          this.download(response.msg);
-          this.exportLoading = false;
-        }).catch(() => {});
+    /** 处理行点击事件 */
+    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.sendWs("lottery",response.msg, row.lotteryId,this.liveId);
+          this.msgSuccess("修改成功");
+        }else{
+          this.msgError(response.msg);
+        }
+          this.open = false;
+          this.getList();
+        });
+    },
+    /** 提交按钮 */
+    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>

+ 44 - 200
src/views/live/liveOrder/index.vue

@@ -107,11 +107,6 @@
           placeholder="选择完成时间">
         </el-date-picker>
       </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 orderStatusOptions" :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>
@@ -119,38 +114,7 @@
     </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:liveOrder: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:liveOrder: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:liveOrder:remove']"
-        >删除</el-button>
-      </el-col>
+
       <el-col :span="1.5">
         <el-button
           type="warning"
@@ -164,7 +128,10 @@
       </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"/>
@@ -196,16 +163,9 @@
             size="mini"
             type="text"
             icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
+            @click="handledetails(scope.row)"
             v-hasPermi="['live:liveOrder:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['live:liveOrder:remove']"
-          >删除</el-button>
+          >查看</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -217,78 +177,23 @@
       :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>
 
-    <!-- 添加或修改订单对话框 -->
-    <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="orderSn">
-          <el-input v-model="form.orderSn" placeholder="请输入订单号" />
-        </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="userName">
-          <el-input v-model="form.userName" placeholder="请输入收货人" />
-        </el-form-item>
-        <el-form-item label="手机号" prop="mobile">
-          <el-input v-model="form.mobile" placeholder="请输入手机号" />
-        </el-form-item>
-        <el-form-item label="地址" prop="address">
-          <el-input v-model="form.address" placeholder="请输入地址" />
-        </el-form-item>
-        <el-form-item label="支付金额" prop="payMoney">
-          <el-input v-model="form.payMoney" placeholder="请输入支付金额" />
-        </el-form-item>
-        <el-form-item label="订单金额" prop="orderMoney">
-          <el-input v-model="form.orderMoney" placeholder="请输入订单金额" />
-        </el-form-item>
-        <el-form-item label="物流编号" prop="deliveryCode">
-          <el-input v-model="form.deliveryCode" placeholder="请输入物流编号" />
-        </el-form-item>
-        <el-form-item label="物流名称" prop="deliveryName">
-          <el-input v-model="form.deliveryName" placeholder="请输入物流名称" />
-        </el-form-item>
-        <el-form-item label="物流单号" prop="deliverySn">
-          <el-input v-model="form.deliverySn" placeholder="请输入物流单号" />
-        </el-form-item>
-        <el-form-item label="支付时间" prop="payTime">
-          <el-date-picker clearable size="small"
-            v-model="form.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="form.finishTime"
-            type="date"
-            value-format="yyyy-MM-dd"
-            placeholder="选择完成时间">
-          </el-date-picker>
-        </el-form-item>
-        <el-form-item label="状态">
-          <el-radio-group v-model="form.status">
-            <el-radio :label="item.dictValue" v-for="item in orderStatusOptions" >{{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 { listLiveOrder, getLiveOrder, delLiveOrder, addLiveOrder, updateLiveOrder, exportLiveOrder } from "@/api/live/liveOrder";
+import { listLiveOrder, exportLiveOrder } from "@/api/live/liveOrder";
+import liveOrderDetails from './liveOrderDetails.vue';
 
 export default {
   name: "LiveOrder",
+  components: { liveOrderDetails },
   data() {
     return {
       //字典
@@ -309,13 +214,10 @@ export default {
       total: 0,
       // 订单表格数据
       liveOrderList: [],
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
       // 查询参数
       queryParams: {
         pageNum: 1,
+        liveId: null,
         pageSize: 10,
         orderSn: null,
         userId: null,
@@ -331,20 +233,42 @@ export default {
         finishTime: null,
         status: null,
       },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {
-      }
+      orderOptions:[],
+      actName:"10",
+      show:{
+        title:"订单详情",
+        open:false,
+      },
     };
   },
   created() {
+    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: {
+    // 查看详情
+    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;
@@ -357,36 +281,6 @@ export default {
     orderStatusFormatter(row, column) {
       return this.selectDictLabel(this.orderStatusOptions, row.status);
     },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        orderId: null,
-        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: 0,
-        createTime: null,
-        createBy: null,
-        updateBy: null,
-        updateTime: null,
-        remark: null
-      };
-      this.resetForm("form");
-    },
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
@@ -403,56 +297,6 @@ export default {
       this.single = selection.length!==1
       this.multiple = !selection.length
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加订单";
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const orderId = row.orderId || this.ids
-      getLiveOrder(orderId).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改订单";
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.orderId != null) {
-            updateLiveOrder(this.form).then(response => {
-              this.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addLiveOrder(this.form).then(response => {
-              this.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const orderIds = row.orderId || this.ids;
-      this.$confirm('是否确认删除订单编号为"' + orderIds + '"的数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delLiveOrder(orderIds);
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        }).catch(() => {});
-    },
     /** 导出按钮操作 */
     handleExport() {
       const queryParams = this.queryParams;

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

@@ -0,0 +1,910 @@
+<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.getlistOrderitem(orderId);
+        // 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){
+      listOrderitem(orderId).then(response => {
+        this.prod = response.rows;
+        console.log(this.prod)
+        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>

+ 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.sendWs("red",response.msg, row.redId,this.liveId);
+          this.msgSuccess("修改成功");
+        }else{
+          this.msgError(response.msg);
+        }
+        this.open = false;
+        this.getList();
+      });
+    },
+    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>