Browse Source

1. 优化座位不能被多选

MONSTER-ygh 2 months ago
parent
commit
dce819d2b0

+ 28 - 5
src/components/seatBox/index.vue

@@ -73,8 +73,7 @@
                                 <div 
                                 :class="[
                                     'seat-item-class',
-                                    item1.key == 'my_column'?'seat-item-class-column':
-                                    item.occupyStatus==0?item.occupyOrderId?'order-occupy-status':item.occupyStatus==0&&item.isSelect?'occupy-status-select occupy-status':'occupy-status': item.occupyStatus==1?'occupy-status-no':item.isDisabled || item.status != 1 ? 'disabled-class' : item.isSelect ? 'select-class' : ''
+                                    setShowStatus(item1,item)
                                 ]" 
                                 v-for="(item, index) in seatMapList[item1.key]" 
                                 :style="{backgroundColor: item.color && !(item.isDisabled || item.status != 1) ? item.color : 'none'}"
@@ -401,6 +400,24 @@
 
             return srt
         },
+
+        /**  设置显示状态  */
+        setShowStatus(item1,item) {
+            /**
+             * key == my_column 序号位置
+             * 
+             * occupyStatus 0 
+             * 
+             * occupyOrderId  // 订单待支付锁定 
+             * 
+             */
+            return  item1.key == 'my_column'?'seat-item-class-column':
+                    item.occupyStatus===0?item.occupyOrderId?'order-occupy-status':
+                    item.occupyStatus===0&&item.isSelect?'occupy-status-select occupy-status':
+                    'occupy-status': item.occupyStatus==1?'occupy-status-no':
+                    item.isDisabled || item.status != 1 ? 'disabled-class' :
+                    item.isSelect ? 'select-class' : ''
+        }
     }   
   };
   </script>
@@ -593,16 +610,22 @@
       transform-origin: 50% 0;
       transform: scale(var(--scaleNum));
       box-sizing: border-box;
+      /**  不可售 座位  */
       .disabled-class{
         background-color: #ffffff;
         border: none !important;
         user-select: none;
         // pointer-events: none;
-        cursor: not-allowed !important;
+        //cursor: not-allowed !important;
+        cursor: default !important;
         .text-class {
             color: #fff !important;
         }
       }
+      .no_select-class{
+        user-select: none;
+        cursor: not-allowed !important;
+      }
       .select-class{
         //background-color: #e85353 !important;
         border: 5px solid #1890ff !important;
@@ -661,7 +684,7 @@
         cursor: not-allowed !important;
         position: relative;
       }
-        /* .occupy-status-no:after{
+        .occupy-status-no:after{
             content:"";
             display:block;
             position:absolute;
@@ -676,7 +699,7 @@
             background-position: 50% 50%;
             background-repeat: no-repeat;
             z-index: 99;
-        } */
+        }
       .seat-item-class-box {
         width: 100%;
         display: flex;

+ 1 - 1
src/components/seatBox/mixins/selectList.js

@@ -172,7 +172,7 @@ export default {
                 occupyStatus = row.occupyStatus
                 
                 if(row.isDisabled || row.status == 2) {
-                    this.$message.error('不能选择已售或不可售座位!!!');
+                    this.$message.error('存在已被占用或不可售座位!!!');
                     flog = true
                     break;
                 }

+ 27 - 2
src/views/ticket/InventoryTemplate/dialog/addAndEdit.vue

@@ -522,15 +522,39 @@ export default {
       }
       let list = []
       let list1 = []
+      let list2 = []
+      this.form.chennelListForm.forEach((item,index)=>{
+        if(item.chennelSeatList && item.stockType == 1) {
+          Object.keys(item.chennelSeatList).forEach((item1)=>{
+            item.chennelSeatList[item1] ? list2 = list2.concat(item.chennelSeatList[item1]) : ''
+          })
+        }
+      })
+      
       if(this.form.chennelListForm[this.chennelAtion].chennelSeatList) {
         Object.keys(this.form.chennelListForm[this.chennelAtion].chennelSeatList).forEach((item)=>{
           list1 = list1.concat(this.form.chennelListForm[this.chennelAtion].chennelSeatList[item])
         })
+        console.log("list2111=====",list2,list1)
         list = this.dataList.filter((item,index)=>{
-          if(list1.includes(item.id)){
+          if(list1.includes(item.id)){ 
+            this.dataList[index].occupyStatus = null  // 解除被占用了
             return item
+          }else if(!list1.includes(item.id) && list2.includes(item.id)){
+            this.dataList[index].occupyStatus = 1 // 被占用了
+          }
+          if(!item.seatTypeId&&item.status != 2) {
+            this.dataList[index].occupyStatus = 1 // 被占用了
+          }
+        })
+      }else {
+        this.dataList.forEach((item,index)=>{
+          if(!list1.includes(item.id) && list2.includes(item.id)){
+            this.dataList[index].occupyStatus = 1 // 被占用了
+          }
+          if(!item.seatTypeId&&item.status != 2) {
+            this.dataList[index].occupyStatus = 1 // 被占用了
           }
-          
         })
       }
       console.log("dfsdfdsfdsf====",list,this.form.chennelListForm[this.chennelAtion].chennelSeatList)
@@ -546,6 +570,7 @@ export default {
          Array.isArray(obj[srt]) ? obj[srt].push(item.id): obj[srt] = [item.id]
       })
       this.form.chennelListForm[this.chennelAtion].chennelSeatList = JSON.stringify(obj) == '{}'?null:obj
+      this.form.chennelListForm[this.chennelAtion].stockNum = list.length>0 ? list.length : ''
       console.log("已选择的====",list,this.form.chennelListForm[this.chennelAtion].chennelSeatList)
     }
   },