|
@@ -82,16 +82,23 @@
|
|
<el-table ref="tables" v-loading="loading" :data="form.chennelListForm[chennelAtion].seatTypeList" border>
|
|
<el-table ref="tables" v-loading="loading" :data="form.chennelListForm[chennelAtion].seatTypeList" border>
|
|
<el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
|
|
<el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
|
|
<el-table-column label="座位类型" align="center" prop="seatTypeName" />
|
|
<el-table-column label="座位类型" align="center" prop="seatTypeName" />
|
|
- <el-table-column label="可配置数量" align="center" prop="stock"></el-table-column>
|
|
|
|
|
|
+ <el-table-column label="可配置数量" align="center" prop="stock">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span> {{ configStockNumObj['seatNum_'+scope.row.seatTypeId].stockTotal - configStockNumObj['seatNum_'+scope.row.seatTypeId].stockYes }} </span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column label="配置数量" align="center">
|
|
<el-table-column label="配置数量" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-input
|
|
|
|
|
|
+ <!-- :max="configStockNumObj['seatNum_'+scope.row.seatTypeId].stockTotal - configStockNumObj['seatNum_'+scope.row.seatTypeId].stockYes" -->
|
|
|
|
+ <el-input-number
|
|
|
|
+ style="width: 200px;"
|
|
v-model="form.chennelListForm[chennelAtion].seatTypeList[scope.$index].stockNum"
|
|
v-model="form.chennelListForm[chennelAtion].seatTypeList[scope.$index].stockNum"
|
|
- type="number"
|
|
|
|
clearable
|
|
clearable
|
|
|
|
+ :min="0"
|
|
placeholder="请输入数量"
|
|
placeholder="请输入数量"
|
|
- @input="(value)=>countNum(value,scope.$index)"
|
|
|
|
- ></el-input>
|
|
|
|
|
|
+ @change="(value)=>countNum(value,scope)"
|
|
|
|
+ :max="configStockNumObj['seatNum_'+scope.row.seatTypeId].stockTotal - configStockNumObj['seatNum_'+scope.row.seatTypeId].stockYes"
|
|
|
|
+ ></el-input-number>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -100,6 +107,7 @@
|
|
<seatBox
|
|
<seatBox
|
|
ref="seatBox"
|
|
ref="seatBox"
|
|
:isOccupyStatus="false"
|
|
:isOccupyStatus="false"
|
|
|
|
+ :seatTypeLimit="configStockNumObj"
|
|
@selectSeat="selectSeat"
|
|
@selectSeat="selectSeat"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
@@ -151,6 +159,7 @@
|
|
import { saveAndEdit, getSelectById,countBySeatTyp,channelType } from '@/api/ticketMr/InventoryTemplate'
|
|
import { saveAndEdit, getSelectById,countBySeatTyp,channelType } from '@/api/ticketMr/InventoryTemplate'
|
|
import { getSelectById as getSeatSelectByIdApi } from "@/api/performanceHallMr/performanceHallMr";
|
|
import { getSelectById as getSeatSelectByIdApi } from "@/api/performanceHallMr/performanceHallMr";
|
|
import { merchantPageList } from '@/api/performanceHallMr/performanceHallMr'
|
|
import { merchantPageList } from '@/api/performanceHallMr/performanceHallMr'
|
|
|
|
+ import { pageList as getSeatType } from '@/api/seatTypeMr/seatTypeMr'
|
|
import seatBox from '@/components/seatBox/index.vue';
|
|
import seatBox from '@/components/seatBox/index.vue';
|
|
export default {
|
|
export default {
|
|
name: "addAndEdit",
|
|
name: "addAndEdit",
|
|
@@ -204,13 +213,33 @@ export default {
|
|
|
|
|
|
seatNum: '',
|
|
seatNum: '',
|
|
configStockNum: 0, // 已分配的座位
|
|
configStockNum: 0, // 已分配的座位
|
|
|
|
+
|
|
|
|
+ // 总的座位类型已分配数量
|
|
|
|
+ configStockNumObj: {},
|
|
|
|
+
|
|
|
|
+ seatTypeListAll: [], // 总的获取座位类型
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
this.getList()// 演出厅
|
|
this.getList()// 演出厅
|
|
this.channelTypeFun() // 渠道
|
|
this.channelTypeFun() // 渠道
|
|
|
|
+ this.getSeatTypeAllList()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ /** 获取座位类型 说明 */
|
|
|
|
+ async getSeatTypeAllList() {
|
|
|
|
+ try {
|
|
|
|
+ let res = await getSeatType({
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 999,
|
|
|
|
+ })
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
+ this.seatTypeListAll = res.data.rows || [];
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ },
|
|
/** 演出厅列表 */
|
|
/** 演出厅列表 */
|
|
getList() {
|
|
getList() {
|
|
merchantPageList({pageNum: 1, pageSize: 100})
|
|
merchantPageList({pageNum: 1, pageSize: 100})
|
|
@@ -235,7 +264,7 @@ export default {
|
|
this.chennelAtion = null
|
|
this.chennelAtion = null
|
|
this.open = true
|
|
this.open = true
|
|
this.activeName = '01';
|
|
this.activeName = '01';
|
|
-
|
|
|
|
|
|
+ this.configStockNumObj = {}
|
|
if(this.channelTypeList.length<0) {
|
|
if(this.channelTypeList.length<0) {
|
|
await this.channelTypeFun()
|
|
await this.channelTypeFun()
|
|
}
|
|
}
|
|
@@ -330,7 +359,7 @@ export default {
|
|
list1.push({
|
|
list1.push({
|
|
"seatTypeId": item1.seatTypeId,
|
|
"seatTypeId": item1.seatTypeId,
|
|
"seatTypeName": item1.seatTypeName,
|
|
"seatTypeName": item1.seatTypeName,
|
|
- "stockNum": '',
|
|
|
|
|
|
+ "stockNum": undefined,
|
|
"stock": item1.stock,
|
|
"stock": item1.stock,
|
|
})
|
|
})
|
|
if(obj.stockType == 0 && data.chennelList && data.chennelList.length>0) {
|
|
if(obj.stockType == 0 && data.chennelList && data.chennelList.length>0) {
|
|
@@ -484,7 +513,7 @@ export default {
|
|
this.open = false;
|
|
this.open = false;
|
|
this.chennelAtion = null
|
|
this.chennelAtion = null
|
|
},
|
|
},
|
|
- /** 获取座位可用数量 */
|
|
|
|
|
|
+ /** 获取座位类型 */
|
|
async countBySeatTypFun(value,type) {
|
|
async countBySeatTypFun(value,type) {
|
|
console.log("vlaue===",value)
|
|
console.log("vlaue===",value)
|
|
try {
|
|
try {
|
|
@@ -497,7 +526,17 @@ export default {
|
|
num = num + item.stock
|
|
num = num + item.stock
|
|
})
|
|
})
|
|
this.seatNum = num
|
|
this.seatNum = num
|
|
- this.countBySeatTypList = res.data
|
|
|
|
|
|
+ this.countBySeatTypList = res.data ? res.data : []
|
|
|
|
+ let obj = {}
|
|
|
|
+ this.countBySeatTypList.forEach((item,index)=>{
|
|
|
|
+ obj['seatNum_'+item.seatTypeId] = {
|
|
|
|
+ stockTotal: item.stock,
|
|
|
|
+ stockSelect: item.stock,
|
|
|
|
+ stockYes: 0,
|
|
|
|
+ stockNo: 0,
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.configStockNumObj = obj
|
|
if(!type) {
|
|
if(!type) {
|
|
this.form.chennelListForm = this.setDataTree({})
|
|
this.form.chennelListForm = this.setDataTree({})
|
|
this.setDictLabel(this.form.chennelListForm[0],0)
|
|
this.setDictLabel(this.form.chennelListForm[0],0)
|
|
@@ -520,19 +559,95 @@ export default {
|
|
this.chennelAtion = index
|
|
this.chennelAtion = index
|
|
if(obj.stockType == 1) {
|
|
if(obj.stockType == 1) {
|
|
this.getSeatSelectById()
|
|
this.getSeatSelectById()
|
|
|
|
+ }else {
|
|
|
|
+ this.countStockNum()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 计算可分配数量
|
|
// 计算可分配数量
|
|
countStockNum() {
|
|
countStockNum() {
|
|
|
|
+ let stockNum = 0
|
|
|
|
+ let stockTotal= 0
|
|
|
|
+ let flog = false
|
|
|
|
+ let obj = {}
|
|
|
|
+ this.countBySeatTypList.forEach((item,index)=>{
|
|
|
|
+ obj['seatNum_'+item.seatTypeId] = {
|
|
|
|
+ stockTotal: item.stock,
|
|
|
|
+ stockSelect: item.stock,
|
|
|
|
+ stockYes: 0,
|
|
|
|
+ stockNo: 0,
|
|
|
|
+ }
|
|
|
|
+ })
|
|
this.form.chennelListForm.forEach((item,index)=>{
|
|
this.form.chennelListForm.forEach((item,index)=>{
|
|
-
|
|
|
|
|
|
+ stockNum = 0
|
|
|
|
+ if(!item.stockType && item.seatTypeList && item.seatTypeList.length>0) {
|
|
|
|
+ item.seatTypeList.forEach((item1,index1)=>{
|
|
|
|
+ if(item1.stockNum) {
|
|
|
|
+ stockNum = stockNum + item1.stockNum
|
|
|
|
+ stockTotal = stockTotal + item1.stockNum
|
|
|
|
+ // if(!flog) {
|
|
|
|
+ // obj['seatNum_'+item1.seatTypeId].stockYes = item1.stockNum
|
|
|
|
+ // flog = true
|
|
|
|
+ // }else {
|
|
|
|
+ // obj['seatNum_'+item1.seatTypeId].stockYes = obj['seatNum_'+item1.seatTypeId].stockYes + item1.stockNum
|
|
|
|
+ // }
|
|
|
|
+ obj['seatNum_'+item1.seatTypeId].stockYes = obj['seatNum_'+item1.seatTypeId].stockYes + item1.stockNum
|
|
|
|
+ }
|
|
|
|
+ if(item1.stockNum && this.chennelAtion == index){
|
|
|
|
+ // if(!flog) {
|
|
|
|
+ // obj['seatNum_'+item1.seatTypeId].stockYes = 0 - item1.stockNum
|
|
|
|
+ // flog = true
|
|
|
|
+ // }else {
|
|
|
|
+ // obj['seatNum_'+item1.seatTypeId].stockYes = obj['seatNum_'+item1.seatTypeId].stockYes - item1.stockNum
|
|
|
|
+ // }
|
|
|
|
+ obj['seatNum_'+item1.seatTypeId].stockYes = obj['seatNum_'+item1.seatTypeId].stockYes - item1.stockNum
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }else if(item.stockType == 1 && item.chennelSeatList){
|
|
|
|
+ Object.keys(item.chennelSeatList).forEach((item1,index1)=>{
|
|
|
|
+ if(item.chennelSeatList[item1]) {
|
|
|
|
+ stockNum = stockNum + item.chennelSeatList[item1].length
|
|
|
|
+ stockTotal = stockTotal + item.chennelSeatList[item1].length
|
|
|
|
+ console.log("item1====",item1,item1.replace('seat_',''))
|
|
|
|
+ // if(!flog) {
|
|
|
|
+ // obj[item1.replace('seat_','seatNum_')].stockYes = item.chennelSeatList[item1].length
|
|
|
|
+ // flog = true
|
|
|
|
+ // }else {
|
|
|
|
+ // obj[item1.replace('seat_','seatNum_')].stockYes = obj[item1.replace('seat_','seatNum_')].stockYes + item.chennelSeatList[item1].length
|
|
|
|
+ // }
|
|
|
|
+ obj[item1.replace('seat_','seatNum_')].stockYes = obj[item1.replace('seat_','seatNum_')].stockYes + item.chennelSeatList[item1].length
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(this.chennelAtion == index && item.chennelSeatList[item1]){
|
|
|
|
+ // if(!flog) {
|
|
|
|
+ // obj[item1.replace('seat_','seatNum_')].stockYes = 0 - item.chennelSeatList[item1].length
|
|
|
|
+ // flog = true
|
|
|
|
+ // }else {
|
|
|
|
+ // obj[item1.replace('seat_','seatNum_')].stockYes = obj[item1.replace('seat_','seatNum_')].stockYes - item.chennelSeatList[item1].length
|
|
|
|
+ // }
|
|
|
|
+ obj[item1.replace('seat_','seatNum_')].stockYes = obj[item1.replace('seat_','seatNum_')].stockYes - item.chennelSeatList[item1].length
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ this.form.chennelListForm[index].stockNum = stockNum
|
|
})
|
|
})
|
|
|
|
+ console.log("this.configStockNumObj====",this.configStockNumObj)
|
|
|
|
+ console.log("this.form====",this.form)
|
|
|
|
+ this.configStockNumObj = obj
|
|
|
|
+ this.configStockNum = stockTotal
|
|
},
|
|
},
|
|
// 选择模式
|
|
// 选择模式
|
|
setStockType(value) {
|
|
setStockType(value) {
|
|
|
|
+ console.log('选择模式===',value)
|
|
|
|
+ this.form.chennelListForm[this.chennelAtion].stockNum = 0
|
|
if(value == 1) {
|
|
if(value == 1) {
|
|
|
|
+ this.form.chennelListForm[this.chennelAtion].seatTypeList.forEach((item,index)=>{
|
|
|
|
+ this.form.chennelListForm[this.chennelAtion].seatTypeList[index].stockNum = undefined
|
|
|
|
+ })
|
|
this.getSeatSelectById()
|
|
this.getSeatSelectById()
|
|
|
|
+ }else {
|
|
|
|
+ this.form.chennelListForm[this.chennelAtion].chennelSeatList = null
|
|
}
|
|
}
|
|
|
|
+
|
|
},
|
|
},
|
|
/** 获取座位 */
|
|
/** 获取座位 */
|
|
async getSeatSelectById() {
|
|
async getSeatSelectById() {
|
|
@@ -579,8 +694,18 @@ export default {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
console.log("dfsdfdsfdsf====",list,this.form.chennelListForm[this.chennelAtion].chennelSeatList)
|
|
console.log("dfsdfdsfdsf====",list,this.form.chennelListForm[this.chennelAtion].chennelSeatList)
|
|
|
|
+ let list3 = []
|
|
|
|
+ this.countBySeatTypList.forEach((item,index)=>{
|
|
|
|
+ list3.push(item.seatTypeId)
|
|
|
|
+ })
|
|
|
|
+ let list4 = []
|
|
|
|
+ this.seatTypeListAll.forEach((item,index)=>{
|
|
|
|
+ if(list3.includes(item.id)) {
|
|
|
|
+ list4.push({...item})
|
|
|
|
+ }
|
|
|
|
+ })
|
|
this.$nextTick(() =>{
|
|
this.$nextTick(() =>{
|
|
- this.$refs.seatBox.querySeatListFun(true,this.dataList,list)
|
|
|
|
|
|
+ this.$refs.seatBox.querySeatListFun(true,this.dataList,list,list4)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
/** 选择座位 */
|
|
/** 选择座位 */
|
|
@@ -595,11 +720,23 @@ export default {
|
|
console.log("已选择的====",list,this.form.chennelListForm[this.chennelAtion].chennelSeatList)
|
|
console.log("已选择的====",list,this.form.chennelListForm[this.chennelAtion].chennelSeatList)
|
|
},
|
|
},
|
|
/** 计算可分配座位 */
|
|
/** 计算可分配座位 */
|
|
- countNum(value,index) {
|
|
|
|
- console.log("value,index=====",value,index)
|
|
|
|
- if(value>this.form.chennelListForm[this.chennelAtion].seatTypeList[index],'stock',this.form.chennelListForm[this.chennelAtion].seatTypeList[index].stock) {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ countNum(value,scope) {
|
|
|
|
+ console.log("value,index=====",value,scope)
|
|
|
|
+ let stockNum = 0
|
|
|
|
+ let stockTotal= 0
|
|
|
|
+ this.form.chennelListForm.forEach((item,index)=>{
|
|
|
|
+ stockNum = 0
|
|
|
|
+ if(item.seatTypeList && item.seatTypeList.length>0) {
|
|
|
|
+ item.seatTypeList.forEach((item1,index1)=>{
|
|
|
|
+ if(item1.stockNum) {
|
|
|
|
+ stockNum = stockNum + item1.stockNum
|
|
|
|
+ stockTotal = stockTotal + item1.stockNum
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ this.form.chennelListForm[index].stockNum = stockNum
|
|
|
|
+ })
|
|
|
|
+ this.configStockNum = stockTotal
|
|
}
|
|
}
|
|
},
|
|
},
|
|
};
|
|
};
|