<!--
 * @Description: 详情弹框
 * @Author: Sugar.
 * @Date: 2023-11-24 13:55:00
 * @LastEditors: Sugar.
 * @LastEditTime: 2023-11-24 13:55:00
 * @FilePath: \cattle_webui\src\views\ticket\ticketMr\dialog\details.vue
 * @Copyright: Copyright (c) 2016~2023 by Sugar., All Rights Reserved.
-->
<template>
  <el-dialog
    title="票务详情"
    :visible.sync="open"
    width="700px"
    append-to-body
    :close-on-click-modal="false"
    @close="cancel"
  >
    <div class="dialog" v-if="form">
      <!--   基础信息   -->
      <div class="title-class" style="margin-top: 0">基础信息</div>
      <el-row>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">票务名称: <span>{{ form.goodsName }}</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">实名信息: <span>全部观影人员均实名</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">停止售卖时间: <span>开演前{{ form.goodsPerform && form.goodsPerform.stopSaleTime }}分钟内</span></div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">核销时间: <span>开演前{{ form.goodsPerform && form.goodsPerform.beforeTime }}分钟内</span></div>
        </el-col>
        <el-col :span="12" v-if="form.goodsPerform">
          <div class="grid-content bg-purple item-class">核销播报次数: <span>{{ form.goodsPerform.verificationSpeaker + '次' || '' }}</span></div>
        </el-col>
        <el-col :span="12" v-if="form.goodsPerform">
          <div class="grid-content bg-purple item-class">票务说明: <span>{{ form.goodsPerform.detail || '' }}</span></div>
        </el-col>
      </el-row>

      <!--   演出信息   -->
      <div class="title-class">销售信息</div>
      <el-row>
        <el-col :span="12">
          <div class="grid-content bg-purple item-class">销售价: <span>{{ form.salePrice + '元' || '' }}</span></div>
        </el-col>
        <!-- <el-col :span="24">
          <div class="grid-content bg-purple item-class">销售有效期: <span>{{ 
            form.goodsPerform && form.goodsPerform.saleBeginTime && form.goodsPerform.saleEndTime ? 
            form.goodsPerform.saleBeginTime +'--'+ form.goodsPerform.saleEndTime :
            '-'
          }}</span></div>
        </el-col> -->
        <el-col :span="12" v-if="form.goodsPerform">
          <div class="grid-content bg-purple item-class">
            是否限购:
            <span>{{ form.goodsPerform.buyAstrict == -1 ? '不限制' : '限售数量' }}</span>
            <span v-if="form.goodsPerform.buyAstrict > -1">每个账号在每个场次限购{{ form.goodsPerform.buyAstrict }}</span>
          </div>
        </el-col>
        <el-col :span="24" v-if="form.goodsPerform">
          <div class="grid-content bg-purple item-class">售票渠道: <span>{{ 
          (form.goodsPerform.channelWx == 0 ? '小程序' : '')
           + ' ' + 
           (form.goodsPerform.channelWindow == 0 ? '窗口' : '')
           + ' ' + 
           (form.goodsPerform.channelAutoSale == 0 ? '自助售/取票机' : '')}}</span></div>
        </el-col>
        <!-- <el-col :span="12">
          <div class="grid-content bg-purple item-class">税率: <span>{{ form.taxRate }}</span></div>
        </el-col> -->
        <el-col :span="24" v-if="form.goodsPerform">
          <div style="width: 100%;height: 100px;overflow: hidden;overflow-y: auto;background-color: rgba(204, 204, 204,0.3);padding: 5px;box-sizing: border-box;border-radius: 10px;">
            <div style="padding: 0 10px;" class="grid-content bg-purple item-class">可售渠道: </div>
            <div v-if="form.saleArea">
              <el-tag :key="index" style="margin-left: 5px;margin-bottom: 5px;" v-for="(item,index) in form.saleArea" >{{ item }}</el-tag>
            </div>  
          </div>
        </el-col>
      </el-row>

      <!--   观影须知   -->
      <div class="title-class">退票信息</div>
      <el-row>
        <el-col :span="24" v-if="form.goodsPerform">
          <div class="grid-content bg-purple item-class">
            是否支持退票:
            <span>{{ form.goodsPerform.backStatus == 1 ? '不可退' : '可退' }}</span>
            <span v-if="form.goodsPerform.backStatus == 0">(按购买日期结算, 提前{{ form.performRefundRule.days }}天{{ form.performRefundRule.hour }}时可退)</span>
          </div>
        </el-col>
      </el-row>
    </div>


    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="cancel">确定</el-button>
    </span>

  </el-dialog>
</template>

<script>
import { getSelectById } from "@/api/ticketMr/ticketMr";
import Editor from "@/components/Editor";
export default {
  name: "detailsDia",
  components: {
    Editor,
  },
  data() {
    return {
      title: "编辑",
      model: "EDIT",
      open: false,
      loading: false,
      form: {
        id: undefined,
      },
      performerVisible: false,
      performerList: []
    };
  },
  methods: {
    /**
     * 打开弹框
     * @date 2023-11-22
     * @param {any} obj
     * @returns {any}
     */
    openDialog(title, obj) {
      this.open = true;
      if (obj){
        this.getSelectByIdApi(obj)
      }
    },
    /** 获取详情 */
    getSelectByIdApi(row) {
      const id = row.id
      getSelectById(id).then(response => {
        this.form = response.data;
      });
    },
    /**
     * 关闭弹框
     * @date 2023-11-22
     * @returns {any}
     */
    cancel() {
      this.open = false;
    },
  },
};
</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;
  }
  .title-class{
    font-size: 16px;
    font-weight: bold;
    color: black;
    margin-bottom: 20px;
    margin-top: 20px;
  }
  .item-class{
    margin-bottom: 20px;
  }
}
</style>
