<template>
  <div>
    <div style="height: 14px; line-height: 14px; font-size: 14px; color: #333; font-weight: bold; border-left: 3px solid #E95252; text-indent: 15px; margin: 20px 0;">{{JourneyScenicName}}</div>
    <div style="width: 100%;  overflow-x: auto;padding-bottom: 10px; " class="ownScrollbarStyle">
	    <input type="button" :value="$t('pub.searchBtn')" @click="GetList()" style="display:none;" />
      <table border="0" cellspacing="1" cellpadding="0" class="scenicSpotInfoTable" v-loading='loading'>
        <tr>
          <th width="50">{{$t('active.ad_xuhao')}}</th>
          <th width="80">{{$t('sm.chufadi')}}</th>
          <th width="140">{{$t('ground.hbsj')}}</th>
          <th width="80">{{$t('salesModule.CompanyNum')}}</th>
          <th width="150">{{$t('Operation.Op_jinchudian')}}</th>
          <th width="80">{{$t('leader.leader_Leader')}}</th>
          <th width="80">{{$t('leader.leader_Guide')}}</th>
          <th width="120" v-for="(item, index) in DayList" :key="index">{{$t('tips.di')}}{{item+1}}{{$t('hotel.hotel_day')}}</th>
        </tr>
        <tbody v-if="DataList.length!==0" v-for="(item,index) in DataList" :key="index">
          <tr>
            <td rowspan="2">{{index+1}}</td>
            <td>
              <div>{{item.StartCityName}}</div>
            </td>
            <td>
              <div class="scenicSpotInfo_flight">
                <div>
                  <span :title="item.flightList[0]&&item.flightList[0].AlName">{{item.flightList[0]&&item.flightList[0].AlName}}</span>
                  <span>{{item.flightList[0]&&item.flightList[0].Flight_number}}</span>
                </div>
                <div>
                  <span>{{item.flightList[0]&&item.flightList[0].DepartureName}}-------{{item.flightList[0]&&item.flightList[0].ArrivalCityName}}</span>
                </div>
                <div>
                  <span>{{item.flightList[0]&&item.flightList[0].Departure_time}}</span>
                  <el-popover width="900" trigger="click" popper-class="scenicSpotInfo_flightTable">
											<table border="0" cellspacing="1" cellpadding="0">
												<thead>
                          <tr>
                            <th width="60">{{$t('Airticket.Air_segment')}}</th>
                            <th width="80">{{$t('system.query_flightNum')}}</th>
                            <th width="150">{{$t('objFill.v101.BasicDocuments.col.t1')}}</th>
                            <th width="80">{{$t('objFill.v101.BasicDocuments.col.t4')}}</th>
                            <th width="100">{{$t('objFill.v101.BasicDocuments.col.t2')}}</th>
                          </tr>
                        </thead>
                        <tbody>
                          <tr v-for="(ft, fi) in item.flightList" :key="fi">
                            <td>
                              <span v-if="fi==0">{{$t('Airticket.Air_go')}}</span>
                              <span v-else-if="fi==item.flightList.length-1">{{$t('Airticket.Air_returnTrip')}}</span>
                              <span v-else-if="fi>0 && fi!=item.flightList.length-1">{{$t('Airticket.Air_transit')}}</span>
                            </td>
                            <td>
                              <div>{{ft.Flight_number}}</div>
														  <div>{{ft.AlName}}</div>
                            </td>
                            <td>
                              <div>{{ft.FlightDate}} {{ft.Departure_time}}</div>
														  <div>{{ft.dName}}</div>
                            </td>
                            <td>
                              <div>{{ft.FlightArrivalTime}} {{ft.Arrival_time}}</div>
														  <div>{{ft.aName}}</div>
                            </td>
                            <td>{{ft.StopoverName}}</td>
                          </tr>
                          <tr v-if="item.flightList.length===0">
                            <td colspan="5" style="background-color: #ffffff;">{{$t('system.content_noData')}}</td>
                          </tr>
                        </tbody>
											</table>
											<span slot="reference">{{$t('Airticket.Air_backAndforth')}}</span>
									</el-popover>
                  <span>{{item.flightList[0]&&item.flightList[0].Arrival_time}}</span>
                </div>
              </div>
            </td>
            <td>
              <div>{{item.TCNUM}}</div>
            </td>
            <td>
              <div>{{item.InOut}}</div>
            </td>
            <td>
              <div>{{item.LeaderName}}</div>
            </td>
            <td>
              <div>{{item.GuideName}}</div>
            </td>
            <td v-for="(item2, index2) in DayList" :key="index2">
              <span v-for="(item3, index3) in item.JourneyScenicList[item2].ChildList" :key="index3" class="useInventory">{{item3.Inventory}}</span>
            </td>
          </tr>
          <tr>
            <td :colspan="maxNum-1" style="text-align: left!important;padding: 10px 20px;">
              {{item.Title}}
            </td>
          </tr>
        </tbody>
        <tbody v-if="DataList.length===0">
          <tr>
            <td :colspan="maxNum">{{$t('system.content_noData')}}</td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        loading: false,
        qMsg: {
          CouponsId: '0',
          StartTime: '',
          EndTime: ''
        },
        JourneyScenicName: '',
        maxNum: 7,
        DayList: [],
        DataList:[]
      }
    },
    methods: {
      GetList: function () {
        this.apipost("ticketcoupons_get_GetJourneyScenicStatisticsList", this.qMsg, res => {
          this.loading = false;
          if (res.data.resultCode == 1) {
            this.DataList = res.data.data.list
            this.JourneyScenicName = res.data.data.JourneyScenicName
            this.maxNum = 7 + res.data.data.MaxDay
            for (let i = 0; i < res.data.data.MaxDay; i++) {
              this.DayList.push(i)
            }
          }
        },err => {})
      }
    },
    mounted: function () {
       this.GetList();
    },
    created: function () {
      let nowDate = new Date().Format('yyyy-MM-dd')
      this.qMsg.CouponsId = this.$route.query.id === undefined ? '0' : this.$route.query.id
      this.qMsg.StartTime = this.$route.query.date === undefined ? nowDate : this.$route.query.date
      this.qMsg.EndTime = this.$route.query.date === undefined ? nowDate : this.$route.query.date
    }
  }

</script>

<style>
  .scenicSpotInfoTable {
    background: #ccc;
    min-width: 100%;
  }

  .scenicSpotInfoTable tr th {
    background: #E6E6E6;
    height: 40px;
    font-size: 12px;
    color: #333;
  }

  .scenicSpotInfoTable tr {
    background: #fff;
    text-align: center;
    height: 40px;
  }

  .scenicSpotInfoTable tr td {
    padding: 10px 0;
    font-size: 12px;
  }
  .scenicSpotInfoTable tr td .useInventory{
    display: inline-block;
    margin: 0 5px;
    vertical-align: top;
  }

  .scenicSpotInfoTable tr td .pHouseStyle {
    border-bottom: 1px solid #ccc;
    height: 20px;
    line-height: 20px;
  }

  .scenicSpotInfoTable tr td .pHouseStyle:last-child {
    border-bottom: none;
  }

  .scenicSpotInfoTable tr td .pDateStyle {
    border-bottom: 1px solid #ccc;
    height: 20px;
    line-height: 20px;
    margin-top: 0;
  }

  .scenicSpotInfoTable tr td .pMsgStyle {
    padding: 0 10px;
    line-height: 20px;
  }

  .scenicSpotInfoTable tr td .link p:hover {
    text-decoration: underline;
    cursor: pointer;
  }

  .scenicSpotInfoTable tr td .phoverStype:hover {
    text-decoration: underline;
    cursor: pointer;
  }

  .scenicSpotInfoTable tr td .scenicSpotInfo_flight{
    margin: 0 auto;
    width: 140px;
    font-size: 0px;

  }
  .scenicSpotInfo_flight>div:nth-child(1){
    padding: 0 10px;
    width: 100%;
    height: 22px;
    line-height: 22px;
    font-size: 12px;
    background: #ccc;
  }
  .scenicSpotInfo_flight>div:nth-child(1)>span:nth-child(1){
    display: inline-block;
    float: left;
    height: 22px;
    width: 50px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    vertical-align: top;
  }
  .scenicSpotInfo_flight>div:nth-child(1)>span:nth-child(2){
    display: inline-block;
    float: right;
    font-style: normal;
    color: #333;
    font-weight: bold;
    vertical-align: top;
  }
  .scenicSpotInfo_flight>div:nth-child(2){
    width: 100%;
    height: 22px;
    line-height: 22px;
    text-align: center;
    font-size: 12px;
  }
  .scenicSpotInfo_flight>div:nth-child(3){
    text-align: center;
  }
  .scenicSpotInfo_flight>div:nth-child(3)>span{
    font-size: 12px;
  }
  .scenicSpotInfo_flight>div:nth-child(3)>span:nth-child(2){
    display: inline-block;
    margin: 0 10px;
    padding: 2px 5px;
    font-size: 12px;
    color: #fff;
    border-radius: 10px;
    background: #2AAEF2;
    cursor: pointer;
  }
  .scenicSpotInfo_flightTable table{
    width: 100%;
    background-color: #CCCCCC;
  }
  .scenicSpotInfo_flightTable table tr th{
    padding: 5px 0;
    text-align: center;
    background-color: #ededed;
  }
  .scenicSpotInfo_flightTable table tr td{
    padding: 5px 0;
    text-align: center;
    background-color: #ffffff;
  }
  .scenicSpotInfo_flightTable table tr td:nth-child(1){
    background-color: #ededed;
  }

</style>
