<style>
  .CM_look {
    padding: 4px !important;
    position: relative;
    top: 1px;
  }

</style>
<template>
  <div class="flexOne">
    <table class="singeRowTable" border="0" cellspacing="0" cellpadding="0" v-loading="loading">
      <tr>
        <th>{{$t('sm.company')}}</th>
        <th>{{$t('admin.admin_Department')}}</th>
        <th>{{$t('system.query_name')}}</th>
        <th>{{$t('objFill.zongrenshu')}}</th>
        <th>{{$t('salesModule.TCmoney')}}</th>
        <th>{{$t('tips.qishu')}}</th>
        <th>{{$t('fnc.xiangqing')}}</th>
      </tr>
      <tr v-for="(item,index) in dataList" :key="index">
        <td>{{item.BName}}</td>
        <td>{{item.DName}}</td>
        <td>{{item.UName}}</td>
        <td><template v-if="item.Frids.length==0">
            {{item.TotalPersion}}
          </template>
        </td>
        <td>
          <template v-if="item.Frids.length==0">
            {{item.CommissionMoney}}
          </template>
        </td>
        <td>
          <template v-if="item.Frids.length==0">
            {{item.Periods}}</template>
          <template v-else>
            {{$t('objFill.v101.administrative.beibhdcwdj')}}:
          </template>
        </td>
        <td>
          <template v-if="item.Frids.length==0">
            <a @click="goUrl(item)" style="color:blue;text-decoration:underline;cursor:pointer;">{{$t('fnc.xiangqing')}}</a>&nbsp;&nbsp;
          </template>
          <template v-else v-for="(subItem,subIndex) in item.Frids">
            <span :key="subIndex" style="color:red;text-decoration:underline;cursor:pointer;"
              @click="goFinaceUrl('FinancialDocumentsDetail',subItem)">
              {{subItem}}
            </span>&nbsp;
          </template>
          <a @click="DownLoadAirticketCommission(item)"
            style="color:blue;text-decoration:underline;cursor:pointer; display:none;">{{$t('objFill.v101.administrative.xiazacayi')}}</a>
        </td>
      </tr>
    </table>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        msg: {
          MainId: 0
        },
        loading: false,
        //数据源
        dataList: [],

      }
    },
    mounted() {
      this.msg.MainId = this.$route.query.ID;
      this.getList();
    },
    methods: {
      //下载票务提成差异
      DownLoadAirticketCommission(item) {
        this.loading = true;
        //导出报表
        let msg = {
          UserId: item.UserId,
          Periods: item.Periods
        };
        var fileName = item.UName + "【" + item.Periods + "】" + this.$t('objFill.v101.administrative.tichengcayi')+".xls";
        this.GetLocalFile("airticket_get_DownloadAirticketCommission", msg, fileName,
          res => {
            this.loading = false;
          });
      },
      //获取数据
      getList() {
        this.loading = true;
        this.apipost(
          "AirTicketRules_post_GetAirticketCommissionDetails",
          this.msg,
          res => {
            this.loading = false;
            if (res.data.resultCode == 1) {
              this.dataList = res.data.data;
            } else {
              this.Error(res.data.message);
            }
          },
          null
        );
      },
      goFinaceUrl(path, id) {
        this.$router.push({
          path: '/' + path,
          query: {
            id: id,
            blank: 'y',
            tab: id + '单据详情'
          }
        })
      },
      goUrl(item) {
        this.$router.push({
          path: "flightPerformance",
          query: {
            UserId: item.UserId,
            Periods: item.Periods,
            blank: 'y',
            tab: '票务业绩详情'
          }
        });
      }
    },
  }

</script>