<template>
  <div>
       <div class="query-box">
        <ul>
          <li>
            <span>
              <em>{{$t('system.table_ssLine')}}</em>
              <el-select class="w150" v-model="msg.LineId" filterable :placeholder="$t('pub.pleaseSel')">
                <el-option :label="$t('pub.unlimitedSel')" :value="SelectDefaultValue"></el-option>
                <el-option v-for="item in LineList" :label="item.LineName" :value="item.LineID"
                           :key="item.LineID"></el-option>
              </el-select>
            </span>
          </li>
          <li>
            <span>
              <em>{{$t('active.ad_xlmc')}}</em>
              <el-select class="w150" v-model="msg.LineteamId" filterable :placeholder="$t('pub.pleaseSel')">
                <el-option :label="$t('pub.unlimitedSel')" :value="SelectDefaultValue"></el-option>
                <el-option v-for="item in LineTeamList" :label="item.LtName" :value="item.LtID"
                           :key="item.LtID"></el-option>
              </el-select>
            </span>
          </li>
          <li>
            <span>
              <em>{{$t('visa.v_tuanhao')}}</em>
              <el-input maxlength="50" v-model="msg.TCNUM" class="permiss-input w150"
                        @keyup.native.enter="getControlList"
                        :placeholder="$t('pub.pleaseImport')"></el-input>
            </span>
          </li>
          <li style="display:none;">
            <span>
              <em>{{$t('hotel.hotel_SerialNumber')}}</em>
              <el-input maxlength="50" v-model="msg.TCID" class="permiss-input w150"
                        @keyup.native.enter="getControlList"
                        :placeholder="$t('pub.pleaseImport')"></el-input>
            </span>
          </li>
          <li>
            <span>
              <em>{{$t('scen.sc_ftTime')}}</em>
              <el-date-picker class="w150" type="date" v-model="msg.StartDate"
                              :picker-options="pickerBeginDateBefore"
                              value-format="yyyy-MM-dd" placeholder></el-date-picker>
              <el-date-picker class="w150" type="date" v-model="msg.EndDate"
                              :picker-options="pickerBeginDateAfter"
                              value-format="yyyy-MM-dd" placeholder></el-date-picker>
            </span>
          </li>
          <li>
            <button class="hollowFixedBtn" @click="resetPageIndex(),getList()">{{$t('pub.searchBtn')}}</button>
          </li>
        </ul>
      </div>
        <table class="singeRowTable" border="0" cellspacing="0" cellpadding="0" v-loading='loading'>
      <tr>
        <th>{{$t('scen.sc_temID')}}</th>
        <th>{{$t('advmanager.v_line')}}</th>
        <th>{{$t('advmanager.v_xilie')}}</th>
        <th>{{$t('visa.v_tuanhao')}}</th>
        <th>{{$t('scen.sc_ftTime')}}</th>
        <th>{{$t('admin.admin_Department')}}</th>
        <th>{{$t('admin.admin_personNumber')}}</th>
        <th>{{$t('leader.leader_Leader')}}</th>
        <th>{{$t('fnc.fnc_tfsrhj')}} </th>
        <th>{{$t('fnc.fnc_zksr')}}</th>
        <th>{{$t('fnc.fnc_thjksr')}}</th>
        <th>{{$t('fnc.fnc_plattev')}}</th>
        <th>{{$t('admin.admin_czPerson')}}</th>
        <th>{{$t('hotel.table_operattime')}}</th>
      </tr>
      <tr v-for="item in tableList" :key="item.Id">
        <td><span  @click='goUrl("priceIncomeConfirmInfo",item.TCID,"收入确认单")' style="cursor:pointer;text-decoration: underline">{{item.TCID}}</span></td>
        <td>{{item.LineName}}</td>
        <td>{{item.LtName}}</td>
        <td>{{item.TCNUM}}</td>
        <td>{{item.StartDate}}</td>
        <td>{{item.DepartmentName}}</td>
        <td>{{item.PeopleNum}}</td>
        <td>{{item.LeaderName}}</td>
        <td>{{item.TotalIncome}}</td>
        <td>{{item.DirectGuestIncome}}</td>
        <td>{{item.PlatformGuestIncome}}</td>
        <td>{{item.PlatformIncome}}</td>

        <td>{{item.EmpName}}</td>
        <td>{{item.DateTimeStr}}</td>
      </tr>
      <tr v-if="tableList.length==0">
          <td colspan="13">{{$t('system.content_noData')}}</td>
      </tr>
    </table>
    <el-pagination background @current-change="handleCurrentChange" :current-page.sync="msg.currentPage"
                   layout="total,prev, pager, next, jumper" :page-size='msg.pageSize' :total='total'>
    </el-pagination>
  </div>
</template>


<script>
import moment from "moment";
export default {

  data () {
    return {
         //查询数据列表
         SelectDefaultValue:0,
         total:0,
        msg: {
            pageIndex:1,
            pageSize:10,
            LineId:0,
            LineteamId:0,
            TCNUM:"",
            StartDate:moment().format("YYYY-MM-DD"),
            EndDate:"",
            currentPage:1,
        },
        LineList:[],
        LineTeamList:[],
        pickerBeginDateBefore: {
          disabledDate: time => {
            let endTime = new Date(this.msg.EndDate)
            return endTime.getTime() < time.getTime()
          }
        },
        pickerBeginDateAfter: {
          disabledDate: time => {
            let startTime = new Date(this.msg.StartDate)
            return startTime.getTime() >= time.getTime()
          }
        },
        loading:false,
        tableList:[],


    }
  },
created() {
    this.getLineList()
    this.getLineTeamList()
    this.getList();
  },
  methods: {
      goUrl (path, TCID, name) {
        this.$router.push({
          name: path,
          query: {
            TCID: TCID,
            blank: 'y',
            tab: name
          }
        })
      },
      //翻页
      handleCurrentChange (val) {
        this.msg.pageIndex = val
        this.getList()
      },
            //新获取列表数据
      getList () {

        this.loading = true
        this.apipost(
          'travel_post_GetPriceIncomeConfirmInfoPageList',
          this.msg,
          res => {
            this.loading = false
            if (res.data.resultCode == 1) {
              this.tableList=res.data.data.pageData;
              this.total=res.data.data.count;
            }
          },
          err => {
          }
        )
      },

    //重新查询
      resetPageIndex () {
        this.msg.pageIndex = 1
        this.msg.currentPage = 1
      },
    //获取线路列表
      getLineList () {
        this.apipost('line_post_GetList', {}, res => {
          if (res.data.resultCode == 1) {
            this.LineList = res.data.data
          }
        })
      },
      //获取系列列表
      getLineTeamList () {
        // this.queryMsg.LineteamId = 0
        // let msg = {
        //   lineID: this.queryMsg.LineId,
        //   placeID: this.queryMsg.PlaceID,
        //   isTOOP: 1
        // }
        this.apipost('team_post_GetList', {}, res => {

          if (res.data.resultCode == 1) {
            this.LineTeamList = res.data.data
          }
        })
      },
  },

}
</script>
<style>


</style>