<style scoped>
  .page_addFD {
    margin-top: 20px;
    position: relative;
    height: 1024px;
  }

  .Receipt_box {
    padding: 15px;
    color: #c94052;
    width: 830px;
    position: relative;
  }

  .page_form {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 60px;
  }

  .Receipt_box tr th {
    color: #c94052
  }

  .Receipt_box.color_blur tr th {
    color: #106BAF
  }

  .Receipt_box.color_blur {
    color: #106BAF;
    background-color: white;
  }

  .Receipt_box.color_blur .rb_stit span {
    display: inline-block;
    border-bottom: 2px solid #106BAF;
    padding: 0 20px
  }

  .rb_tit {
    font-size: 18px;
    text-align: center
  }

  .rb_stit {
    font-size: 14px;
    text-align: center;
    margin-top: 10px;
  }

  .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;
    align-items: center;
    margin-top: 10px
  }

  .rb_top_row span._r_name {
    color: #333333;
    display: inline-block;
  }

  .rb_top_row span._r_bold {
    font-weight: bold
  }

  .rb_top_row ._r_time span {
    color: #333333
  }

  ._r_mb5 {
    margin-bottom: 10px;
  }

  .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;
    position: relative;
  }

  ._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
  }

  td {
    padding: 5px;
    height: 34px;
  }

  ._border_b_1 {
    border-bottom: 1px solid #666666 !important;
  }

  ._flow_chart {
    position: absolute;
    display: inline-block;
    right: 15px;
    top: 7px;
    padding: 5px 25px;
    font-size: 12px;
    color: #FFFFFF;
    background-color: #E95252;
    border-radius: 14px;
    cursor: pointer;
  }

  ._explain {
    padding: 20px 0 10px 0;
    border-top: 1px dashed #BFBFBF;
    background-color: white;
    margin-top: 15px
  }

  ._explain>p {
    color: #1273BC;
    font-size: 12px;
  }

  ._explain>div {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #333333;
    margin-top: 10px;
    align-items: center;
  }

  ._explain>div span {
    display: inline-block;
  }

  ._remark p {
    color: #1273BC;
    font-size: 12px;
  }

  ._remark textarea {
    width: 100%;
    height: 100px;
    background: rgba(255, 255, 255, 1);
    border: 1px solid rgba(220, 220, 220, 1);
    border-radius: 4px;
    margin-top: 10px;
    padding: 15px;
  }

  ._log_t {
    padding: 10px;
  }

  ._submit {
    height: 50px;
    padding: 10px 20px;
    width: 830px;
    position: absolute;
    bottom: -50px;
    left: 0;
    display: flex;
    background-color: white;
  }

  ._submit .btn-box {
    width: 216px;
  }

  ._submit .chosenNextBox {
    flex: 1;
    font-size: 12px;
    height: 30px;
    line-height: 30px;
  }

  ._submit .chosenNextBox .red {
    color: #C94052;
    margin-right: 15px;
  }

  ._submit .el-input__inner {
    width: 300px !important;
  }

  ._color_b {
    color: #333333 !important;
    font-size: 12px
  }

  ._font_size12 {
    font-size: 12px !important
  }

  ._addUpload_box {
    display: block;
    margin-top: 15px
  }

  ._addUpload_box img {
    width: 100%;
    height: 100%;
  }

  ._addUpload_box>div {
    float: left;
    width: 138px;
    height: 92px;
    border: 1px dashed rgba(210, 210, 210, 1);
    border-radius: 2px;
    cursor: pointer;
    margin-bottom: 10px;
    padding: 5px;
    margin-right: 10px;
    position: relative;
  }

  ._addUpload_box>div:hover {
    background-color: #f5f5f5;
  }

  ._addFile_name {
    padding-left: 15px;
    max-width: 450px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  ._addUpload_box .icon-guanbi1 {
    font-size: 12px;
    color: white;
    display: inline-block;
    margin-left: 15px;
    position: absolute;
    right: -6px;
    top: -9px;
    background-color: #f56c6c;
    border-radius: 50%;
    height: 20px;
    width: 20px;
    text-align: center;
    line-height: 20px;
  }

  ._addUpload_box .icon-guanbi1:hover {
    font-size: 12px;
    color: #c94052;
  }

  ._addUpload_box .icon-excel,
  ._addUpload_box .icon-pdf {
    text-align: center;
    font-size: 38px;
    color: green;
    line-height: 75px;
  }

  ._show_img_box {
    position: fixed;
    background: rgba(0, 0, 0, .6);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    text-align: center;
  }

  ._IsPublic {
    margin-left: 0;
    margin-top: 10px;
  }

  ._IsPublic .el-radio__label {
    font-size: 12px;
  }

  ._submit .chosenNextBox {
    flex: 1;
    font-size: 12px;
    height: 30px;
    line-height: 30px;
  }

  ._submit .chosenNextBox .red {
    color: #C94052;
    margin-right: 15px;
  }

  ._display_inline {
    display: inline !important;
  }

  ._addUpload_tips {
    font-size: 12px;
    color: #999999;
  }

  ._jump_page {
    cursor: pointer;
    text-decoration: underline;
  }

  ._jump_page:hover {
    color: #c94052;
  }

  ._TCIDAndTCNUMList {
    display: flex;
  }

  ._TCIDAndTCNUMList ._TCIDAndTCNUMList_item span {
    display: inline-block;
    padding-bottom: 5px;
  }

  ._font_bold {
    font-weight: bold;
  }

  ._TCIDAndTCNUMList_item {
    max-width: 160px;
  }

  .page_addFD ._yewudanju {
    position: absolute;
    text-align: right;
    font-size: 12px;
    right: 15px;
    top: 60px;
  }

  .iconfont._delete_row {
    position: absolute;
    right: -30px;
    top: 10px;
    cursor: pointer;
  }

  .page_addFD .el-radio+.el-radio {
    margin-left: 20px;
  }

  .page_addFD .rb_top_row input {
    font-size: 12px;
  }

</style>
<template>
  <div class="page_addFD" v-loading='loading'>
    <div class="page_form">
      <div class="Receipt_box color_blur">
        <el-popover popper-class="detailsIT_Journal" width="600" placement="right-start" trigger="click">
          <div class="InfoChangeLog">
            <div class="changLog">
              <p class="_log_t">{{$t('fnc.spliucheng')}}</p>
              <my-FlowChartModule :data="AuditListData"></my-FlowChartModule>
            </div>
          </div>
          <span slot="reference" class="_flow_chart">{{$t('fnc.liuchengtu')}}</span>
        </el-popover>
        <p class="rb_tit">{{BillName}}
          (<el-select filterable v-model='msg.RB_Branch_Id' ref='CostTypeId'
            @change="admin_get_DepartmentGetList(msg.RB_Branch_Id)" class="w120 _border_b_1"
            :disabled="(orderObj&&orderObj.Rate)||(orderObj&&orderObj.isRB_Branch_Id)||(crmOrderObj&&crmOrderObj.isRB_Branch_Id)?true:false">
            <el-option v-for='item in companyList' :label='item.BName' :value='item.Id' :key='item.Id'
              :disabled="item.disabled">
            </el-option>
          </el-select>)
        </p>
        <p class="rb_stit">
          <span>{{BillSonName}}</span>
        </p>
        <p class="_yewudanju" v-if="OrderSource==8">{{$t('hotel.order_Number')}}:<span
            @click="msg.OrderID>0?jumpPage('RegistrationList',GetDetail,8):''">{{msg.OrderID==0?$t('fnc.no'):msg.OrderID}}</span>
        </p>
        <!-- <div class="rb_top_row _r_mb5">
                   <el-radio-group v-model="msg.IsPublic" @change="IsPublicChange" class="_IsPublic">
                       <el-radio :label="1" v-if='msg.TemplateId!==36 && msg.TemplateId!==37 && msg.TemplateId!==43 && msg.TemplateId!==48'>{{$t('fnc.gongzhang')}}</el-radio>
                       <el-radio :label="0" v-if='msg.TemplateId!==36 && msg.TemplateId!==37 && msg.TemplateId!==43  && msg.TemplateId!==48'>{{$t('fnc.sizhang')}}</el-radio>
                       <el-radio :label="2" v-if='msg.TemplateId!==36 && msg.TemplateId!==37 && msg.TemplateId!==43  && msg.TemplateId!==48'>{{$t('fnc.rmbxianjin')}}</el-radio>
                       <el-radio :label="3" v-if='msg.TemplateId!==36 && msg.TemplateId!==37 && msg.TemplateId!==48'>{{$t('fnc.wbxianjin')}}</el-radio>
                       <el-radio :label="4" v-if='msg.TemplateId===36 || msg.TemplateId===37 || msg.TemplateId===48'>{{$t('fnc.zjinchi')}}</el-radio>
                       <el-radio :label="5" v-if='msg.TemplateId!==36 && msg.TemplateId!==37 && msg.TemplateId!==43  && msg.TemplateId!==48'>{{$t('fnc.ptxnzhanghu')}}</el-radio>
                       <el-radio :label="6" v-if='msg.TemplateId!==36 && msg.TemplateId!==37 && msg.TemplateId!==43  && msg.TemplateId!==48'>{{$t('fnc.djxnzhanghu')}}</el-radio>
                       <el-radio :label="7" v-if='msg.TemplateId!==36 && msg.TemplateId!==37 && msg.TemplateId!==43  && msg.TemplateId!==48'>{{$t('fnc.szxiangdi')}}</el-radio>

                   </el-radio-group>
               </div> -->
        <div class="rb_top_row _r_mb5 ceshi">
          <p>{{$t('fnc.fkduixiang')}}:
            <el-select v-if='msg.TemplateId===90||msg.TemplateId===91' filterable v-model='msg.IsPublic'
              :placeholder="$t('objFill.fukuantype')" @change="IsPublicChange" class="w135 _border_b_1">
              <el-option :label="$t('objFill.xulizhanghu')" :value='10' :key='10'
                v-if='msg.TemplateId===90||msg.TemplateId===91'></el-option>

            </el-select>
            <el-select v-else-if='msg.TemplateId===193' filterable v-model='msg.IsPublic'
              :placeholder="$t('objFill.fukuantype')" @change="IsPublicChange" class="w135 _border_b_1">
              <el-option :label="$t('fnc.djxnzhanghu')" :value='6' :key='6' v-if='msg.TemplateId===193'></el-option>

            </el-select>
            <el-select v-else filterable v-model='msg.IsPublic' :placeholder="$t('objFill.fukuantype')"
              @change="IsPublicChange" class="w135 _border_b_1">
              <el-option :label="$t('fnc.gongzhang')" :value='1' :key='1'
                v-if='msg.TemplateId!==36 && msg.TemplateId!==37 && msg.TemplateId!==48 && msg.TemplateId !==53'>
              </el-option>
              <el-option :label="$t('fnc.sizhang')" :value='0' :key='0'
                v-if='msg.TemplateId!==36 && msg.TemplateId!==37  && msg.TemplateId!==48 && msg.TemplateId !==53'>
              </el-option>
              <el-option :label="$t('fnc.rmbxianjin')" :value='2' :key='2'
                v-if='msg.TemplateId!==36 && msg.TemplateId!==37  && msg.TemplateId!==48 && msg.TemplateId !==53'>
              </el-option>
              <el-option :label="$t('fnc.wbxianjin')" :value='3' :key='3'
                v-if='msg.TemplateId!==36 && msg.TemplateId!==37 && msg.TemplateId!==48 && msg.TemplateId !==53'>
              </el-option>
              <el-option :label="$t('fnc.zjinchi')" :value='4' :key='4'
                v-if='msg.TemplateId===36 || msg.TemplateId===37 || msg.TemplateId===48 || msg.TemplateId===53|| msg.TemplateId===51|| msg.TemplateId===52'>
              </el-option>
              <el-option :label="$t('fnc.ptxnzhanghu')" :value='5' :key='5'
                v-if='msg.TemplateId!==36 && msg.TemplateId!==37  && msg.TemplateId!==48 && msg.TemplateId !==53'>
              </el-option>
              <el-option :label="$t('fnc.djxnzhanghu')" :value='6' :key='6'
                v-if='msg.TemplateId!==36 && msg.TemplateId!==37  && msg.TemplateId!==48 && msg.TemplateId !==53'>
              </el-option>
              <el-option :label="$t('fnc.szxiangdi')" :value='7' :key='7'
                v-if='msg.TemplateId!==36 && msg.TemplateId!==37  && msg.TemplateId!==48 && msg.TemplateId !==53'>
              </el-option>
              <el-option :label="$t('objFill.originalrefund')" :value='8' :key='8'
                v-if='msg.TemplateId===2 || msg.TemplateId===12 ||msg.TemplateId===61 || msg.TemplateId===62 || msg.TemplateId===120'>
              </el-option>
              <el-option :label="$t('objFill.dijieyuzhikuan')" :value='9' :key='9'
                v-if='msg.TemplateId===67||msg.TemplateId===74||msg.TemplateId===119'></el-option>
              <el-option :label="$t('objFill.dianshanjieshuan')" :value='11' :key='11' v-if='msg.TemplateId===121'>
              </el-option>
            </el-select>
            <el-select v-if="!showDisable" filterable v-model='msg.ClientType' :placeholder="$t('fnc.khleixing')"
              @change="financeinfo_post_GetClientAccountList(msg.ClientType)" class="w135 _border_b_1">
              <el-option v-for='item in ClientTypeList' :label='item.Name' :value='item.ID' :key='item.ID'>
              </el-option>
            </el-select>
            <!-- <el-select  filterable v-if="msg.ClientType==7&&!showDisable"  v-model='msg.IsLeader' :placeholder="$t('fnc.khmingcheng')" class="w135 _border_b_1">
                           <el-option :label='$t("fnc.zslingdui")' :value='1' :key='1'> </el-option>
                           <el-option :label='$t("fnc.lslingdui")' :value='0' :key='0'> </el-option>
                       </el-select> -->
            <template v-if="msg.ClientType==7&&msg.IsPublic!=2&&msg.IsPublic!=3&&!showDisable">
              <el-select v-if="msg.IsLeader==1" filterable v-model='msg.ClientID' :placeholder="$t('fnc.khmingcheng')"
                @change="GetClientAccountList(msg.ClientID)" class="w135 _border_b_1">
                <el-option v-for='item in ClientAccountList' :label='item.Name' :value='item.ID' :key='item.ID'>
                </el-option>
              </el-select>
            </template>
            <template v-if="msg.ClientType!=7&&msg.IsPublic!=2&&msg.IsPublic!=3&&!showDisable">
              <el-select filterable v-model='msg.ClientID' :placeholder="$t('fnc.khmingcheng')"
                @change="GetClientAccountList(msg.ClientID)" class="w135 _border_b_1">
                <el-option v-for='item in ClientAccountList' :label='item.Name' :value='item.ID' :key='item.ID'>
                </el-option>
              </el-select>
            </template>
            <template v-if="(msg.IsPublic==2||msg.IsPublic==3)&&msg.IsLeader==1">
              <el-input v-model='msg.RemitterName' :placeholder="$t('system.ph_name')" class="w135 _border_b_1">
              </el-input>
            </template>
          </p>
          <p><span
              class="">{{$t('hotel.hotel_SerialNumber')}}.</span>{{GetDetail.FrID==0?$t('fnc.daishengcheng'):GetDetail.FrID}}
          </p>
        </div>
        <div class="rb_top_row _r_mb5">
          <template v-if="msg.IsPublic!=2&&msg.IsPublic!=3&&(msg.ClientType==7&&msg.IsLeader==1)&&msg.IsPublic!=4">
            <p>{{$t('fnc.fkzhanghu')}}:
              <el-select filterable v-model='msg.AccountNumber' :placeholder="$t('fnc.qxzfkzh')"
                class="w425 _border_b_1">
                <el-option v-for='item in ClientAccountListS' :label='item.allName' :value='item.allName'
                  :key='item.allName'>
                </el-option>
              </el-select>
            </p>
          </template>
          <template v-if="msg.ClientType!=7&&msg.IsPublic!=2&&msg.IsPublic!=3&&msg.IsPublic!=4">
            <p>{{$t('fnc.fkzhanghu')}}:
              <el-select filterable v-model='msg.AccountNumber' :placeholder="$t('fnc.qxzfkzh')"
                class="w425 _border_b_1">
                <el-option v-for='item in ClientAccountListS' :label='item.allName' :value='item.allName'
                  :key='item.allName'>
                </el-option>
              </el-select>
            </p>
          </template>
          <template v-if="msg.ClientType==7&&msg.IsLeader==0&&msg.IsPublic!=4">
            <p>{{$t('fnc.ldmingcheng')}}:
              <el-input v-model='msg.RemitterName' :placeholder="$t('system.ph_name')" class="w425 _border_b_1">
              </el-input>
            </p>
          </template>
          <template v-if="(msg.IsPublic==2||msg.IsPublic==3)&&msg.IsLeader==1">
            <p>&nbsp;</p>
          </template>
          <p v-if="GetDetail.IsPublic==4" class="_r_name" style="color: #fff;"></p>
          <p class="_r_time">
            <span>{{yaer}}</span> {{$t('pub.year')}} <span>{{month}}</span> {{$t('pub.month')}} <span>{{dateS}}</span>
            {{$t('fnc.day')}} <span>{{timer}}</span>
          </p>
        </div>
        <table class="Receipt_table" border="1" bordercolor="#106BAF" style="border-collapse:collapse;">
          <tr>
            <th rowspan="2" width="150">{{$t('fnc.fyshuoming')}}</th>
            <th rowspan="2">{{$t('restaurant.res_Number')}}</th>
            <th rowspan="2">{{$t('fnc.danjia')}}</th>
            <th rowspan="2" width="100">{{$t('hotel.hotel_Currency')}}</th>
            <th colspan="3">{{$t('fnc.jine')}}
              <template v-if="StandardCurrencyId>0">({{StandardCurrencyName}})</template>
            </th>
            <th rowspan="2">{{$t('hotel.hotel_remark')}}</th>
          </tr>
          <tr>
            <th width="88">{{$t('fnc.yuanbi')}}</th>
            <th width="50">{{$t('hotel.hotel_CurrentRate')}}</th>
            <th width="88">{{$t('fnc.bweibi')}}</th>
          </tr>
          <template v-for="(da,daIn) in msg.detailList">
            <tr v-if="!da.show" @click="showEdit(daIn)" class="_color_b">
              <td height="26px">{{da.CostTypeName}}</td>
              <td height="26px">{{da.Number}}</td>
              <td height="26px">{{da.UnitPriceTo}}</td>
              <td height="26px">{{da.currenName}}</td>
              <td height="26px">{{da.yTotalPriceTo}}</td>
              <td height="26px">{{da.Rate}}</td>
              <td height="26px">{{da.bTotalPriceTo}}</td>
              <td height="26px">{{da.Remark}}</td>
            </tr>
            <tr class="addList2" v-else @keyup.enter="addList(2,daIn+1)">
              <td height="26px">
                <el-select filterable v-model='da.CostTypeId' ref='CostTypeId' :placeholder="$t('rule.qxzfyshuoming')"
                  @change="getCostTypeName(da.CostTypeId, daIn),getRate(da.CostTypeId,da.CurrencyId,2,daIn),addList(2,daIn+1)"
                  class=" _border_b_1">
                  <!-- SelectDisablsed!=item.ID -->
                  <el-option v-for='item in GetCostTypeList' :label='item.Name' :value='item.ID' :key='item.ID'
                    :disabled="SelectState">
                  </el-option>
                </el-select>
              </td>
              <!-- return( /[\d]/.test(String.fromCharCode(evt.which?evt.which:window.event.keyCode))) -->
              <!-- <td height="26px"><el-input v-model="da.Number" type="text" onkeypress='return( /[\d]/.test(String.fromCharCode(event.keyCode)))' @blur="addList(2,daIn+1)"  @change="Calculation(2,daIn+1)" class="w80 _border_b_1"></el-input></td>
                           <td height="26px">
                               <input v-model="da.UnitPrice"  type="text" @keydown="handleInput2" @blur="addList(2,daIn+1)" @change="Calculation(2,daIn+1)" class="w80 h34 _border_b_1"></input>
                           </td> -->
              <td height="26px">
                <el-input v-model="da.Number" @keyup.native="checkInteger(da,'Number')" @input="chages($event)"
                  :disabled="daIn === 0 && XSTC" type="text" @blur="addList(2,daIn+1)" @change="Calculation(2,daIn+1)"
                  class="w80 _border_b_1"></el-input>
              </td>
              <td height="26px">
                <el-input v-model="da.UnitPrice" @input="chages($event)" type="text"
                  :disabled="((msg.TemplateId == 43 || msg.TemplateId == 48 || msg.TemplateId == 56 || msg.TemplateId == 53) && !ZhuiJiaTK) || (daIn === 0 && XSTC)"
                  @keyup.native="checkPrice(da,'UnitPrice',true)" @blur="addList(2,daIn+1)"
                  @change="Calculation(2,daIn+1)" class="w80 h34 _border_b_1"></el-input>
              </td>
              <td height="26px">
                <el-select filterable :disabled="detailCurrDis || (daIn === 0 && XSTC)" v-model='da.CurrencyId'
                  :placeholder="$t('rule.qxzbzhong')"
                  @change="getRate(da.CostTypeId,da.CurrencyId,2,daIn),addList(2,daIn+1)" class=" _border_b_1">
                  <el-option v-for='item in coinGetList' :label='item.Name' :value='item.ID' :key='item.ID'>
                  </el-option>
                </el-select>
              </td>
              <td height="26px">{{da.yTotalPrice}}</td>
              <!-- @blur="addList(2,daIn+1)" @change="Calculation(2,daIn+1)" -->
              <td height="26px">
                <el-input v-model="da.Rate" type="text" :disabled="true" class="w80 _border_b_1"></el-input>
              </td>
              <td height="26px">{{da.bTotalPrice}}</td>
              <td height="26px">
                <el-input v-model="da.Remark" type="textarea" class="w80 _border_b_1" @input="chages($event)">
                </el-input> <i @click="deleteRow(daIn,da)" class="_delete_row iconfont icon-img_delete_small"></i>
              </td>
            </tr>
          </template>

          <tr class="addList1" @keyup.enter="addList(1)">

            <td>
              <el-select v-if="!SelectState" filterable v-model='detailList.CostTypeId' ref='CostTypeId'
                :placeholder="$t('rule.qxzfyshuoming')"
                @change="getCostTypeName(detailList.CostTypeId), getRate(detailList.CostTypeId,detailList.CurrencyId,1),addList(1)"
                class="_border_b_1">
                <el-option v-for='item in GetCostTypeList' :label='item.Name' :value='item.ID' :key='item.ID'>
                </el-option>
              </el-select>
              <el-select v-if="SelectState" filterable v-model='detailList.CostTypeId' ref='CostTypeId'
                :placeholder="$t('rule.qxzfyshuoming')"
                @change="getCostTypeName(detailList.CostTypeId), getRate(detailList.CostTypeId,detailList.CurrencyId,1),addList(1)"
                class="_border_b_1">
                <!-- SelectDisablsed!=item.ID -->
                <el-option v-for='item in GetCostTypeList' :label='item.Name' :value='item.ID' :key='item.ID'
                  :disabled="SelectState">
                </el-option>
              </el-select>
            </td>
            <!-- <td>
                           <el-input v-model="detailList.Number" type="text" onkeypress='return( /[\d]/.test(String.fromCharCode(event.keyCode)))' @blur="addList(1)" @change="Calculation(1)" class="w80 _border_b_1"></el-input>
                       </td>
                       <td>
                           <input v-model="detailList.UnitPrice" type="text" @keydown="handleInput2" @blur="addList(1)" @change="Calculation(1)" class="w80 h34 _border_b_1"></input>
                       </td> -->
            <td>
              <el-input v-model="detailList.Number" type="text" @keyup.native="checkInteger(detailList,'Number')"
                @blur="addList(1)" @change="Calculation(1)" class="w80 _border_b_1"></el-input>
            </td>
            <td>
              <el-input v-model="detailList.UnitPrice" type="text"
                @keyup.native="checkPrice(detailList,'UnitPrice',true)" @blur="addList(1)" @change="Calculation(1)"
                :disabled="(msg.TemplateId == 43 || msg.TemplateId == 48 || msg.TemplateId == 56 || msg.TemplateId == 53) && !ZhuiJiaTK"
                class="w80 h34 _border_b_1"></el-input>
            </td>
            <td>
              <el-select filterable v-model='detailList.CurrencyId' :placeholder="$t('rule.qxzbzhong')"
                @change="getRate(detailList.CostTypeId,detailList.CurrencyId,1),addList(1),Calculation(1)"
                class=" _border_b_1">
                <el-option v-for='item in coinGetList' :label='item.Name' :value='item.ID' :key='item.ID'>
                </el-option>
              </el-select>
            </td>
            <td>
              <span
                v-if="detailList.yTotalPrice && detailList.yTotalPrice!=''">{{detailList.yTotalPrice.toFixed(2)}}</span>
              <span v-else>{{detailList.yTotalPrice}}</span>
            </td>
            <!--  @blur="addList(1)" @change="Calculation(1)"  -->
            <td>
              <el-input v-model="detailList.Rate" type="text" :disabled="true" class="w80 _border_b_1"></el-input>
            </td>
            <td>{{detailList.bTotalPrice}}</td>
            <td>
              <el-input v-model="detailList.Remark" type="textarea" @blur="addList(1)" @input="chages($event)"
                class="w80 _border_b_1"></el-input>
            </td>
          </tr>
          <tr v-if="msg.detailList.length<2">
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
          </tr>
          <tr v-if="msg.detailList.length<3">
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
          </tr>
          <tr v-if="msg.detailList.length<4">
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
          </tr>
          <tr>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px">{{$t('objFill.yuanbiheji')}}</td>
            <td height="26px">{{ybSumPrice}}</td>
            <td height="26px"></td>
            <td height="26px"></td>
            <td height="26px"></td>
          </tr>
          <tr>
            <td>{{$t('fnc.sfjine')}}<br /><span class="_font_size12">{{$t('fnc.daxie')}}</span></td>
            <td colspan="3">{{chinaAllPrice}}</td>
            <td>{{$t('fnc.sfjine')}}<br /><span class="_font_size12">{{$t('fnc.xiaoxie')}}</span></td>
            <td colspan="3">{{allPriceTo!='NaN'?allPriceTo:''}}</td>
          </tr>
          <tr>
            <td>{{$t('fnc.yjfkuanriqi')}}</td>
            <td colspan="7">
              <el-date-picker format="yyyy-MM-dd" value-format="yyyy-MM-dd" clearable class="w190 _border_b_1"
                v-model="msg.PayDate" type="datetime" :placeholder="$t('fnc.qxzrqshijian')" align="right">
              </el-date-picker>
            </td>
          </tr>
        </table>
        <div class="rb_top_row _r_mt10">
          <template v-for="(item,index) in newAuditList">
            <p v-if="item.NodeType == '3' && AuditState.IsTravel">
              {{item.AuditDescription}}:<span class="_r_name"></span>
            </p>
            <p v-else-if="item.NodeType == '2' && msg.RB_Branch_Id!=0">
              {{item.AuditDescription}}:<span class="_r_name"></span>
            </p>
            <p v-else-if="item.NodeType == '1' && msg.RB_Branch_Id==0">
              {{item.AuditDescription}}:<span class="_r_name"></span>
            </p>
            <p v-else-if="!item.NodeType || item.NodeType == ''">
              {{item.AuditDescription}}:<span class="_r_name"></span>
            </p>
          </template>
          <p>
            {{$t('visa.v_yewuyuan')}}:<span class="_r_name _jump_page">{{emplyeeName}}</span>
          </p>
        </div>
        <div class="_explain">
          <p>{{$t('fnc.fjshuoming')}}</p>
          <div>
            <div style="display: flex;">
              <p>
                {{$t('fnc.fygsbumen')}}:<span>
                  <el-select filterable v-model='msg.RB_Depart_Id' class="w135 _border_b_1">
                    <el-option v-for='item in departmentList' :label='item.DepartmentName' :value='item.DepartmentID'
                      :key='item.DepartmentID'>
                    </el-option>
                  </el-select>
                </span>


              </p>

              <p v-if="StoredCustomerList&&StoredCustomerList.length" style="margin-left: 15px;">
                {{$t('objFill.yushoudiyong')}}:<span>
                  <el-select clearable v-model='msg.DepositCustomerId' class="w135 _border_b_1"
                    @change="getSigningCustomerId(2)" :disabled="isDepositCustomer">
                    <el-option v-for='item in StoredCustomerList' :label='item.customerName' :value='item.customerId'
                      :key='item.customerId'>
                    </el-option>
                  </el-select>
                </span>
              </p>

              <p style="margin-left: 15px;">
                <span class="el-select ">
                  <el-tooltip :content="$t('objFill.dianfuduixiangtips')" placement="top">
                    <el-checkbox v-model="KingdeeClientIDCheck" @change="changeKingdeeClientID"
                      :style="{'margin-top':KingdeeClientIDCheck?'0px':'6px'}">垫付对象</el-checkbox>
                  </el-tooltip>
                  <template v-if="KingdeeClientIDCheck">
                    <el-select v-model="msg.KingdeeClientID" class="w135 _border_b_1" filterable remote reserve-keyword
                      :placeholder="$t('pub.PleaseKeyWords')" :remote-method="GetClientAccountListByKeyWord">
                      <el-option v-for='item in ClientKingdeeAccountList'
                        :label='`${item.AccountAlias}(${item.AccountHolder}/${item.CardNum})`' :value='item.ID'
                        :key='item.ID'>
                        <div>
                          <span>{{`${item.AccountAlias}(${item.AccountHolder}/${item.CardNum})`}}</span>
                          <span style="margin-left: 15px;">
                            {{item.ID}}
                            <el-tag size="mini" v-if="item.Status==1">{{$t('pub.fressSel')}}</el-tag>
                          </span>
                        </div>
                      </el-option>

                    </el-select>
                  </template>
                </span>
              </p>
            </div>
            <template v-if="GetDetail.FrID!=0">
              <p v-if="GetDetail.OrderSource==9&&GetDetail.SourceID>0">{{$t("fnc.gnpiaowu")}}:<span
                  class="_jump_page _font_bold"
                  @click="jumpPage('SettlementOrder',GetDetail,2)">{{GetDetail.SourceID}}</span></p>
              <p v-if="GetDetail.OrderSource==10&&GetDetail.SourceID>0">{{$t('active.cl_qianzheng')}}:<span
                  class="_jump_page _font_bold"
                  @click="jumpPage('VisaProductCopy',GetDetail,3)">{{GetDetail.SourceID}}</span></p>
              <div v-if="OrderSource==4&&GetDetail.SourceID>0" class="_TCIDAndTCNUMList">
                <span>{{$t('fnc.jpshouzhi')}}:</span>
                <p class="_TCIDAndTCNUMList_item">
                  <template v-for="(i,ix) in GetDetail.TCIDAndTCNUMList">
                    <span class="_jump_page _font_bold"
                      @click="jumpPage('FinancialOrder',GetDetail,4)">{{i.TCNUM}}({{GetDetail.SourceID}}) </span>
                    <span v-if="ix!=GetDetail.TCIDAndTCNUMList.length-1"><br /></span>
                  </template>
                </p>
              </div>
              <!-- <p v-if="GetDetail.OrderSource==4&&GetDetail.SourceID>0" @click="jumpPage('FinancialOrder',GetDetail.SourceID,4)" class="_jump_page _font_bold">机票收支</p> -->
            </template>
            <template v-if="isHandFee">
              <el-tooltip :content="$t('objFill.peizhishoupeifei')" placement="top">
                <el-switch v-model="is_HandFee" @change="getHandFee">
                </el-switch>
              </el-tooltip>
            </template>

          </div>

          <template v-if="!BillSonName.includes('分摊')&&!BillSonName.includes('预付')">
            <div>
              <p>
                {{this.$route.query.Type==1?$t('objFill.bangdaishou'):$t('objFill.bangdaifu')}}{{$t('objFill.degongsi')}}:
                <span>
                  <el-select filterable v-model='msg.HelpBranchId' class="w120 _border_b_1">
                    <el-option :label="$t('objFill.feidaishoudaifu')" :value='-1' :key='-1'></el-option>
                    <el-option v-for='item in companyList' :label='item.BName' :value='item.Id' :key='item.Id'
                      :disabled="item.Id===msg.RB_Branch_Id">
                    </el-option>
                  </el-select>
                </span>
                <span style="margin-left: 20px;color: red;">{{$t('objFill.zhuzhiyouxuqitadfzhl')}}</span>
              </p>
            </div>

          </template>
          <template v-if="(isHandFee&&is_HandFee)||(is_HandFee&&this.GetDetail.Status==0)">
            <div>
              <p>
                {{$t('objFill.handpartscharge')}}:
                <span>
                  <el-select v-model='HandFee.BranchId' class="w135 _border_b_1"
                    :placeholder="$t('objFill.qinxuanzheshoupeifei')" @change="chooseHandFee">
                    <el-option v-for='item in HandFeeList' :label='item.BranchName' :value='item.BranchId'
                      :key='item.BranchId'>
                    </el-option>
                  </el-select>
                </span>
                <template v-if="HandFeeDetail">
                  <span
                    style="margin-left: 20px;">{{$t('objFill.handpartscharge')}}{{$t('hotel.hotel_Currency')}}:{{HandFeeDetail.CurrencyName}}</span>
                </template>
                <span style="margin-left: 20px;color: red;">{{$t('objFill.shoupeifeizdscts')}}</span>
              </p>
            </div>
            <table v-if="HandFeeDetail&&
                   HandFeeDetail.DetailList.findIndex((x)=>x.show == true)!=-1" class="Receipt_table" border="1"
              bordercolor="#106BAF" style="border-collapse:collapse;margin-top: 10px;">
              <tr>
                <th colspan="3">{{$t('ground.mx')}}</th>
                <th rowspan="2" width="150">{{$t('fnc.a_heji')}}</th>
                <th rowspan="2">{{$t('hotel.hotel_remark')}}</th>
              </tr>
              <tr>
                <th width="80">{{$t('salesModule.Type')}}</th>
                <th width="150">{{$t('restaurant.res_Number')}}</th>
                <th width="150">{{$t('fnc.jine')}}</th>
              </tr>
              <template v-for="(x,index) in HandFeeDetail.DetailList">
                <tr v-if="x.show" class="addList2">
                  <td>
                    <!-- <el-select v-model='x.Type' placeholder="选择类型" class="w80 _border_b_1">
                                    <el-option v-for='item in TypeListArr'
                                        :label='item.Name'
                                        :value='item.Id'
                                        :key='item.Id'>
                                    </el-option>
                                </el-select> -->
                    <span v-if="x.Type==1">{{$t('objFill.fang')}}</span>
                    <span v-if="x.Type==2">{{$t('objFill.can')}}</span>
                    <span v-if="x.Type==3">{{$t('objFill.che')}}</span>
                    <span v-if="x.Type==4">{{$t('scen.sc_piao')}}</span>
                    <span v-if="x.Type==5">{{$t('objFill.fangfeiskssl')}}</span>
                    <span v-if="x.Type==6">{{$t('objFill.canfeiskssl')}}</span>
                    <span v-if="x.Type==7">{{$t('objFill.menpiaofeiskssl')}}</span>
                  </td>
                  <td>
                    <el-input v-model="x.Num" type="Number" class="w80 _border_b_1" :disabled="x.Type>4?true:false">
                    </el-input>
                  </td>
                  <td>
                    <el-input v-model="x.Unit_Price" type="Number" :disabled="x.Type>4?true:false"
                      @keyup.native="checkInteger(x,'Number')" class="w80 _border_b_1"></el-input>
                  </td>
                  <td>{{x.Num*x.Unit_Price}}</td>
                  <td>
                    <el-input v-model="x.Remark" type="textarea"></el-input>
                  </td>
                </tr>
              </template>


            </table>
          </template>
          <table v-if="DepositCustomer" class="Receipt_table" border="1" bordercolor="#c94052"
            style="border-collapse:collapse;margin-top: 10px;">
            <tr>
              <th>{{$t('objFill.yucunkehu')}}</th>
              <th>{{$t('hotel.suplier_contact')}}</th>
              <th>{{$t('system.table_phone')}}</th>
              <th>{{$t('fnc.yueacc')}} </th>
            </tr>
            <tr class="_color_b">
              <td height="26px">{{DepositCustomer.customerName?DepositCustomer.customerName:'-'}}</td>
              <td height="26px">{{DepositCustomer.contact?DepositCustomer.contact:'-'}}</td>
              <td height="26px">{{DepositCustomer.contactNumber?DepositCustomer.contactNumber:'-'}}</td>
              <td height="26px">{{DepositCustomer.depositMoney?DepositCustomer.depositMoney:'-'}}</td>
            </tr>
          </table>
        </div>
        <div class="_remark">
          <p>{{$t('system.label_info')}}</p>
          <textarea v-model="Description">
                   </textarea>
        </div>
        <div>
          <div v-if="IsUploadPic===1">
            <p>{{$t('fnc.scfujian')}}<span class="_addUpload_tips">{{$t('tips.wjdxbncgsz')}}</span></p>

            <div class="_addUpload_box clearfix">
              <template v-for="(file,fIndex) in saveMsg">
                <div v-if="file.Type==3">
                  <div style="width:100%;height:100%;overflow: hidden;">
                    <img :src="file.Url?file.Url:file.Content" @click="showUpLoadFile(file)">
                  </div>
                  <span class="iconfont icon-guanbi1" @click="deleteUploadFile(fIndex)"></span>
                </div>
                <div v-if="file.Type==1">
                  <div class="iconfont "
                    :class="file.Content.substring(file.Content.lastIndexOf('.')+1,file.Content.length).toUpperCase()=='PDF'? 'icon-pdf' : 'icon-excel'"
                    @click="showUpLoadFile(file)">

                  </div>
                  <span class="iconfont icon-guanbi1" @click="deleteUploadFile(fIndex)"></span>
                </div>
                <div v-if="file.Type==2">
                  <div class="iconfont icon-excel" @click="showUpLoadFile(file)">

                  </div>
                  <span class="iconfont icon-guanbi1" @click="deleteUploadFile(fIndex)"></span>
                </div>
              </template>
              <div class="_pic_upload">
                <el-upload drag :http-request="uploadFileBtn" :multiple="true" :show-file-list="false" action="">
                  <i class="el-icon-plus avatar-uploader-icon"></i>
                  <div class="el-upload__text">{{$t('active.ld_djscwj')}}</div>
                </el-upload>
              </div>
            </div>
          </div>

          <div v-if="$route.query.Type==2||msg.Type==2">
            <p>{{$t('objFill.shangchuanfapiaofj')}}<span class="_addUpload_tips">{{$t('tips.wjdxbncgsz')}}</span><span
                class="_addUpload_tips" style="color:red;">{{$t('objFill.fapiaofujiants')}}</span></p>

            <div class="_addUpload_box clearfix">
              <template v-for="(file,fIndex) in saveMsgInvoice">
                <div v-if="file.Type==3">
                  <div style="width:100%;height:100%;overflow: hidden;">
                    <img :src="file.Url?file.Url:file.Content" @click="showUpLoadFile(file)">
                  </div>
                  <span class="iconfont icon-guanbi1" @click="deleteInvoiceUploadFile(fIndex)"></span>
                </div>
                <div v-if="file.Type==1">
                  <div class="iconfont "
                    :class="file.Content.substring(file.Content.lastIndexOf('.')+1,file.Content.length).toUpperCase()=='PDF'? 'icon-pdf' : 'icon-excel'"
                    @click="showUpLoadFile(file)">

                  </div>
                  <span class="iconfont icon-guanbi1" @click="deleteInvoiceUploadFile(fIndex)"></span>
                </div>
                <div v-if="file.Type==2">
                  <div class="iconfont icon-excel" @click="showUpLoadFile(file)">

                  </div>
                  <span class="iconfont icon-guanbi1" @click="deleteInvoiceUploadFile(fIndex)"></span>
                </div>
              </template>
              <div class="_pic_upload">
                <el-upload drag :http-request="uploadFileInvoiceBtn" :multiple="true" :show-file-list="false" action="">
                  <i class="el-icon-plus avatar-uploader-icon"></i>
                  <div class="el-upload__text">{{$t('active.ld_djscwj')}}</div>
                </el-upload>
              </div>
            </div>
          </div>
          <div class="_submit">
            <div class="chosenNextBox">
              <div
                v-if='resultCode==11019 || ((EmployeeId===755 || EmployeeId===400) && (msg.RB_Branch_Id&& msg.RB_Branch_Id!=0))'>
                <label>
                  <!-- {{$t('fnc.xiayibu')}} -->
                  {{$t('objFill.xiayibushenheren')}}:<span class="red">{{msg.AuditDescription}}</span></label>
                <!-- $t('rule.qxzxybshren') -->
                <el-select size="mini" style="width:300px" v-model="chosenPeople" multiple filterable remote
                  reserve-keyword :placeholder="$t('objFill.qinshurubinxuanzhongshr')" :remote-method="remoteMethod"
                  :loading="loadingPeople">
                  <el-option v-for="item in peopleData" :key="item.empId" :label="`${item.name}`" :value="item.empId">
                    <span style="float: left; font-size: 12px">{{ item.name }}</span>
                    <span style="float: right; font-size: 12px; margin-right:20px;">{{ item.departmentName }}</span>
                  </el-option>
                </el-select>
              </div>
            </div>
            <button class="normalBtn" v-if="GetDetail.Status==0||GetDetail.Status==3||msg.FrID==0"
              @click="AddFinancial(1)">{{$t('fnc.zancun')}}</button>
            <button class="normalBtn" @click="AddFinancial()">{{$t('fnc.tijiao')}}</button>
            <button class="hollowFixedBtn" @click="AuditOrRefund()">{{$t('pub.returnBack')}}</button>
          </div>
        </div>





        <div v-if='picIsShow' class="_show_img_box" @click="picIsShow=false,picObj=[]">
          <div
            style="position: absolute; width: 800px; height: 600px; left: 50%; top: 50%; margin-left: -400px; margin-top: -300px;">
            <el-carousel :initial-index=initialIndex height="600px" :interval="5000" trigger="click">
              <el-carousel-item style="height: 600px;overflow:auto;" v-for="(item,index) in picObj" :key="index">
                <img :src="item" style="" />
              </el-carousel-item>
            </el-carousel>
          </div>
        </div>
      </div>
    </div>
    <el-dialog :title="$t('tips.tips')" :visible.sync="maxmoneyTips" width="420px">
      <div style="margin: 0px 0 15px 0;">
        <p><span style="color: #e6a23c;font-size: 16px;" class="el-notification__icon el-icon-warning"></span>
          {{$t('objFill.genjugongsigdmzbcg')}}{{maxmoneyData}}{{$t('objFill.yuanrenmib')}}</p>
        <p style="padding-left: 23px;margin-top: 10px;">{{$t('objFill.chaoguoewzhidan')}}</p>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="maxmoneyTips = false">{{$t('pub.cancelBtn')}}</el-button>
        <el-button size="small" type="danger" @click="maxmoneyTips=false">{{$t('pub.sureBtn')}}</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
  import myFlowChartModule from "./FinancialSubmodule/FlowChartModule.vue";
  export default {
    data() {
      return {
        isDepositCustomer: false,
        ContractCustomer: null,
        DepositCustomer: null,
        CustomerIdList: [],
        StoredCustomerList: [],
        yballPriceTo: 0, //原币合计
        maxmoneyData: 0,
        detailCurrDis: false,
        Description: "",
        ClientKingdeeAccountList: [],
        KingdeeClientIDCheck: false,
        msg: {
          FrID: 0,
          ClientType: '',
          ClientID: '',
          RemitterName: '',
          AccountNumber: '',
          TradeDate: '',
          TCID: 0,
          OrderID: 0,
          OrderSource: 0,
          TemplateId: 0,
          Description: '132356',
          detailList: [],
          RB_Branch_Id: '',
          HelpBranchId: -1,
          RB_Depart_Id: '',
          Status: 1,
          URL: this.$route.query.path,
          vorcherInos: [],
          InvoiceVoucherInfo: [],
          IsPublic: '',
          Cmd: '',
          emList: [],
          TCIDList: [],
          Obj: {},
          SourceID: 0,
          TCIDAndTCNUMList: [],
          IsLeader: 1,
          PayDate: '',
          CallType: 0,
          Type: 0,
          GuestInfoList: [],
          LineName: 0,
          KingdeeClientID: '', //垫付对象的id
        },
        detailList: {
          ID: 0,
          UnitPrice: '',
          UnitPriceTo: '',
          Number: '',
          Rate: '',
          CostTypeId: '',
          CurrencyId: '',
          Remark: '',
          CostTypeName: '',
          yTotalPrice: '',
          yTotalPriceTo: '',
          bTotalPrice: '',
          bTotalPriceTo: '',
          show: false,
        },
        ClientTypeList: [],
        ClientAccountList: [],
        GetCostTypeList: [],
        ClientAccountListS: [],
        coinGetList: [],
        yaer: '',
        month: '',
        dateS: '',
        AuditListData: {
          AuditList: []
        },
        newAuditList: [],
        AuditState: {
          IsTravel: false,
          IsParentBranch: false
        },
        peopleData: [],
        BillName: '',
        BillSonName: '',
        department: '',
        emplyeeName: '',
        allPrice: 0,
        allPriceTo: '',
        allPriceTocalc: '',
        ybSumPrice: '', //原币汇总
        chinaAllPrice: this.$commonUtils.changeMoneyToChinese(this.allPrice),
        DepartIDs: '0',
        GetDetail: {},
        loading: false,
        returnCode: '',
        RB_Branch_id: '',
        departmentMsg: {
          RB_Group_Id: '0',
          RB_Branch_Id: '-1',
          Status: '0',
          ParentId: '-1',
          Tier: '0',
        },
        companyMsg: {
          RB_Group_Id: '0',
          Status: 0,
        },
        departmentList: [],
        companyList: [],
        orderObj: null,
        IsUploadPic: 0,
        headers: {
          'Content-Type': 'application/octet-stream'
        },
        saveMsg: [],
        saveMsgInvoice: [],
        picIsShow: false,
        picObj: [],
        initialIndex: 0,
        loadingPeople: false,
        chosenPeople: [],
        OrderSource: null,
        timer: '',
        leaderType: 1,
        resultCode: null,
        EmployeeId: 0,
        describeList: [],
        isFrompassenger: false,
        showDisable: false,
        editTemplateId: -1,
        ZhuiJiaTK: false,
        SelectDisablsed: 0,
        SelectState: false,
        XSTC: false,
        czmsg: {},
        czmsgState: false,
        maxmoneyTips: false,
        crmOrderObj: null,
        commissionObj: null,
        tradeObj: null,
        StandardCurrencyId: 0,
        StandardCurrencyName: '',
        TCID: '',
        HandFeeList: [], //手配费配置列表
        HandFee: {
          BranchId: null
        },
        HandFeeDetail: null, //已选手配费信息
        TypeListArr: [{
            Name: '房',
            Id: 1,
            disabled: false
          },
          {
            Name: '餐',
            Id: 2,
            disabled: false
          },
          {
            Name: '车',
            Id: 3,
            disabled: false
          },
          {
            Name: '门票',
            Id: 4,
            disabled: false
          },
          {
            Name: '房费送客手数料',
            Id: 5,
            disabled: false
          },
          {
            Name: '餐费送客手数料',
            Id: 6,
            disabled: false
          },
          {
            Name: '门票送客手数料',
            Id: 7,
            disabled: false
          },
        ], //类型
        isHandFee: false,
        is_HandFee: true, //是否开启
        HandlingChargeType: 0, //月结制单 1转账手续费 2转账手续费差额
      }
    },
    methods: {
      changeKingdeeClientID() {
        if (!this.KingdeeClientIDCheck) {
          this.msg.KingdeeClientID = '';
        }
      },
      GetClientAccountListByKeyWord(query) {
        if (query !== '') {
          // 获取对象类型
          let msg = {
            Type: 0,
            ObjID: 0,
            CardNum: "",
            IsAll: false,
            KeyWord: query,
          };
          this.apipost(
            "financeinfo_post_GetClientAccountList",
            msg,
            res => {
              if (res.data.resultCode == 1) {
                let data = res.data.data;
                this.ClientKingdeeAccountList = data;
              }
            },
            err => {}
          );
        }
      },
      // 获取预存用户
      getSigningCustomerId(type) {
        // 1 签约客户 2 预存客户抵用
        if (type == 1) {
          // if (!this.msg.SigningCustomerId) {
          //   this.ContractCustomer = null
          // }
          this.CustomerIdList.forEach(item => {
            if (item.customerId == this.msg.SigningCustomerId) {
              this.ContractCustomer = item
            }
          })
          // this.msg.DepositCustomerId = ''
          // this.DepositCustomer = null
        } else if (type == 2) {
          if (!this.msg.DepositCustomerId) {
            this.DepositCustomer = null
          }
          this.StoredCustomerList.forEach(item => {
            if (item.customerId == this.msg.DepositCustomerId) {
              this.DepositCustomer = item
            }
          })
          // this.msg.SigningCustomerId = ''
          // this.ContractCustomer = null
        }
      },
      // 获取签约用户、预存用户
      getCustomerIdList() {
        this.apipost(
          "app_today_visit_GetMySigningCustomerList", {
            pageIndex: 1,
            pageSize: 1000,
            CustomerStatus: 0
          },
          res => {
            if (res.data.resultCode == 1) {
              this.CustomerIdList = res.data.data.signingList;
              this.StoredCustomerList = res.data.data.depositList
              if (this.msg.SigningCustomerId || this.msg.DepositCustomerId) {
                let type = this.msg.SigningCustomerId ? 1 : 2
                this.getSigningCustomerId(type)
              }
            } else {
              this.loading = false;
              this.$message.error(res.data.message);
            }
          },
          err => {},
        );
      },
      // 是否开启手配费
      getHandFee() {

        if (this.is_HandFee) {
          this.chooseHandFee()
        } else {
          this.msg.HandFeeList = null
          this.msg.KingdeeBranchId = 0
        }
      },
      // 获取当前手配费选项
      chooseHandFee() {
        let handfreeCount = 0;
        let companyID = this.$route.query.companyID;
        if (companyID == 1220) {
          this.msg.detailList.forEach((x, index) => {
            if (x.CostTypeName.indexOf('房费送客手数料') != -1 ||
              x.CostTypeName.indexOf('餐费送客手数料') != -1 ||
              x.CostTypeName.indexOf('门票送客手数料') != -1) {
              handfreeCount += 1;
            }
          });
          if (handfreeCount > 0) {
            this.is_HandFee = true;
          } else {
            this.is_HandFee = false;
          }
        }

        if (!this.is_HandFee) return
        if (this.msg.detailList.length > 0) {
          let HandFeeObj = this.HandFeeList.map(item => {
            if (item.BranchId == this.HandFee.BranchId) return item
          })

          this.HandFeeDetail = HandFeeObj[0]
          this.HandFeeDetail && this.HandFeeDetail.DetailList.forEach(x => {
            x.show = false
          })
          let numToFANG = 0
          let numToCAN = 0
          let numToCE = 0
          let numToMEN = 0
          let states = true

          this.msg.detailList.forEach((x, index) => {
            let obj = x
            if (x.CostTypeName.indexOf('房') != -1 ||
              x.CostTypeName.indexOf('餐') != -1 ||
              x.CostTypeName.indexOf('车') != -1 ||
              x.CostTypeName.indexOf('门票') != -1) {
              this.HandFeeDetail && this.HandFeeDetail.DetailList.forEach((y, indexs) => {

                if (x.CostTypeName.indexOf('房') != -1 && x.CostTypeName.indexOf('房费送客手数料') == -1 && y.Type ==
                  1 && companyID != 1220) {
                  y.show = true, numToFANG += Number(obj.Number) //, y.Num = numToFANG
                }
                if (x.CostTypeName.indexOf('餐') != -1 && x.CostTypeName.indexOf('餐费送客手数料') == -1 && y.Type ==
                  2 && companyID != 1220) {
                  y.show = true, numToCAN += Number(obj.Number) //, y.Num = numToCAN
                }
                if (x.CostTypeName.indexOf('车') != -1 && y.Type == 3 && companyID != 1220) {
                  y.show = true, numToCE += Number(obj.Number) //, y.Num = numToCE
                }
                if (x.CostTypeName.indexOf('门票') != -1 && x.CostTypeName.indexOf('门票送客手数料') == -1 && y.Type ==
                  4 && companyID != 1220) {
                  y.show = true, numToMEN += Number(obj.Number) //, y.Num = numToMEN
                }
                if (x.CostTypeName.indexOf('房费送客手数料') != -1 && y.Type == 5) {
                  if (x.UnitPrice < 0) {
                    y.Unit_Price = this.RoundItUp(parseFloat(-(x.UnitPrice * 0.55)).toFixed(2))
                  } else {
                    y.Unit_Price = this.RoundItUp(parseFloat(x.UnitPrice * 0.55).toFixed(2))
                  }
                  y.Num = x.Number
                  y.show = true, numToMEN += Number(obj.Number) //, y.Num = numToMEN
                }
                if (x.CostTypeName.indexOf('餐费送客手数料') != -1 && y.Type == 6) {
                  y.Num = x.Number
                  if (x.UnitPrice < 0) {
                    y.Unit_Price = this.RoundItUp(parseFloat(-(x.UnitPrice * 0.55)).toFixed(2))
                  } else {
                    y.Unit_Price = this.RoundItUp(parseFloat(x.UnitPrice * 0.55).toFixed(2))
                  }
                  y.show = true, numToMEN += Number(obj.Number) //, y.Num = numToMEN
                }
                if (x.CostTypeName.indexOf('门票送客手数料') != -1 && y.Type == 7) {
                  y.Num = x.Number
                  if (x.UnitPrice < 0) {
                    y.Unit_Price = this.RoundItUp(parseFloat(-(x.UnitPrice * 0.55)).toFixed(2))
                  } else {
                    y.Unit_Price = this.RoundItUp(parseFloat(x.UnitPrice * 0.55).toFixed(2))
                  }
                  y.show = true, numToMEN += Number(obj.Number) //, y.Num = numToMEN
                }
                states = false
              })
            }
          })

          if (states) {
            this.msg.detailList.forEach((x, index) => {
              this.HandFeeDetail && this.HandFeeDetail.DetailList.forEach((y, indexs) => {
                let obj = x
                if (y.Type == 3) {
                  y.show = true, numToCE += Number(obj.Number) //, y.Num = numToCE
                  states = false
                }
              })
            })
          }
        } else {
          this.HandFeeDetail && this.HandFeeDetail.DetailList.forEach((y, indexs) => {
            y.show = false
          })
        }
      },
      //获取手配费所有配置
      GetHandFeeList() {
        if (!this.isHandFee || this.GetDetail.Status > 0) return
        this.apipost(
          "handfee_post_GetHandFeeList", {
            BranchId: -1
          },
          res => {
            if (res.data.resultCode == 1) {
              let arrList = function (arr) {
                arr.forEach(item => {
                  item.Num = null
                  item.Remark = null
                  item.show = false
                })
              }
              res.data.data.forEach(x => {
                arrList(x.DetailList)
              })
              this.HandFeeList = res.data.data;
              // this.HandFee.BranchId = this.HandFeeList[0].BranchId
              // this.HandFeeDetail.CurrencyName = this.HandFeeList[0].CurrencyName
            }
          },
          err => {}
        );
      },
      deleteRow(i, obj) {
        obj.show = false;
        this.msg.Description = this.Description;
        this.msg.detailList.splice(i, 1);
        this.chooseHandFee()
        this.$forceUpdate();
      },
      IsPublicChange(val) {
        this.showDisable = false;

        this.msg.ClientType = '';
        this.msg.ClientID = '';
        this.msg.AccountNumber = '';
        this.ClientAccountListS = [];
        if (val == 8 || val == 9) {
          this.showDisable = true;
        }
      },
      jumpPage(path, obj, type) { //生成单据时连带信息跳转
        if (type == 1) {
          // let routeData = this.$router.resolve({
          //     name: path,
          //     query: { TCIDList: obj}
          // });
          // window.open(routeData.href, "_blank");
          this.$router.push({
            name: path,
            query: {
              TCIDList: obj,
              blank: 'y'
            }
          })
        } else if (type == 2) {
          // let routeData = this.$router.resolve({
          //     name: path,
          //     query: { ID: obj}
          // });
          // window.open(routeData.href, "_blank");
          this.$router.push({
            name: path,
            query: {
              ID: obj,
              blank: 'y'
            }
          })
        } else if (type == 3) {
          // let routeData = this.$router.resolve({
          //     name: path,
          //     query: { ID: obj}
          // });
          // window.open(routeData.href, "_blank");
          this.$router.push({
            name: path,
            query: {
              ID: obj,
              blank: 'y'
            }
          })
        } else if (type == 4) {
          // let routeData = this.$router.resolve({
          //     name: path,
          //     query: { OrderSource: obj.OrderSource,SourceID: obj.SourceID}
          // });
          // window.open(routeData.href, "_blank");
          this.$router.push({
            name: path,
            query: {
              OrderSource: obj.OrderSource,
              SourceID: obj.SourceID,
              blank: 'y'
            }
          })
        } else if (type == 5) {
          // let routeData = this.$router.resolve({
          //     name: path,
          //     query: { id:obj[0].TCID,OutBranchId:obj.RB_Branch_Id}
          // });
          // window.open(routeData.href, "_blank");
          this.$router.push({
            name: path,
            query: {
              id: obj[0].TCID,
              OutBranchId: obj.RB_Branch_Id,
              blank: 'y'
            }
          })
        } else if (type == 6) {
          this.$router.push({
            name: path,
            query: {
              id: obj,
              OutBranchId: obj.RB_Branch_Id,
              'CloseIncomeBtn': true,
              blank: 'y'
            }
          })
        } else if (type == 7) {
          this.$router.push({
            name: path,
            query: {
              id: id,
              isShow: false,
              blank: 'y'
            }
          })
        } else if (type == 8) {
          this.$router.push({
            name: path,
            query: {
              id: id,
              orderID: this.msg.OrderID,
              isShow: false,
              blank: 'y'
            }
          })
        } else if (type == 9) {
          this.$router.push({
            name: path,
            query: {
              id: this.msg.OrderID,
              EmployeeId: this.EmployeeId,
              isOwn: false,
              blank: 'y'
            }
          })
        }
      },
      remoteMethod(query) {
        if (query !== '') {
          this.loadingPeople = true
          this.apipost('admin_Get_Chat_All_SelectEmpName', {
            EmName: query
          }, res => {
            if (res.data.resultCode == 1) {
              this.peopleData = res.data.data
            }
            this.loadingPeople = false
          }, err => {})
        } else {
          this.peopleData = [];
        }
      },
      showUpLoadFile(i) { // 预览上传文件
        if (i.Type == 3) {
          this.picObj.push(i.Url);
          this.picIsShow = true;
        } else {
          if (i.Content.substring(i.Content.lastIndexOf('.') + 1, i.Content.length).toUpperCase() == 'PDF') {
            this.previewPDF(i.Url)
          } else {
            window.open("https://view.officeapps.live.com/op/view.aspx?src=" + i.Url)
          }
        }
      },
      deleteInvoiceUploadFile(i) { // 删除上传文件
        this.saveMsgInvoice.splice(i, 1);
      },

      uploadFileInvoiceBtn(file) { //上传
        if (file.file.size > 1024 * 1024 * 10) {
          this.$message.warning(this.$t('tips.wjdxbncgsz'))
          return
        }
        //  1 文档  2 数据 3 图片
        let typeArr = [{
            stringArr: 'GIF|JPG|JPEG|PNG|BMP',
            type: 3
          },
          {
            stringArr: 'DOCX|DOC|XLSX|XLS|PPT|PPTX|PDF',
            type: 1
          },
        ]
        let ft = file.file.name.substring(file.file.name.lastIndexOf('.') + 1, file.file.name.length).toUpperCase();
        let fileTypeNumber = 2;
        let typeOk = false;
        typeArr.forEach(x => {
          if (x.stringArr.indexOf(ft) != '-1') {
            fileTypeNumber = x.type;
            typeOk = true;
          }
        })
        if (!typeOk) return this.$message.error(this.$t('tips.qscWEfile'));
        let newArr = [];
        newArr.push(file.file)
        let path = "/Upload/Temporary/"
        this.$message.info(this.$t('tips.shangchuanzhong'))
        this.UploadSelfFileT(path, newArr, x => {
          let fileSize = file.file.size < 1024 ? file.file.size : (file.file.size / 1024).toFixed(0);
          this.saveMsgInvoice.push({
            Content: x.data.FilePath,
            ID: 0,
            Type: fileTypeNumber,
            Url: this.domainManager().ViittoFileUrl + x.data.FilePath,
          })
          this.$message.success(this.$t('tips.scchenggong'))
        }, 1);
      },
      deleteUploadFile(i) { // 删除上传文件
        this.saveMsg.splice(i, 1);
      },
      uploadFileBtn(file) { //上传
        if (file.file.size > 1024 * 1024 * 10) {
          this.$message.warning(this.$t('tips.wjdxbncgsz'))
          return
        }
        //  1 文档  2 数据 3 图片
        let typeArr = [{
            stringArr: 'GIF|JPG|JPEG|PNG|BMP',
            type: 3
          },
          {
            stringArr: 'DOCX|DOC|XLSX|XLS|PPT|PPTX|PDF',
            type: 1
          },
        ]
        let ft = file.file.name.substring(file.file.name.lastIndexOf('.') + 1, file.file.name.length).toUpperCase();
        let fileTypeNumber = 2;
        let typeOk = false;
        typeArr.forEach(x => {
          if (x.stringArr.indexOf(ft) != '-1') {
            fileTypeNumber = x.type;
            typeOk = true;
          }
        })
        if (!typeOk) return this.$message.error(this.$t('tips.qscWEfile'));
        let newArr = [];
        newArr.push(file.file)
        let path = "/Upload/Temporary/"
        this.$message.info(this.$t('tips.shangchuanzhong'))
        this.UploadSelfFileT(path, newArr, x => {
          let fileSize = file.file.size < 1024 ? file.file.size : (file.file.size / 1024).toFixed(0);
          this.saveMsg.push({
            Content: x.data.FilePath,
            ID: 0,
            Type: fileTypeNumber,
            Url: this.domainManager().ViittoFileUrl + x.data.FilePath,
          })
          this.$message.success(this.$t('tips.scchenggong'))
        }, 1);
      },
      AuditOrRefund() {
        this.MsgBus.$emit('msg');
      },
      handleInput2(e) {
        e.target.value = (e.target.value.match(/^\d*(\.?\d{0,1})/g)[0]) || null
      },
      AddFinancial(z) { //保存
        if (this.describeList && this.describeList.length > 0) {
          let num = 0
          this.msg.detailList.forEach(x => {
            num += Number(x.Number)
          })
          if (this.describeList.length != num) {
            this.Error(this.$t('objFill.fiyongzsylkmdrsbf'))
            return
          }
        }
        for (let i = 0; i < this.msg.detailList.length; i++) {
          if (!this.msg.detailList[i].CurrencyId) {
            this.Error(this.$t('objFill.qinwanshanfyxgxx'))
            return
          }
        }
        //手配费参数
        if (this.is_HandFee) {
          if (!this.HandFee.BranchId) {
            this.Error(this.$t('objFill.qinxuanzheshoupeifei'))
            return
          }
          this.msg.KingdeeBranchId = this.HandFee.BranchId
          this.msg.HandFeeList = []
          for (let i = 0; i < 4; i++) {
            if (this.HandFeeDetail && this.HandFeeDetail.DetailList[i].show && (!this.HandFeeDetail.DetailList[i].Num ||
                !this.HandFeeDetail.DetailList[i].Unit_Price)) {
              this.Error(this.$t('objFill.shoupeifsljjexdyl'))
              return
            }
          }
          this.HandFeeDetail && this.HandFeeDetail.DetailList.forEach(x => {
            let obj = {
              Type: x.Type,
              Num: x.Num,
              Unit_Price: x.Unit_Price,
              Remark: x.Remark
            }
            if (x.show) {
              this.msg.HandFeeList.push(JSON.parse(JSON.stringify(obj)))
            }
          })
          if (this.msg.HandFeeList.length == 0) {
            this.Error(this.$t('objFill.zhanwukepzdspfts'))
            return
          }
        }
        if (z) {
          this.msg.Status = 0;
        } else {
          this.msg.Status = 1;
          if (this.msg.detailList.length < 1) return this.$message.error(this.$t('rule.qtxzsyxfyshuoming'));
          if (this.msg.PayDate === '') return this.$message.error(this.$t('rule.qxzyjfkshijian'));
        }

        if (this.msg.IsPublic != 8 && this.msg.IsPublic != 9) {
          if (this.msg.ClientType === '') return this.$message.error(this.$t('rule.qxzfkduixiang'));
        } else {
          this.msg.ClientType = 0;
        }
        // IsPublic 2 现金 IsLeader 0 临时领队
        if (this.msg.IsPublic < 2 && this.IsLeader === 1) {
          if (this.msg.ClientID === '') return this.$message.error(this.$t('rule.qxzkhmingcheng'));
          if (this.msg.AccountNumber === '') return this.$message.error(this.$t('rule.qxzfkdzhanghu'));
        } else {

        }
        // if(this.msg.ClientID=='')return this.$message.error('请选择客户名称!');
        // if(this.msg.IsPublic!=2 && this.IsLeader!=0){
        //     if(this.msg.AccountNumber=='')return this.$message.error('请选择付款账户!');
        // }
        if (this.msg.IsHave == 0 && this.chosenPeople.length == 0) return this.$message.error(this.$t(
          'rule.qxzxybsheren'));
        if (!this.msg.RB_Depart_Id) return this.$message.error(this.$t('rule.qxzzdbumen'));
        delete this.msg.DetailList;
        delete this.msg.VorcherInos;
        this.msg.vorcherInos = this.saveMsg;
        this.msg.InvoiceVoucherInfo = this.saveMsgInvoice;
        this.msg.emList = this.chosenPeople;
        if (this.orderObj) {
          this.msg.VisaIds = this.orderObj.VisaIds ? this.orderObj.VisaIds : '';
          //从电商过来的参数处理
          this.msg.OrderSource = this.orderObj.OrderSource ? this.orderObj.OrderSource : 0;
          this.msg.OtherType = this.orderObj.OtherType ? this.orderObj.OtherType : 0;
          this.msg.ReFinanceId = this.orderObj.ReFinanceId ? this.orderObj.ReFinanceId : 0;
          this.msg.ReFinanceId2 = this.orderObj.ReFinanceId2 ? this.orderObj.ReFinanceId2 : 0;
          this.msg.ReFinanceIds = this.orderObj.ReFinanceIds ? this.orderObj.ReFinanceIds : '';
          this.msg.ECOrderList = this.orderObj.ECOrderList ? this.orderObj.ECOrderList : [];
          this.msg.EduCommissionEmp = this.orderObj.EduCommissionEmp ? this.orderObj.EduCommissionEmp : null
          this.msg.MatchFrId = this.orderObj.MatchFrId ? this.orderObj.MatchFrId : 0;
          this.msg.StandardCurrencyName = this.orderObj.StandardCurrencyName ? this.orderObj.StandardCurrencyName : ''
          this.msg.LineName = this.orderObj.LineId ? this.orderObj.LineId : 0;
        }
        if (this.orderObj && this.orderObj.OtherType && this.orderObj.OtherType == 75 && this.orderObj.ReFinances ==
          '') {
          this.Error(this.$t('objFill.chengbenyjbnwk'))
          return
        }
        // 台湾提成汇率 验证原币总金额是否一致
        // 月结制单 ||(this.orderObj.isVerifyMoney)
        if (this.orderObj && this.orderObj.Money && this.orderObj.Rate) {
          let yballPrice = 0
          let totalAmount
          this.msg && this.msg.detailList && this.msg.detailList.forEach((item, i) => {
            yballPrice += (Number(item.UnitPrice) * 100)
          })
          this.yballPriceTo = yballPrice / 100
          totalAmount = Math.round(this.orderObj.Money * 100) / 100
          if (totalAmount != this.yballPriceTo) {
            this.Error(`${this.$t('objFill.yuanbizongjexdy')}${this.orderObj.Money}!`)
            return
          }
        }

        //验证总金额是否一致
        if (this.commissionObj) {
          let totalAmount
          if (this.commissionObj) {
            this.msg.OtherType = this.commissionObj.OtherType ? this.commissionObj.OtherType : 0;
            this.msg.ReFinanceId = this.commissionObj.PeroidsId ? this.commissionObj.PeroidsId : 0;
            this.msg.RelevanceFrId = this.commissionObj.EmpIds ? this.commissionObj.EmpIds : 0;
            totalAmount = this.$commonUtils.addCommas(Math.round(this.commissionObj.totalAmount * 100) / 100)
          }
          // if (this.orderObj && this.orderObj.Money && this.orderObj.isVerifyMoney) {
          //   totalAmount = this.$commonUtils.addCommas(Math.round(this.orderObj.Money * 100) / 100)
          // }
          if (this.allPriceTo != totalAmount) {
            this.Error(`${this.$t('objFill.shifujexdy')}${totalAmount}!`)
            return
          }
        }
        // 同业制单
        if (this.tradeObj && this.tradeObj.OtherType) {
          this.msg.OtherType = this.tradeObj.OtherType ? this.tradeObj.OtherType : 0;
          this.msg.ReFinanceId = this.tradeObj.ReFinanceId ? this.tradeObj.ReFinanceId : 0;
          this.msg.ReFinanceId2 = this.tradeObj.ReFinanceId2 ? this.tradeObj.ReFinanceId2 : 0;
          this.msg.MatchFrId = this.tradeObj.MatchFrId ? this.tradeObj.MatchFrId : 0;
          this.msg.RelevanceFrId = this.tradeObj.RelevanceFrId ? this.tradeObj.RelevanceFrId : 0; //1接机  2送机  3包车
        }
        // crm自动登陆传过来的参数
        if (this.crmOrderObj) {
          this.msg.OtherType = this.crmOrderObj.OtherType
          this.msg.ReFinanceId = this.crmOrderObj.ReFinanceId
          this.msg.ReFinanceId2 = this.crmOrderObj.ReFinanceId2
          this.msg.GuestId = this.crmOrderObj.GuestId
          this.msg.RelevanceFrId = this.crmOrderObj.RelevanceFrId
        }
        // 2019-12-3 18:29:31 新增费用类型判断
        let riqi = false
        this.msg.detailList.forEach(x => {
          if (!riqi && (x.CostTypeName == '房费' || x.CostTypeName == '差旅费' || x.CostTypeName == '签证费' || x
              .CostTypeName.indexOf('机票') !== -1)) {
            riqi = true
          }
          delete x.rate;
        });
        if (riqi) {
          var today = new Date();
          var year = today.getFullYear();
          var month = today.getMonth();
          var date = today.getDate();
          var weeks = ["日", "一", "二", "三", "四", "五", "六"]
          var temp = new Date(year, month, date + 60)
          var today = Date.parse(new Date())
          var PayDate = this.msg.PayDate
          var startTime = Date.parse(temp);
          var endTime = Date.parse(PayDate);
          if (endTime > startTime) {
            this.$message.error(this.$t('objFill.yufukrqzdthss'));
            return
          }
          //  else if (endTime < today) {
          //     this.$message.error('房费、差旅费、签证费、机票相关费用类型单据的预付款日期最多推后3天!');
          //     return
          // }
        }
        // 判断付款金额与最大金额
        if (Number(this.maxmoneyData) > 0 && (Number(this.allPriceTocalc) > Number(this.maxmoneyData)) && this
          .StandardCurrencyId <= 0) {
          this.maxmoneyTips = true;
          return;
        }
        //旅客名单数据组装
        if (!this.$route.query.edit) {
          this.msg.Type = this.$route.query.Type
        }
        if (this.orderObj != null && this.orderObj.OrderSource === 10) {
          let guestInfo = JSON.parse(sessionStorage.getItem("saveGuestInfo"));
          //  return;
          this.msg.GuestInfoList = [];
          if (guestInfo != null && guestInfo.length > 0) {
            guestInfo.forEach(t => {
              this.msg.GuestInfoList.push({
                GuestId: t.Id,
                GuestName: ""
              })
            })
          }
        }
        if (this.orderObj && this.orderObj.TravelReplenish) {
          this.msg.TravelReplenish = this.orderObj.TravelReplenish
        }

        this.msg.Description = this.Description;


        // 财务收据
        if (this.czmsg && this.czmsg.ReFinanceId2) {
          this.msg.ReFinanceId2 = this.czmsg.ReFinanceId2;
        }
        //   预付款冲抵 电商商品
        if (this.czmsg && this.czmsg.ReFinanceId) {
          this.msg.ReFinanceId = this.czmsg.ReFinanceId;
          this.msg.OtherType = this.czmsg.OtherType;

        }
        //   电商商品内部结算
        if (this.czmsg && this.czmsg.ReTCID) {
          this.msg.OtherType = this.czmsg.OtherType;
          this.msg.ReTCID = this.czmsg.ReTCID;
        }

        // 是否是日本客户
        let that = this
        let ClientAccountObj = this.ClientAccountList.find(x => {
          return x.ID == this.msg.ClientID
        })
        // 是否存在转账手续费
        let detailObj = this.msg.detailList.find(x => {
          return x.CostTypeId == 114
        })
        let confirmMsg = [];
        if (ClientAccountObj && ClientAccountObj.ClientAccountType && ClientAccountObj.ClientAccountType == 1 && !
          detailObj) {
          confirmMsg.push(this.$t('objFill.zhuanzhanggrbzhqdwss'));
        }
        // 是否存在转账手续费  提示独立制单
        let feeObj = this.msg.detailList.find(x => {
          return x.CostTypeId == 114 && x.CurrencyId == 3 && (x.UnitPrice == 550 || x.UnitPrice == 275 || x
            .UnitPrice == 183 || x.UnitPrice == 184 || x.UnitPrice == 137.5)
        })
        if (feeObj) {
          confirmMsg.push(this.$t('objFill.chongqizdssfblts'));
        }

        if (this.msg.HelpBranchId > -1) {
          let that = this
          let brandName = this.$t('objFill.querenypu');
          this.companyList.forEach(item => {
            if (item.Id == this.msg.HelpBranchId) {
              brandName += item.BName;
            }
          });
          brandName += (this.$route.query.Type == 1 ? this.$t('objFill.daishou') : this.$t('objFill.daifu')) + this.$t(
            'objFill.cibikuanxianbmbh');
          confirmMsg.push(brandName);
        }
        if (confirmMsg && confirmMsg.length > 0) {
          let title = z ? this.$t('fnc.zancun') : this.$t('fnc.tijiao')
          const h = this.$createElement
          const newDatas = []
          for (const i in confirmMsg) {
            newDatas.push(h('p', null, confirmMsg[i]))
          }
          this.$confirm(this.$t('tips.tips'), {
            title: this.$t('tips.tips'),
            message: h('div', null, newDatas),
            confirmButtonText: `${this.$t('objFill.jixu')}${title}`,
            cancelButtonText: `${this.$t('pub.cancelBtn')}${this.$t('objFill.jixu')}${title}`,
            type: 'warning'
          }).then(() => {
            that.loading = true;
            that.FinancialPostSet()
          }).catch(() => {})
        } else {
          that.loading = true;
          that.FinancialPostSet()
        }
      },
      // 提交 暂存接口
      FinancialPostSet(z) {
        this.apipost('Financial_post_Set', this.msg, res => {
          if (res.data.resultCode == 1) {
            //清除旅客名单数据
            sessionStorage.removeItem("saveGuestInfo");
            sessionStorage.removeItem("guoji");
            this.$confirm(this.$t('tips.czcgsfjxzhidan'), this.$t('tips.tips'), {
              confirmButtonText: this.$t('fnc.jxzhidan'),
              cancelButtonText: this.$t('fnc.nothanks'),
              type: 'warning'
            }).then(() => {
              this.$router.push({
                name: 'addFinancialDocuments',
                query: {
                  "id": this.$route.query.id,
                  "Name": this.$route.query.Name,
                  'InPay': this.$route.query.InPay,
                  "Type": this.$route.query.Type,
                  "orderObj": this.$route.query.orderObj,
                  'IsUploadPic': this.$route.query.IsUploadPic,
                  'companyID': this.$route.query.companyID
                }
              })
            }).catch(() => {
              if (this.orderObj && (this.orderObj.EduCommissionEmp || this.orderObj.queryObj)) {
                location.reload()
                this.$router.push({
                  name: 'leaderReimbursement',
                  query: {
                    ...this.orderObj.queryObj,
                    'blank': 'y',
                  }
                });
              } else {
                this.$router.push({
                  name: 'FinancialDocuments',
                  query: {
                    'Type': this.$route.query.Type,
                    'InPay': this.$route.query.InPay
                  }
                });
              }
            });
          } else {
            this.resultCode = res.data.resultCode;
            this.$message.error(res.data.message);
          }
          this.loading = false;
        }, err => {})

      },
      FinancialFlowTemplate_post_GetProcessList(id) {
        this.apipost('FinancialFlowTemplate_post_GetProcessList', {
          ID: id,
          WorkFlowID: 0,
          TemplateType: 0
        }, res => {
          if (res.data.resultCode == 1) {
            res.data.data.forEach(y => {
              y.contentTips = y.AuditDescription + (y.AuditWay == "2" ? this.$t('fnc.huiqian') : this.$t('fnc.huoqian'))
            })
            this.AuditListData.AuditList = res.data.data;
            let data = JSON.parse(JSON.stringify(this.AuditListData.AuditList));
            this.newAuditList = data.reverse();
          } else {}
        }, err => {})
      },
      showEdit(i) { // 修改
        this.$forceUpdate();
        this.msg.detailList[i].show = true;
        this.$set(this.msg.detailList, i, this.msg.detailList[i]);
      },
      addList(t, i) { // 添加
        let list = {};
        if (t == 2 && i) {
          list = JSON.parse(JSON.stringify(this.msg.detailList[i - 1]));
        } else {
          list = JSON.parse(JSON.stringify(this.detailList));
        }
        if (list.yTotalPrice && list.yTotalPrice != '') {
          list.yTotalPrice = list.yTotalPrice.toFixed(2)
        }

        if (list.CostTypeId == '') return
        if (list.Number == '') return
        if (list.UnitPrice == '') return
        if (list.CurrencyId == '') return
        if (t == 2 && i) {
          list.show = false;
          this.msg.detailList[i - 1] = list;
        } else {
          this.msg.detailList.push(list);
        }
        let allPrice = 0;
        let ybsumprice = 0;
        this.msg.detailList.forEach(x => {
          this.coinGetList.forEach(y => {
            if (y.ID == x.CurrencyId) {
              x.currenName = y.Name;
            }
          })
          allPrice = allPrice + parseFloat(x.bTotalPrice);
          //HK 2023-08-17新增
          if (x.yTotalPrice) {
            ybsumprice += Number(x.yTotalPrice);
          }
        })
        this.$forceUpdate()
        this.allPrice = allPrice;
        this.ybSumPrice = ybsumprice.toFixed(2);
        this.allPriceTo = this.$commonUtils.addCommas(Math.round(this.allPrice * 100) / 100)
        this.allPriceTocalc = Math.round(this.allPrice * 100) / 100
        this.chinaAllPrice = this.$commonUtils.changeMoneyToChinese(this.allPrice)
        this.detailList = {
          ID: 0,
          UnitPrice: '',
          UnitPriceTo: '',
          Number: '',
          Rate: '',
          CostTypeId: '',
          CurrencyId: '',
          Remark: '',
          CostTypeName: '',
          yTotalPrice: '',
          yTotalPriceTo: '',
          bTotalPrice: '',
          bTotalPriceTo: '',
          show: false,
        }
        this.chooseHandFee()
      },
      chages(e) { //处理输入框不能输入问题
        this.$forceUpdate()
      },
      Calculation(t, i) { // 计算原币 本位币
        let numberC = 0;
        let price = 0;
        let rate = 0;
        if (t == 2 && i) {
          numberC = parseFloat(this.msg.detailList[i - 1].Number);
          price = parseFloat(this.msg.detailList[i - 1].UnitPrice);
          // 台湾提成汇率
          if (this.orderObj && this.orderObj.Rate) {
            rate = parseFloat(this.orderObj.Rate);
          } else {
            rate = parseFloat(this.msg.detailList[i - 1].Rate);
          }

          if (price == 0) {
            price = '';
            this.msg.detailList[i - 1].UnitPrice = '';
          }
          if (numberC && price) {
            this.msg.detailList[i - 1].UnitPriceTo = this.$commonUtils.addCommas(Math.round(price * 100) / 100)
            this.msg.detailList[i - 1].yTotalPrice = numberC * price;
            this.msg.detailList[i - 1].yTotalPriceTo = this.$commonUtils.addCommas(Math.round(this.msg.detailList[i - 1]
              .yTotalPrice * 100) / 100);
            if (!isNaN(rate)) {
              let num = (numberC * price) * rate;
              num = Math.round(num * 100) / 100;
              this.msg.detailList[i - 1].bTotalPrice = num;
              this.msg.detailList[i - 1].bTotalPriceTo = this.$commonUtils.addCommas(num)
            }
          }
        } else {
          numberC = parseFloat(this.detailList.Number);
          price = parseFloat(this.detailList.UnitPrice);
          // 台湾提成汇率
          if (this.orderObj && this.orderObj.Rate) {
            rate = parseFloat(this.orderObj.Rate);
          } else {
            rate = parseFloat(this.detailList.Rate);
          }
          if (price == 0) {
            price = '';
            this.detailList.UnitPrice = '';
          }
          if (numberC && price) {
            this.detailList.UnitPriceTo = this.$commonUtils.addCommas(Math.round(price * 100) / 100)
            this.detailList.yTotalPrice = numberC * price;
            this.detailList.yTotalPriceTo = this.$commonUtils.addCommas(Math.round(this.detailList.yTotalPrice * 100) /
              100);
            if (!isNaN(rate)) {
              let num = (numberC * price) * rate;
              num = Math.round(num * 100) / 100;
              this.detailList.bTotalPrice = num;
              this.detailList.bTotalPriceTo = this.$commonUtils.addCommas(num)
            }
          }
        }
      },
      getCostTypeName(i, t) { // 根据支出费用类型获取费用类型名称 列表展示用
        this.GetCostTypeList.forEach(x => {
          if (x.ID == i) {
            if (t >= 0) {
              this.msg.detailList[t].CostTypeName = x.Name;
              if (x.ID === 56) {
                this.msg.detailList[t].Remark = this.orderObj.TCNUMS ?
                  `${this.$t('objFill.dijiefeilqzdsc')}:${this.orderObj.TCNUMS}` : '';
              }
            } else {
              this.detailList.CostTypeName = x.Name;
              if (x.ID === 56) {
                this.detailList.Remark = this.orderObj.TCNUMS ?
                  `${this.$t('objFill.dijiefeilqzdsc')}:${this.orderObj.TCNUMS}` : '';
              }
            }
          }
        })
        this.$forceUpdate()
      },
      getRate(cID, i, t, index) { // 根据选择币种获取汇率
        this.coinGetList.forEach(x => {
          if (x.ID == i) {
            if (this.czmsgState) {
              if (t == 1) {
                this.detailList.Rate = this.czmsg.Rate;
                this.detailList.currenName = x.Name;
              } else {
                this.msg.detailList[index].Rate = this.czmsg.Rate;
                this.msg.detailList[index].currenName = x.Name;
              }
            } else {
              if (t == 1) {
                this.detailList.Rate = cID === 57 ? x.PayRateHistory : x.PayRate;
                this.detailList.currenName = x.Name;
              } else {
                this.msg.detailList[index].Rate = cID === 57 ? x.PayRateHistory : x.PayRate;
                this.msg.detailList[index].currenName = x.Name;
              }
            }
            this.$forceUpdate();
          }
        })

        this.Calculation(t, index + 1)
      },
      financeinfo_post_GetClientTypeList() { // 获取对象类型
        this.apipost('financeinfo_post_GetClientTypeList', {}, res => {
          if (res.data.resultCode == 1) {
            this.ClientTypeList = res.data.data;
          }
        }, err => {})
      },
      GetClientAccountList(i) { //获取客户名称并且根据费用类型和付款对象获取客户账号
        this.msg.AccountNumber = '';
        this.ClientAccountList.forEach(x => {
          if (x.ID == i) {
            this.msg.RemitterName = x.Name;
            this.financeinfo_post_GetClientAccountList(this.msg.ClientType, x.ID);
          }
        })
      },
      financeinfo_post_GetClientAccountList(t, i) { //获取付款 对象类型  新增用
        let msg = {
          ID: 0,
          Type: t,
          ObjID: 0,
          CardNum: ''
        }
        if (i >= 0) {
          msg.ID = i;
        } else {
          this.msg.ClientID = '';
          this.msg.AccountNumber = '';
          this.msg.RemitterName = '';
          this.msg.IsLeader = 1;
        }
        this.apipost('financeinfo_post_GetClientAccountList', msg, res => {
          if (res.data.resultCode == 1) {
            let data = res.data.data;
            let ClientAccountList = [];
            if (i) {
              data.forEach(x => {
                let obj = {
                  ID: x.ID,
                  Name: x.AccountHolder + +`(${x.AccountAlias})`,
                  Nom: x.CardNum,
                  OpenBankName: x.OpenBankName,
                  allName: x.CardNum + " " + x.OpenBankName,
                  ObjID: x.ObjID,
                  ClientAccountType: x.ClientAccountType,
                }
                ClientAccountList.push(obj)
              })
              this.ClientAccountListS = ClientAccountList;
            } else {
              data.forEach(x => {
                let obj = {
                  ID: x.ID,
                  Name: x.AccountHolder + `(${x.AccountAlias})`,
                  Nom: x.CardNum,
                  OpenBankName: x.OpenBankName,
                  ObjID: x.ObjID,
                  ClientAccountType: x.ClientAccountType,
                }
                ClientAccountList.push(obj)
              })
              this.ClientAccountList = ClientAccountList;
            }
          }
        }, err => {})
      },
      financeinfo_post_GetClientAccountListEdit(t) { //获取付款 对象类型  修改用
        let msg = {
          Type: t,
          ObjID: 0,
          CardNum: ''
        }
        this.apipost('financeinfo_post_GetClientAccountList', msg, res => {
          if (res.data.resultCode == 1) {
            let data = res.data.data;
            let ClientAccountList = [];
            data.forEach(x => {
              let obj = {
                ID: x.ID,
                Name: x.AccountHolder + `(${x.AccountAlias})`,
                Nom: x.CardNum,
                OpenBankName: x.OpenBankName,
                ObjID: x.ObjID,
              }
              if (x.ID == this.msg.ClientID) {
                this.financeinfo_post_GetClientAccountList(this.msg.ClientType, x.ObjID);
              }
              ClientAccountList.push(obj)
            })
            this.ClientAccountList = ClientAccountList;
          }
        }, err => {})
      },
      Financial_post_GetCostTypeList(id, type) { //获取支出费用类型
        this.apipost('Financial_post_GetCostTypeList', {
          ID: id
        }, res => {

          if (res.data.resultCode == 1) {
            this.GetCostTypeList = res.data.data;
            if (type) {
              this.msg.detailList.forEach(x => {
                this.GetCostTypeList.forEach(y => {
                  if (y.ID == x.CostTypeId) {
                    x.CostTypeName = y.Name;
                  }
                })
              })
            }
            if (this.orderObj && this.orderObj.CostType) {
              this.getCostTypeName(this.detailList.CostTypeId)
            }
          }
        }, err => {})
      },
      financeinfo_post_GetList(TCID) { // 获取币种
        this.apipost('financeinfo_post_GetList', {
          Name: '',
          TCID: TCID,
          StandCurrBranchId: this.msg.RB_Branch_Id
        }, res => {
          if (res.data.resultCode == 1) {
            this.coinGetList = res.data.data;
            let numberC = 0;
            let price = 0;
            let rate = 0;
            this.coinGetList.forEach(x => {
              if (x.ID == this.detailList.CurrencyId) {
                this.detailList.currenName = x.Name
                // 台湾提成汇率
                if (this.orderObj && this.orderObj.Rate) {
                  this.detailList.Rate = this.orderObj.Rate
                } else {
                  this.detailList.Rate = x.Rate
                }

              }
              this.msg && this.msg.detailList && this.msg.detailList.forEach((item, i) => {
                if (item.CurrencyId == x.ID) {
                  item.currenName = x.Name
                  // 台湾提成汇率
                  if (this.orderObj && this.orderObj.Rate) {
                    item.Rate = this.orderObj.Rate
                  } else if(!item.Rate) {
                    item.Rate = x.Rate
                  }

                }
                price = parseFloat(item.UnitPrice);
                rate = parseFloat(item.Rate);
                if (price == 0) {
                  price = '';
                  item.UnitPrice = '';
                }
                if (numberC && price) {
                  item.UnitPriceTo = this.$commonUtils.addCommas(Math.round(price * 100) / 100)
                  item.yTotalPrice = numberC * price;
                  item.yTotalPriceTo = this.$commonUtils.addCommas(Math.round(item.yTotalPrice * 100) /
                    100);
                  if (!isNaN(rate)) {
                    let num = (numberC * price) * rate;
                    num = Math.round(num * 100) / 100;
                    item.bTotalPrice = num;
                    item.bTotalPriceTo = this.$commonUtils.addCommas(num)
                  }
                }
              })
            })
            this.jisuanTO()
          }
        }, err => {})
      },
      // 计算实付金额
      jisuanTO() {
        let allPrice = 0
        this.msg.detailList.forEach(x => {
          this.coinGetList.forEach(y => {
            if (y.ID == x.CurrencyId) {
              x.currenName = y.Name;
            }
          })
          allPrice = allPrice + parseFloat(x.bTotalPrice);
        })
        this.$forceUpdate()
        this.allPrice = allPrice;
        this.allPriceTo = this.$commonUtils.addCommas(Math.round(this.allPrice * 100) / 100)
        this.allPriceTocalc = Math.round(this.allPrice * 100) / 100
        this.chinaAllPrice = this.$commonUtils.changeMoneyToChinese(this.allPrice)
      },
      Financial_post_Get(id, tempId) { //获取单据详情
        this.loading = true;
        this.apipost('Financial_post_Get', {
          ID: id,
          TempId: tempId,
          TCIDList: (this.orderObj && this.orderObj.TCIDList) ? this.orderObj.TCIDList : []
        }, res => {
          if (res.data.resultCode == 1) {
            let data = res.data.data;

            this.$forceUpdate()
            this.editTemplateId = data.TemplateId;
            this.getCompany();
            data.IsLeader = 1;
            this.msg = JSON.parse(JSON.stringify(data));
            if (this.msg.KingdeeClientID > 0) {
              this.KingdeeClientIDCheck = true;
              this.ClientKingdeeAccountList = this.msg.KingdeeClientBankAccountList;
            }
            this.msg.KingdeeClientID = this.msg.KingdeeClientID == 0 ? '' : this.msg.KingdeeClientID;
            this.msg.ClientType = this.msg.ClientType == 0 ? '' : this.msg.ClientType;
            this.msg.ClientID = this.msg.ClientID == 0 ? '' : this.msg.ClientID;
            this.msg.DepositCustomerId = data.DepositCustomerId ? Number(data.DepositCustomerId) : ''
            if (this.msg.DepositCustomerId) this.isDepositCustomer = true
            if (id || id === 0) {
              // if (!this.orderObj) {
              //     this.msg.RB_Branch_Id = this.getLocalStorage().RB_Branch_id
              // }
              if (!this.orderObj && id > 0) {
                this.msg.RB_Branch_Id = this.msg.RB_Branch_Id
              } else {
                this.msg.RB_Branch_Id = this.getLocalStorage().RB_Branch_id
                if ((this.$route.query.id == 245 ||
                    this.$route.query.id == 246 ||
                    this.$route.query.id == 247 ||
                    this.$route.query.id == 248 ||
                    this.$route.query.id == 267) && (!this.BillSonName.includes('分摊') && !this.BillSonName.includes(
                    '预付'))) {
                  this.msg.HelpBranchId = 1218;

                } else {
                  this.msg.HelpBranchId = -1;
                }
              }
            } else {
              this.msg.RB_Branch_Id = this.msg.RB_Branch_Id == 0 ? this.getLocalStorage().RB_Branch_id : this.msg
                .RB_Branch_Id;
            }


            if (this.orderObj && this.orderObj.companyIDList && this.orderObj.companyIDList.length > 0) {
              this.msg.RB_Branch_Id = this.orderObj.companyIDList[0];
            } else if ((this.orderObj && (this.orderObj.RB_Branch_Id != '' && this.orderObj.RB_Branch_Id != null &&
                this.orderObj.RB_Branch_Id != undefined)) || (this.crmOrderObj && (this.crmOrderObj.RB_Branch_Id !=
                '' && this.crmOrderObj.RB_Branch_Id != null &&
                this.crmOrderObj.RB_Branch_Id != undefined))) {
              this.msg.RB_Branch_Id = this.orderObj && this.orderObj.RB_Branch_Id >= 0 ? this.orderObj
                .RB_Branch_Id : this.crmOrderObj.RB_Branch_Id
            } else if (this.$route.query.companyID) {
              this.msg.RB_Branch_Id = parseInt(this.$route.query.companyID);
            }
            this.admin_get_DepartmentGetList(this.msg.RB_Branch_Id);
            this.msg.PayDate = this.msg.PayDate;
            this.msg.detailList = [];
            this.FinancialFlowTemplate_post_GetProcessList(data.TemplateId);
            this.financeinfo_post_GetClientAccountListEdit(data.ClientType);
            this.Financial_post_GetCostTypeList(data.TemplateId, 2);
            let allPrice = 0
            let yballPrice = 0
            data.DetailList.forEach(x => {
              // 20190815 新增领款单据重新生成自动带上计算后的金额
              x.UnitPrice = this.$route.query.dijieEditMoney ? this.$route.query.dijieEditMoney : x.UnitPrice
              x.OriginalMoney = this.$route.query.dijieEditMoney ? this.$route.query.dijieEditMoney : x
                .OriginalMoney
              x.UnitPriceTo = this.$commonUtils.addCommas(Math.round(x.UnitPrice * 100) / 100);
              x.yTotalPrice = x.Number * x.UnitPrice;
              x.rate = x.Rate;
              let num = (x.Number * x.UnitPrice) * x.Rate;
              num = Math.round(num * 100) / 100;
              x.bTotalPrice = num;
              x.Money = Math.round(x.Money * 100) / 100;

              x.yTotalPriceTo = this.$commonUtils.addCommas(Math.round(x.yTotalPrice * 100) / 100);
              x.bTotalPriceTo = this.$commonUtils.addCommas(num);
              x.OriginalMoney = Math.round(x.OriginalMoney * 100) / 100;
              x.show = false;
              this.coinGetList.forEach(y => {
                if (y.ID == x.CurrencyId) {
                  x.currenName = y.Name;
                }
              })
              this.msg.detailList.push(x);
              allPrice = allPrice + parseFloat(x.bTotalPrice);
            });
            this.allPrice = allPrice;
            this.allPriceTo = this.$commonUtils.addCommas(Math.round(this.allPrice * 100) / 100)
            this.allPriceTocalc = Math.round(this.allPrice * 100) / 100


            this.chinaAllPrice = this.$commonUtils.changeMoneyToChinese(this.allPrice)
            this.BillName = data.CompanyName;
            this.BillSonName = data.FinanceName;
            this.IsUploadPic = data.IsUploadPic;
            this.msg.IsPublic = data.IsPublic;
            this.GetDetail = data;
            this.GetHandFeeList() //获取手配费功能权限配置
            if (this.orderObj != null && this.orderObj.OrderSource === 10) {

            } else {
              this.Description = this.GetDetail.Description;
            }
            if (this.orderObj) {
              this.msg.OrderID = this.orderObj.OrderID ? this.orderObj.OrderID : 0;
              this.OrderSource = this.msg.OrderSource = this.orderObj.OrderSource ? this.orderObj.OrderSource : 0;
              this.msg.TCID = this.orderObj.TCID ? this.orderObj.TCID : 0;

              this.msg.TCIDList = this.orderObj.TCIDList ? this.orderObj.TCIDList : [];
              this.msg.Obj = this.orderObj.Obj ? this.orderObj.Obj : '';
              this.msg.SourceID = this.orderObj.SourceID ? this.orderObj.SourceID : 0;
              this.msg.CallType = this.orderObj.CallType ? this.orderObj.CallType : 0;

              if (this.orderObj.OtherType == 75) {
                let msgObj = {
                  ID: 0,
                  UnitPrice: '',
                  UnitPriceTo: '',
                  Number: 1,
                  Rate: '',
                  CostTypeId: this.orderObj.CostType,
                  CurrencyId: '',
                  Remark: '',
                  CostTypeName: this.orderObj.CostType ? '支付月结预提成本或费用' : '',
                  yTotalPrice: '',
                  yTotalPriceTo: '',
                  bTotalPrice: '',
                  bTotalPriceTo: '',
                  show: false,
                }
                this.msg.detailList = []
                if (this.orderObj.CostType) {
                  msgObj.UnitPrice = this.orderObj.Money
                  msgObj.UnitPriceTo = this.orderObj.Money
                  this.msg.detailList.push(JSON.parse(JSON.stringify(msgObj)))
                }
                if (this.orderObj.MoneyClosed) {
                  msgObj.UnitPrice = this.orderObj.MoneyClosed
                  msgObj.UnitPriceTo = this.orderObj.MoneyClosed
                  this.msg.detailList.push(JSON.parse(JSON.stringify(msgObj)))
                }
                if (this.orderObj.CostType2 || this.orderObj.CostType3) {
                  if (this.orderObj.CostType2) {
                    msgObj.CostTypeId = this.orderObj.CostType2
                    msgObj.UnitPrice = this.orderObj.HandlingChargeMoney
                    msgObj.UnitPriceTo = this.orderObj.HandlingChargeMoney
                    this.msg.detailList.push(JSON.parse(JSON.stringify(msgObj)))
                  }
                  if (this.orderObj.CostType3) {
                    msgObj.CostTypeName = '转账手续费'
                    msgObj.CostTypeId = this.orderObj.CostType3
                    msgObj.UnitPrice = this.orderObj.balanceMoney
                    msgObj.UnitPriceTo = this.orderObj.balanceMoney
                    this.msg.detailList.push(JSON.parse(JSON.stringify(msgObj)))
                  }
                }

              } else {
                this.detailList.CostTypeId = this.orderObj.CostType ? this.orderObj.CostType : '';
                this.detailList.UnitPrice = this.orderObj.Money ? this.orderObj.Money : 0;
                this.detailList.Number = this.orderObj.CostType ? 1 : 0
              }


              this.msg.OtherType = this.orderObj.OtherType ? this.orderObj.OtherType : 0;
              this.XSTC = this.orderObj.XSTC ? true : false
              if (!JSON.parse(sessionStorage.getItem("saveGuestInfo"))) {
                this.Description = this.orderObj.laRemark ? this.orderObj.laRemark : '';
              }
              // 判断是否禁用费用说明
              if (this.orderObj.SelectState) {
                this.SelectState = true;
                this.SelectDisablsed = Number(this.orderObj.CostType)
              }
              if (this.orderObj.CurrencyId) {
                this.detailList.CurrencyId = Number(this.orderObj.CurrencyId);
                this.detailCurrDis = true;
                this.detailList.CostTypeId = this.orderObj.CostType ? this.orderObj.CostType : '';
                this.getRate(this.detailList.CostTypeId, this.detailList.CurrencyId, 1)
                this.addList(1);

              }

            }

            if (data.VorcherInos) {
              data.VorcherInos.forEach(x => {
                x.Url = x.Content;
                this.saveMsg.push(x);
              })
            }
            if (data.InvoiceVoucherInfo) {
              data.InvoiceVoucherInfo.forEach(x => {
                x.Url = x.Content;
                this.saveMsgInvoice.push(x);
              })
            }
            if (this.msg.TCIDAndTCNUMList == null) {
              this.msg.TCIDAndTCNUMList = [];
            }
            if (this.orderObj && this.orderObj.CostType) {
              this.Calculation(1)
            }
            this.msg.URL = this.$route.query.path;
            this.msg.Cmd = this.$route.query.Cmd ? this.$route.query.Cmd : '';
            if (id > 0) {
              let TCID = data.TCIDList.length > 0 ? data.TCIDList[0] : 0
              this.TCID = TCID
              this.financeinfo_post_GetList(TCID);
            }
            this.$forceUpdate();
            this.loading = false;
            if (this.$route.query.InPay) {
              this.msg.Type = this.$route.query.InPay;
            }
            if (this.isFrompassenger) {
              this.setDocument();
            }
          } else {
            this.loading = false;
            this.$message.error(res.data.message);
          }

        }, err => {})
      },
      admin_get_DepartmentGetList(Bid, T) {
        // if (this.msg.RB_Branch_Id == 1220) { update by:W 2023-10-16
        //   this.is_HandFee = false
        //   this.isHandFee = false
        // } else {
        if (this.$route.query.id == 245 ||
          this.$route.query.id == 246 ||
          this.$route.query.id == 247 ||
          this.$route.query.id == 248 ||
          this.$route.query.id == 267) {
          this.is_HandFee = true
          this.isHandFee = true
        } else if ((this.msg.TemplateId == 245 ||
            this.msg.TemplateId == 246 ||
            this.msg.TemplateId == 247 ||
            this.msg.TemplateId == 248 ||
            this.msg.TemplateId == 267) && this.msg.HandFeeFrId ==
          0) { //&& this.msg.RB_Branch_Id != 1220  update by:W 2023-10-16
          this.is_HandFee = true
          this.isHandFee = true
        } else {
          this.is_HandFee = false
          this.isHandFee = false
        }
        //}
        if (Bid >= 0) {
          let isShow = true
          this.companyList.forEach(item => {
            // &&item.StandardCurrencyId>0
            if (Bid == item.Id) {
              this.StandardCurrencyId = item.StandardCurrencyId
              this.StandardCurrencyName = item.StandardCurrencyName
              isShow = false
            }
          })
          if (isShow) {
            this.StandardCurrencyId = -1
            this.StandardCurrencyName = ''
          }
        }
        this.financeinfo_post_GetList(this.TCID)
        if (Bid == 0) {
          this.chosenPeople = [];
        }
        // this.msg.RB_Depart_Id = '';
        // this.departmentMsg.RB_Branch_Id = Bid ? Bid : -1;
        this.departmentMsg.RB_Branch_Id = -1;
        this.msg.RB_Depart_Id = '';
        this.apipost('admin_get_DepartmentGetList', this.departmentMsg, res => {
          if (res.data.resultCode == 1) {
            this.departmentList = res.data.data;
            if (this.orderObj && this.orderObj.companyIDList && this.orderObj.companyIDList.length > 0) {

            } else {
              this.msg.RB_Depart_Id = this.msg.RB_Depart_Id ? this.msg.RB_Depart_Id : this.getLocalStorage()
                .RB_Department_Id;
            }

          }
        }, err => {})
      },
      getCompany() { //公司
        this.apipost('admin_get_BranchGetList', this.companyMsg, res => {
          let data = res.data.data;
          let Status = false;
          if (this.$route.query.companyID !== '-1' && this.$route.query.companyID !== undefined) {
            Status = true;
            data.forEach(x => {
              x.disabled = true;
            })
          }
          if (this.orderObj && this.orderObj.companyIDList && this.orderObj.companyIDList.length > 0) {
            Status = true;
            this.orderObj.companyIDList.forEach(x => {
              data.forEach(y => {
                if (y.disabled === false) {
                  y.disabled = false
                } else {
                  y.disabled = x !== y.Id;
                }
              })

            });
          }
          this.companyList = data;
          this.companyList.forEach(x=>{
            if((this.orderObj.LineId=='90'&&x.Id==1247)||this.$route.query.companyID==x.Id){
              x.disabled = false
            }
          })

          if (!Status) {
            let id = 0;
            if (this.$route.query.id) {
              id = this.$route.query.id;
            } else {
              id = this.editTemplateId;

            }
            this.apipost('FinancialFlowTemplate_post_GetTemplateBranch', {
              ID: id
            }, res => {
              if (res.data.resultCode == 1) {
                let resdata = res.data.data;
                if (resdata.IsGroupCommon == 0) {
                  let BranchList = resdata.BranchList;
                  let num = 0
                  data.forEach(x => {
                    x.disabled = true;
                    let Id = this.getLocalStorage().RB_Branch_id
                    BranchList.forEach(y => {
                      if (x.Id == y) {
                        x.disabled = false;
                        if (num < 1 && !this.$route.query.edit) {
                          if ((this.orderObj && this.orderObj.RB_Branch_Id) || (this.crmOrderObj && this
                              .crmOrderObj.RB_Branch_Id)) {
                            this.msg.RB_Branch_Id = this.orderObj && this.orderObj.RB_Branch_Id >= 0 ?
                              this.orderObj.RB_Branch_Id : this.crmOrderObj.RB_Branch_Id
                          } else {
                            this.msg.RB_Branch_Id = x.Id
                          }

                        }
                        if (Id === x.Id && !this.$route.query.edit) {
                          if ((this.orderObj && this.orderObj.RB_Branch_Id) || (this.crmOrderObj && this
                              .crmOrderObj.RB_Branch_Id)) {
                            this.msg.RB_Branch_Id = this.orderObj && this.orderObj.RB_Branch_Id >= 0 ?
                              this.orderObj.RB_Branch_Id : this.crmOrderObj.RB_Branch_Id
                          } else {
                            this.msg.RB_Branch_Id = x.Id
                          }
                        }
                        num = num + 1
                      }
                    })
                    if(this.orderObj.Id==90&&x.Id==1247){
                      x.disabled = false
                    }
                  })

                  this.companyList = data;
                  this.companyList.forEach(x=>{
                    if((this.orderObj.LineId=='90'&&x.Id==1247)||this.$route.query.companyID==x.Id){
                      x.disabled = false
                    }
                  })
                }
              }
            }, err => {})

          }
          if (this.msg.RB_Branch_Id != '') {
            this.admin_get_DepartmentGetList(this.msg.RB_Branch_Id)
          }
        }, err => {})
      },
      //设置选中单据名单
      setDocument() {
        let guojiSessions = JSON.parse(window.sessionStorage.getItem("guoji"));
        if (guojiSessions.guojiArr.length > 0) {
          this.msg.detailList.push({
            ID: 0,
            UnitPrice: '',
            UnitPriceTo: '',
            Number: guojiSessions.guojiArr.length,
            Rate: '',
            CostTypeId: 52,
            CurrencyId: '',
            Remark: '',
            CostTypeName: '',
            yTotalPrice: '',
            yTotalPriceTo: '',
            bTotalPrice: '',
            bTotalPriceTo: '',
            show: false,
          });
        }
        if (guojiSessions.guoneiArr.length > 0) {
          this.msg.detailList.push({
            ID: 0,
            UnitPrice: '',
            UnitPriceTo: '',
            Number: guojiSessions.guoneiArr.length,
            Rate: '',
            CostTypeId: 66,
            CurrencyId: '',
            Remark: '',
            CostTypeName: '',
            yTotalPrice: '',
            yTotalPriceTo: '',
            bTotalPrice: '',
            bTotalPriceTo: '',
            show: false,
          });
        }
        if (guojiSessions.shuijinArr.length > 0) {
          this.msg.detailList.push({
            ID: 0,
            UnitPrice: '',
            UnitPriceTo: '',
            Number: guojiSessions.shuijinArr.length,
            Rate: '',
            CostTypeId: 80,
            CurrencyId: '',
            Remark: '',
            CostTypeName: '',
            yTotalPrice: '',
            yTotalPriceTo: '',
            bTotalPrice: '',
            bTotalPriceTo: '',
            show: false,
          });
        }
        if (this.orderObj != null && this.orderObj.OrderSource === 4 && this.isFrompassenger) {
          let guojiSessions = JSON.parse(window.sessionStorage.getItem("guoji"));
          let guoji = '',
            guonei = '',
            guojizhongduan = '',
            shuijin = '',
            shengcang = '';
          guojiSessions.guojiArr.forEach(x => {
            guoji += x + ' '
          })
          guojiSessions.guoneiArr.forEach(x => {
            guonei += x + ' '
          })
          guojiSessions.gjzdArr.forEach(x => {
            guojizhongduan += x + ' '
          })
          guojiSessions.shuijinArr.forEach(x => {
            shuijin += x + ' '
          })
          guojiSessions.shengcangArr.forEach(x => {
            shengcang += x + ' '
          })
          var gj = guoji == '' ? '' : '国际机票:' + guoji;
          var gn = guonei == '' ? '' : '国内航段:' + guonei;
          var gjzd = guojizhongduan == '' ? '' : '国际中段:' + guojizhongduan;
          var sj = shuijin == '' ? '' : '税金:' + shuijin;
          var sc = shengcang == '' ? '' : '升舱:' + shengcang;
          if (gj != '') {
            gj = gj + `\n`
          }
          if (gn != '') {
            gn = gn + `\n`
          }
          if (gjzd != '') {
            gjzd = gjzd + `\n`
          }
          if (sj != '') {
            sj = sj + `\n`
          }
          this.Description = gj + gn + gjzd + sj + sc
        }
      },
      MaxMoney() { // 获取最大金额
        this.apipost('Financial_get_GetFinanceMoneyLimit', {}, res => {
          if (res.data.resultCode == 1) {
            this.maxmoneyData = res.data.data;
          }
        }, err => {})
      },
    },
    created() {
      var that = this;
      // crm自动登陆传过来的参数
      if (this.$route.query.crmOrderObj) {
        this.crmOrderObj = JSON.parse(this.$route.query.crmOrderObj);
        if (this.crmOrderObj.id >= 0) this.msg.TemplateId = this.crmOrderObj.id;
      } else if (this.$route.query.commissionObj) { //印象提成参数
        this.commissionObj = JSON.parse(this.$route.query.commissionObj);
      } else if (this.$route.query.tradeObj) { //同业参数
        this.tradeObj = JSON.parse(this.$route.query.tradeObj);
      } else {
        this.orderObj = this.$route.query.orderObj ? JSON.parse(this.$route.query.orderObj) : null;
      }
      this.isFrompassenger = this.orderObj ? this.orderObj.isFromPassenger : undefined;
      let TCID = (this.orderObj && this.orderObj.TCIDList && this.orderObj.TCIDList.length > 0) ? this.orderObj
        .TCIDList[0] : 0
      this.TCID = TCID
      if (this.orderObj != null && this.orderObj.OrderSource === 10 && this.isFrompassenger == undefined) {
        that.Description = this.$t('salesModule.LKMD') + ":";
        that.describeList = JSON.parse(sessionStorage.getItem("saveGuestInfo"));
        if (that.describeList) {
          that.describeList.forEach(item => {
            that.Description += item.guestName + " ";
          })
        }

      }


      if (this.orderObj && this.orderObj.OtherType) {
        this.ZhuiJiaTK = true
      }
      this.apipost('financeinfo_post_GetList', {
        Name: '',
        TCID: TCID,
        StandCurrBranchId: this.msg.RB_Branch_Id
      }, res => {
        if (res.data.resultCode == 1) {
          this.coinGetList = res.data.data;
        }
      }, err => {})

      //验证是否团队
      if (TCID > 0) {
        this.AuditState.IsTravel = true;
      }
      if (this.orderObj != null && this.orderObj.OrderSource === 10 && this.orderObj.OrderID > 0) {
        this.AuditState.IsTravel = true;
      }
      if (this.tradeObj && this.tradeObj.OtherType) {
        if (this.tradeObj.OtherType == 61 || this.tradeObj.OtherType == 66 || this.tradeObj.OtherType == 67 || this
          .tradeObj.OtherType == 55) {
          this.AuditState.IsTravel = true;
        }
      }
      this.getCustomerIdList()
    },

    mounted() {

      // 付款单新增或修改  获取最大金额
      if ((this.$route.query.type && this.$route.query.type == 2) || (this.$route.query.Type && this.$route.query
          .Type == 2)) {
        this.MaxMoney();
      }
      if (this.$route.query.id == 245 ||
        this.$route.query.id == 246 ||
        this.$route.query.id == 247 ||
        this.$route.query.id == 248 ||
        this.$route.query.id == 267) {
        this.is_HandFee = true
        this.isHandFee = true
      } else {
        this.is_HandFee = false
        this.isHandFee = false
      }

      let userInfo = this.getLocalStorage();
      this.department = userInfo.DepartName;
      this.EmployeeId = userInfo.EmployeeId;
      this.emplyeeName = userInfo.emName;
      this.DepartIDs = this.msg.RB_Depart_Id = userInfo.RB_Department_Id;
      if (this.$route.query.id == 245 ||
        this.$route.query.id == 246 ||
        this.$route.query.id == 247 ||
        this.$route.query.id == 248 ||
        this.$route.query.id == 267) {
        this.msg.HelpBranchId = 1218;

      }
      if ((this.orderObj && this.orderObj.RB_Branch_Id != '' && this.orderObj.RB_Branch_Id != null && this.orderObj
          .RB_Branch_Id != undefined) || (this.crmOrderObj && this.crmOrderObj.RB_Branch_Id != '' && this.crmOrderObj
          .RB_Branch_Id != null && this.crmOrderObj
          .RB_Branch_Id != undefined)) {
        this.RB_Branch_id = this.departmentMsg.RB_Branch_Id = this.msg.RB_Branch_Id = this.orderObj && this.orderObj
          .RB_Branch_Id >= 0 ? this.orderObj.RB_Branch_Id : this.crmOrderObj.RB_Branch_Id;
      } else {
        this.RB_Branch_id = this.departmentMsg.RB_Branch_Id = this.msg.RB_Branch_Id = userInfo.RB_Branch_id;
      }
      this.companyMsg.RB_Group_Id = this.departmentMsg.RB_Group_Id = userInfo.RB_Group_id;
      this.IsUploadPic = this.$route.query.IsUploadPic;
      this.msg.Cmd = this.$route.query.Cmd ? this.$route.query.Cmd : '';
      this.financeinfo_post_GetClientTypeList();
      const myDate = new Date();
      this.yaer = myDate.getFullYear(); //获取完整的年份(4位,1970-????)
      this.month = myDate.getMonth() + 1; //获取当前月份(0-11,0代表1月)
      this.dateS = myDate.getDate(); //获取当前日(1-31)
      let hour = myDate.getHours() < 10 ? "0" + myDate.getHours() : myDate.getHours();
      let minute = myDate.getMinutes() < 10 ? "0" + myDate.getMinutes() : myDate.getMinutes();
      let second = myDate.getSeconds() < 10 ? "0" + myDate.getSeconds() : myDate.getSeconds();
      this.timer = hour + ':' + minute + ':' + second;
      // this.financeinfo_post_GetList(TCID);
      if (this.$route.query.edit) {
        // 编辑
        this.msg.FrID = this.$route.query.FrID;
        this.Financial_post_Get(this.$route.query.FrID, 0);
      } else {
        if (this.$route.query.czmsg) {
          this.czmsg = JSON.parse(this.$route.query.czmsg);
          if (this.czmsg.Rate) {
            this.czmsgState = true;
          }
        }
        if (this.$route.query.id >= 0) this.msg.TemplateId = this.$route.query.id;
        if (this.msg.TemplateId == 90 || this.msg.TemplateId == 91) {
          this.msg.IsPublic = 10;
        }
        this.Financial_post_GetCostTypeList(this.msg.TemplateId);
        this.BillName = userInfo.GroupName;
        this.BillSonName = this.$route.query.Name;
        this.FinancialFlowTemplate_post_GetProcessList(this.msg.TemplateId);
        this.Financial_post_Get(0, parseInt(this.msg.TemplateId));
      }
      if (this.$route.query.Conditon) {
        this.returnCode = this.$route.query.Conditon;
      }

      this.getCompany();
      // this.admin_get_DepartmentGetList();

    },
    components: {
      "my-FlowChartModule": myFlowChartModule
    }
  }

</script>