<style>
@import url("../../assets/css/domestic/TicketingModule.css");
</style>
<template>
  <div class="m_TicketingModule">
    <div class="_tit">
      <span class="_text">机票信息</span>
      <div>
        <span class="_btn" v-if="tableShow" @click="tableShow=false">收起 <i class="iconfont icon-gengduo _rotate"></i></span>
        <span class="_btn" v-else @click="tableShow=true">展开 <i class="iconfont icon-gengduo"></i></span>
      </div>
    </div>
    <div v-show="tableShow" class="_padding_20_15">
      <table class="singeRowTable" border="0" style="border:1px solid #E6E6E6;" cellspacing="0" cellpadding="0">
        <tr>
          <th>航空公司</th>
          <th>航班号</th>
          <th>时间</th>
          <th>出发城市</th>
          <th>到达城市</th>
          <th>使用数量</th>
          <th>状态</th>
        </tr>
        <tr  v-for="item in DataList.FlightList">
          <td>{{item.AlName}}</td>
          <td>
            {{item.Flight_number}}
          </td>
          <td>
             {{item.FlightDateStr}} {{item.Departure_time}}
          </td>
          <td>
            {{item.DepartureName}}
          </td>
          <td>
            {{item.ArrivalCityName}}
          </td>
          <td>{{DataList.UseAccount}}</td>
          <td v-if="Type">{{getTypeStr()}}</td>
        </tr>
      </table>
    </div>
  </div>
</template>
<script>
export default {
  props:["SourceID","id","Callback"],
  data() {
    return {
      tableShow: false,
      //机票编号
      // SourceID: 0,
      //数据列表
      DataList: {},
      //数据对象
      // Callback: {},
      //定金类型
      Type: null
    };
  },
  methods: {
    getTypeStr() {
      var str = "";
      switch (this.Type) {
        case 1:
          str = "一定";
          break;
        case 2:
          str = "二定";
          break;
        case 3:
          str = "三定";
          break;
        case 4:
          str = "四定";
          break;
        case 5:
          str = "尾款";
          break;
      }
      return str;
    },
    getList() {
      this.apipost(
        "AirTicket_Get_GetAirticketById",
        {
          ID: this.SourceID
        },
        r => {
          if (r.data.resultCode == 1) {
            this.DataList = r.data.data;
          }
        },
        null
      );
    }
  },
  mounted() {
    let obj = JSON.parse(this.Callback);
    this.Type =  obj.Type;  
    this.getList();
  }
};
</script>