<template>
  <el-form
    inline
    class="dialog-info"
    label-width="110px"
  >
    <el-form-item label="票种分类">
      {{ data.category | groupIndividual }}
    </el-form-item>
    <el-form-item label="助记符">
      {{ data.shorthand }}
    </el-form-item>
    <el-form-item label="销售价格">
      {{ data.price }} 元
    </el-form-item>
    <el-form-item label="游玩天数">
      {{ data.use_valid_days }}
    </el-form-item>
    <el-form-item label="可售日期">
      {{ data.sell_startdate | formatDate }} - {{ data.sell_enddate | formatDate }}
    </el-form-item>
    <el-form-item label="可用日期">
      {{ data.use_startdate | formatDate }} - {{ data.use_enddate | formatDate }}
    </el-form-item>
    <el-form-item label="当日游玩时段">
      {{ data.use_time_start + ' - '+ data.use_time_end }}
    </el-form-item>
    <el-form-item label="是否二次入园">
      {{ data.check_second | yesOrNo }}
    </el-form-item>
    <div
      class="block-wrap">
      <div class="block-title">
        适用景点及检票次数
      </div>
      <ul class="pill-wrap">
        <li
          class="pill"
          v-for="(item,index) in data.ticketTypeScenic"
          :key="index">
          <span>{{ item.scenic.name }}</span>
          <span>{{ data.check_type === 1 && data.scenic_check_times_type === 1 ? item.check_limit_times+' 次' : '不限次' }} </span>
        </li>
      </ul>
    </div>
  </el-form>
</template>

<script>
export default {
  props: {
    data: {
      type: Object,
      default: () => {}
    }
  },
  filters: {
    complicatedCheckType (arr) {
      switch (arr[0]) {
        case 1:
          switch (arr[1]) {
            case 1:
              return `单人按次 单独限制`
            case 2:
              return `单人按次 批量限制 共可检${arr[3]}次`
            default:
              return ''
          }
        case 2:
          switch (arr[2]) {
            case 0:
              return `按有效期 截止到票种有效期`
            default:
              return `按有效期 ${arr[2]}天`
          }
        default:
          return ''
      }
    }
  }
}
</script>
