<style scoped>
  p{margin: 0;}
  .Receipt_box{color: #c94052;width: 100%;background-color: rgba(245, 245, 245, 1);position: relative;margin-top: 15px;}
  .Receipt_box tr th{color: #c94052}
  .Receipt_box.color_blur tr th{color: #106BAF}
  .Receipt_box.color_blur{color: #106BAF;}
  .Receipt_box.color_blur .rb_stit span{display: inline-block;border-bottom: 2px solid #106BAF;padding: 0 20px}
  .rb_tit{font-size: 16px;text-align: center;margin-bottom: 20px;}
  .rb_stit{font-size: 14px;text-align: center}
  .rb_stit span{display: inline-block;border-bottom: 2px solid #C94052;padding: 0 20px}
  .rb_top_row{display: flex;justify-content: space-between;font-size: 12px;}
  .rb_top_row span._r_name{color: #333333}
  .rb_top_row span._r_bold{font-weight: bold}
  .rb_top_row ._r_time span{color: #333333}
  ._r_mb5{margin-bottom: 5px;}
  .Receipt_table{width: 100%;font-size: 14px;text-align: center}
  .Receipt_table th{font-weight: 200 !important}
  .Receipt_table tr th,.Receipt_table tr td{background-color: white}
  ._r_mt10{margin-top: 10px;}
  .Receipt_box.color_blur{color: #106BAF;}
  .Receipt_box.color_blur .rb_stit span{display: inline-block;border-bottom: 2px solid #106BAF;padding: 0 20px}
  ._color_b{color: #333333 !important;font-size: 12px}
  ._font_size12{font-size: 12px !important}
  ._r_IsPublic{
    padding-left: 15px;
  }
  ._guanlian{
    font-size: 12px;
    color: gray;
  }
  ._guanlian span{
    font-size: 14px;
    color: #333333;
  }
  ._yewudanju{
    position: absolute;
    text-align: right;
    font-size: 12px;
    right: 15px;
    top: 15px;
  }
  ._jump_page{
    cursor: pointer;
    text-decoration: underline;
  }
  i{
    font-style: initial;
  }
  .Receipt_box._PrintPageStyle tr th{color: #333333}
  .Receipt_box._PrintPageStyle{color: #333333;}
  .Receipt_box._PrintPageStyle .rb_stit span{border-bottom: 2px solid #333333;}
  .Receipt_box._PrintPageStyle{color: #333333;}
  .Receipt_box._PrintPageStyle .rb_stit span{border-bottom: 2px solid #333333;}
  ._border_color_r{
    border-color: #c94052;
  }
  ._border_color_b{
    border-color: #106BAF;
  }
  ._border_color_p{
    border-color: #333333;
  }
  .Receipt_box .rb_stit span._rb_stit_print{
    padding: 0;
    padding-top: 10px;
    border: none;
  }
  ._sanjiao_{
    position: absolute;
    top: 0px;
    left: 0px;
    width: 0px;
    height: 0px;
    border-top: 20px solid #e73828;
    border-bottom: 20px solid transparent;
    border-left: 20px solid #e73828;
    border-right: 20px solid transparent;
  }
  ._sanjiao_:after{
    content: '合';
    position: absolute;
    top: -15px;
    left: -14px;
    white-space: nowrap;
    color: #FFFFFF;
    font-size: 12px;
  }
  ._border_1{
    border:1px solid #333;
    padding: 15px;
    margin-bottom: 20px;
  }
</style>
<template v-if="GetDetail&&GetDetail.DetailList.length>0">
  <div class="Receipt_box" :class="[GetDetail.Type==1?'':'color_blur',isPrintPage?'_PrintPageStyle':'']" :style="{width:width,backgroundColor:color}" @click.stop v-loading='loading'>
    <div v-show="disabled">
      <template v-for="(val,index) in loopNumN">
        <div v-if="index==1" class="_border_1" :key="index">
          <div class="_sanjiao_"></div>
          <p class="rb_tit">{{GetDetail.CompanyName}}</p>
          <table class="Receipt_table" border="1" :class="[GetDetail.Type==1?'_border_color_r':'_border_color_b',isPrintPage?'_border_color_p':'']" :bordercolor="GetDetail.Type==1?'#c94052':'#106BAF'" style="border-collapse:collapse;">
            <tr>
              <th rowspan="2">{{$t('system.query_company')}}</th>
              <th rowspan="2">{{$t('visa.v_tuanhao')}}</th>
              <th rowspan="2">{{$t('fnc.danhao')}}</th>
              <th rowspan="2">{{$t('fnc.fyshuoming')}}</th>
              <!--<th rowspan="2">数量</th>-->
              <!--<th rowspan="2">单 价</th>-->
              <th rowspan="2">{{$t('hotel.hotel_Currency')}}</th>
              <th colspan="5">{{$t('fnc.jine')}}</th>
              <th rowspan="2">{{$t('hotel.hotel_remark')}}</th>
              <th rowspan="2">{{$t('fnc.zhidanren')}}</th>
            </tr>
            <tr>
              <th width="88">{{$t('fnc.yuanbi')}}</th>
              <th width="50">{{$t('hotel.hotel_CurrentRate')}}</th>
              <th width="68">{{$t('fnc.bweibi')}}</th>
              <th width="68">到账</th>
              <th width="48">手续费</th>
            </tr>
            <template v-if="GetDetail.MergeDetailList&&GetDetail.MergeDetailList.length">
              <tr v-for="(item) in GetDetail.MergeDetailList" class="_color_b">
                <td height="34px">{{item.BName}}</td>
                <td height="34px">
                  <template v-for="tc in item.TCIDAndTCNUMList">
                    <p class="_jump_page" @click="jumpPage('productQuery',tc.TCID,1)">
                      <span v-if="GetDetail.Type==1">{{tc.TCNUM}}</span>
                      <span v-if="GetDetail.Type==2">{{tc.TCID}}</span>
                    </p>
                  </template>
                </td>
                <td height="34px">{{item.FinanceId}}</td>
                <td height="34px">{{item.CostTypeName}}</td>
                <!--<td height="34px">{{item.Number}}</td>-->
                <!--<td height="34px">{{item.UnitPrice}}</td>-->
                <td height="34px">{{item.CurrencyName}}</td>
                <td height="34px">{{item.OriginalMoney}}</td>
                <td height="34px">{{item.Rate}}</td>
                <td height="34px">{{item.Money}}</td>
                <td height="34px">{{item.PayMoney}}</td>
                <td height="34px">{{item.Fee}}</td>
                <td height="34px" style="max-width: 120px;">{{item.Remark}}</td>
                <td height="34px">{{item.EmName}}</td>
              </tr>
            </template>
            <tr v-if="GetDetail.MergeDetailList&&GetDetail.MergeDetailList.length<2">
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <!--<td height="34px"></td>-->
              <!--<td height="34px"></td>-->
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
            </tr>
            <tr v-if="GetDetail.MergeDetailList&&GetDetail.MergeDetailList.length<3">
              <td height="34px"></td>
              <td height="34px"></td>
              <!--<td height="34px"></td>-->
              <!--<td height="34px"></td>-->
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
            </tr>
            <tr v-if="GetDetail.MergeDetailList&&GetDetail.MergeDetailList.length<4">
              <td height="34px"></td>
              <td height="34px"></td>
              <!--<td height="34px"></td>-->
              <!--<td height="34px"></td>-->
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
            </tr>
            <!--v-if="GetDetail.MergeBankList&&GetDetail.MergeBankList.length>0"-->
            <tr v-if="GetDetail.MergeBankList&&GetDetail.MergeBankList.length>0">
              <td height="34px" class="">{{$t('tips.jiaoyifangshi')}}</td>
              <td height="34px" colspan="11" class="_color_b">
                <template v-for="(item,index) in GetDetail.MergeBankList">
                  <p  class="_fex_cen clearfix"><span class="_bold">{{item.Alias}}-</span><span class="_bank_name">{{item.TypeName}}-</span><span class="_bank_type" :class="item.AccountType=='对私'?'':'_bank_type2'">{{item.AccountType==""?$t('fnc.no'):item.AccountType}}</span> {{item.BankNo?'-':''}} <span>{{item.BankNo}}</span></p>
                </template>
              </td>
            </tr>
            <tr v-if="GetDetail.Merge">
              <td  height="34px" class="">{{$t('fnc.wbzjine')}}<span class="_font_size12"></span></td>
              <td  height="34px" colspan="4" class="_color_b">{{GetDetail.Merge.WBMoney==''?$t('fnc.ling'):GetDetail.WBChineseMoney}}（{{GetDetail.Merge.WBMoney}}）</td>
              <td  height="34px" class="">{{$t('fnc.bwbzjine')}}<span class="_font_size12"></span></td>
              <td  height="34px" colspan="6" class="_color_b">{{GetDetail.Merge.Money==''?$t('fnc.ling'):GetDetail.ChineseMoney}}（{{GetDetail.Merge.Money}}）</td>
            </tr>
            <tr class="_huik_info" v-if="GetDetail.Type==1&&GetDetail.Merge">
              <td height="34px" class="">{{$t('fnc.huikuanren')}}</td>
              <td height="34px" colspan="4">
                <span class="_color_b _font_size12">{{GetDetail.Merge.RemitterNameV2}}</span>
              </td>
              <td height="34px" class="">{{$t('fnc.hkshijian')}}</td>
              <td height="34px" colspan="6">
                <span class="_color_b _font_size12">{{GetDetail.Merge.TradeDateV2}}</span>
              </td>
            </tr>
            <tr class="_huik_info" v-else-if="GetDetail.Type!=1&&GetDetail.Merge">
              <td height="34px" class="">{{$t('fnc.jiaoyiriqi')}}</td>
              <td height="34px" colspan="11">
                <span class="_color_b _font_size12">{{GetDetail.Merge.TradeDateV2}}</span>
              </td>
            </tr>
          </table>`
        </div>
      </template>

    </div>
    <div v-show="!disabled">
      <template v-for="(val,index) in loopNumN">
        <div v-if="index==1" class="_border_1" :key="index">
          <div class="_sanjiao_"></div>
          <p class="rb_tit">
            <el-input size="small" style="width:auto" v-model="GetDetail.CompanyName" placeholder="请输入"></el-input>
          </p>
          <table class="Receipt_table" border="1" :class="[GetDetail.Type==1?'_border_color_r':'_border_color_b',isPrintPage?'_border_color_p':'']" :bordercolor="GetDetail.Type==1?'#c94052':'#106BAF'" style="border-collapse:collapse;">
            <tr>
              <th rowspan="2">{{$t('system.query_company')}}</th>
              <th rowspan="2">{{$t('visa.v_tuanhao')}}</th>
              <th rowspan="2">{{$t('fnc.danhao')}}</th>
              <th rowspan="2">{{$t('fnc.fyshuoming')}}</th>
              <!--<th rowspan="2">数量</th>-->
              <!--<th rowspan="2">单 价</th>-->
              <th rowspan="2">{{$t('hotel.hotel_Currency')}}</th>
              <th colspan="5">{{$t('fnc.jine')}}</th>
              <th rowspan="2">{{$t('hotel.hotel_remark')}}</th>
              <th rowspan="2">{{$t('fnc.zhidanren')}}</th>
            </tr>
            <tr>
              <th width="88">{{$t('fnc.yuanbi')}}</th>
              <th width="50">{{$t('hotel.hotel_CurrentRate')}}</th>
              <th width="68">{{$t('fnc.bweibi')}}</th>
              <th width="68">到账</th>
              <th width="48">手续费</th>
            </tr>
            <template v-if="GetDetail.MergeDetailList&&GetDetail.MergeDetailList.length">
              <tr v-for="(item) in GetDetail.MergeDetailList" class="_color_b">
                <td height="34px">
                  <el-input size="small" style="width:80px" v-model="item.BName" placeholder="请输入"></el-input>
                </td>
                <td height="34px">
                  <template v-for="tc in item.TCIDAndTCNUMList">
                    <p class="_jump_page">
                      <el-input v-if="GetDetail.Type==1" size="small" style="width:auto;display:inline-block;width:120px" v-model="tc.TCNUM" placeholder="请输入"></el-input>
                      <el-input v-if="GetDetail.Type==2" style="display:inline-block;width:120px;" size="small" v-model="tc.TCID" placeholder="请输入"></el-input>
                    </p>
                  </template>
                </td>
                <td height="34px">{{item.FinanceId}}</td>
                <td height="34px">
                  <el-input size="small" style="width:auto;display:inline-block;width:120px" v-model="item.CostTypeName" placeholder="请输入"></el-input>
                </td>
                <!--<td height="34px">{{item.Number}}</td>-->
                <!--<td height="34px">{{item.UnitPrice}}</td>-->
                <td height="34px">
                  <el-input size="small" style="width:80px" v-model="item.CurrencyName" placeholder="请输入"></el-input>
                </td>
                <td height="34px">{{item.OriginalMoney}}</td>
                <td height="34px">{{item.Rate}}</td>
                <td height="34px">{{item.Money}}</td>
                <td height="34px">{{item.PayMoney}}</td>
                <td height="34px">{{item.Fee}}</td>
                <td height="34px" style="max-width: 120px;">
                  <el-input size="small" style="width:auto" v-model="item.Remark" placeholder="请输入"></el-input>
                </td>
                <td height="34px">{{item.EmName}}</td>
              </tr>
            </template>
            <tr v-if="GetDetail.MergeDetailList&&GetDetail.MergeDetailList.length<2">
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <!--<td height="34px"></td>-->
              <!--<td height="34px"></td>-->
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
            </tr>
            <tr v-if="GetDetail.MergeDetailList&&GetDetail.MergeDetailList.length<3">
              <td height="34px"></td>
              <td height="34px"></td>
              <!--<td height="34px"></td>-->
              <!--<td height="34px"></td>-->
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
            </tr>
            <tr v-if="GetDetail.MergeDetailList&&GetDetail.MergeDetailList.length<4">
              <td height="34px"></td>
              <td height="34px"></td>
              <!--<td height="34px"></td>-->
              <!--<td height="34px"></td>-->
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
              <td height="34px"></td>
            </tr>
            <!--v-if="GetDetail.MergeBankList&&GetDetail.MergeBankList.length>0"-->
            <tr v-if="GetDetail.MergeBankList&&GetDetail.MergeBankList.length>0">
              <td height="34px" class="">{{$t('tips.jiaoyifangshi')}}</td>
              <td height="34px" colspan="11" class="_color_b">
                <template v-for="(item,index) in GetDetail.MergeBankList">
                  <p  class="_fex_cen clearfix">
                          <span class="_bold">
                              <el-input size="small" style="width:120px" v-model="item.Alias" placeholder="请输入"></el-input>
                              -
                              <el-input size="small" style="width:120px" v-model="item.TypeName" placeholder="请输入"></el-input>
                              -
                              <el-input size="small" style="width:120px" v-model="item.AccountType" placeholder="请输入"></el-input>
                              <el-input size="small" style="width:120px" v-model="item.BankNo" placeholder="请输入"></el-input>
                          </span>
                    <!-- {{item.Alias}}-</span><span class="_bank_name">{{item.TypeName}}-</span>
                    <span class="_bank_type" :class="item.AccountType=='对私'?'':'_bank_type2'">
                        {{item.AccountType==""?$t('fnc.no'):item.AccountType}}</span>
                        {{item.BankNo?'-':''}} <span>{{item.BankNo}} -->
                  </p>
                </template>
              </td>
            </tr>
            <tr v-if="GetDetail.Merge">
              <td  height="34px" class="">{{$t('fnc.wbzjine')}}<span class="_font_size12"></span></td>
              <td  height="34px" colspan="4" class="_color_b">{{GetDetail.Merge.WBMoney==''?$t('fnc.ling'):GetDetail.WBChineseMoney}}（{{GetDetail.Merge.WBMoney}}）</td>
              <td  height="34px" class="">{{$t('fnc.bwbzjine')}}<span class="_font_size12"></span></td>
              <td  height="34px" colspan="6" class="_color_b">{{GetDetail.Merge.Money==''?$t('fnc.ling'):GetDetail.ChineseMoney}}（{{GetDetail.Merge.Money}}）</td>
            </tr>
            <tr class="_huik_info" v-if="GetDetail.Type==1&&GetDetail.Merge">
              <td height="34px" class="">{{$t('fnc.huikuanren')}}</td>
              <td height="34px" colspan="4">
                <span class="_color_b _font_size12">{{GetDetail.Merge.RemitterNameV2}}</span>
              </td>
              <td height="34px" class="">{{$t('fnc.hkshijian')}}</td>
              <td height="34px" colspan="6">
                  <span class="_color_b _font_size12">
                      <el-input size="small" style="width:auto" v-model="GetDetail.Merge.TradeDateV2" placeholder="请输入"></el-input>
                  </span>
              </td>
            </tr>
            <tr class="_huik_info" v-else-if="GetDetail.Type!=1&&GetDetail.Merge">
              <td height="34px" class="">{{$t('fnc.jiaoyiriqi')}}</td>
              <td height="34px" colspan="11">
                  <span class="_color_b _font_size12">
                      <el-input size="small" style="width:auto" v-model="GetDetail.Merge.TradeDateV2" placeholder="请输入"></el-input>
                  </span>
              </td>
            </tr>
          </table>
        </div>
      </template>

    </div>

  </div>
</template>
<script>
  export default {
    props:["ID","width","color","isPrintPage","name","disabled","loopNumN"],  //接收参数 ID width color
    data(){
      return{
        loading:false,
        // GetDetail:{DetailList:null},
        EmployeeId:'',
        EndDate:'',
        StartDate:'',
        GetDetail: {},
        disabled:true,
      }
    },methods:{
      jumpPage(path,id,type){
        if(type==1){
          // let routeData = this.$router.resolve({
          //     name: path,
          //     query: { id:id,orderID:this.GetDetail.OrderID,isShow:false}
          // });
          // window.open(routeData.href, "_blank");
          this.$router.push({
            name: path,
            query: {  id:id,orderID:this.GetDetail.OrderID,isShow:false,blank:'y'}
          })
        }else if(type==2){
          // let routeData = this.$router.resolve({
          //     name: path,
          //     query: { starTime:this.StartDate,endTime:this.EndDate,EmployeeId:this.EmployeeId}
          // });
          // window.open(routeData.href, "_blank");
          this.$router.push({
            name: path,
            query: { starTime:this.StartDate,endTime:this.EndDate,EmployeeId:this.EmployeeId,blank:'y'}
          })
        }
      },
      Financial_post_GetDetail(id){  //获取单据详情
        if(!id) return
        this.loading = true;
        this.apipost('Financial_post_GetDetail',{ID:id}, res => {
          if(res.data.resultCode == 1) {
            let data= res.data.data;
            data.DetailList.forEach(x=>{
              x.UnitPrice = this.$commonUtils.addCommas(Math.round(x.UnitPrice * 100) / 100)
              x.Money = Math.round(x.Money * 100) / 100
              x.OriginalMoney = Math.round(x.OriginalMoney * 100) / 100
            })
            data.ChineseMoney = this.$commonUtils.changeMoneyToChinese(data.Merge.Money)
            data.WBChineseMoney = this.$commonUtils.changeMoneyToChinese(data.Merge.WBMoney)
            data.Money = this.$commonUtils.addCommas(Math.round(data.Money * 100) / 100)
            data.Merge.TradeDateV2 = new Date(data.Merge.TradeDateV2).Format('yyyy-MM-dd')
            data.AuditSteps.reverse()
            this.GetDetail = data;
            this.loading=false
            this.$set(this.$data,"GetDetail",data);
          }
        }, err => {})
      },
    },mounted(){

      const myDate = new Date();
      let yaer = myDate.getFullYear(); //获取完整的年份(4位,1970-????)
      let month = myDate.getMonth()+1; //获取当前月份(0-11,0代表1月)
      let dateS = myDate.getDate(); //获取当前日(1-31)
      this.StartDate = yaer + '-' + month + '-' + '01';
      this.EndDate = yaer + '-' + month + '-' + dateS;
      let userInfo = this.getLocalStorage();
      this.EmployeeId = userInfo.EmployeeId;
      this.Financial_post_GetDetail(this.ID);
    },watch: {  // 监听参数变化
      GetDetail: {
        handler: function(val, oldVal) {
        },
        deep: true
      },
      ID:{
        handler: function(val, oldVal) {
          this.ID = val
          this.Financial_post_GetDetail(this.ID)
        },
        deep: true
      }
    }
  }
</script>
