|
@@ -0,0 +1,490 @@
|
|
|
+<!--
|
|
|
+ * @Description: 新增/编辑弹框
|
|
|
+ * @Author: Sugar.
|
|
|
+ * @Date: 2023-11-24 13:55:00
|
|
|
+ * @LastEditors: Sugar.
|
|
|
+ * @LastEditTime: 2023-11-24 13:55:00
|
|
|
+ * @FilePath: \cattle_webui\src\views\programmeMr\dialog\AddOrEditDialog.vue
|
|
|
+ * @Copyright: Copyright (c) 2016~2023 by Sugar., All Rights Reserved.
|
|
|
+-->
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ :title="title"
|
|
|
+ :visible.sync="open"
|
|
|
+ width="800px"
|
|
|
+ append-to-body
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ @close="cancel"
|
|
|
+ >
|
|
|
+ <div class="dialog">
|
|
|
+ <el-form :model="form" ref="form" :rules="rules" label-width="120px">
|
|
|
+ <el-tabs v-model="activeName">
|
|
|
+ <!-- 基础信息 -->
|
|
|
+ <el-tab-pane label="基础信息" name="01">
|
|
|
+ <el-form-item label="票务名称:" prop="name" style="margin-top: 20px">
|
|
|
+ <el-input
|
|
|
+ v-model="form.name"
|
|
|
+ placeholder="票务名称"
|
|
|
+ clearable
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="使用年龄:" prop="sponsorId">
|
|
|
+ <el-radio v-model="form.type" label="1">不限制</el-radio>
|
|
|
+ <el-radio v-model="form.type" label="2">限制</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="实名信息:" prop="status">
|
|
|
+ <el-radio v-model="form.type" label="1">全部观影人员均实名</el-radio>
|
|
|
+ <el-radio v-model="form.type" label="2">1位观影人员实名即可</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="核销播报次数:" prop="name">
|
|
|
+ <el-input
|
|
|
+ v-model="form.name"
|
|
|
+ placeholder="核销播报次数"
|
|
|
+ clearable
|
|
|
+ style="width: 100%;"
|
|
|
+ >
|
|
|
+ <template slot="append">次</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-tab-pane>
|
|
|
+
|
|
|
+ <!-- 销售信息 -->
|
|
|
+ <el-tab-pane label="销售信息" name="02">
|
|
|
+ <el-form-item label="原价:" label-width="100px" style="margin-top: 20px">
|
|
|
+ <el-input
|
|
|
+ v-model="form.name"
|
|
|
+ placeholder="原价"
|
|
|
+ clearable
|
|
|
+ style="width: 100%;"
|
|
|
+ >
|
|
|
+ <template slot="append">元</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="销售价:" label-width="100px">
|
|
|
+ <el-input
|
|
|
+ v-model="form.name"
|
|
|
+ placeholder="原价"
|
|
|
+ clearable
|
|
|
+ style="width: 100%;"
|
|
|
+ >
|
|
|
+ <template slot="append">元</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="每日限售:" prop="status" label-width="100px">
|
|
|
+ <el-radio v-model="form.type" label="1">不限</el-radio>
|
|
|
+ <el-radio v-model="form.type" label="2">限制</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="每日限售:" prop="status" label-width="100px">
|
|
|
+ <el-radio v-model="form.type" label="1">不限</el-radio>
|
|
|
+ <el-radio v-model="form.type" label="2">限制</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="是否限购:" prop="status" label-width="100px">
|
|
|
+ <el-radio v-model="form.type" label="1">是</el-radio>
|
|
|
+ <el-radio v-model="form.type" label="2">否</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="售票时间:" prop="status" label-width="100px">
|
|
|
+ <el-radio v-model="form.ticketing" label="1">不限</el-radio>
|
|
|
+ <el-radio v-model="form.ticketing" label="2">限制</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="限制时间段:" v-if="form.ticketing == 2" label-width="100px">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="form.value1"
|
|
|
+ type="datetimerange"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="售票渠道:" prop="status" label-width="100px">
|
|
|
+ <el-checkbox v-model="form.xcx">小程序</el-checkbox>
|
|
|
+ <el-checkbox v-model="form.ck">窗口</el-checkbox>
|
|
|
+ </el-form-item>
|
|
|
+ </el-tab-pane>
|
|
|
+
|
|
|
+ <!-- 退票信息 -->
|
|
|
+ <el-tab-pane label="退票信息" name="03">
|
|
|
+ <el-form-item label="是否支持退票:" prop="status" label-width="180px">
|
|
|
+ <el-radio v-model="form.type" label="1">是</el-radio>
|
|
|
+ <el-radio v-model="form.type" label="2">否</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="是否支持退票:" prop="status" label-width="180px">
|
|
|
+ <el-radio v-model="form.type" label="1">百分比</el-radio>
|
|
|
+ <el-radio v-model="form.type" label="2">固定值</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="手续费类型与扣费规则:" prop="status" label-width="180px">
|
|
|
+ <div>
|
|
|
+ <div style="margin-bottom: 10px">
|
|
|
+ <span style="padding-right: 5px">演出开始前</span>
|
|
|
+ <el-input v-model="form.name" placeholder="票务名称" style="width: 120px" clearable />
|
|
|
+ <span style="padding-left: 5px">分钟以上, </span>
|
|
|
+ <span style="padding-right: 5px">收取</span>
|
|
|
+ <el-input v-model="form.name" placeholder="票务名称" style="width: 120px" clearable />
|
|
|
+ <span style="padding-left: 5px">元</span>
|
|
|
+ <el-button style="padding-left: 15px" type="text">添加</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <span style="padding-right: 5px">演出开始前</span>
|
|
|
+ <el-input v-model="form.name" placeholder="票务名称" style="width: 120px" clearable />
|
|
|
+ <span style="padding-left: 5px">分钟以上, </span>
|
|
|
+ <span>不允许退票</span>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-tab-pane>
|
|
|
+
|
|
|
+ <!-- 选座信息 -->
|
|
|
+ <el-tab-pane label="选座信息" name="04">
|
|
|
+ <el-form-item label="是否支持选座:" prop="status">
|
|
|
+ <el-radio v-model="form.type" label="1">是</el-radio>
|
|
|
+ <el-radio v-model="form.type" label="2">否</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="选座渠道:" prop="status">
|
|
|
+ <el-checkbox v-model="form.xcx">小程序</el-checkbox>
|
|
|
+ <el-checkbox v-model="form.ck">窗口</el-checkbox>
|
|
|
+ </el-form-item>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="cancel">取消</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm"
|
|
|
+ v-loading.fullscreen.lock="loading"
|
|
|
+ element-loading-text="提交中..."
|
|
|
+ element-loading-spinner="el-icon-loading"
|
|
|
+ element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
|
+ >
|
|
|
+ <span v-if="loading">提交中...</span>
|
|
|
+ <span v-else>保存</span>
|
|
|
+ </el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+// import { updateNoticeMgr } from "@/api/system/noticeMgr";
|
|
|
+import { saveAndEdit, getSelectById } from '@/api/programmeMr/programmeMr'
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
+import { pageList } from '@/api/performMr/performMr'
|
|
|
+export default {
|
|
|
+ name: "addAndEdit",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ channelList: [
|
|
|
+ {id: 1, name: '小程序', value: 1},
|
|
|
+ {id: 2, name: '窗口', value: 2},
|
|
|
+ ],
|
|
|
+ title: "编辑",
|
|
|
+ model: "EDIT",
|
|
|
+ activeName: '01',
|
|
|
+ // 演员信息弹窗
|
|
|
+ performerVisible: false,
|
|
|
+ // 演员信息
|
|
|
+ performerList: [],
|
|
|
+ // 演员上传图片索引
|
|
|
+ performerIndex: 0,
|
|
|
+ open: false,
|
|
|
+ loading: false,
|
|
|
+ form: {
|
|
|
+ id: undefined,
|
|
|
+ type: "",
|
|
|
+ content: "",
|
|
|
+ checkedCities: []
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ name: [{ required: true, message: "请输入剧目名称", trigger: "blur" }],
|
|
|
+ sponsorId: [{ required: true, message: "请选择主办方", trigger: "blur" }],
|
|
|
+ status: [{ required: true, message: "请选择是否启用状态", trigger: "blur" }]
|
|
|
+ },
|
|
|
+ uploadObj: {
|
|
|
+ url: process.env.VUE_APP_UPLOAD_FILE_API + "/upload/single/minio",
|
|
|
+ Headers: { Authorization: "Bearer " + getToken() },
|
|
|
+ },
|
|
|
+ statusList: [
|
|
|
+ {id: 1, name: '是', value: 1},
|
|
|
+ {id: 2, name: '否', value: 2},
|
|
|
+ ],
|
|
|
+ performList: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 查询主办方列表 */
|
|
|
+ getList() {
|
|
|
+ pageList({pageNum: 1, pageSize: 100})
|
|
|
+ .then(response => {
|
|
|
+ this.performList = response.data.rows;
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ /** 主办方选择事件 */
|
|
|
+ changePerform(val) {
|
|
|
+ this.performList.forEach(item => {
|
|
|
+ if(item.id == val){
|
|
|
+ this.form.sponsorName = item.name
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 多选框事件 */
|
|
|
+ handleCheckedCitiesChange() {
|
|
|
+
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 打开弹框
|
|
|
+ * @date 2023-11-22
|
|
|
+ * @param {any} obj
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+ openDialog(title, obj) {
|
|
|
+ this.open = true;
|
|
|
+ this.form = {};
|
|
|
+ this.activeName = '01';
|
|
|
+ if (obj){
|
|
|
+ this.title = "编辑票务管理";
|
|
|
+ this.getSelectByIdApi(obj)
|
|
|
+ }else{
|
|
|
+ this.title = "添加票务管理";
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs["form"].clearValidate();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 获取详情 */
|
|
|
+ getSelectByIdApi(row) {
|
|
|
+ const id = row.id
|
|
|
+ getSelectById(id).then(response => {
|
|
|
+ const obj = response.data;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$set(this.form, 'id', obj.id);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 保存
|
|
|
+ * @date 2023-11-22
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ try {
|
|
|
+ this.loading = true;
|
|
|
+ const { code } = await saveAndEdit({ ...this.form });
|
|
|
+ if (code === 200) {
|
|
|
+ this.$message.success("修改成功!");
|
|
|
+ this.$emit("getList");
|
|
|
+ this.cancel();
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ } finally {
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 演员信息添加
|
|
|
+ * @date 2023-11-22
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+ performerEven() {
|
|
|
+ let target=[...this.performerList];
|
|
|
+ this.form.performerList = JSON.parse(JSON.stringify(target));
|
|
|
+ this.performerVisible = false;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 重置
|
|
|
+ * @date 2023-11-22
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+ reset() {
|
|
|
+ this.$refs["form"].resetFields();
|
|
|
+ this.form.id = undefined;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 关闭弹框
|
|
|
+ * @date 2023-11-22
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+ cancel() {
|
|
|
+ this.reset();
|
|
|
+ this.open = false;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 上传成功
|
|
|
+ * @date 2023-11-22
|
|
|
+ * @param {any} res
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+ handleAvatarSuccess(res) {
|
|
|
+ if (res.code === 200) {
|
|
|
+ // this.form.mainImg = res?.data?.url;
|
|
|
+ this.$set(this.form, 'showImg', res?.data?.url)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 剧目海报上传成功
|
|
|
+ * @date 2023-11-22
|
|
|
+ * @param {any} res
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+ handlePhotoListSuccess(res) {
|
|
|
+ if (res.code === 200) {
|
|
|
+ let photo = {
|
|
|
+ imageUrl: res?.data?.url,
|
|
|
+ photoType: '2'
|
|
|
+ }
|
|
|
+ if(!this.form.photoList){
|
|
|
+ this.form.photoList = []
|
|
|
+ }
|
|
|
+ this.form.photoList.push(photo);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleRemove(file, fileList) {
|
|
|
+ fileList.forEach(item => {
|
|
|
+ if(item.response && item.response.data){
|
|
|
+ let res = item.response.data;
|
|
|
+ let photo = {
|
|
|
+ imageUrl: res?.data?.url,
|
|
|
+ photoType: '2'
|
|
|
+ }
|
|
|
+ if(!this.form.photoList){
|
|
|
+ this.form.photoList = []
|
|
|
+ }
|
|
|
+ this.form.photoList.push(photo);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 上传文件之前之前
|
|
|
+ * @date 2023-11-22
|
|
|
+ * @param {any} file
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ const isJPG = file.type === "image/jpeg" || "image/png";
|
|
|
+ if (!isJPG) {
|
|
|
+ this.$message.error("上传头像图片只能是jpg或png格式!");
|
|
|
+ }
|
|
|
+ return isJPG;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 演员新增
|
|
|
+ * @date 2023-11-22
|
|
|
+ */
|
|
|
+ handleAdd() {
|
|
|
+ if(!this.performerList){
|
|
|
+ this.performerList = []
|
|
|
+ }
|
|
|
+ this.performerList.push({})
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 演员删除
|
|
|
+ * @date 2023-11-22
|
|
|
+ */
|
|
|
+ handleDelete(row, index) {
|
|
|
+ this.$confirm('是否确认删当前数据?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.performerList.splice(index, 1);
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
+ });
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 演员弹窗打开
|
|
|
+ * @date 2023-11-22
|
|
|
+ */
|
|
|
+ performerOpen() {
|
|
|
+ if(!this.form.performerList){
|
|
|
+ this.form.performerList = []
|
|
|
+ }
|
|
|
+ let target=[...this.form.performerList];
|
|
|
+ this.performerList = JSON.parse(JSON.stringify(target));
|
|
|
+ this.performerVisible = true;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 演员图片上传成功
|
|
|
+ * @date 2023-11-22
|
|
|
+ * @param {any} res
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+ handlePerformerAvatarSuccess(res) {
|
|
|
+ if (res.code === 200) {
|
|
|
+ // this.form.mainImg = res?.data?.url;
|
|
|
+ this.$set(this.performerList[this.performerIndex], 'performerHead', res?.data?.url);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 演员图片上传点击记录当前索引
|
|
|
+ * @date 2023-11-22
|
|
|
+ * @param {any} row
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+ changeIndexEven(row) {
|
|
|
+ this.performerIndex = row.$index;
|
|
|
+ }
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.dialog {
|
|
|
+ padding: 0 30px;
|
|
|
+ max-height: 65vh;
|
|
|
+ overflow-y: auto;
|
|
|
+}
|
|
|
+.dialog {
|
|
|
+ padding: 0 30px;
|
|
|
+ .upload-btn {
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ background-color: #fbfdff;
|
|
|
+ border: dashed 1px #c0ccda;
|
|
|
+ border-radius: 5px;
|
|
|
+ i {
|
|
|
+ font-size: 30px;
|
|
|
+ margin-top: 20px;
|
|
|
+ }
|
|
|
+ &-text {
|
|
|
+ margin-top: -10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .avatar {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+}
|
|
|
+.el-table{
|
|
|
+ .upload-btn {
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ background-color: #fbfdff;
|
|
|
+ border: dashed 1px #c0ccda;
|
|
|
+ border-radius: 5px;
|
|
|
+ i {
|
|
|
+ font-size: 30px;
|
|
|
+ margin-top: 20px;
|
|
|
+ }
|
|
|
+ &-text {
|
|
|
+ margin-top: -10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .avatar {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|