<style>
  .BusExportTitle {
    width: 1000px;
    margin: 0 auto;
    text-align: center;
    font-weight: bold;
    margin-top: 10px;
    font-size: 16px;
  }

  .Bus_Content {
    width: 100%;
    height: auto;
    margin: auto;
    position: absolute;
  }

  .Bus_detailTable {
    width: 1000px;
    font-size: 12px;
    color: #333;
    margin: 10px auto;
    border-collapse: collapse;
    background-color: #fff;
    border: 1px solid #d1d1d1;
  }

  .Bus_detailTable td {
    border: 1px solid #d1d1d1;
    padding: 0 10px;
    height: 32px;
    font-size: 16px;
  }

  .Bus_detailTable th {
    background-color: #fff;
    border: 1px solid #d1d1d1;
    font-size: 16px;
    font-weight: bold;
    height: 32px;
  }

  .txLeft {
    text-align: left;
  }

  .txRight {
    text-align: right;
  }

  .fontBold {
    font-weight: bold;
  }

  .totalTabal td {
    height: 33px;
  }

  .excelBtn {
    color: #fff;
    padding: 0 15px;
    height: 30px;
    background: #E95252;
    border: 1px solid #E95252;
    cursor: pointer;
    border-radius: 15px;
    margin-left: 10px;
  }

</style>

<template>
  <div class="Bus_Content">
    <div class="BusExportTitle">
      {{Year}}{{$t('pub.year')}}{{Month}}{{$t('objFill.v101.yuegshecz')}}
      <input type="button" style="float:right;" @click="downLoadExcel" class="excelBtn" :value="$t('objFill.xz')+'excel'" />
    </div>
    <table class="Bus_detailTable">
      <thead>
        <tr>
          <th>{{$t('objFill.v101.hote.zuozhangzt')}}</th>
          <th width="200">{{$t('visa.v_tuanhao')}}</th>
          <th>{{$t('fnc.danhao')}}</th>
          <th>{{$t('objFill.v101.busManagement.chepeih')}}</th>
          <th style="width:20%">{{msg.CurrName}}</th>
          <th style="width:20%">{{$t('fnc.a_rminbi')}}</th>
        </tr>
      </thead>
      <tbody v-for="item in dataList">
        <tr v-for="subItem in item.RBobj">
          <td class="txLeft">{{subItem.BranchName}}</td>
          <td class="txLeft">{{subItem.TCNUM}}({{subItem.TCID}})</td>
          <td class="txRight">{{subItem.FrID}}</td>
          <td class="txRight">{{subItem.CarDistribution}}</td>
          <td class="txRight">{{subItem.sMoney}}</td>
          <td class="txRight">{{subItem.Money}}</td>
        </tr>
        <tr>
          <td colspan="4" class="txRight">{{item.BranchName}}{{$t('objFill.yingfuzje')}}：</td>
          <td class="txRight">{{item.SumOMoney}}</td>
          <td class="txRight">{{item.SumMoney}}</td>
        </tr>
        <tr style="height:12px">
          <td colspan="6" style="background:#999; height:12px;"></td>
        </tr>
      </tbody>
    </table>
    <table class="Bus_detailTable totalTabal" style="border:0px;page-break-before:always;margin:0 auto;">
      <tr>
        <td class="txRight" colspan="4">
          <div style="width:275px;text-align:right;float:right;">{{Year}}{{$t('pub.year')}}{{Month}}{{$t('objFill.v101.yueyfgschez')}}：</div>
        </td>
        <td class="txRight fontBold" style="width:20%">{{TotalJan}}</td>
        <td class="txRight fontBold" style="width:20%">{{TotalCn}}</td>
      </tr>
      <tr v-for="item in dataList">
        <td class="txRight" colspan="4">{{item.BranchName}}{{$t('objFill.yingfuzje')}}：</td>
        <td class="txRight fontBold">{{item.SumOMoney}}</td>
        <td class="txRight fontBold">{{item.SumMoney}}</td>
      </tr>
      <tr>
        <td colspan="3" style="padding-top:30px;border:0px;">{{$t('visa.v_zongjingli')}}：</td>
        <td colspan="1" style="padding-top:30px;border:0px;width:25%">{{$t('op.bmzg')}}：</td>
        <td colspan="1" style="padding-top:30px;border:0px;float:right">{{$t('fnc.zhibiao')}}：</td>
        <td style="padding-top:30px;border:0px;"></td>
      </tr>
      <tr>
        <td colspan="6" style="padding-top:10px;border:0px;">
          <div style="float:right;margin-right:30%;text-align:right;">{{$t('fnc.zhibiao')}}{{$t('pub.date')}}：</div>
        </td>
      </tr>
    </table>
    <table class="Bus_detailTable" v-for="(item,index) in dataList"
      style="margin: 5px auto;border:0px;page-break-before:always;">
      <tr >
        <th>{{$t('objFill.v101.hote.zuozhangzt')}}</th>
        <th width="250">{{$t('visa.v_tuanhao')}}</th>
        <th>{{$t('fnc.danhao')}}</th>
        <th>{{$t('objFill.v101.busManagement.chepeih')}}</th>
        <th style="width:20%">{{msg.CurrName}}</th>
        <th style="width:19%">{{$t('fnc.a_rminbi')}}</th>
      </tr>
      <tr v-for="subItem in item.RBobj">
        <td class="txLeft">{{subItem.BranchName}}</td>
        <td class="txLeft">{{subItem.TCNUM}}({{subItem.TCID}})</td>
        <td class="txRight">{{subItem.FrID}}</td>
        <td class="txRight">{{subItem.CarDistribution}}</td>
        <td class="txRight">{{subItem.sMoney}}</td>
        <td class="txRight">{{subItem.Money}}</td>
      </tr>
      <tr>
        <td colspan="4" class="txRight">{{item.BranchName}}{{$t('objFill.yingfuzje')}}：</td>
        <td class="txRight">{{item.SumOMoney}}</td>
        <td class="txRight">{{item.SumMoney}}</td>
      </tr>
    </table>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        msg: {
          Month: '',
          MakeStartDate: '',
          MakeEndDate: '',
          CurrType: '',
          CurrName: '',
          ClientId: ''
        },
        Year: '',
        Month: '',
        dataList: [],
        TotalJan: '',
        TotalCn: '',
        downList: "",
      }
    },
    mounted() {
      this.msg.Month = this.$route.query.Month;
      this.msg.MakeStartDate = this.$route.query.MakeStartDate;
      this.msg.MakeEndDate = this.$route.query.MakeEndDate;
      this.msg.CurrType = this.$route.query.CurrType;
      this.msg.ClientId = this.$route.query.ClientId;
      this.Year = this.msg.Month.split('-')[0];
      this.Month = this.msg.Month.split('-')[1];
      this.getList();
    },
    methods: {
      getList() {
        this.apipost('bus_get_CarfareApportionExport', this.msg, res => {
          if (res.data.resultCode == 1) {
            this.dataList = res.data.data.RObj;
            this.msg.CurrName = res.data.data.CurrName;
            this.TotalJan = res.data.data.TotalStatistics.TSumOMoney;
            this.TotalCn = res.data.data.TotalStatistics.TSumMoney;
          } else {
            this.Error(res.data.message);
          }
        }, err => {})
      },
      //点击下载
      downLoadExcel() {
        let msg = JSON.parse(JSON.stringify(this.msg));
        this.GetLocalFile(
          "bus_get_CarfareApportionExcelExport",
          msg,
          this.Year + this.$t('pub.year') + this.Month + this.$t('pub.month') + this.$t('objFill.v101.gongschez')+'.xls'
        );
      }
    },
  }
</script>
