cpop_nftmeta_sdm/web/src/views/zshow/zShow/zshowSchedule.vue

235 lines
7.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<el-dialog title="演出日程" :visible.sync="show" width="70%">
<template #title>
<h3>演出日程</h3>
<el-button @click="createHandler" type="primary">新建</el-button>
</template>
<el-table
:data="listData"
style="width: 100%;"
:header-cell-style="{ 'text-align': 'center' }"
:cell-style="{ 'text-align': 'center' }"
:loading="loading"
:border="true"
>
<el-table-column type="expand">
<template slot-scope="scope">
<div v-if="!scope.row.ticketTiers.length" class="center">
该日程暂无票档快去添加票档吧~
</div>
<el-table
:data="scope.row.ticketTiers"
style="width: 100%;"
:header-cell-style="{
'text-align': 'center',
'background-color': '#f5f7fa',
}"
:cell-style="{ 'text-align': 'center' }"
:loading="loading"
:border="true"
v-else
>
<el-table-column label="票档名称" prop="tierName">
</el-table-column>
<el-table-column label="票档价格" prop="tierPrice">
</el-table-column>
<el-table-column label="票档状态" prop="status">
<template slot-scope="scope">
<el-tag type="info" v-if="scope.row.status === 0">
待开售
</el-tag>
<el-tag type="success" v-if="scope.row.status === 1">
开售中
</el-tag>
<el-tag type="danger" v-if="scope.row.status === 2">
已售罄
</el-tag>
</template>
</el-table-column>
<el-table-column label="座位数" prop="seatsInTier">
</el-table-column>
<el-table-column label="可用座位数" prop="seatsAvailableInTier">
</el-table-column>
<el-table-column fixed="right" label="操作" width="180">
<template slot-scope="scopeChe">
<el-button
type="text"
icon="el-icon-edit-outline"
size="small"
plain
@click="editHandlerTier(scopeChe.row)"
>编辑</el-button
>
<el-button
type="text"
icon="el-icon-delete"
size="small"
plain
@click="deleteHandlerTier(scopeChe.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column label="场次名称" prop="scheduleName">
</el-table-column>
<el-table-column label="日程时间" prop="scheduleTime">
</el-table-column>
<el-table-column label="总座位数" prop="seatsTotal"> </el-table-column>
<el-table-column label="可用座位数" prop="seatsAvailable">
</el-table-column>
<el-table-column label="场次状态" prop="status">
<template slot-scope="scope">
<el-tag type="info" v-if="scope.row.status === 0">
待开售
</el-tag>
<el-tag type="success" v-if="scope.row.status === 1">
开售中
</el-tag>
<el-tag type="danger" v-if="scope.row.status === 2">
已售罄
</el-tag>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作">
<template slot-scope="scope">
<el-button
type="text"
icon="el-icon-circle-plus-outline"
size="small"
plain
@click="addTierDialog(scope.row)"
>添加票档</el-button
>
<el-button
type="text"
icon="el-icon-edit-outline"
size="small"
plain
@click="editHandler(scope.row)"
>编辑</el-button
>
<el-button
type="text"
icon="el-icon-delete"
size="small"
plain
@click="deleteHandler(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</el-dialog>
<showScheduleForm
ref="scheduleForm"
@reloadTable="fetPage()"
></showScheduleForm>
<tiketTierForm ref="tiketTierForm" @reloadTable="fetPage()"></tiketTierForm>
</div>
</template>
<script>
import { fetPage, delObj } from "@/api/zshow/zShowSchedule";
import { delTierObj } from "@/api/zshow/zTicketTier";
import showScheduleForm from "./showScheduleForm.vue";
import tiketTierForm from "./tiketTierForm.vue";
export default {
components: { showScheduleForm, tiketTierForm },
data() {
return {
show: false,
showId: undefined,
loading: false,
listData: [],
};
},
methods: {
open(row) {
console.log(row);
this.show = true;
this.showId = row.showId;
this.fetPage();
},
fetPage() {
this.loading = true;
fetPage(this.page).then((res) => {
const { records, total } = res.data;
this.listData = records;
// this.page.total = total;
this.loading = false;
});
},
// 新建日程
createHandler() {
this.$refs.scheduleForm.open({ edit: false, showId: this.showId });
},
// 编辑日程
editHandler(row) {
this.$refs.scheduleForm.open({ edit: true, row: row });
},
// 删除日程
deleteHandler(row) {
this.$confirm("此操作将永久删除该日程, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delObj(row.scheduleId).then((res) => {
this.$message({
type: "success",
message: "删除成功!",
});
this.fetPage();
});
});
},
// 添加票档
addTierDialog(row) {
this.$refs.tiketTierForm.open({
edit: false,
showId: this.showId,
scheduleId: row.scheduleId,
});
},
// 编辑票档
editHandlerTier(row) {
this.$refs.tiketTierForm.open({ edit: true, row: row });
},
// 删除票档
deleteHandlerTier(row) {
this.$confirm(`是否删除${row.tierName}票档?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
delTierObj(row.tierId).then((res) => {
if (res.code === "success") {
this.$message.success("删除成功!");
this.fetPage();
} else {
this.$message.error("删除失败");
}
});
})
.catch(() => {});
},
},
};
</script>
<style>
.center {
text-align: center;
}
</style>