|
|
@@ -23,6 +23,25 @@
|
|
|
end-placeholder="结束日期">
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="场次"
|
|
|
+ prop="curBatchConfigId"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="curBatchConfigId"
|
|
|
+ placeholder="请选择场次"
|
|
|
+ style="width: 200px;"
|
|
|
+ @change="switchBatchConfig"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in batchConfigList"
|
|
|
+ :key="item.batchConfigId"
|
|
|
+ :label="item.batchName"
|
|
|
+ :value="item.batchConfigId"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<div class="btn-wrap">
|
|
|
<el-button
|
|
|
@click="reset"
|
|
|
@@ -42,137 +61,121 @@
|
|
|
<!-- <div class="block-title">
|
|
|
现有票种
|
|
|
</div> -->
|
|
|
+ <el-tag type="warning">-1表示为不限制</el-tag>
|
|
|
<el-table
|
|
|
border
|
|
|
stripe
|
|
|
v-loading="loading"
|
|
|
:data="tableData"
|
|
|
+ style="margin-bottom: 20px;"
|
|
|
>
|
|
|
<el-table-column
|
|
|
- prop="id"
|
|
|
- label="票种ID"
|
|
|
- width="80"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="name"
|
|
|
- label="票种名称"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="票种分类"
|
|
|
+ prop="batchName"
|
|
|
+ label="场次信息"
|
|
|
+ width="150"
|
|
|
+ fixed="left"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- {{ getTicketCate(scope.row.category) }}
|
|
|
+ <div>
|
|
|
+ <span class="label" style="font-weight: bold">场次名称:</span>
|
|
|
+ <span class="value">{{ scope.row.batchName }}</span>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <span class="label" style="font-weight: bold">开始时间:</span>
|
|
|
+ <span class="value">{{ scope.row.startTime }}</span>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <span class="label" style="font-weight: bold">结束时间:</span>
|
|
|
+ <span class="value">{{ scope.row.endTime }}</span>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
<el-table-column
|
|
|
- prop="price"
|
|
|
- label="窗口价格"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="在售状态"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-switch
|
|
|
- @change="handelStatusChange($event,scope.row)"
|
|
|
- v-model="scope.row.isSale"
|
|
|
- active-text="在售"
|
|
|
- inactive-text="禁售"
|
|
|
- :active-value="1"
|
|
|
- :inactive-value="0">
|
|
|
- </el-switch>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="useDate"
|
|
|
- label="使用日期"
|
|
|
+ v-for="date in dateColumns"
|
|
|
+ :key="date"
|
|
|
+ :label="date"
|
|
|
+ :prop="date"
|
|
|
+ min-width="120"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.useDateStart }} - {{ scope.row.useDateEnd }}
|
|
|
+ <div style="font-size: 16px">
|
|
|
+ <span style="font-weight: bold">余量:</span>
|
|
|
+ <span style="color: green" title="剩余">{{ getDateLeftNum(date, scope.row) }}</span> / <span style="color: blue" title="总量">{{ getDateTotalNum(date, scope.row) }}</span>
|
|
|
+ </div>
|
|
|
+ <div style="display:flex; justify-content: space-between; margin-top: 5px;">
|
|
|
+ <i
|
|
|
+ class="el-icon-s-opportunity"
|
|
|
+ :title="getDateStatus(date, scope.row) === 1 ? '可售' : '停售'"
|
|
|
+ :style="{ color: getDateStatus(date, scope.row) === 1 ? 'green' : 'gray', fontSize: '16px' }"></i>
|
|
|
+ <i
|
|
|
+ class="el-icon-edit"
|
|
|
+ v-if="hasPermission('batch-manage-update')"
|
|
|
+ @click="editDate(date, scope.row)"></i>
|
|
|
+ <span v-else></span>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="checkType"
|
|
|
- label="核销凭证"
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <!-- 票种弹框 -->
|
|
|
+ <el-dialog
|
|
|
+ title="编辑"
|
|
|
+ :visible.sync="dateItemDialogVisible"
|
|
|
+ width="80%"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ @close="dateItemDialogVisible = false">
|
|
|
+ <el-form
|
|
|
+ ref="dateItemForm"
|
|
|
+ :model="dateItem"
|
|
|
+ :rules="dateItemRules"
|
|
|
+ label-width="120px">
|
|
|
+ <el-form-item
|
|
|
+ label="场次名称"
|
|
|
+ prop="batchConfigName"
|
|
|
>
|
|
|
- <template slot-scope="scope">
|
|
|
- {{ scope.row.checkType | checkTypeFilter }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="checkRule"
|
|
|
- label="核销规则"
|
|
|
+ <span>{{ dateItem.batchConfigName }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="场次日期"
|
|
|
+ prop="batchConfigName"
|
|
|
>
|
|
|
- <template slot-scope="scope">
|
|
|
- {{ scope.row.checkRule | checkRuleFilter }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="checkScenic"
|
|
|
- label="核销景点"
|
|
|
+ <span>{{ dateItem.batchDate }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="最大售卖数量"
|
|
|
+ prop="maxSaleNums"
|
|
|
>
|
|
|
- <template slot-scope="scope">
|
|
|
- {{ getScenicName(scope.row.ticketTypeScenicList) }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="操作"
|
|
|
+ <el-input-number
|
|
|
+ v-model="dateItem.maxSaleNums"
|
|
|
+ placeholder="请输入"
|
|
|
+ :min="-1"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="售卖状态"
|
|
|
+ prop="status"
|
|
|
>
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-link
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- @click="showDialog('edit', scope.row)"
|
|
|
- >
|
|
|
- 编辑
|
|
|
- </el-link>
|
|
|
- <el-link
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- @click="showDialog('priceCalendar', scope.row)"
|
|
|
- >
|
|
|
- 价格日历
|
|
|
- </el-link>
|
|
|
- <br>
|
|
|
- <el-link
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- @click="showDialog('add', itemWithoutCategoryAndShorthand(scope.row))"
|
|
|
- >
|
|
|
- 复制
|
|
|
- </el-link>
|
|
|
- <el-link
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- @click="deleteTicket(scope.row.id)"
|
|
|
- >
|
|
|
- 删除
|
|
|
- </el-link>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </div>
|
|
|
- <!-- 票种弹框 -->
|
|
|
- <TicketDialog
|
|
|
- ref="ticketDialogRef"
|
|
|
- :dialog-type="dialogType"
|
|
|
- :ticket-item="curItem"
|
|
|
- :scenic-list="scenicList"
|
|
|
- :ticket-tag-list="ticketTagList"
|
|
|
- :member-type-list="memberTypeList"
|
|
|
- :invoice-seller="InvoiceSeller"
|
|
|
- @updateList="getTicketTypeList"
|
|
|
- ></TicketDialog>
|
|
|
+ <el-switch
|
|
|
+ v-model="dateItem.status"
|
|
|
+ :active-value="1"
|
|
|
+ :inactive-value="0"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div
|
|
|
+ slot="footer"
|
|
|
+ class="dialog-footer"
|
|
|
+ >
|
|
|
+ <el-button @click="dateItemDialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="handleDateItemSubmit">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import moment from 'moment'
|
|
|
import { getBatchList, updateBatch } from '@/api/batch'
|
|
|
-import TicketDialog from './ticket/Dialog'
|
|
|
import { TicketCategory } from './ticket/constant'
|
|
|
import { cloneDeep } from '@/utils'
|
|
|
|
|
|
@@ -211,11 +214,6 @@ const getCheckRuleName = (rule) => {
|
|
|
}
|
|
|
|
|
|
export default {
|
|
|
- computed: {
|
|
|
- ticketCategory () {
|
|
|
- return this.$store.state.app.ticketCategory
|
|
|
- }
|
|
|
- },
|
|
|
data () {
|
|
|
return {
|
|
|
form: {
|
|
|
@@ -233,7 +231,38 @@ export default {
|
|
|
scenicList: [],
|
|
|
ticketTagList: [],
|
|
|
ticketPricePlanList: [],
|
|
|
- InvoiceSeller: []
|
|
|
+ InvoiceSeller: [],
|
|
|
+ batchConfigList: [],
|
|
|
+ curBatchConfigId: '',
|
|
|
+ dateItemDialogVisible: false,
|
|
|
+ dateItem: {
|
|
|
+ batchConfigId: '',
|
|
|
+ batchDate: '',
|
|
|
+ batchConfigName: '',
|
|
|
+ status: 1,
|
|
|
+ maxSaleNums: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ticketCategory () {
|
|
|
+ return this.$store.state.app.ticketCategory
|
|
|
+ },
|
|
|
+ permissionList () {
|
|
|
+ return this.$store.state.user.menuList || []
|
|
|
+ },
|
|
|
+ dateColumns () {
|
|
|
+ const { batchDateStart, batchDateEnd } = this.form
|
|
|
+
|
|
|
+ const start = moment(batchDateStart)
|
|
|
+ const end = moment(batchDateEnd)
|
|
|
+ const dates = []
|
|
|
+
|
|
|
+ while (start.isSameOrBefore(end)) {
|
|
|
+ dates.push(start.format('YYYY-MM-DD'))
|
|
|
+ start.add(1, 'days')
|
|
|
+ }
|
|
|
+ return dates
|
|
|
}
|
|
|
},
|
|
|
filters: {
|
|
|
@@ -264,9 +293,6 @@ export default {
|
|
|
created () {
|
|
|
this.getBatchList()
|
|
|
},
|
|
|
- components: {
|
|
|
- TicketDialog
|
|
|
- },
|
|
|
methods: {
|
|
|
getScenicName (scenicList) {
|
|
|
if (!scenicList || scenicList.length === 0) return ''
|
|
|
@@ -285,6 +311,63 @@ export default {
|
|
|
this.$refs.ticketDialogRef.show(item, type)
|
|
|
this.dialogVisible = true
|
|
|
},
|
|
|
+ hasPermission (key) {
|
|
|
+ return !!this.permissionList.some(item => item.code === key)
|
|
|
+ },
|
|
|
+ editDate (date, item) {
|
|
|
+ this.dateItem = {
|
|
|
+ batchConfigId: item.batchConfigId,
|
|
|
+ batchDate: date,
|
|
|
+ batchConfigName: item.batchName,
|
|
|
+ status: this.getDateStatus(date, item),
|
|
|
+ maxSaleNums: this.getMaxSaleNum(date, item)
|
|
|
+ }
|
|
|
+ this.dateItemDialogVisible = true
|
|
|
+ },
|
|
|
+ handleDateItemSubmit () {
|
|
|
+ updateBatch({
|
|
|
+ batchConfigId: this.dateItem.batchConfigId,
|
|
|
+ batchDate: this.dateItem.batchDate,
|
|
|
+ status: this.dateItem.status,
|
|
|
+ maxSaleNums: this.dateItem.maxSaleNums
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code === '200') {
|
|
|
+ this.$message.success('保存成功')
|
|
|
+ this.getBatchList()
|
|
|
+ this.dateItemDialogVisible = false
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg || '保存失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getDateLeftNum (date, item) {
|
|
|
+ const dateObj = item.batchResponseList.find(d => d.batchDate === date)
|
|
|
+ if (dateObj) {
|
|
|
+ return dateObj.leftNums
|
|
|
+ }
|
|
|
+ return '-'
|
|
|
+ },
|
|
|
+ getDateTotalNum (date, item) {
|
|
|
+ const dateObj = item.batchResponseList.find(d => d.batchDate === date)
|
|
|
+ if (dateObj) {
|
|
|
+ return dateObj.leftNums
|
|
|
+ }
|
|
|
+ return '-'
|
|
|
+ },
|
|
|
+ getMaxSaleNum (date, item) {
|
|
|
+ const dateObj = item.batchResponseList.find(d => d.batchDate === date)
|
|
|
+ if (dateObj) {
|
|
|
+ return dateObj.maxSaleNums
|
|
|
+ }
|
|
|
+ return '-'
|
|
|
+ },
|
|
|
+ getDateStatus (date, item) {
|
|
|
+ const dateObj = item.batchResponseList.find(d => d.batchDate === date)
|
|
|
+ if (dateObj) {
|
|
|
+ return dateObj.status
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+ },
|
|
|
// '创建票种失败,名称或助记符重复' 复制时去掉名称和助记符,待复制时用户填入
|
|
|
itemWithoutCategoryAndShorthand (item) {
|
|
|
const copyItem = cloneDeep(item)
|
|
|
@@ -292,10 +375,19 @@ export default {
|
|
|
copyItem.id = ''
|
|
|
return copyItem
|
|
|
},
|
|
|
+ switchBatchConfig (value) {
|
|
|
+ const selectedBatch = this.batchConfigList.find(batch => batch.batchConfigId === value)
|
|
|
+
|
|
|
+ if (selectedBatch) {
|
|
|
+ this.tableData = [selectedBatch]
|
|
|
+ }
|
|
|
+ },
|
|
|
getBatchList () {
|
|
|
+ this.form.batchDateStart = moment(this.form.createTime[0]).format('YYYY-MM-DD')
|
|
|
+ this.form.batchDateEnd = moment(this.form.createTime[1]).format('YYYY-MM-DD')
|
|
|
getBatchList(this.form).then(res => {
|
|
|
- this.tableData = res.data.records || []
|
|
|
- this.total = res.data.total
|
|
|
+ this.batchConfigList = res.data || []
|
|
|
+ this.tableData = this.batchConfigList
|
|
|
})
|
|
|
},
|
|
|
handleSizeChange (size) {
|
|
|
@@ -305,79 +397,6 @@ export default {
|
|
|
// 获取票种列表
|
|
|
handleClose () {
|
|
|
this.dialogVisible = false
|
|
|
- },
|
|
|
- handelStatusChange (value, ticket) {
|
|
|
- const currentTicket = cloneDeep(ticket)
|
|
|
- currentTicket.ticketTypeSourceList = ticket.ticketTypeSourceList || ticket.source || []
|
|
|
-
|
|
|
- if (!currentTicket.ticketTypeSourceList) {
|
|
|
- currentTicket.ticketTypeSourceList = []
|
|
|
- }
|
|
|
-
|
|
|
- if (!currentTicket.ticketTypeScenicList) {
|
|
|
- currentTicket.ticketTypeScenicList = []
|
|
|
- }
|
|
|
-
|
|
|
- if (!currentTicket.singleScenicList) {
|
|
|
- currentTicket.singleScenicList = []
|
|
|
- }
|
|
|
-
|
|
|
- if (!currentTicket.groupScenicList) {
|
|
|
- currentTicket.groupScenicList = []
|
|
|
- }
|
|
|
-
|
|
|
- if (!currentTicket.batchConfigList) {
|
|
|
- currentTicket.batchConfigList = []
|
|
|
- }
|
|
|
-
|
|
|
- let groupFlag = ''
|
|
|
- let groupIndex = 0
|
|
|
- currentTicket.ticketTypeScenicList.forEach(item => {
|
|
|
- if (!item.groupFlag) {
|
|
|
- currentTicket.singleScenicList.push({
|
|
|
- scenicId: item.scenicId,
|
|
|
- checkLimitTimes: item.checkLimitTimes,
|
|
|
- singleDayLimitTimes: item.singleDayLimitTimes
|
|
|
- })
|
|
|
- } else {
|
|
|
- if (groupFlag !== item.groupFlag) {
|
|
|
- groupFlag = item.groupFlag
|
|
|
- groupIndex += 1
|
|
|
- currentTicket.groupScenicList.push({
|
|
|
- scenicId: [item.scenicId],
|
|
|
- checkLimitTimes: item.checkLimitTimes,
|
|
|
- scenicLimitTimes: item.scenicLimitTimes,
|
|
|
- singleDayLimitTimes: item.singleDayLimitTimes
|
|
|
- })
|
|
|
- } else {
|
|
|
- currentTicket.groupScenicList[groupIndex - 1].scenicId.push(item.scenicId)
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- const gsList = []
|
|
|
- const { groupScenicList } = currentTicket
|
|
|
-
|
|
|
- for (let i = 0; i < groupScenicList.length; i++) {
|
|
|
- const item = groupScenicList[i]
|
|
|
- const sList = item.scenicId.map(scenicId => {
|
|
|
- return {
|
|
|
- scenicId,
|
|
|
- checkLimitTimes: item.checkLimitTimes,
|
|
|
- singleDayLimitTimes: item.singleDayLimitTimes || -1,
|
|
|
- scenicLimitTimes: item.scenicLimitTimes || -1
|
|
|
- }
|
|
|
- })
|
|
|
- gsList.push(sList)
|
|
|
- }
|
|
|
- currentTicket.groupScenicList = gsList
|
|
|
- currentTicket.isSale = value
|
|
|
-
|
|
|
- updateTicket(currentTicket).then(res => {
|
|
|
- if (res.code === '200') {
|
|
|
- this.$message.success('操作成功')
|
|
|
- this.getTicketTypeList()
|
|
|
- }
|
|
|
- })
|
|
|
}
|
|
|
}
|
|
|
}
|