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

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

  .Receipt_box {
    padding: 15px;
    color: #c94052;
    width: 100%;
    width: 830px;
    position: absolute;
  }

  .Receipt_box tr th {
    color: #c94052
  }

  .Receipt_box.color_blur tr th {
    color: #c94052
  }

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

  .Receipt_box.color_blur .rb_stit span {
    display: inline-block;
    border-bottom: 2px solid #c94052;
    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: #c94052;
  }

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

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

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

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

  ._AccountNumber {
    font-size: 14px;
    color: #333333;
    display: inline-block;
    min-width: 307px;
  }

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

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

  ._addUpload_box img {
    width: 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;
  }

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

</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="_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>
        <p class="rb_tit">{{BillName}}
          (<el-select filterable v-model='msg.RB_Branch_Id' @change="admin_get_DepartmentGetList(msg.RB_Branch_Id)"
            class="w120 _border_b_1">
            <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>
        <div class="rb_top_row _r_mb5">
          <p>{{$t('fnc.fkuanzhanghu')}}：
            <el-select filterable v-model='bankType' placeholder="" @change="getAccountList(bankType),getCourseId()"
              class="w100 _border_b_1">
              <el-option v-for='item in AccList' :label='item.Name' :value='item.ID' :key='item.ID'>
              </el-option>
            </el-select>
            <!--<el-select  filterable  v-model='msg.BankList[0].Type' placeholder="" @change="getAccountList(msg.BankList[0].Type)" class="w100 _border_b_1">-->
            <!--<el-option v-for='item in GetAccountType' -->
            <!--:label='item.Name'-->
            <!--:value='item.ID'-->
            <!--:key='item.ID'>-->
            <!--</el-option>-->
            <!--</el-select>-->
            <el-select filterable v-model='msg.BankList[0].AccountId' placeholder=""
              @change="getAccName(msg.BankList[0].AccountId,1,1),Calculation(0,1),countFee()" class="w100 _border_b_1">
              <el-option v-for='(item,index) in accountList' :label='item.Name' :value='item.ID' :key='index'>
              </el-option>
            </el-select>
          </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">
          <p>{{$t('fnc.skuanzhanghao')}}：
            <span class="_border_b_1 _AccountNumber">{{AccountNumber}}</span>
          </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="#c94052" style="border-collapse:collapse;">
          <tr>
            <th rowspan="2">{{$t('fnc.fyshuoming')}}</th>
            <th rowspan="2">{{$t('restaurant.res_Number')}}</th>
            <th rowspan="2">{{$t('fnc.danjia')}}</th>
            <th rowspan="2" width="80">{{$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 v-else @keyup.enter="addList(2,daIn+1)" style="border-right:none;">
              <td height="26px">
                <el-select filterable v-model='da.CostTypeId' :placeholder="$t('rule.qxzfyshuoming')"
                  @change="getCostTypeName(da.CostTypeId, daIn),addList(2,daIn+1)" class="w200 _border_b_1">
                  <el-option v-for='item in GetCostTypeList' :label='item.Name' :value='item.ID' :key='item.ID'>
                  </el-option>
                </el-select>
              </td>
              <!-- <td height="26px"><el-input v-model="da.Number" type="number" 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="number" @keydown="handleInput2" @change="Calculation(2,daIn+1)" @blur="addList(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')" type="text"
                  @input="chages($event)" @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" type="text" @keyup.native="checkPrice(da,'UnitPrice',true)"
                  @input="chages($event)" @change="Calculation(2,daIn+1)" @blur="addList(2,daIn+1)"
                  class="w80 h34 _border_b_1"></el-input>
              </td>
              <td height="26px">
                <span class="w80">{{da.currenName}}</span>
              </td>
              <td height="26px">{{da.yTotalPrice}}</td>
              <!--  @change="Calculation(2,daIn+1)" @blur="addList(2,daIn+1)" -->
              <td height="26px">
                <el-input v-model="da.Rate" :disabled="true" type="text" 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 @keyup.enter="addList(1)">
            <td>
              <el-select filterable v-model='detailList.CostTypeId' :placeholder="$t('rule.qxzfyshuoming')"
                @change="getCostTypeName(detailList.CostTypeId),addList(1)" class="w200 _border_b_1">
                <el-option v-for='item in GetCostTypeList' :label='item.Name' :value='item.ID' :key='item.ID'>
                </el-option>
              </el-select>
            </td>
            <!-- <td>
                            <el-input v-model="detailList.Number" type="number" 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="number" @keydown="handleInput2"  @change="Calculation(1)" @blur="addList(1)" class="w80 h34 _border_b_1"></input>
                        </td> -->
            <td>
              <el-input v-model="detailList.Number" type="text" @keyup.native="checkInteger(detailList,'Number')"
                @input="chages($event)" @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)" @change="Calculation(1)" @blur="addList(1)"
                @input="chages($event)" class="w80 h34 _border_b_1"></el-input>
            </td>
            <td>
              <span class="w110">{{detailList.currenName}}</span>
            </td>
            <td>{{detailList.yTotalPrice}}</td>
            <!-- @change="Calculation(1)" @blur="addList(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" @blur="addList(1)" type="textarea" class="w80 _border_b_1"
                @input="chages($event)">
              </el-input>
            </td>
          </tr>
          <tr v-if="msg.detailList&&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&&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&&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 colspan="1">{{$t('fnc.shouxufei')}}<br /><span class="_font_size12">{{$t('fnc.khyuanbi')}}</span></td>
            <td colspan="3"><input class="_border_b_1 w80" type="number" v-model="msg.OriginalFee"
                @change="countFee()"></input></td>
            <td colspan="1">{{$t('fnc.shouxufei')}}<br /><span class="_font_size12">{{$t('fnc.khbweibi')}}</span></td>
            <td colspan="3"><span class=" w80" type="number">{{msg.Fee}}</span></td>
          </tr>
          <tr>
            <td>{{$t('fnc.ysjine')}}<br /><span class="_font_size12">{{$t('fnc.daxie')}}</span></td>
            <td colspan="3">{{chinaAllPrice}}</td>
            <td>{{$t('fnc.ysjine')}}<br /><span class="_font_size12">{{$t('fnc.xiaoxie')}}</span></td>
            <td colspan="3">{{allPriceTo}}</td>
          </tr>
          <tr>
            <td>{{$t('fnc.huikuanren')}}</td>
            <td colspan="1">
              <el-input v-model="msg.RemitterName" type="text" class="w80 _border_b_1"></el-input>
            </td>
            <td>{{$t('fnc.jylshuihao')}}</td>
            <td colspan="2">
              <el-tooltip class="item" effect="dark" :content="msg.AccountNumber" placement="top">
                <el-input v-model="msg.AccountNumber" type="text" class="w80 _border_b_1"></el-input>
              </el-tooltip>
            </td>
            <td>{{bankType==12&&msg&&msg.BankList[0]&&msg.BankList[0].AccountId==95?'最晚兑付日期':$t('fnc.hkshijian')}}</td>
            <td colspan="2">
              <el-date-picker clearable class="w150 _border_b_1" v-model="msg.TradeDate" type="date" format="yyyy-MM-dd"
                value-format="yyyy-MM-dd">
              </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 style="display: flex;flex-wrap: wrap; justify-content: start;">
            <p>
              <span style="flex-shrink: 0;">{{$t('fnc.fygsbumen')}}：</span>
              <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>

              <!-- msg.TemplateId==27&&msg.CourseId&&orderObj&&orderObj.OrderID&&orderObj.OrderSource==8 -->
            <template v-if="isReceivablesAccount">
              <!--
              <p style="margin-left: 15px;">
                <el-tooltip class="item" effect="dark" content="请输入参加活动的转账卡号/平台用户名，不输入则此单不参与" placement="top">
                  <i class="el-icon-warning-outline" style="cursor: pointer;"></i>
                </el-tooltip>
                <span>类型：</span>
                <span>
                <el-select v-model="msg.CourseId" placeholder="选择收款类型" clearable
                class="w135 _border_b_1"
                style="width: 100%;" @change="getCourseId">
                  <el-option v-for="item in PaymentMethodList" :key="item.Id" :label="item.Name"
                    :value="item.Id"></el-option>
                </el-select>
              </span>
            </p> -->
            <p style="margin-left: 15px;">
              <el-tooltip v-if="(msg.CourseId!=12||(PlatformUserNameList&&PlatformUserNameList.length>0))&&msg.CourseId>0" class="item" effect="dark"
                :content="AccountPrompt" placement="top">
                <i class="el-icon-warning-outline" style="cursor: pointer;"></i>
              </el-tooltip>
              <span>
                <template v-if="msg.CourseId!=12&&msg.CourseId>0">
                  卡号：
                </template>
                <template v-if="msg.CourseId==12&&PlatformUserNameList&&PlatformUserNameList.length>0">
                  平台用户名称：
                </template>
              </span>
              <span>
              <el-input v-if="msg.CourseId!=12&&msg.CourseId>0" type="text" class="w135 _border_b_1"
              v-model="msg.PayReceipt_No" placeholder="输入银行卡号后四位" style="width: 364px;" clearable></el-input>
              <el-select v-if="msg.CourseId==12&&PlatformUserNameList&&PlatformUserNameList.length>0"
                v-model="msg.PayReceipt_No" placeholder="选择平台用户名称" clearable
              class="_border_b_1"
              style="width: 100%;">
                <el-option v-for="(item,index) in PlatformUserNameList" :key="index" :label="item"
                  :value="item"></el-option>
              </el-select>
            </span>
            </p>
            </template>

            <template v-if="(orderObj&&!orderObj.isPrestore)||msg.SigningCustomerId||msg.DepositCustomerId||RB_Branch_Id==1218 || showSigningCustomer">
              <template v-if="!msg.DepositCustomerId||RB_Branch_Id==1218 || showSigningCustomer">
                <p v-if="CustomerIdList&&CustomerIdList.length" style="margin-left: 15px;">签约客户：<span>
                    <el-select clearable filterable v-model='msg.SigningCustomerId' class="w135 _border_b_1"
                      :disabled="isDepositCustomer" @change="getSigningCustomerId(1)">
                      <el-option v-for='item in CustomerIdList' :label='item.customerName' :value='item.customerId'
                        :key='item.customerId'>
                      </el-option>
                    </el-select>
                  </span>
                </p>
              </template>
              <template v-if="!msg.SigningCustomerId && !showSigningCustomer">
                <p v-if="StoredCustomerList&&StoredCustomerList.length" style="margin-left: 15px;">预收抵用：<span>
                    <el-select clearable filterable v-model='msg.DepositCustomerId' class="w135 _border_b_1"
                      :disabled="isDepositCustomer" @change="getSigningCustomerId(2)">
                      <el-option v-for='item in StoredCustomerList' :label='item.customerName' :value='item.customerId'
                        :key='item.customerId'>
                      </el-option>
                    </el-select>
                  </span>
                </p>
              </template>

            </template>
          </div>
          <template v-if="!BillSonName.includes('分摊')&&!BillSonName.includes('预付')">
            <div>
              <p>
                代收款原公司：
                <span>
                  <el-select filterable v-model='msg.HelpBranchId' class="w120 _border_b_1">
                  <el-option  label='非代收代付' :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;">注：只有帮其他公司{{this.$route.query.Type==1?'代收':'代付'}}的需选择此项，非代收代付则忽略此项</span>
              </p>
            </div>

          </template>
          <table v-if="ContractCustomer" class="Receipt_table" border="1" bordercolor="#c94052"
            style="border-collapse:collapse;margin-top: 10px;">
            <tr>
              <th>签约客户</th>
              <th>联系人</th>
              <th>手机号</th>
              <th>签约到期时间</th>
              <th>签约金额</th>
              <th>待结算金额</th>
            </tr>
            <tr class="_color_b">
              <td height="26px">{{ContractCustomer.customerName?ContractCustomer.customerName:'-'}}</td>
              <td height="26px">{{ContractCustomer.contact?ContractCustomer.contact:'-'}}</td>
              <td height="26px">{{ContractCustomer.contactNumber?ContractCustomer.contactNumber:'-'}}</td>
              <td height="26px">{{ContractCustomer.signingEndTimet?ContractCustomer.signingEndTimet:'-'}}</td>
              <td height="26px">{{ContractCustomer.signingPrice?ContractCustomer.signingPrice:'-'}}</td>
              <td height="26px">{{ContractCustomer.signingUnsettledPrice?ContractCustomer.signingUnsettledPrice:'-'}}
              </td>
            </tr>
          </table>
          <table v-if="DepositCustomer" class="Receipt_table" border="1" bordercolor="#c94052"
            style="border-collapse:collapse;margin-top: 10px;">
            <tr>
              <th>预存客户</th>
              <th>联系人</th>
              <th>手机号</th>
              <th>余额 </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 class="">
          <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 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')}} -->
                  下一步审核人：<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="请输入下一步审核人，并选中下" :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>
            <div class="btn-box">
              <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()">返回</button>
            </div>
          </div>
        </div>
        <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>
    <!-- 跟团订单、当地游订单，获取订单客户签约信息 -->
    <OrderReceivablesAccount v-if="isReceivablesAccount"
      :clientData="clientData" @ClosePopup="isReceivablesAccount=false"></OrderReceivablesAccount>

  </div>
</template>
<script>
  import myFlowChartModule from "./FinancialSubmodule/FlowChartModule.vue";
  import TicketingModule from "../commonPage/TicketingModule.vue";
  import OrderReceivablesAccount from "./components/OrderReceivablesAccount.vue";
  export default {
    data() {
      return {
        PaymentMethodList:[
          {Name:'银行卡',Id:1},
          // {Name:'支付宝',Id:2},
          // {Name:'微信',Id:3},
          {Name:'平台',Id:12},
        ],
        DepositCustomer: null,
        ContractCustomer: null,
        Description: '',
        msg: {
          Course_Name: '',
          PayReceipt_No: null,
          CourseId: null,
          ReFinanceId: '',
          FrID: 0,
          ClientType: 0,
          ClientID: 0,
          RemitterName: '',
          AccountNumber: '',
          TradeDate: '',
          TCID: 0,
          OrderID: 0,
          OrderSource: 0,
          TemplateId: 0,
          Description: '',
          detailList: [],
          RB_Depart_Id: '',
          RB_Branch_Id: '',
          HelpBranchId:-1,
          Status: 1,
          OriginalFee: 0,
          emList: [],
          BankList: [{
            AccountId: '',
            CurrencyId: '',
            Type: '',
            Fee: 0,
            ID: 0,
            ybFee: 0,
            bbFee: 0,
            Rate: 0,
          }],
          URL: this.$route.query.path,
          Cmd: '',
          TCIDList: [],
          Obj: {},
          SourceID: 0,
          TCIDAndTCNUMList: [],
          CallType: 0,
          Type: 0,
        },
        AccountNumber: '',
        queryAccMsg: {
          IsPublic: -1,
          Is_Open: true,
        },
        bankType: '',
        detailList: {
          ID: 0,
          UnitPrice: '',
          UnitPriceTo: '',
          Number: '',
          Rate: '',
          CostTypeId: '',
          CurrencyId: '',
          Remark: '',
          CostTypeName: '',
          yTotalPrice: '',
          yTotalPriceTo: '',
          bTotalPrice: '',
          bTotalPriceTo: '',
          show: false,
          currenName: '',
          ybFee: 0,
          bbFee: 0,
        },
        ClientAccountList: [],
        GetCostTypeList: [],
        ClientAccountListS: [],
        coinGetList: [],
        yaer: '',
        month: '',
        dateS: '',
        AuditListData: {
          AuditList: []
        },
        AccList: [],
        accountList: [],
        GetAccountType: [],
        newAuditList: [],
        AuditState:{
          IsTravel:false,
          IsParentBranch:false
        },
        BillName: '',
        BillSonName: '',
        department: '',
        emplyeeName: '',
        EmployeeId: 0,
        allPrice: 0,
        allPriceTo: 0,
        chinaAllPrice: this.$commonUtils.changeMoneyToChinese(this.allPrice),
        DepartIDs: '0',
        GetDetail: {
          FrID: 0
        },
        loading: false,
        loadingPeople: 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: [],
        CustomerIdList: [],
        companyList: [],
        edit: false,
        IsUploadPic: 0,
        headers: {
          'Content-Type': 'application/octet-stream'
        },
        saveMsg: [],
        picIsShow: false,
        picObj: [],
        initialIndex: 0,
        companyID: null,
        chosenPeople: [],
        peopleData: [],
        currentId: 0,
        currentType: 0,
        nextPoint: {},
        orderObj: {},
        OrderSource: null,
        timer: '',
        hideFlashMan: false,
        imgList: [],
        resultCode: null,
        templateType: 1,
        setCode: '',
        shouxufei: 0,
        tradeWay: '',
        platformAccount: '',
        Handmsg: {},
        crmOrderObj: null,
        tradeObj: {},
        StandardCurrencyId: 0,
        StandardCurrencyName: '',
        TCID: 0,
        StoredCustomerList: [],
        isDepositCustomer: false,
        AccountPrompt: '',
        isReceivablesAccount: false,
        clientData: {},
        PlatformUserNameList: [],
        showSigningCustomer : false
      }
    },
    methods: {
      // 获取订单客户收款账号
      getReceivablesAccount(OrderID){
        this.apipost('Financial_post_GetCanActivityContractInfo', {
          OrderId: OrderID
        }, res => {
          if (res.data.resultCode == 1) {
            this.clientData = res.data.data
            this.PlatformUserNameList = res.data.data.PlatformUserNameList
            if(res.data.data.State==1){
              this.isReceivablesAccount = true
            }
          }else{
            this.Error(res.data.message)
          }
        }, err => {})

      },

      // 客户平台名称
      getCourseId(){
        this.msg.PayReceipt_No = ''
        let list = this.PaymentMethodList.filter(x=>{ return x.Id==this.msg.CourseId })
        this.msg.Course_Name = list[0].Name
        this.$forceUpdate()
      },
      deleteRow(i, obj) {
        obj.show = false;
        this.msg.detailList.splice(i, 1);
        if (this.bankType == 12) {
          this.getcommission()
          this.countFee();
        }

        this.$forceUpdate();
      },
      jumpPage(path, id, type) { //生成单据时连带信息跳转
        if (type == 1) {
          // let routeData = this.$router.resolve({
          //     name: path,
          //     query: { TCIDList: id}
          // });
          // window.open(routeData.href, "_blank");
          this.$router.push({
            name: path,
            query: {
              TCIDList: id,
              blank: 'y'
            }
          })
        } else if (type == 2) {
          // let routeData = this.$router.resolve({
          //     name: path,
          //     query: { ID: id}
          // });
          // window.open(routeData.href, "_blank");
          this.$router.push({
            name: path,
            query: {
              ID: id,
              blank: 'y'
            }
          })
        } else if (type == 3) {
          // let routeData = this.$router.resolve({
          //     name: path,
          //     query: { ID: id}
          // });
          // window.open(routeData.href, "_blank");
          this.$router.push({
            name: path,
            query: {
              ID: id,
              blank: 'y'
            }
          })
        } else if (type == 4) {
          this.$router.push({
            name: path,
            query: {
              OrderSource: id.OrderSource,
              SourceID: id.SourceID,
              blank: 'y'
            }
          })
        } else if (type == 5) {
          this.$router.push({
            name: path,
            query: {
              id: id[0].TCID,
              OutBranchId: id.RB_Branch_Id,
              blank: 'y'
            }
          })
        } else if (type == 6) {
          this.$router.push({
            name: path,
            query: {
              id: id,
              OutBranchId: id.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.imgList.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)
          }
        }
      },
      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.Success(this.$t('tips.scchenggong'))
          if (this.bankType == 13 && x.data.Ocr.length > 0) {
            var OcrStr = '';
            x.data.Ocr.forEach(x => {
              OcrStr += x.words
            })
            var wechat = [];
            var zhifu = [];
            wechat = OcrStr.match(/商户单号.\d+/);
            zhifu = OcrStr.match(/商家可扫码退款或查询交易.\d+/);
            let barcode = x.data.Barcode;
            if (wechat == null && zhifu == null && barcode == "") {
              return;
            }
            if (zhifu == null && wechat != null && wechat.length > 0 && wechat[wechat.length - 1].length > 20) {
              this.setCode = wechat[wechat.length - 1].replace('商户单号', '');
            } else if (wechat == null && zhifu != null && zhifu.length > 0 && zhifu[zhifu.length - 1].length > 20) {
              this.setCode = zhifu[zhifu.length - 1].replace('商家可扫码退款或查询交易', '');
            } else if (barcode != "") {
              this.setCode = barcode;
            }
            this.$confirm('匹配到交易流水号是否替换?', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              this.msg.AccountNumber = this.setCode
            }).catch(() => {
              this.$message({
                type: 'info',
                message: '已取消删除'
              });
            });
          }
        }, 1);
      },
      countFee() { // 输入原币手续费计算本位币手续费
        if (this.msg.detailList.length > 0 && this.msg.detailList[0].Rate && this.msg.OriginalFee) {
          let r = parseFloat(this.msg.detailList[0].Rate);
          let f = parseFloat(this.msg.OriginalFee);
          this.msg.Fee = Math.round((r * f) * 100) / 100;
          let allPrice = 0;
          this.msg.detailList.forEach(x => {
            allPrice = allPrice + parseFloat(x.bTotalPrice);
          })
          allPrice = allPrice - parseFloat(this.msg.Fee);
          this.allPrice = Math.round(allPrice * 100) / 100;
          this.allPriceTo = this.$commonUtils.addCommas(this.allPrice);
          this.chinaAllPrice = this.$commonUtils.changeMoneyToChinese(this.allPrice);
          this.$forceUpdate();
        } else {
          let r = 1;
          let f = parseFloat(this.msg.OriginalFee);
          this.msg.Fee = Math.round((r * f) * 100) / 100;
          let allPrice = 0;
          this.msg.detailList.forEach(x => {
            allPrice = allPrice + parseFloat(x.bTotalPrice);
          })
          allPrice = allPrice - parseFloat(this.msg.Fee);
          this.allPrice = Math.round(allPrice * 100) / 100;
          this.allPriceTo = this.$commonUtils.addCommas(this.allPrice);
          this.chinaAllPrice = this.$commonUtils.changeMoneyToChinese(this.allPrice);
          this.$forceUpdate();
        }
      },
      getAccName(i, o, t) { // 根据选择账户获取账户名
        this.accountList.forEach(x => {
          if (x.ID == i) {
            this.AccountNumber = x.allName;
            this.msg.BankList[0].CurrencyId = x.CurrencyId;
            this.msg.BankList[0].Type = x.BankType;
            this.detailList.currenName = x.CurrencyName;
            this.detailList.CurrencyId = x.CurrencyId;
            if (this.edit == false || o) {
              this.detailList.Rate = x.Rate
            }
            this.msg.detailList.forEach((y, i) => {
              y.CurrencyId = x.CurrencyId;
              y.currenName = x.CurrencyName;
              if (this.edit == false || o) {
                y.Rate = x.Rate;
              }
              this.Calculation(2, i + 1);
            })
          }
        })
        if (this.bankType == 13) {
          this.apipost('Financial_post_GetQRCodeServiceCharge', {
            AccountId: i
          }, res => {
            this.shouxufei = res.data.data
          }, err => {})
        } else {
          if (!this.$route.query.edit && !t) {
            this.msg.OriginalFee = 0
            this.msg.Fee = 0
          }
        }
        if (this.bankType == 12) { //如果等于平台账户 进去判断
          this.getcommission()
          this.countFee();
        }
      },
      clearAccBank() { // 选择账户类型清空数据
        this.msg.BankList[0].Type = '';
        this.msg.BankList[0].AccountId = '';
        this.AccountNumber = '';
      },
      BankAccount_post_GetAccountType() { //获取账户类型列表
        this.apipost('BankAccount_post_GetAccountType', {}, res => {
          if (res.data.resultCode == 1) {
            this.GetAccountType = res.data.data;
          }
        }, err => {})
      },
      getAccountList(i, t) { //获取账户类型对应下的账户列表
        // 1 银行卡号 12平台用户名称
        if(i!=12){
          this.msg.CourseId = 1
          this.AccountPrompt = '请输入参加活动的转账卡号，不输入则此单不参与'
          this.msg.Course_Name = '银行卡'
        }if(i==12){
          this.msg.CourseId = 12
          this.AccountPrompt = '请选择参加活动的平台用户名称，不输入则此单不参与'
          this.msg.Course_Name = '平台'
        }

        if (!t) {
          this.msg.BankList[0].AccountId = '';
          this.AccountNumber = '';
        }
        this.apipost('FinancialInstitutions_post_GetALLAccountList', {
          TypeId: i,
          StandCurrBranchId: this.msg.RB_Branch_Id,
          TCID: this.TCID
        }, res => {
          if (res.data.resultCode == 1) {
            let data = res.data.data;
            let list = []
            if (this.$route.query.id == 192) { //如果流程等于192 只显示地接部专户 10月8号新增
              list = []
              data.forEach(x => {
                if (x.Alias == '国内地接专户') {
                  x.allName = x.BackNo + "(" + x.Alias + ")";
                  x.Name = x.Alias;
                  list.push(x)
                }
              })
            } else { //如果不是192的情况不显示 国内地接专户
              list = []
              data.forEach(x => {
                if (x.Alias != '国内地接专户') {
                  x.allName = x.BackNo + "(" + x.Alias + ")";
                  x.Name = x.Alias;
                  list.push(x)
                }
              })
            }
            this.accountList = list;
            if (this.$route.query.edit) {
              this.getAccName(this.msg.BankList[0].AccountId)
            }
            if (t) {
              let isState = true
              this.accountList.forEach(item => {
                if (isState && item.ID === this.msg.BankList[0].AccountId) {
                  this.detailList.Rate = item.Rate
                  this.msg.detailList.forEach(x => {
                    x.Rate = item.Rate
                  })
                  isState = false
                  return
                }
              })

              if (isState) {
                this.msg.BankList[0].AccountId = '';
                this.AccountNumber = '';
              }
              this.getAccName(this.msg.BankList[0].AccountId, 1, 1)
              // this.Calculation(0,1)
              // this.countFee()
            }
          }
        }, err => {})
      },
      BankAccount_post_GetPlatformList(i) { //获取平台账户
        let msg = {
          BackId: 0,
          TypeId: this.bankType,
          BranchId: -1,
          Alias: '',
          RB_Branch_Id: this.RB_Branch_Id,
        }
        this.apipost('BankAccount_post_GetPlatformList', msg, res => {
          if (res.data.resultCode == 1) {
            let data = res.data.data;
            data.forEach(x => {
              x.allName = x.PlatformNo + "(" + x.Alias + ")";
              x.Name = x.Alias;
            })
            this.accountList = data;
            if (this.$route.query.edit) {
              this.getAccName(this.msg.BankList[0].AccountId)
            }
          }
        }, err => {})
      },
      BankAccount_post_GetCashAccountList(i) { // 获取现金账户
        let msg = {
          TypeId: this.bankType,
          BranchId: -1,
          Alias: '',
        }
        this.apipost('BankAccount_post_GetCashAccountList', msg, res => {
          if (res.data.resultCode == 1) {
            let data = res.data.data;
            data.forEach(x => {
              x.allName = x.Alias;
              x.Name = x.Alias;
            })
            this.accountList = data;
            if (this.$route.query.edit) {
              this.getAccName(this.msg.BankList[0].AccountId)
            }
          }
        }, err => {})
      },
      bankaccount_post_GetList(i) { // 获取银行账户
        this.apipost('bankaccount_post_GetList', {
          TypeId: this.bankType
        }, res => {
          if (res.data.resultCode == 1) {
            let data = res.data.data;
            data.forEach(x => {
              x.allName = x.BackNo + "(" + x.Openingbank + ")";
              x.Name = x.Alias;
            })
            this.accountList = data;
            if (this.$route.query.edit) {
              this.getAccName(this.msg.BankList[0].AccountId)
            }
          }
        }, err => {})
      },
      BankAccount_post_GetCashPoolList(i) { // 获取资金池账
        this.apipost('BankAccount_post_GetCashPoolList', {
          TypeId: this.bankType,
          BranchId: -1,
          Alias: '',
          RB_Branch_Id: this.RB_Branch_Id,
        }, res => {
          if (res.data.resultCode == 1) {
            let data = res.data.data;
            data.forEach(x => {
              x.allName = x.Alias;
              x.Name = x.Alias;
            })
            this.accountList = data;
            if (this.$route.query.edit) {
              this.getAccName(this.msg.BankList[0].AccountId)
            }
          }
        }, err => {})
      },
      AccountType_post_GetList() { //获取账户类型下拉
        this.apipost('AccountType_post_GetList', this.queryAccMsg, res => {
          if (res.data.resultCode == 1) {
            let AccList = res.data.data;
            let newAccList = []
            this.GetDetail.walist.forEach(x => {
              if (x.Type === 1) {
                AccList.forEach(y => {
                  if (y.Name === '私帐账户' || y.Name === '公帐账户' || y.Name === '微信支付宝' || y.Name === '虚拟账户') {
                    newAccList.push(y)
                  }
                })
              }
              if (x.Type === 2) {
                AccList.forEach(y => {
                  if (y.Name === '现金账户') {
                    newAccList.push(y)
                  }
                })
              }
              if (x.Type === 3) {
                AccList.forEach(y => {
                  if (y.Name === '平台账户') {
                    newAccList.push(y)
                  }
                })
              }
              if (x.Type === 4) {
                AccList.forEach(y => {
                  if (y.Name === '公社资金池' || y.Name === '水口资金池' || y.Name === '橡胶资金池' || y.Name == '地接部专户' ||
                    y.Name == '票务部专户' || y.Name == '老挝购物店资金池') {
                    newAccList.push(y)
                  }
                })
              }
            })
            if (this.$route.query.id == 192) { //如果流程等于192 只显示地接部专户 10月8号新增
              newAccList = []
              AccList.forEach(y => {
                if (y.Name == '地接部专户') {
                  newAccList.push(y)
                }
              })
            }
            this.AccList = newAccList;
          } else {
            this.$message.error(res.data.message);
          }
        }, err => {})
      },
      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.msg.TemplateId==27&&this.msg.CourseId&&!this.msg.PayReceipt_No){
        //   return this.Error(`请输入${this.msg.CourseId!=12&&this.msg.CourseId>0?'银行卡号后四位':'平台用户名称'}`)
        // }
        if ((this.orderObj && !this.orderObj.isPrestore) || this.msg.DepositCustomerId) {
          let To = Number(this.allPrice + this.msg.Fee)
          let totalAmount = 0;
          if (this.DepositCustomer && this.DepositCustomer.depositMoney) {
            totalAmount = this.DepositCustomer.depositMoney;
            if (To > totalAmount) {
              this.Error(`本位币总金额需小于等于${this.DepositCustomer.depositMoney}！`)
              return
            }
          }
        }
        if (this.Handmsg != null) {
          this.msg.ReFinanceId = this.Handmsg.ReFinanceId;
          if (this.Handmsg.TCNUM) {
            this.msg.TCNUM = this.Handmsg.TCNUM
          }
        }
        if (this.orderObj != null && this.orderObj.OrderSource === 8 && this.orderObj.tipObj == 1) {
          let tipguestInfo = JSON.parse(sessionStorage.getItem("TipGuestList"));
          this.msg.TipGuestList = tipguestInfo;
        }
        this.msg.Description = this.Description;
        if (z) {
          this.msg.Status = 0;
        } else {
          this.msg.Status = 1;
          if (this.msg.RemitterName == '') return this.$message.error(this.$t('rule.qtxhkuanren'));
          if (this.msg.TradeDate == '') return this.$message.error(this.$t('rule.qtxhkshijian'));
          if (this.msg.detailList.length < 1) return this.$message.error(this.$t('rule.qtxzsyxfyshuoming'));
        }
        if (this.bankType === 12) {
          if (this.msg.AccountNumber === "") {
            return this.$message.error(this.$t('rule.qxzjylshuihao'));
          }
        }
        if (this.msg.BankId == '') return this.$message.error(this.$t('rule.qxzskzhanghao'));
        if (!this.msg.RB_Depart_Id) return this.$message.error(this.$t('rule.qxzzdbumen'));
        if (!this.$route.query.edit) {
          this.msg.Type = this.$route.query.Type
        }
        delete this.msg.DetailList;
        delete this.msg.PayMoney;
        delete this.msg.VorcherInos;
        this.msg.Fee = this.msg.Fee ? parseFloat(this.msg.Fee) : 0;
        this.msg.OriginalFee = this.msg.OriginalFee ? parseFloat(this.msg.OriginalFee) : 0;
        this.msg.detailList.length ? this.msg.detailList[0].Rate : 0;
        this.msg.vorcherInos = this.saveMsg;
        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.ECOrderList = this.orderObj.ECOrderList ? this.orderObj.ECOrderList : [];
          this.msg.StandardCurrencyName = this.orderObj.StandardCurrencyName ? this.orderObj.StandardCurrencyName : '';
        }
        // 原币总金验证
        if (this.orderObj && this.orderObj.Money) {
          let yballPrice = 0
          this.msg && this.msg.detailList && this.msg.detailList.forEach((item, i) => {
            yballPrice += Number(item.UnitPrice)
          })
          this.yballPriceTo = yballPrice
          if(this.orderObj.Money&&this.orderObj.Money2){
            let Money = ((this.orderObj.Money*100)+(this.orderObj.Money2*100))/100
            if (Money != this.yballPriceTo) {
              this.Error(`原币总金额需等于${Money}！`)
              return
            }
          }else{
            if (this.orderObj.Money != this.yballPriceTo) {
              this.Error(`原币总金额需等于${this.orderObj.Money}！`)
              return
            }
          }

        }
        // 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
        }
        // 同业的参数
        if (this.tradeObj.OtherType) {
          this.msg.OtherType = this.tradeObj.OtherType
          this.msg.ReFinanceId = this.tradeObj.ReFinanceId
          this.msg.ReFinanceId2 = this.tradeObj.ReFinanceId2
        }
        this.msg.detailList.forEach(x => {
          delete x.rate;
        });
        this.msg.OrderTradeWay = this.tradeWay;
        this.msg.PlatformAccountId = this.platformAccount;

        if(this.clientData&&this.clientData.State&&this.clientData.State==1
        &&(!this.msg.PayReceipt_No||this.msg.PayReceipt_No=='')){
          let text = '选择平台用户昵称'
          if(this.msg.CourseId!=12&&this.msg.CourseId>0){
            text = '输入卡尾号'
          }
          let that = this
          this.$confirm(`此单是签约送优惠券订单， 因尚未${text} 本单将不会享受优惠券发放，确认要提交吗？`, this.$t('tips.tips'), {
              confirmButtonText: '确认提交',
              cancelButtonText: '取消提交',
              type: 'warning'
            }).then(() => {
              that.Financial_post_Set()
            }).catch(() => {

            })
        }
        else if(this.msg.HelpBranchId>-1){
          let that = this
          let brandName='确认是帮';
          this.companyList.forEach(item => {
            if(item.Id==this.msg.HelpBranchId){
              brandName+=item.BName;
            }
          });
          brandName+=  (this.$route.query.Type==1?'代收':'代付')+'此笔款项，请确认准确避免驳回';
          this.$confirm(brandName, this.$t('tips.tips'), {
              confirmButtonText: '确认提交',
              cancelButtonText: '取消提交',
              type: 'warning'
            }).then(() => {
              that.Financial_post_Set()
            }).catch(() => {

            })
        }
        else{
          this.Financial_post_Set()
        }

      },
      Financial_post_Set(){
        console.log(this.msg,'=====------msg')
        // return
        this.loading = true;
        this.apipost('Financial_post_Set', this.msg, res => {
          if (res.data.resultCode == 1) {
            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: 'addReceivablesDocuments',
                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(() => {
              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) { // 添加
        this.edit = false;
        let list = {};
        if (t == 2 && i) {
          list = JSON.parse(JSON.stringify(this.msg.detailList[i - 1]));
          this.detailList.Rate = list.Rate;
          this.msg.detailList.forEach((x, o) => {
            x.Rate = list.Rate ? list.Rate : x.Rate;
            this.Calculation(2, o + 1);
            this.Calculation(1);
          })
        } else {
          list = JSON.parse(JSON.stringify(this.detailList));
          this.detailList.Rate = list.Rate;
          this.msg.detailList.forEach((x, o) => {
            x.Rate = list.Rate ? list.Rate : x.Rate;
            this.Calculation(2, o + 1);
            this.Calculation(1);
          })
        }


        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
        this.msg.detailList.forEach(x => {
          allPrice = allPrice + parseFloat(x.bTotalPrice);
        })
        this.allPrice = allPrice;
        this.allPriceTo = this.$commonUtils.addCommas(Math.round(this.allPrice * 100) / 100)
        this.chinaAllPrice = this.$commonUtils.changeMoneyToChinese(this.allPrice)
        this.detailList = {
          ID: 0,
          UnitPrice: '',
          UnitPriceTo: '',
          Number: '',
          Rate: this.detailList.Rate,
          CostTypeId: '',
          CurrencyId: this.detailList.CurrencyId,
          Remark: '',
          CostTypeName: '',
          currenName: this.detailList.currenName,
          yTotalPrice: '',
          yTotalPriceTo: '',
          bTotalPrice: '',
          bTotalPriceTo: '',
          show: false,
          ybFee: 0,
          bbFee: 0,
        };
        if (this.shouxufei > 0) {
          this.shouxufeiJiSuan()
        }
        if (this.bankType == 12) {
          this.getcommission()
        }
        this.countFee();

      },
      getcommission() { //计算手续费 满足平台账户 而且是结算方式为百分比 SettlementType=1
        let obj = null
        for (let i = 0; i < this.accountList.length; i++) {
          let x = this.accountList[i]
          if (x.ID == this.msg.BankList[0].AccountId) {
            obj = {
              SettlementType: x.SettlementType,
              Commission: x.Commission
            }
            break
          }
        }
        let price = 0
        if (obj.SettlementType == 1) {
          if (this.msg.detailList && this.msg.detailList.length > 0) {
            this.msg.detailList.forEach(x => {
              if (Number(x.yTotalPrice) > 0) {
                price = price + Number(x.yTotalPrice)
              }
            })
          }
          this.msg.OriginalFee = Math.round((price * obj.Commission)) / 100;
        } else {
          this.msg.OriginalFee = 0
          this.msg.Fee = 0
        }
      },
      Calculation(t, i) { // 计算原币 本位币
        let numberC = 0;
        let price = 0;
        let rate = 0;
        if (this.edit == true) {
          this.msg.BankList[0].ybFee = this.GetDetail.OriginalFee;
          this.msg.BankList[0].bbFee = this.GetDetail.OriginalFee * this.GetDetail.BankList[0].Rate;
        }
        if (t == 2 && i) {
          this.msg.detailList[i - 1].ybFee = 0;
          this.msg.detailList[i - 1].bbFee = 0;
          numberC = parseFloat(this.msg.detailList[i - 1].Number);
          price = parseFloat(this.msg.detailList[i - 1].UnitPrice);
          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 (this.msg.BankList[0].Type == 2) {
              let id = this.msg.BankList[0].AccountId;
              this.accountList.forEach(x => {
                if (id == x.ID) {
                  let talPrice = 0;
                  this.msg.detailList.forEach(y => {
                    talPrice = talPrice + (parseFloat(y.Number) * parseFloat(y.UnitPrice))
                  });
                  let num = talPrice * (x.Commission / 100);
                  this.msg.BankList[0].ybFee = Math.round(num * 100) / 100;
                  if (!isNaN(rate)) {
                    let num = talPrice * (x.Commission / 100) * rate;
                    this.msg.BankList[0].bbFee = Math.round(num * 100) / 100;
                  } else {
                    this.msg.detailList[i - 1].bbFee = 0;
                  }
                }
              })
            }
            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 {
          this.detailList.ybFee = 0;
          this.detailList.bbFee = 0;
          numberC = parseFloat(this.detailList.Number);
          price = parseFloat(this.detailList.UnitPrice);
          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 (this.msg.BankList[0].Type == 2) {
              let id = this.msg.BankList[0].AccountId;
              this.accountList.forEach(x => {
                if (id == x.ID) {
                  let talPrice = 0;
                  if (this.msg.detailList.length > 0) {
                    this.msg.detailList.forEach(y => {
                      talPrice = talPrice + (parseFloat(y.Number) * parseFloat(y.UnitPrice))
                    });
                  }
                  talPrice = talPrice + (parseFloat(this.detailList.Number) * parseFloat(this.detailList.UnitPrice))
                  let num = talPrice * (x.Commission / 100);
                  this.msg.BankList[0].ybFee = Math.round(num * 100) / 100;
                  if (!isNaN(rate)) {
                    let num = talPrice * (x.Commission / 100) * rate;
                    this.msg.BankList[0].bbFee = Math.round(num * 100) / 100;
                  } else {
                    this.detailList.bbFee = 0;
                  }
                }
              })
            } else {
              this.msg.BankList[0].ybFee = 0;
              this.msg.BankList[0].bbFee = 0;
            }
            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);
            };
          }
        }
        this.msg.BankList[0].Fee = parseFloat(this.msg.BankList[0].ybFee);
        this.$forceUpdate();
      },
      chages() {
        this.$forceUpdate()
      },

      shouxufeiJiSuan: function () {
        let price = 0;
        this.msg.detailList.forEach(y => {
          price = price + y.bTotalPrice
        });
        this.msg.OriginalFee = Math.round((price * this.shouxufei) * 100) / 100;
      },
      getCostTypeName(i, t) { // 根据支出费用类型获取费用类型名称 列表展示用
        this.GetCostTypeList.forEach(x => {
          if (x.ID == i) {
            if (t >= 0) {
              this.msg.detailList[t].CostTypeName = x.Name;
            } else {
              this.detailList.CostTypeName = x.Name;
            }
          }
        })
      },
      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 => {})
      },
      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 => {
          this.loading = false;
          if (res.data.resultCode == 1) {
            let data = res.data.data;
            this.msg = JSON.parse(JSON.stringify(data));
            this.msg.SigningCustomerId = data.SigningCustomerId ? Number(data.SigningCustomerId) : ''
            this.msg.DepositCustomerId = data.DepositCustomerId ? Number(data.DepositCustomerId) : ''


            this.msg.TemplateId = data.TemplateId
            if(data.TemplateId==27&&data.Course_Name&&data.OrderID>0&&data.TCIDList&&data.TCIDList.length>0){
              this.msg.Course_Name = data.Course_Name
              this.msg.CourseId = data.Course_Name=='银行卡'?1:12
              this.msg.PayReceipt_No = data.PayReceipt_No
              this.getReceivablesAccount(this.msg.OrderID)
            }


            if (this.msg.DepositCustomerId) this.isDepositCustomer = true
            if (this.orderObj&&(this.msg.SigningCustomerId||this.msg.DepositCustomerId)) this.$set(this.orderObj, 'isPrestore', true)
            let obj = {
              AccountId: '',
              CurrencyId: '',
              Type: '',
              Fee: 0,
              ID: 0,
              ybFee: 0,
              bbFee: 0,
              Rate: 0,
            };
            this.msg.BankList.push(obj)
            this.msg.detailList = [];

            let userInfo = this.getLocalStorage()
            let ParentCompanyId = userInfo.ParentCompanyId;

            if(!this.$route.query.edit){
            this.msg.RB_Branch_Id = this.msg.RB_Branch_Id == 0 || this.msg.RB_Branch_Id == ParentCompanyId ? 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.$route.query.companyID) {
              this.msg.RB_Branch_Id = parseInt(this.$route.query.companyID);
            }
            this.admin_get_DepartmentGetList(this.msg.RB_Branch_Id);
            this.msg.RB_Depart_Id = this.msg.RB_Depart_Id ? this.getLocalStorage().RB_Department_Id : this.msg
              .RB_Depart_Id;
            this.FinancialFlowTemplate_post_GetProcessList(data.TemplateId);
            this.Financial_post_GetCostTypeList(data.TemplateId, 2);
            let allPrice = 0
            data.DetailList.forEach(x => {
              x.UnitPriceTo = this.$commonUtils.addCommas(Math.round(x.UnitPrice * 100) / 100);
              x.yTotalPrice = x.Number * x.UnitPrice;
              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) / 10;
              x.show = false;
              this.detailList.Rate = x.Rate
              this.msg.detailList.push(x);
              this.coinGetList.forEach(y => {
                if (y.ID == x.CurrencyId) {
                  x.currenName = y.Name;
                }
              })
              allPrice = allPrice + parseFloat(x.bTotalPrice);
            });
            this.allPrice = allPrice;
            this.allPriceTo = this.$commonUtils.addCommas(Math.round(data.Money * 100) / 100)
            this.chinaAllPrice = this.$commonUtils.changeMoneyToChinese(data.Money)
            this.BillName = data.CompanyName;
            this.BillSonName = data.FinanceName;
            this.bankType = data.BankList.length > 0 ? data.BankList[0].AccountTypeId : '';
            this.IsUploadPic = data.IsUploadPic;
            this.GetDetail = data;
            if (data.BankList.length > 0) {
              this.getAccountList(this.bankType);
              this.msg.BankList[0].AccountId = this.GetDetail.BankList.length > 0 ? this.GetDetail.BankList[0]
                .AccountId : '0';
              this.msg.BankList[0].ID = this.GetDetail.BankList[0].ID;
            }
            this.msg.TradeDate = this.msg.TradeDate.replace('年', '-').replace('月', '-').replace('日', '');
            this.msg.OrderID = data.OrderID;
            this.msg.OrderSource = 0;
            this.msg.TCID = data.TCID;
            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;

              // 用房手配费
              if(this.orderObj.Money){
                let orderObjMoney = this.$commonUtils.addCommas(Math.round(this.orderObj.Money * 100) / 100);
                let obj = {
                  ID: 0,
                  UnitPrice: this.orderObj.Money,
                  UnitPriceTo: orderObjMoney,
                  Number: 1,
                  Rate: 1,
                  CostTypeId: this.orderObj.CostType?this.orderObj.CostType:'',
                  CurrencyName: '',
                  CurrencyId: 0,
                  Remark: "",
                  CostTypeName: "用房手配费",
                  yTotalPrice: this.orderObj.Money,
                  yTotalPriceTo: orderObjMoney,
                  bTotalPrice: this.orderObj.Money,
                  bTotalPriceTo: orderObjMoney,
                  show: this.orderObj.Money2?true:false,
                  currenName: "",
                  ybFee: 0,
                  bbFee: 0
                }
                this.msg.detailList.push(obj)
              }
              // 房费送客手数料
              if(this.orderObj.Money2){
                let orderObjMoney2 = this.$commonUtils.addCommas(Math.round(this.orderObj.Money2 * 100) / 100);
                let obj2 = {
                  ID: 0,
                  UnitPrice: this.orderObj.Money2,
                  UnitPriceTo: orderObjMoney2,
                  Number: 1,
                  Rate: 1,
                  CostTypeId: this.orderObj.CostType2?this.orderObj.CostType2:'',
                  CurrencyName: '',
                  CurrencyId: 0,
                  Remark: "",
                  CostTypeName: "房费送客手数料",
                  yTotalPrice: this.orderObj.Money2,
                  yTotalPriceTo: orderObjMoney2,
                  bTotalPrice: this.orderObj.Money2,
                  bTotalPriceTo: orderObjMoney2,
                  show: this.orderObj.Money?false:true,
                  currenName: "",
                  ybFee: 0,
                  bbFee: 0
                }
                this.msg.detailList.push(obj2)
              }
              // if(this.orderObj.Money&&!this.orderObj.Money2){
              //   this.msg.CostTypeId = this.orderObj.CostType ? this.orderObj.CostType : '';
              //   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.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;

              this.msg.OtherType = this.orderObj.OtherType ? this.orderObj.OtherType : 0;

              if (!JSON.parse(sessionStorage.getItem("saveGuestInfo")) && !JSON.parse(sessionStorage.getItem(
                  "TipGuestList"))) {
                this.Description = this.orderObj.laRemark ? this.orderObj.laRemark : '';
              }
              if (this.orderObj != null && this.orderObj.OrderSource === 8 && this.orderObj.tipObj == 1) {
                let Description = "旅客名单：";
                let describeList = JSON.parse(sessionStorage.getItem("TipGuestList"));
                if (describeList) {
                  describeList.forEach(item => {
                    Description += item.GuestName + " ";
                  })
                  this.msg.Description = Description
                }
              }
            }
            if (this.Handmsg) {
              this.msg.OtherType = this.Handmsg.OtherType ? this.Handmsg.OtherType : 0;
            }
            if (data.VorcherInos) {
              data.VorcherInos.forEach(x => {
                x.Url = x.Content;
                this.saveMsg.push(x);
              })
            }
            if (this.msg.TCIDAndTCNUMList == null) {
              this.msg.TCIDAndTCNUMList = [];
            }
            if (this.$route.query.edit) {
              this.Description = data.Description
            }
            this.msg.URL = this.$route.query.path;
            this.msg.Cmd = this.$route.query.Cmd ? this.$route.query.Cmd : '';
            this.$forceUpdate();
            this.loading = false;
            if (this.$route.query.InPay) {
              this.msg.Type = this.$route.query.InPay;
            }
          } else {
            this.loading = false;
            this.$message.error(res.data.message);
          }
          this.AccountType_post_GetList();
        }, err => {})
      },
      admin_get_DepartmentGetList(Bid, T) { // 获取部门
        if (this.bankType) {
          this.getAccountList(this.bankType, 1)
        }
        this.msg.detailList.forEach(x => {
          x.Rate = ''
        })
        this.detailList.Rate = ''
        let isShow = true
        if (this.msg.RB_Branch_Id) {
          this.companyList.forEach(item => {
            if (this.msg.RB_Branch_Id == item.Id && item.StandardCurrencyId > 0) {
              this.StandardCurrencyId = item.StandardCurrencyId
              this.StandardCurrencyName = item.StandardCurrencyName
              isShow = false
            }
          })
        }
        if (isShow) {
          this.StandardCurrencyId = -1
          this.StandardCurrencyName = ''
        }
        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 => {})
      },
      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 => {},
        );
      },
      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;
          if (this.msg.RB_Branch_Id) {
            this.companyList.forEach(item => {
              if (this.msg.RB_Branch_Id == item.Id && item.StandardCurrencyId > 0) {
                this.StandardCurrencyId = item.StandardCurrencyId
                this.StandardCurrencyName = item.StandardCurrencyName
              }
            })
          }
          if (!Status) {
            let id = this.$route.query.id;
            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;
                  data.forEach(x => {
                    x.disabled = true;
                    BranchList.forEach(y => {
                      if (x.Id == y) {
                        x.disabled = false;
                      }
                    })
                  })
                  this.companyList = data;
                }
              }
            }, err => {})
          }
        }, err => {})
      },
    },
    created() {
      let that = this;
      this.tradeWay = this.$route.query.tradeWay ? this.$route.query.tradeWay : 0;
      this.platformAccount = this.$route.query.platformAccount ? this.$route.query.platformAccount : 0;
      // crm自动登陆传过来的参数
      if (this.$route.query.crmOrderObj) {
        this.crmOrderObj = JSON.parse(this.$route.query.crmOrderObj);
      } 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;
        if (this.orderObj && this.orderObj.Money) {
          // this.detailList.UnitPrice = this.orderObj.Money
        }
      }

      let TCID = (this.orderObj && this.orderObj.TCIDList && this.orderObj.TCIDList.length > 0) ? this.orderObj
        .TCIDList[0] : 0
      this.TCID = TCID

      this.Handmsg = this.$route.query.Handmsg ? JSON.parse(this.$route.query.Handmsg) : null;

      if (this.orderObj != null && this.orderObj.OrderSource === 8 && this.orderObj.tipObj == 1) {
        that.Description = "旅客名单：";
        that.describeList = JSON.parse(sessionStorage.getItem("TipGuestList"));
        if (that.describeList) {
          that.describeList.forEach(item => {
            that.Description += item.GuestName + " ";
          })
        }
      }
      //验证是否团队
      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;
        }
      }


    },
    mounted() {
      this.getCustomerIdList();
      let userInfo = this.getLocalStorage();
      this.department = userInfo.DepartName;
      this.emplyeeName = userInfo.emName;
      this.EmployeeId = userInfo.EmployeeId;
      this.DepartIDs = this.msg.RB_Depart_Id = userInfo.RB_Department_Id;
      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;
      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.IsUploadPic = this.$route.query.IsUploadPic;
      this.msg.Cmd = this.$route.query.Cmd ? this.$route.query.Cmd : '';
      this.getCompany();
      if (this.$route.query.edit) {
        this.edit = this.$route.query.edit;
        this.msg.FrID = this.$route.query.FrID;
        this.Financial_post_Get(parseInt(this.$route.query.FrID), 0);
        this.currentType = 1
        this.currentId = this.$route.query.FrID
      } else {
        this.msg.TemplateId = this.$route.query.id;
        this.BillName = userInfo.GroupName;
        this.BillSonName = this.$route.query.Name;
        this.FinancialFlowTemplate_post_GetProcessList(this.$route.query.id);
        this.currentType = 0;
        this.currentId = this.$route.query.id;
        this.Financial_post_Get(0, parseInt(this.$route.query.id));
        if(userInfo.RB_Department_Id==239 && this.$route.query.id==84){
          this.showSigningCustomer=true;
        }
      }
      if (this.$route.query.Conditon) {
        this.returnCode = this.$route.query.Conditon;
      }
      this.BankAccount_post_GetAccountType();
      // 跟团订单、当地游订单，获取订单客户签约信息
      if(this.orderObj&&this.orderObj.OrderID&&this.orderObj.OrderSource==8&&this.msg.TemplateId==27){
        this.getReceivablesAccount(this.orderObj.OrderID)
      }
    },
    components: {
      "my-FlowChartModule": myFlowChartModule,
      "TicketingModule": TicketingModule,
      OrderReceivablesAccount,
    }
  }

</script>
