<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>公司</th>
        <th>部门</th>
        <th>姓名</th>
        <th>总人数</th>
        <th>提成金额</th>
        <th>期数</th>
        <th>详情</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>
            被驳回的财务单据:
          </template>
        </td>
        <td>
          <template v-if="item.Frids.length==0">
            <a @click="goUrl(item)" style="color:blue;text-decoration:underline;cursor:pointer;">详情</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;">下载差异</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 + "】" + "提成差异.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>
