瀏覽代碼

票务销售:增加批量锁定功能按钮

shipeng 5 天之前
父節點
當前提交
5fd7e926eb

+ 10 - 0
src/api/windowTicketSales/ticketingSales.js

@@ -120,6 +120,16 @@ export const lockOrUnLock = (query) => {
   })
 }
 
+// 批量锁定
+export const batchLockApi = (query) => {
+  return request({
+    url: '/merchant/merchantSeatOccupy/batchLockOrUnLock',
+    method: 'post',
+    data: query
+  })
+}
+
+
 //  票务是否设置了价格
 
 export const selectRegion = (query) => {

+ 21 - 1
src/views/officesale/ticketingSales.vue

@@ -228,6 +228,7 @@
  import { pageList as getSeatType } from '@/api/seatTypeMr/seatTypeMr'
  import selectListMixin from "./mixins/selectList"
 import LockSeat from './model/lockSeat.vue'
+import { mapGetters } from 'vuex'
  export default {
     name: "TicketingSales",
     components: {
@@ -310,6 +311,11 @@ import LockSeat from './model/lockSeat.vue'
     mounted() {
         this.$set(this.queryParams,'performDate',moment().format("yyyy-MM-DD"))
     },
+    computed: {
+      ...mapGetters([
+        'isBuylock',
+      ]),
+    },
     methods: {
         moment,
 
@@ -670,7 +676,7 @@ import LockSeat from './model/lockSeat.vue'
                 this.$message.error('你已选择锁定座位,只能再选择被锁定的座位!!!');
                 return
             }
-            if(this.seatSelectList.length > 0 && row.occupyStatus == 0){
+            if(this.seatSelectList.length > 0 && row.occupyStatus == 0 && this.isBuylock === 0){
                 this.$message.error('此座已被锁定,请先解锁!!!');
                 return
             }
@@ -696,6 +702,20 @@ import LockSeat from './model/lockSeat.vue'
                         }
                     })
                 }
+                // 配置该用户 可以购买锁定票
+                if(this.isBuylock === 1) {
+                    if(row.isSelect){
+                        this.seatSelectList.push(JSON.parse(JSON.stringify(row)))
+                    } else {
+                        let list = JSON.parse(JSON.stringify(this.seatSelectList))
+                        list.forEach((item,index)=>{
+                            if(item.id == row.id) {
+                                this.seatSelectList.splice(index, 1)
+                            }
+                        })
+                    }
+
+                }
             }else if(row.isDisabled || row.status == 2){
                 return false
             }else {

+ 210 - 0
src/views/windowTicketSales/model/batchLock.vue

@@ -0,0 +1,210 @@
+<template>
+  <el-dialog :title="title" :visible.sync="dialogVisible" custom-class="custom-dialog" width="75%"
+    :before-close="handleClose">
+    <div class="dialog-content">
+      <div>
+        <span class="demonstration">选择月份:</span>
+        <el-date-picker v-model="performMonth" type="month" value-format="yyyy-MM" placeholder="选择月"
+          @change="hanldeChange">
+        </el-date-picker>
+      </div>
+      <div style="display: flex;justify-content: flex-end;margin-bottom: 20px;">
+        <el-button type="primary" icon="el-icon-finished" @click="handleCheckAllChange">{{ checkAll ?
+          '取消全选' : '全选' }}</el-button>
+      </div>
+      <div v-loading="loading" style="margin: 0 20px;height: 430px;overflow-y: auto;">
+        <!-- <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll"
+                @change="handleCheckAllChange">全选</el-checkbox> -->
+        <el-checkbox-group v-model="checkedList" @change="handleCheckedChange">
+          <el-checkbox v-for="item in performTimeList" :label="item.id" :key="item.id" :value="item.id">
+            <span>{{ item.performDate + '(' +
+              item.performTimeStart + '-' + item.performTimeEnd + ')' }}</span>
+          </el-checkbox>
+        </el-checkbox-group>
+      </div>
+      <div v-loading="loading" style="margin-top: 20px;">
+        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
+          <el-form-item label="锁定原因" prop="remark">
+            <el-input type="textarea" :rows="4" placeholder="请输入锁定原因" maxlength="250" v-model="ruleForm.remark"
+              style="width: 80%;"></el-input>
+          </el-form-item>
+        </el-form>
+      </div>
+    </div>
+
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="handleClose">取 消</el-button>
+      <el-button :loading="loading" type="primary" @click="lockOrUnLockFun">提交</el-button>
+    </span>
+  </el-dialog>
+</template>
+<script>
+import {
+  batchLockApi,
+  merchantPerformTimeListNew
+} from "@/api/windowTicketSales/ticketingSales"
+import moment from "moment"
+
+export default {
+  name: "LockSeat",
+  data() {
+    return {
+      loading: false,
+      dialogVisible: false,
+      list: [],
+      title: '',
+      auditoriumId: '',
+      timeId: '',
+      ruleForm: {
+        remark: null
+      },
+      rules: {
+        remark: [
+          { required: true, message: '请输入锁定原因', trigger: ['blur', 'change'] },
+        ]
+      },
+      checkAll: false,
+      checkedList: [],
+      performTimeList: [], // 场次
+      isIndeterminate: true,
+      performMonth: '',
+    }
+  },
+  methods: {
+    /**
+     * @param list 解锁列表
+     * @param list1 上锁列表
+     */
+    async openDialog(list = [], list1 = [], auditoriumId = null, timeId = null) {
+      this.auditoriumId = auditoriumId
+      // this.timeId = timeId
+      this.performMonth = moment().format("yyyy-MM")
+      this.merchantPerformTimeListFun();
+      this.list = list.length > 0 ? list : list1
+      this.title = '批量锁定座位'
+      this.dialogVisible = true
+      this.$nextTick(() => {
+        if (list.length == 0) {
+          this.$refs.ruleForm.clearValidate()
+        }
+      })
+    },
+    // 全选
+    handleCheckAllChange() {
+      this.checkAll = !this.checkAll
+      let ids = this.performTimeList.map(ele => ele.id)
+      this.isIndeterminate = false;
+      this.checkedList = this.checkAll ? ids : [];
+    },
+    handleCheckedChange(value) {
+      let checkedCount = value.length;
+      this.checkAll = checkedCount === this.performTimeList.length;
+      this.isIndeterminate = checkedCount > 0 && checkedCount < this.performTimeList.length;
+    },
+    // 选月份
+    hanldeChange() {
+      if (!this.performMonth) {
+        this.$message.info(`请选择月份查询场次!`);
+        return
+      }
+      this.merchantPerformTimeListFun();
+    },
+    /**  获取场次  */
+    async merchantPerformTimeListFun() {
+      try {
+        let param = {
+          auditoriumId: this.auditoriumId,
+          performMonth: this.performMonth,
+          status: 1,
+        };
+        let res = await merchantPerformTimeListNew(param)
+        if (res.code == 200) {
+          this.performTimeList = res.data.list
+
+        }
+      } catch (error) {
+
+      }
+    },
+    handleClose() {
+      this.ruleForm = {}
+      this.dialogVisible = false
+      this.checkAll = false
+      this.isIndeterminate = false;
+      this.checkedList = []
+    },
+    /**  批量座位锁定  */
+    async lockOrUnLockFun(type) {
+      try {
+        if (this.checkedList.length <= 0) {
+          this.$message.info(`请勾选需要批量锁定座位的场次`);
+          return
+        }
+        if (!this.ruleForm.remark) {
+          this.$message.info(`请输入锁定原因`);
+          return
+        }
+        this.loading = true
+        let list = []
+        this.list.forEach((item, index) => {
+          list.push({
+            "auditoriumId": this.auditoriumId,
+            "seatId": item.id,
+          })
+        })
+        let res = await batchLockApi({
+          type: 0, // 类型 0锁定,1解锁
+          seatList: list,
+          remark: this.ruleForm.remark,
+          timeIds: this.checkedList
+        })
+        this.loading = false
+        if (res.code) {
+          this.$message({
+            showClose: true,
+            message: res.msg,
+            type: 'success'
+          });
+          this.$emit('querySeatListFun', true)
+          this.handleClose()
+        }
+
+      } catch (error) {
+        this.loading = false
+        this.$message({
+          showClose: true,
+          message: "操作失败!!!",
+          type: 'error'
+        });
+        console.error('error===', error)
+      }
+
+    },
+  }
+}
+</script>
+<style lang="scss" scoped>
+::v-deep .el-checkbox {
+  color: #606266;
+  font-weight: 500;
+  font-size: 14px;
+  position: relative;
+  cursor: pointer;
+  display: inline-block;
+  white-space: nowrap;
+  -webkit-user-select: none;
+  -moz-user-select: none;
+  -ms-user-select: none;
+  user-select: none;
+  margin-right: 20px;
+  margin-bottom: 10px;
+  padding: 5px;
+  border: 1px solid #dcdada;
+  border-radius: 6px;
+}
+
+.dialog-content {
+  height: 660px;
+  overflow-y: auto;
+}
+</style>

+ 45 - 15
src/views/windowTicketSales/ticketingSales.vue

@@ -160,6 +160,7 @@
                 </div>
                 <div style="width: 100%;display: flex;justify-content: center;height: 30px;">
                     <el-button size="mini" v-hasPermi="['windowTicketSales:ticketingSales:lock']" type="warning" :loading="lockOrUnLockLoading" @click="lockOrUnLockFun(0)">{{ seatSelectListNo.length>0?'解锁':'锁定' }}</el-button>
+                    <el-button size="mini" v-hasPermi="['windowTicketSales:ticket:batchlock']" type="danger" @click="batchLockFun">批量锁定</el-button>
                     <el-button size="mini" v-hasPermi="['windowTicketSales:ticketingSales:buy']" type="primary" @click="increaseViewersFun">购票</el-button>
                 </div>
             </div>
@@ -199,6 +200,8 @@
       </div>
       <!--  锁座备注  -->
       <lock-seat ref="lockSeat" @querySeatListFun="querySeatListFun" />
+      <!--  批量锁座  -->
+      <batch-lock ref="batchLockSeat" @querySeatListFun="querySeatListFun" />
       <!--  添加观影人  -->
       <increaseViewers ref="increaseViewers" @clearDialogVisible="clearDialogVisible" />
       
@@ -227,12 +230,15 @@
  import moment from "moment"
  import { pageList as getSeatType } from '@/api/seatTypeMr/seatTypeMr'
  import selectListMixin from "./mixins/selectList"
-import LockSeat from './model/lockSeat.vue'
+ import LockSeat from './model/lockSeat.vue'
+ import batchLock from './model/batchLock.vue'
+ import { mapGetters } from 'vuex'
  export default {
     name: "TicketingSales",
     components: {
         increaseViewers,
-        LockSeat
+        LockSeat,
+        batchLock
     },
     mixins: [selectListMixin],
     dicts: ['channel_type'],
@@ -310,6 +316,11 @@ import LockSeat from './model/lockSeat.vue'
     mounted() {
         this.$set(this.queryParams,'performDate',moment().format("yyyy-MM-DD"))
     },
+    computed: {
+      ...mapGetters([
+        'isBuylock',
+      ]),
+    },
     methods: {
         moment,
 
@@ -370,13 +381,24 @@ import LockSeat from './model/lockSeat.vue'
                 param.status  = 1;
                 let res = await merchantPerformTimeListNew(param)
                 if(res.code == 200){
-                    console.log('merchantPerformTimeListS',res.data.rows);
+                    // console.log('merchantPerformTimeListS',res.data.rows);
                     this.merchantPerformTimeListS = res.data.list
                 }
             } catch (error) {
                 
             }
         },
+        // 批量锁定
+        batchLockFun(){
+          let listS = this.seatSelectListNo.length > 0 ? this.seatSelectListNo : this.seatSelectList
+          if (listS.length <= 0) {
+            this.$message.info(`请选择需要锁定的座位!!!`);
+            return
+          }
+          if (this.seatSelectListNo.length == 0) {
+            this.$refs.batchLockSeat.openDialog(this.seatSelectListNo, this.seatSelectList, this.queryParams.auditoriumId, this.queryParams.timeId)
+          }
+        },
         /**  座位锁定/解锁  */
         async lockOrUnLockFun(type){
             try {
@@ -495,12 +517,12 @@ import LockSeat from './model/lockSeat.vue'
                     return a.sort - b.sort
                 })
                 this.seatMapListKey = seatMapListKey
-                console.log("seatMapListKey=====",seatMapListKey)
+                // console.log("seatMapListKey=====",seatMapListKey)
                 this.width = 70*(flog + 1)
                 this.$nextTick(()=>{
                     if(this.$refs.seatbox) {
                         var ele = this.$refs.seatbox
-                        console.log(ele.getBoundingClientRect().width); // 100
+                        // console.log(ele.getBoundingClientRect().width); // 100
                         if(this.width<ele.getBoundingClientRect().width) {
                             this.justifyContent = true
                         }else {
@@ -511,7 +533,7 @@ import LockSeat from './model/lockSeat.vue'
                     }
                 })
                 
-                console.log("list====",listCopy)
+                // console.log("list====",listCopy)
                 
                 let columnList = []
                 listCopy[seatMapListKey[0].key].forEach((item,index)=>{
@@ -544,7 +566,7 @@ import LockSeat from './model/lockSeat.vue'
         },
         /**  选择场次时间  */
         changeTime(value,type){
-            console.log("fsdfsdf----",value,type)
+            // console.log("fsdfsdf----",value,type)
             if(type == 'timeId') {
                 this.$set(this.queryParams,'goodsId','')
                 this.stockType = null
@@ -572,9 +594,8 @@ import LockSeat from './model/lockSeat.vue'
         },
         /**  选择场次时间  */
         async changeTimeCheck(value,type){
-            console.log("fsdfsdf")
             if(this.queryParams && this.queryParams.timeId && type != 'timeId' && type != 'goodsId') {
-                console.log('sdfsdfsdf',this.queryParams)
+                // console.log('sdfsdfsdf',this.queryParams)
                 this.$set(this.queryParams,'timeId','')
                 this.$set(this.queryParams,'goodsId','')
                 this.merchantPerformTimeListS = []
@@ -587,7 +608,6 @@ import LockSeat from './model/lockSeat.vue'
             if(type == 'goodsId'){
                 //this.$refs.queryForm.clearValidate("goodsId")
                 if(value) {
-                    console.log("dsfsdfdsfds===",value)
                     await this.getGoodsPerformFun(value);
 
                     this.handleQuery()
@@ -609,7 +629,6 @@ import LockSeat from './model/lockSeat.vue'
         },
         /**  设置 场次 对应得剧目ID */
         changePerformId(value){
-            console.log("value=====",value)
             this.performId = ''
             this.merchantPerformTimeListS.forEach((item,index)=>{
                 if(item.id == value){
@@ -619,7 +638,6 @@ import LockSeat from './model/lockSeat.vue'
         },
         /**  设置 票务 对应价格 */
         changeSalePrice(value){
-            console.log("value=====",value)
             this.salePrice = null
             this.goodsPageListS.forEach((item,index)=>{
                 if(item.goodsId == value){
@@ -670,12 +688,11 @@ import LockSeat from './model/lockSeat.vue'
                 this.$message.error('你已选择锁定座位,只能再选择被锁定的座位!!!');
                 return
             }
-            if(this.seatSelectList.length > 0 && row.occupyStatus == 0){
+            if(this.seatSelectList.length > 0 && row.occupyStatus == 0 && this.isBuylock === 0){
                 this.$message.error('此座已被锁定,请先解锁!!!');
                 return
             }
             if(row.occupyStatus == 0){
-                // console.log("weqwrwerewrer")
                 // this.$confirm('此座已被锁定,请先解锁', '提示', {
                 //     confirmButtonText: '确定',
                 //     cancelButtonText: '取消',
@@ -696,6 +713,19 @@ import LockSeat from './model/lockSeat.vue'
                         }
                     })
                 }
+                // 配置该用户 可以购买锁定票
+                if(this.isBuylock === 1) {
+                    if(row.isSelect) {
+                        this.seatSelectList.push(JSON.parse(JSON.stringify(row)))
+                    } else {
+                        let list = JSON.parse(JSON.stringify(this.seatSelectList))
+                        list.forEach((item,index)=> {
+                            if(item.id == row.id) {
+                                this.seatSelectList.splice(index, 1)
+                            }
+                        })
+                    }
+                }
             }else if(row.isDisabled || row.status == 2){
                 return false
             }else {
@@ -868,7 +898,7 @@ import LockSeat from './model/lockSeat.vue'
                             left: (e.x + 10)+ 'px',
                             zIndex: 999999
                         }
-                        console.log('dsfdsff====',this.lockObj,this.lockStyle)
+                        // console.log('dsfdsff====',this.lockObj,this.lockStyle)
                         return
                     }else {
                         this.isLcokShow = false