<style scoped>
  /deep/.el-table th.el-table__cell {
    background-color: #E6E6E6;
  }
  .el-form-item{
    margin-bottom:5px;
  }
</style>

<template>
  <div class="page_fnDm page_RecPayQuery" @keyup.enter="resetPageIndex()">
    <div class="query-box" style="margin-bottom: 0px;">
      <el-form class="_info_box clearfix" label-width="110px">
        <el-row style="padding:15px 10px 0 0;">
          <el-col :span="4">
            <el-form-item :label="$t('fnc.danhao')">
              <el-input placeholder="" class="" v-model="msg.FrID" @keyup.native="checkInteger(msg,'FrID')"
                maxlength="8"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="$t('scen.sc_temID')">
              <el-input v-model="msg.TCNUM" class=""></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="$t('objFill.settlementstatus')">
              <el-select v-model='msg.IsSelectAduiting'>
                <el-option v-for='item in SelectAduitingList' :label='item.Name' :value='item.Id' :key='item.Id'>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="$t('system.query_company')">
              <el-select filterable v-model='msg.RB_Branch_Id'
                @change="getDepartmentMsg.RB_Branch_Id=msg.RB_Branch_Id,msg.RB_Depart_Id='',msg.UpdateBy='',getDepartment()"
                class="">
                <el-option :value="-1" :label="$t('system.ph_buxian')"></el-option>
                <el-option v-for='item in CompanyList' :label='item.BName' :value='item.Id' :key='item.Id'>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="$t('fnc.zdrenyuan')">
              <el-select filterable v-model='msg.UpdateBy' class="">
                <el-option :value="0" :label="$t('system.ph_buxian')"></el-option>
                <el-option v-for='item in EmployeeList' :label='item.EmName' :value='item.EmployeeId'
                  :key='item.EmployeeId'>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="$t('fnc.djleixing')">
              <el-select filterable v-model='msg.Type' class="">
                <el-option key="-1" value="-1" :label="$t('system.ph_buxian')"></el-option>
                <el-option key="1" value="1" :label="$t('restaurant.res_income')"></el-option>
                <el-option key="2" value="2" :label="$t('restaurant.res_outcome')"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="$t('fnc.feiyongleixing')">
              <el-select filterable v-model='msg.CostTypeID'>
                <el-option :value="0" :label="$t('system.ph_buxian')"></el-option>
                <el-option v-for="item in GetCostTypeList" :key="item.ID" :value="item.ID" :label="item.Name">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="4">
              <el-form-item :label="$t('fnc.dxleixing')">
                <el-select filterable v-model='msg.ClientType'
                @change="ClaerClientAccountList(),msg.ClientID=''" class="">
                <el-option value="" :label="$t('pub.unlimitedSel')"></el-option>
                <el-option v-for='item in ClientTypeList' :label='item.Name' :value='item.ID' :key='item.ID'>
                </el-option>
              </el-select>
              </el-form-item>
            </el-col> -->
          <el-col :span="4">
            <el-form-item :label="$t('fnc.fkduixiang')">
              <el-select v-model="msg.ClientID" class="" filterable remote reserve-keyword
                :placeholder="$t('pub.PleaseKeyWords')" :remote-method="GetClientAccountListByKeyWord">
                <el-option value="" :label="$t('pub.unlimitedSel')"></el-option>
                <el-option v-for='item in ClientAccountList'
                  :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;">
                      <el-tag size="mini" v-if="item.Status==1">{{$t('pub.fressSel')}}</el-tag>
                    </span>
                  </div>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="$t('fnc.jine')">
              <div style="display: flex;flex-direction: row;flex-wrap: nowrap;">
                <div>
                  <el-input v-model="msg.sMoney" @keyup.native="checkPrice(msg,'sMoney')" style="width: 100%;">
                  </el-input>
                </div>
                <span style="padding: 0 10px;">-</span>
                <div>
                  <el-input v-model="msg.eMoney" @keyup.native="checkPrice(msg,'eMoney')" style="width: 100%;">
                  </el-input>
                </div>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="$t('fnc.zdriqi')">
              <el-date-picker class="h34" @change="timeAdd(1)" v-model="productionDate" type="daterange"
                value-format="yyyy-MM-dd">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="多单号分隔">
              <el-input placeholder="" class="" v-model="msg.FrIDs"></el-input>
            </el-form-item>
          </el-col>
          <template v-if="heightQueryBox">
            <el-col :span="6">
              <el-form-item :label="$t('scen.sc_ftTime')">
                <el-date-picker class="h34" v-model="missionDate" @change="timeAdd(4)" type="daterange"
                  value-format="yyyy-MM-dd">
                </el-date-picker>
              </el-form-item>
            </el-col>

            <el-col :span="4">
              <el-form-item :label="$t('fnc.mbleixing')">
                <el-select v-model="msg.TemplateIds" filterable>
                  <el-option value="" :label="$t('system.ph_buxian')"></el-option>
                  <el-option v-for='item in TemplateGetList' :label='item.Name' :value='item.Id' :key='item.Id'>
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item :label="$t('fnc.shzhuangtai')">
                <el-select filterable v-model='msg.Status' class="">
                  <el-option key="-1" value="-1" :label="$t('system.ph_buxian')"></el-option>
                  <el-option key="0" value="0" :label="$t('fnc.zancun')"></el-option>
                  <el-option key="1" value="1" :label="$t('fnc.a_shezhong')"></el-option>
                  <el-option key="2" value="2" :label="$t('visa.v_tongguo')"></el-option>
                  <el-option key="3" value="3" :label="$t('fnc.bohui')"></el-option>
                  <el-option key="4" value="4" :label="$t('active.cl_zuofei')"></el-option>
                  <el-option key="5" value="5" :label="$t('fnc.a_cnzancun')"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item :label="$t('OrderList.search.orderType')">
                <el-select filterable v-model='msg.OtherType' class="" :disabled="typeSystem">
                  <el-option key="0" value="0" :label="$t('system.ph_buxian')"></el-option>
                  <el-option key="63" value="63" :label="$t('active.cl_team')"></el-option>
                  <el-option key="61" value="61" :label="$t('hotel.hotel')"></el-option>
                  <el-option key="66" value="66" :label="$t('scen.sc_piao')"></el-option>
                  <el-option key="67" value="67" :label="$t('MarketingActi.car')"></el-option>
                  <el-option key="62" value="62" :label="$t('active.cl_qianzheng')"></el-option>
                  <el-option key="80" value="80" :label="$t('objFill.nipponcardealership')"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item :label="$t('OrderList.search.orderNum')">
                <el-input v-model="msg.ReFinanceId"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
            <el-form-item :label="$t('fnc.huikuanren')">
              <el-input placeholder="" class="" v-model="msg.RemitterName"></el-input>
            </el-form-item>
          </el-col>
            <el-col :span="4">
              <el-form-item :label="$t('fnc.fybumen')">
                <el-select filterable v-model='msg.RB_Depart_Id'
                  @change="employeeMsg.DepartmentId=msg.RB_Depart_Id,getEmployee(),msg.UpdateBy=''" class="">
                  <el-option :value="0" :label="$t('system.ph_buxian')"></el-option>
                  <el-option v-for='item in DepartmentList' :label='item.DepartmentName' :value='item.DepartmentID'
                    :key='item.DepartmentID'>
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item :label="$t('system.table_rank')">
                <el-select filterable v-model='msg.Sort'>
                  <el-option key="-1" value="-1" :label="$t('system.ph_buxian')"></el-option>
                  <el-option key="0" value="0" :label="$t('fnc.tuanqi')"></el-option>
                  <el-option key="1" value="1" :label="$t('fnc.hkriqi')"></el-option>
                  <el-option key="2" value="2" :label="$t('fnc.danhao')"></el-option>
                  <el-option key="3" value="3" :label="$t('fnc.jylshuihao')"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item :label="$t('objFill.remarkquery')">
                <el-input v-model="msg.Remark"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item :label="$t('objFill.dealershipcustomer')">
                <el-select filterable v-model='msg.JapanCarCustomerId'>
                  <el-option :value="0" :label="$t('system.ph_buxian')"></el-option>
                  <el-option v-for="item in JapanCarCustomerList" :key="item.Id" :value="item.Id"
                    :label="item.CustomerName"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="永乐车辆">
                <el-select filterable v-model='msg.JapanCarId'>
                  <el-option :value="0" :label="$t('system.ph_buxian')"></el-option>
                  <el-option v-for="item in JapanCarList" :key="item.Id" :value="item.Id"
                    :label="item.CarNo"></el-option>
                </el-select>
              </el-form-item>
            </el-col>

          </template>
        </el-row>
      </el-form>
      <ul class="clearfix">
        <li class="hight_query">
          <span style="font-size: 13px;color: red;cursor: pointer;">
            <em @click.stop="heightQueryBox=!heightQueryBox">{{$t('visa.v_gjchaxun')}} <i class="iconfont icon-gengduo"
                style="font-size: 12px;"></i></em>
          </span>
          <button class="hollowFixedBtn" @click="resetPageIndex()">{{$t('pub.searchBtn')}}</button>
          <button class="normalBtn" @click="method5()">{{$t('visa.v_daochu')}}</button>
          <button v-if="FinanceCreate" class="normalBtn" @click="GenerateDocuments()">{{$t('objFill.generatedocuments')}}</button>
        </li>
      </ul>
    </div>
    <div style="display: flex;flex-wrap: nowrap; padding: 10px;">
      <div style="display: flex;flex-wrap: wrap;">
        <span>{{$t('objFill.selecteddata')}}:</span>
        <template v-if="multipleSelection.length>0">
          <el-tag size="mini" closable style="margin-right: 5px;margin-bottom: 5px;"
            v-for="(x,index) in multipleSelection" :key="x.FrID" @close="handleClose([multipleSelection[index]])"
            :type="x.Type==2?'danger':'success'">
            {{x.FrID}}/
            <template v-for="(y,i) in x.DetailList">
              {{y.CostTypeName}}:{{y.OriginalMoney}} {{i!=(x.DetailList.length-1)?',':''}}
            </template>
          </el-tag>
        </template>
        <template v-else>
          {{$t('fnc.no')}}
        </template>
      </div>
      <div style="margin-left: 20px;flex-shrink: 0;">
        {{$t('fnc.a_zongjine')}}:{{getMoney()}}
      </div>
    </div>
    <div class="_fnDm_content" v-loading='loading'>
      <el-table ref="multipleTable" :data="DataList" tooltip-effect="dark" style="width: 100%" row-key="FrID"
        @selection-change="handleSelectionChange">
        <el-table-column type="selection" :selectable="selectable" width="55" :reserve-selection="true" />
        </el-table-column>
        <el-table-column :label="$t('fnc.danhao')" width="120">
          <template slot-scope="scope">
            <span style="cursor: pointer;color: #00C6FF;"
              @click="openDetails(scope.row.FrID)">{{ scope.row.FrID }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="name" :label="$t('fnc.djleixing')" width="120">
          <template slot-scope="scope">
            <span v-if="scope.row.Type==2" style="display: inline-block;
              padding: 2px 8px;
              color: white;
              background-color: #E95252;
              line-height: 16px;
              border-radius: 4px;">
              {{$t('restaurant.res_outcome')}}
            </span>
            <span v-if="scope.row.Type==1" style="display: inline-block;
              padding: 2px 8px;
              color: white;
              background-color: #2BB87C;
              line-height: 16px;
              border-radius: 4px;">
              {{$t('restaurant.res_income')}}
            </span>
            <span v-if="scope.row.Type==5" style="display: inline-block;
              padding: 2px 8px;
              color: white;
              background-color: #2BB87C;
              line-height: 16px;
              border-radius: 4px;">
              {{$t('fnc.yingshou')}}
            </span>
            <span v-if="scope.row.Type==6" style="display: inline-block;
              padding: 2px 8px;
              color: white;
              background-color: #E95252;
              line-height: 16px;
              border-radius: 4px;">
              {{$t('fnc.yingfu')}}
            </span>
            <el-tooltip class="item" effect="dark" :content="$t('ground.zjiatk')" placement="top">
              <span v-if="scope.row.OtherType == 1" style="width: 20px;
                  height: 20px;
                  display: inline-block;
                  border-radius: 50%;
                  text-align: center;
                  line-height:  20px;
                  color: #E95252;
                  border: 1px solid #E95252;
                  font-size: 12px;" class="zhuiClass">{{$t('objFill.chase')}}</span>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column prop="" :label="$t('hotel.hotel_corrlelatition')" show-overflow-tooltip width="200">
          <template slot-scope="scope">
            <template v-if="scope.row.TCIDAndTCNUMList.length>0">
              <p class="_TCIDAndTCNUMList" style="display: flex;">
                <span>{{$t('visa.v_tuanhao')}}:</span>
                <template v-if="scope.row.TCIDAndTCNUMList&&scope.row.TCIDAndTCNUMList.length>0">
                  <p><span v-for="(i,ix) in scope.row.TCIDAndTCNUMList">{{i.TCNUM}}({{i.TCID}}) <span
                        v-if="ix!=scope.row.TCIDAndTCNUMList.length-1">,</br></span></span></p>
                </template>
                <template v-else>
                  <span>{{$t('fnc.no')}}</span>
                </template>
              </p>
              <p v-if="scope.row.OrderID>0 && scope.row.OrderSource==8">{{$t('fnc.danhao')}}:<span
                  class="">{{scope.row.OrderID}}</span></p>
            </template>
            <template v-else-if="scope.row.OrderSource==8 && scope.row.TCIDAndTCNUMList.length==0">
              <p class="_TCIDAndTCNUMList">{{$t('tips.zwtqxinxi')}}</p>
            </template>
            <template v-else-if="scope.row.OrderSource==4 && scope.row.TCIDAndTCNUMList.length==0">
              <p class="_TCIDAndTCNUMList" style="text-decoration: underline;cursor: pointer;"
                @click="goTicketPage(rowData)">{{$t('fnc.jpbianhao')}}:{{scope.row.SourceID}}</p>
              <p style="margin-top: 5px;">
                {{$t('advmanager.v_line')}}:<span>{{scope.row.LineName?scope.row.LineName:$t('tips.jpswxzxianlu')}}</span>
              </p>
            </template>
            <template v-else-if="scope.row.OrderSource==9 && scope.row.TCIDAndTCNUMList.length==0">
              <p class="_TCIDAndTCNUMList">{{$t('fnc.gnjpqishu')}}:{{scope.row.Term}}</p>
            </template>
            <template v-else-if="scope.row.OrderSource==10 && scope.row.TCIDAndTCNUMList.length==0">
              <p class="_TCIDAndTCNUMList">{{$t('tips.qzcpbianhao')}}:{{scope.row.SourceID}}</p>
            </template>
            <template v-else-if="scope.row.OrderSource==0 || scope.row.OrderSource==null">
              <p class="_TCIDAndTCNUMList">{{ scope.row.BranchName }}-{{scope.row.DepartName}} </p>
            </template>
            <template v-else>
              <p class="_TCIDAndTCNUMList">{{$t('pub.noMsg')}}</p>
            </template>

            <template v-if="scope.row.OtherType>0&&scope.row.ReFinanceId2>0">
              <p v-if="scope.row.OtherType==66">
                <span>{{$t('objFill.admissionticketid')}}</span>
                <span>{{scope.row.ReFinanceId2}}</span>
              </p>
              <p v-else-if="scope.row.OtherType==67">
                <span>{{$t('objFill.vehicleid')}}</span>
                <span>{{scope.row.ReFinanceId2}}</span>
              </p>
              <p v-else-if="scope.row.OtherType==61">
                <span>{{$t('salesModule.HotelOrderNum')}}</span>
                <span>{{scope.row.ReFinanceId2}}</span>
              </p>
              <p v-else-if="scope.row.OtherType==80">
                <span>{{$t('objFill.impressioncarshopid')}}:</span>
                <span @click="ImpressionSingleDetails('CarDealerOrderOP',80,scope.row.ReFinanceId2)" style="cursor: pointer; color: #00C6FF">{{scope.row.ReFinanceId2}}</span>
              </p>
              <p v-else-if="scope.row.OtherType==83">
                <span>印象车行包车订单号:</span>
                <span @click="ImpressionSingleDetails('CarDealerOrderOP',83,scope.row.ReFinanceId2)" style="cursor: pointer; color: #00C6FF">{{scope.row.ReFinanceId2}}</span>
              </p>
            </template>
            <template v-else-if="scope.row.OrderSource>0&&scope.row.OrderID>0">
              <p v-if="scope.row.OrderSource==8">
                <span>{{$t('objFill.teamordernumber')}}</span>
                <span>{{scope.row.OrderID}}</span>
              </p>
              <p v-else-if="scope.row.OrderSource==10">
                <span>{{$t('objFill.visaordernumber')}}</span>
                <span>{{scope.row.OrderID}}</span>
              </p>
            </template>


          </template>
        </el-table-column>
        <el-table-column prop="" :label="$t('fnc.feiyongleixing')" show-overflow-tooltip width="150">
          <template slot-scope="scope">
            <template v-for="(s,si) in scope.row.CostTypeList">
              <span
                style="background-color: rgba(64,158,255,.1);display: inline-block;padding: 0 5px;height: 22px;line-height: 20px;font-size: 12px;color: #646464;border-radius: 4px;box-sizing: border-box;border: 1px solid rgba(64,158,255,.2);white-space: nowrap;margin-bottom: 4px;">{{s}}</span></br>
            </template>
          </template>
        </el-table-column>
        <el-table-column prop="" :label="$t('objFill.originalamount')" show-overflow-tooltip width="150">
          <template slot-scope="scope">
            {{scope.row.WBMoney?scope.row.WBMoney+'/'+scope.row.CurrencyName:''}}
          </template>
        </el-table-column>
        <el-table-column prop="" :label="$t('fnc.bwbjine')" show-overflow-tooltip width="150">
          <template slot-scope="scope">
            {{scope.row.Money}}
            <!-- <p style="line-height:20px" v-if="scope.row.Money>0">{{scope.row.Type==1?$t('fnc.yingshou'):$t('fnc.yingfu')}}:<span>{{scope.row.Money}}</span></p>
              <p style="line-height:20px" v-if="scope.row.PayMoney>0">{{scope.row.Type==1?$t('fnc.shishou'):$t('fnc.shifu')}}:<span>{{scope.row.PayMoney}}</span></p>
              <p v-if="scope.row.IsAdvanceFinance==1&&scope.row.MatchMoney>0" style="line-height:20px">{{$t('objFill.balanceout')}}:<span>{{scope.row.MatchMoney}}</span></p> -->
          </template>
        </el-table-column>
        <el-table-column prop="" :label="$t('fnc.fkduixiang')" show-overflow-tooltip>
          <template slot-scope="scope">
            <span
              style="color: gray">{{scope.row.Type==2?scope.row.ClientTypeName+':':$t('fnc.huikuanren')+':'}}</span><span>{{scope.row.RemitterName}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="" :label="$t('fnc.zdrenyuan')" show-overflow-tooltip width="170">
          <template slot-scope="scope">
            <div>{{scope.row.EmName}}</div>
            <div>{{scope.row.CreateDate}}</div>
          </template>
        </el-table-column>
        <el-table-column prop="" :label="$t('fnc.dqzhuangtai')" show-overflow-tooltip width="120">
          <template slot-scope="scope">
            <i v-if="scope.row.Status==1" class="iconfont icon-daiqueren" style="color: #4BCA81"></i>
            <i v-if="scope.row.Status==4" class="iconfont icon-yiquxiao" style="color: #4BCA81"></i>
            <i v-if="scope.row.Status==2" class="iconfont icon-yiqueren" style="color: #959595"></i>
            <i v-if="scope.row.Status==3" class="iconfont icon-shenhebohui" style="color: #E95252"></i>
            <i v-if="scope.row.Status==0" class="iconfont icon-zancun" style="color: #FF9C01"></i>
            <el-popover popper-class="detailsIT_Journal" width="250" trigger="click">
              <div style="height: auto;max-height: 220px;background-color: #FFFFFF;">
                <div class="changLog">
                  <p class="_log_t">{{$t('fnc.lcrizhi')}}</p>
                  <ul style="padding-left: 20px;max-height: 180px;overflow: auto;" v-if="GetFinancLogList"
                    v-loading='LogLoading'>
                    <li
                      style="border-left: 1px solid #E9E9E9;position: relative;padding-bottom: 10px;padding-left: 20px;padding-top: 10px;"
                      v-for="(log,li) in GetFinancLogList">
                      <span
                        style="background-color: #47BF8C;width: 7px;height: 7px;border-radius: 50%;display: inline-block;position: absolute;left: -4px;top: 19px;"></span>
                      <p> <span class="_color_blue">{{log.EmName}}</span> <span
                          class="fr changLog_time">{{log.UpdateDate}}</span> </p>
                      <p class="_dtel">{{log.StartValue}}</p>
                    </li>
                  </ul>
                  <ul v-else>
                    <li>{{$t('fnc.zwxgrizhi')}}</li>
                  </ul>
                </div>
              </div>
              <span slot="reference" class="text_d _font_init"
                @click="Financial_post_GetFinancLogList(scope.row.FrID)">{{scope.row.StatusStr}}</span>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="" :label="$t('objFill.relatedmonthlystatement')" show-overflow-tooltip width="120">
          <template slot-scope="scope">
            <span v-if="scope.row.ReFinanceId" style="cursor: pointer;color: #00C6FF;"
              @click="openDetails(scope.row.ReFinanceId)">{{ scope.row.ReFinanceId }}</span>
            <template v-else>-</template>
          </template>
        </el-table-column>
      </el-table>
      <div style="padding-bottom:15px">
        <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChanges"
          layout="total,sizes,prev, pager, next, jumper" :page-sizes="[8,20,50,70,100,200]" :page-size="msg.pageSize"
          :current-page.sync="currentPage" :total='total'>
        </el-pagination>
      </div>
    </div>
    <template v-if="showDialog">
      <selectListData :multipleSelection="multipleSelection" @close="showDialog=false"></selectListData>
    </template>
  </div>
</template>
<script>
  import Vue from 'vue'
  import selectListData from "./components/selectListData";
  export default {
    components: {
      selectListData
    },
    data() {
      return {
        showDialog: false,
        multipleSelection: [],
        SelectAduitingList: [{
            Name: this.$t('pub.unlimitedSel'),
            Id: '0'
          },
          {
            Name: this.$t('objFill.havealreadysettled'),
            Id: '1'
          },
          {
            Name: this.$t('objFill.unsettled'),
            Id: '2'
          },
        ],
        msg: {
          pageIndex: 1,
          pageSize: 8,
          FrID: '',
          sDate: '',
          eDate: '',
          Status: '-1',
          TemplateIds: '0',
          RB_Branch_Id: '',
          RB_Depart_Id: '',
          sTradeDate: '',
          eTradeDate: '',
          ClientType: '0',
          JapanCarCustomerId: 0,
          JapanCarId: 0,
          RemitterName: '',
          ClientID: '',
          sMoney: '',
          eMoney: '',
          CurrencyId: '0',
          CostTypeID: '',
          Conditon: '',
          TCNUM: '',
          TradeWay: '',
          Type: '-1',
          AccountType: '',
          ReFinanceId: 0,
          OtherType: '0',
          QEndDate: '',
          QStartDate: '',
          UpdateBy: '',
          IsFormRecPayQuery: '1',
          KJCostTypeId: 0,
          IsSelectKJSetCostType: 0,
          Remark: '', //备注查询
          Sort: '2',
          EmployeeId: '',
          IsSelectAduiting: '0',
        },
        getCompanyMsg: { // 公司
          RB_Group_Id: '0',
          Status: '0',
        },
        getDepartmentMsg: { // 部门
          RB_Group_Id: '',
          RB_Branch_Id: '',
          Status: 0,
          ParentId: -1,
          Tier: 0,
        },
        employeeMsg: { // 员工
          GroupId: '',
          BranchId: -1,
          DepartmentId: 0,
          PostId: 0,
          IsLeave: 0,
        },
        DataList: [],
        GetFinancLogList: [],
        StatusList: [],
        ClientAccountList: [],
        ClientTypeList: [],
        accountList: [],
        BranchAccountList: [],
        DepartmentList: [],
        EmployeeList: [],
        ConditionList: [],
        CompanyList: [],
        productionDate: [],
        transactionDate: [],
        missionDate: [],
        currencyTypeList: [],
        GetCostTypeList: [],
        TemplateGetList: [],
        AccList: [],
        dateStart: '',
        dateEnd: '',
        loading: false,
        LogLoading: false,
        currentPage: 1,
        total: 0,
        ChineseStr: '',
        DepartIDs: '',
        heightQueryBox: false,
        JapanCarCustomerList: [],
        JapanCarList: [],
        typeSystem: 0,
        FinanceCreate: false
      }
    },
    created() {
      if (this.$route.query.pageIndex) {
        this.msg.pageIndex = this.$route.query.pageIndex;
      }
      if (this.$route.query.FrID) {
        this.msg.FrID = this.$route.query.FrID;
      }
      if (this.$route.query.Type) {
        this.msg.Type = this.$route.query.Type + '';
      }
      if (this.$route.query.rec) {
        this.msg.AccountType = 15;
        this.msg.TradeWay = 4;
        this.getAccountList(this.msg.AccountType, this.msg.TradeWay)
        this.msg.BankID = this.$route.query.BankID;
        this.transactionDate[0] = this.$route.query.StartDate;
        this.transactionDate[1] = this.$route.query.StartDate;
        this.msg.sTradeDate = this.$route.query.StartDate;
        this.msg.eTradeDate = this.$route.query.StartDate;

        if (this.$route.query.BankID == '') {
          // 费用类型:机票折让费
          this.msg.CostTypeID = 197;
        }
      }
      if (this.$route.query.air) {
        this.msg.AccountType = 17;
        this.msg.TradeWay = 4;
        this.getAccountList(this.msg.AccountType, this.msg.TradeWay)
        this.msg.BankID = 20;
        this.transactionDate[0] = this.$route.query.StartDate;
        this.transactionDate[1] = this.$route.query.StartDate;
      }
    },
    mounted() {
      if (localStorage.typeSystem && localStorage.typeSystem == 1) this.typeSystem = localStorage.typeSystem
      if (this.typeSystem == 1) this.msg.OtherType = '80'
      let userInfo = this.getLocalStorage();
      let ActionMenuCode = userInfo.ActionMenuCode;
      if (ActionMenuCode.indexOf("F_Query_AllIncomPay") != -1) {
        this.FinanceCreate = true;
      }
      this.getCompanyMsg.RB_Group_Id = this.employeeMsg.GroupId = this.getDepartmentMsg.RB_Group_Id = userInfo
        .RB_Group_id; //集团ID
      this.DepartIDs = userInfo.RB_Department_Id;
      this.msg.EmployeeId = userInfo.EmployeeId;
      this.msg.FrID = this.$route.query.FrID ? this.$route.query.FrID : 0
      this.financeinfo_post_GetList();
      this.financeinfo_post_GetCostTypeList();
      this.FinancialFlowTemplate_post_GetList();
      this.getCompanyList();
      this.Financial_post_GetConditionList();
      this.getEmployee();
      this.getDepartment();
      this.Financial_post_GetBranchAccountList();
      this.financeinfo_post_GetClientTypeList();
      this.FinancialFlowTemplate_post_GetStatusList();
      this.getPageList();
      this.AccountType_post_GetList();
      this.GetJapanCarCustomerList();
      var that = this;
    },
    methods: {
      // 单项酒店订单
      ImpressionSingleDetails(path,OtherType,ReFinanceId) {
          if(OtherType == 80){
              this.$router.push({
                path: path,
                query: {
                  OrderId: ReFinanceId,
                  blank: 'y'
                }
              });
          }
          else if(OtherType == 83){
              this.$router.push({
                path: path,
                query: {
                  MainId: ReFinanceId,
                  blank: 'y'
                }
              });
          }
      },
      GetJapanCarCustomerList() { // 获取对象类型
        this.apipost('JapanCar_get_GetJapanCarCustomerList', {}, res => {
          if (res.data.resultCode == 1) {
            this.JapanCarCustomerList = res.data.data;
          }
        }, err => {})
        this.apipost('JapanCar_get_GetCarList', {keyWord:''}, res => {
          if (res.data.resultCode == 1) {
            this.JapanCarList = res.data.data;
          }
        }, err => {})
      },
      ClaerClientAccountList() {
        this.ClientAccountList = [];
      },
      handleClose(rows) {
        if (rows) {
          rows.forEach(row => {
            this.$refs.multipleTable.toggleRowSelection(row);
          });
        }
        // this.multipleSelection.splice(index,1)
      },
      // 单据详情
      openDetails(FrID) {
        let query = {
          id: FrID,
          blank: "y",
        };
        this.$router.push({
          path: "/FinancialDocumentsDetail",
          query
        });
      },
      selectable(row, index) {
        if (!this.DataList[index].ReFinanceId) {
          return true;
        } else {
          return false;
        }
      },
      handleSelectionChange(val) {
        this.multipleSelection = val;
      },
      // 数据筛选
      filterMethod(filters) {},
      handleSizeChange(val) {
        this.msg.pageSize = val
        this.msg.pageIndex = 1;
        this.getPageList();
      },
      handleCurrentChanges(val) {
        this.msg.pageIndex = val;
        this.getPageList();
      },
      AccountType_post_GetList() { //获取账户类型下拉
        this.apipost('AccountType_post_GetList', this.queryAccMsg, res => {
          if (res.data.resultCode == 1) {
            this.AccList = res.data.data;
          } else {
            this.$message.error(res.data.message);
          }
        }, err => {})
      },
      getPageList() { // 获取列表数据
        if (!this.msg.ClientID) this.msg.ClientID = "";
        if (!this.msg.ClientType) this.msg.ClientType = 0;
        if (!this.msg.CurrencyId) this.msg.CurrencyId = 0;
        if (!this.msg.CostTypeID) this.msg.CostTypeID = 0;
        if (this.msg.TemplateIds == '0') this.msg.TemplateIds = '';
        if (this.msg.RB_Branch_Id === '') this.msg.RB_Branch_Id = -1;
        if (!this.msg.RB_Depart_Id) this.msg.RB_Depart_Id = 0;
        if (!this.msg.UpdateBy) this.msg.UpdateBy = 0;
        if (!this.msg.TCID) this.msg.TCID = 0;
        if (!this.msg.ReFinanceId) this.msg.ReFinanceId = 0;
        if (!this.msg.OtherType) this.msg.OtherType = 0;
        if (!this.msg.Status) this.msg.Status = 0;
        if (!this.msg.FrID) this.msg.FrID = 0;
        if (!this.msg.Conditon) this.msg.Conditon = 1;
        if (!this.msg.TradeWay) this.msg.TradeWay = 0;
        if (!this.msg.AccountType) this.msg.AccountType = 0;
        if (!this.msg.KJCostTypeId) this.msg.KJCostTypeId = 0;
        if (!this.msg.IsSelectKJSetCostType) this.msg.IsSelectKJSetCostType = 0;
        this.loading = true;
        this.apipost('Financial_post_GetCostMonthALLPageList', this.msg, res => {
          if (res.data.resultCode == 1) {
            let data = res.data.data.pageData;
            let arrList = function (arr) {
              arr.forEach(x => {
                x._checked = true
                x._disabled = false
              })
            }
            arrList(data)
            let userInfo = this.getLocalStorage();
            data.forEach(x => {
              if (("," + userInfo.ActionMenuCode + ",").indexOf(',Finance_CreateByCareOf,') != -1) {
                x.isExchange = true
              } else {
                x.isExchange = false
              }
            })
            this.total = res.data.data.count;
            if (this.total == 0) {
              this.DataList = [];
            } else {
              this.DataList = data;
            }
            this.loading = false;
          } else {
            this.loading = false;
            this.$message.error(res.data.message);
          }
          // this.msg.TCID= this.msg.TCID==0?this.msg.TCID:'';
          // this.queryInfoInit();
          this.currentPage = parseInt(this.msg.pageIndex);
        }, err => {})
      },
      method5: function () {
        if (!this.msg.ClientID) this.msg.ClientID = "";
        if (!this.msg.ClientType) this.msg.ClientType = 0;
        if (!this.msg.CurrencyId) this.msg.CurrencyId = 0;
        if (!this.msg.CostTypeID) this.msg.CostTypeID = 0;
        if (this.msg.TemplateIds == '0') this.msg.TemplateIds = '';
        if (this.msg.RB_Branch_Id === '') this.msg.RB_Branch_Id = -1;
        if (!this.msg.RB_Depart_Id) this.msg.RB_Depart_Id = 0;
        if (!this.msg.UpdateBy) this.msg.UpdateBy = 0;
        if (!this.msg.TCID) this.msg.TCID = 0;
        if (!this.msg.OrderID) this.msg.OrderID = 0;
        if (!this.msg.Status) this.msg.Status = 0;
        if (!this.msg.FrID) this.msg.FrID = 0;
        if (!this.msg.Conditon) this.msg.Conditon = 1;
        if (!this.msg.TradeWay) this.msg.TradeWay = 0;
        if (!this.msg.AccountType) this.msg.AccountType = 0;
        if (!this.msg.KJCostTypeId) this.msg.KJCostTypeId = 0;
        if (!this.msg.IsSelectKJSetCostType) this.msg.IsSelectKJSetCostType = 0;
        let time = this.getBeforeDate(0, new Date().Format("yyyy-MM-dd"))
        var fileName = `${this.$t('objFill.monthlystatementofcosts')}${time}.xls`;
        this.GetLocalFile("Financial_get_GetCostMonthALLExport", this.msg, fileName);
      },
      financeRemove(id) { //作废
        this.$confirm(this.$t('tips.zuofeicaiwudan'), this.$t('tips.tips'), {
          confirmButtonText: this.$t('pub.sureBtn'),
          cancelButtonText: this.$t('pub.cancelBtn'),
          type: 'warning'
        }).then(() => {
          this.deletFinance(id)
        }).catch(() => {
          this.$message({
            type: 'info',
            message: this.$t('hotel.hotel_HasBeenCancelled')
          });
        });
      },
      deletFinance(id) {
        this.apipost('Financial_post_Cancel', {
          ID: id
        }, res => {
          if (res.data.resultCode == 1) {
            this.$message.success(res.data.message)
          } else {
            this.$message.error(res.data.message)
          }
          this.getPageList();
        }, err => {})
      },
      Financial_post_GetFinancLogList(id) { // 获取单据日志
        this.LogLoading = true;
        this.apipost('Financial_post_GetFinancLogList', {
          ID: id,
          Type: 2
        }, res => {
          if (res.data.resultCode == 1) {
            let data = res.data.data;
            data.forEach(x => {
              x.UpdateDate = this.$commonUtils.formatMsgTime(x.UpdateDate)
            })
            this.LogLoading = false;
            this.GetFinancLogList = data;
          }
        }, err => {})
      },
      mathMoney(n) { // 数字转中文大写 1
        this.ChineseStr = this.$commonUtils.changeMoneyToChinese(n)
      },
      FinancialFlowTemplate_post_GetStatusList() { // 获取审核状态枚举
        this.apipost('FinancialFlowTemplate_post_GetStatusList', {}, res => {
          if (res.data.resultCode == 1) {
            this.StatusList = res.data.data;
          }
        }, err => {})
      },
      financeinfo_post_GetClientTypeList() { // 获取对象类型
        this.apipost('financeinfo_post_GetClientTypeList', {}, res => {
          if (res.data.resultCode == 1) {
            this.ClientTypeList = res.data.data;
          }
        }, err => {})
      },
      GetClientAccountListByKeyWord(query) {
        if (query !== '') {
          // 获取对象类型
          let msg = {
            Type: 0,
            ObjID: 0,
            CardNum: "",
            IsAll: true,
            KeyWord: query,
          };
          this.apipost(
            "financeinfo_post_GetClientAccountList",
            msg,
            res => {
              if (res.data.resultCode == 1) {
                let data = res.data.data;

                this.ClientAccountList = data;
              }
            },
            err => {}
          );
        }
      },

      getAccountList(i, t) { //收款账户
        let accountList = [];
        if (t == 1) { // 银行
          this.apipost('bankaccount_post_GetList', {
            TypeId: i
          }, res => {
            if (res.data.resultCode == 1) {
              let data = res.data.data;
              data.forEach(x => {
                let obj = {
                  ID: x.ID,
                  Name: x.Alias,
                  Nom: 0,
                }
                accountList.push(obj)
              })
              this.accountList = accountList;
            }
          }, err => {})
        }
        if (t == 2) { //平台账户
          let msg = {
            BackId: 0,
            TypeId: i,
            BranchId: -1,
            Alias: ''
          }
          this.apipost('BankAccount_post_GetPlatformList', msg, res => {
            if (res.data.resultCode == 1) {
              let data = res.data.data;
              data.forEach(x => {
                let obj = {
                  ID: x.ID,
                  Name: x.Alias,
                  Nom: x.PlatformNo
                }
                accountList.push(obj)
              })
              this.accountList = accountList;
            }
          }, err => {})
        }
        if (t == 3) { //现金账户
          let msg = {
            TypeId: i,
            BranchId: -1,
            Alias: ''
          }
          this.apipost('BankAccount_post_GetCashAccountList', msg, res => {
            if (res.data.resultCode == 1) {
              let data = res.data.data;
              data.forEach(x => {
                let obj = {
                  ID: x.ID,
                  Name: x.Alias,
                  Nom: 0
                }
                accountList.push(obj)
              })
              this.accountList = accountList
            }
          }, err => {})
        }
        if (t == 4) { //资金池账户
          let msg = {
            TypeId: i,
            BranchId: -1,
            Alias: ''
          }
          this.apipost('BankAccount_post_GetCashPoolList', msg, res => {
            if (res.data.resultCode == 1) {
              let data = res.data.data;
              data.forEach(x => {
                let obj = {
                  ID: x.ID,
                  Name: x.Alias,
                  Nom: 0
                }
                accountList.push(obj)
              })
              this.accountList = accountList
            }
          }, err => {})
        }

      },
      Financial_post_GetBranchAccountList() { //获取交易方式列表
        this.apipost('Financial_post_GetBranchAccountList', {}, res => {
          if (res.data.resultCode == 1) {
            this.BranchAccountList = res.data.data;
          }
        }, err => {})
      },
      getDepartment() { //部门
        this.apipost('admin_get_DepartmentGetList', this.getDepartmentMsg, res => {
          if (res.data.resultCode == 1) {
            this.DepartmentList = res.data.data;
          }
        }, err => {})
      },
      getEmployee() { //员工
        this.apipost('admin_get_EmployeeGetList', this.employeeMsg, res => {
          if (res.data.resultCode == 1) {
            this.EmployeeList = res.data.data;
          }
        }, err => {})
      },
      getCompanyList() { //获取公司列表
        this.apipost('admin_get_BranchGetList', this.getCompanyMsg, res => {
          if (res.data.resultCode == 1) {
            this.CompanyList = res.data.data;
          } else {}
        }, err => {})
      },
      Financial_post_GetConditionList() { //获取财务单据枚举列表
        this.apipost('Financial_post_GetConditionList', {}, res => {
          if (res.data.resultCode == 1) {
            this.ConditionList = res.data.data;
          } else {}
        }, err => {})
      },
      financeinfo_post_GetList() { // 币种类型
        this.apipost('financeinfo_post_GetList', {
          Name: ''
        }, res => {
          if (res.data.resultCode == 1) {
            this.currencyTypeList = res.data.data;
          } else {

          }
        }, err => {})
      },
      financeinfo_post_GetCostTypeList() { // 费用类型
        this.apipost('financeinfo_post_GetCostTypeList', {
          Name: '',
          type: 0,
          DepartIDs: this.DepartIDs,
          IsBalanceOfTheQuery: 1
        }, res => {
          if (res.data.resultCode == 1) {
            this.GetCostTypeList = res.data.data;
          } else {

          }
        }, err => {})
      },
      FinancialFlowTemplate_post_GetList() { // 单据类型
        this.apipost('Financial_post_GetList', {}, res => {
          if (res.data.resultCode == 1) {
            this.TemplateGetList = res.data.data;
          } else {

          }
        }, err => {})
      },
      timeAdd(t) { // 日期格式
        if (t == 1) { //制单日期
          if (!this.productionDate) {
            this.msg.sDate = '';
            this.msg.eDate = '';
            return
          }
          this.msg.sDate = this.productionDate[0];
          this.msg.eDate = this.productionDate[1];
        }
        if (t == 4) { //发团日期
          if (!this.missionDate) {
            this.dateStart = '';
            this.dateEnd = '';
            return
          }
          this.msg.QStartDate = this.missionDate[0];
          this.msg.QEndDate = this.missionDate[1];
        }
      },
      queryInfoInit() { // 初始化msg
        let msg = {
          pageIndex: this.msg.pageIndex,
          pageSize: 6,
          FrID: this.msg.FrID == 0 ? '' : this.msg.FrID,
          sDate: this.msg.sDate,
          eDate: this.msg.eDate,
          Status: this.msg.Status,
          TemplateIds: this.msg.TemplateIds,
          RB_Branch_Id: this.msg.RB_Branch_Id,
          RB_Depart_Id: this.msg.RB_Depart_Id,
          UpdateBy: this.msg.UpdateBy,
          sTradeDate: this.msg.sTradeDate,
          eTradeDate: this.msg.eTradeDate,
          ClientType: this.msg.ClientType,
          RemitterName: this.msg.RemitterName,
          ClientID: this.msg.ClientID,
          sMoney: this.msg.sMoney,
          eMoney: this.msg.eMoney,
          CurrencyId: this.msg.CurrencyId,
          CostTypeID: this.msg.CostTypeID,
          Conditon: this.msg.Conditon,
          TCNUM: this.msg.TCNUM == 0 ? "" : this.msg.TCNUM,
          TradeWay: this.msg.TradeWay == 0 ? "" : this.msg.TradeWay,
          Type: this.msg.Type,
          AccountType: this.msg.AccountType == 0 ? '' : this.msg.AccountType,
          QEndDate: this.msg.QEndDate,
          QStartDate: this.msg.QStartDate,
          OrderID: this.msg.OrderID == 0 ? '' : this.msg.OrderID,
          Sort: this.msg.Sort,
          EmployeeId: this.msg.EmployeeId,
          KJCostTypeId: this.msg.KJCostTypeId == 0 ? '' : this.msg.KJCostTypeId,
          IsSelectKJSetCostType: this.msg.IsSelectKJSetCostType == 0 ? '' : this.msg.IsSelectKJSetCostType,
        }
        this.msg = msg;
      },
      handleCurrentChange(val) { //翻页
        this.msg.pageIndex = val;
        this.getPageList();
      },
      resetPageIndex() { // 重置页码
        this.msg.pageIndex = 1;
        this.currentPage = 1;

        this.getPageList()
      },
      getMoney() {
        let Money = 0
        this.multipleSelection.forEach(x => {
          x.DetailList.forEach(y => {
            if (y.CostTypeId != 114) {
              Money += (y.OriginalMoney * 100)
            }
          })

        })
        return Money / 100
      },
      GenerateDocuments() {
        if (this.multipleSelection.length == 0) {
          this.Error(this.$t('objFill.pleaseselectdocuments'));
          return;
        }
        this.showDialog = true
        return
        let ids
        ids = this.multipleSelection.map(x => {
          return x.FrID
        })
        let orderObj = {
          CostType: 1547,
          OtherType: 75,
          Money: this.getMoney(),
          isVerifyMoney: true,
          ReFinanceIds: ids.join(','), //单号
          ReFinanceId2: 3, //成本

        }
        this.$confirm(`${this.$t('ObjFill.theorderselected')}:${ids.join(',')},
        ${this.$t('fnc.a_zongjine')}:${orderObj.Money},
        ${this.$t('objFill.whethertocontinueorder')}`, this.$t('tips.tips'), {
            confirmButtonText: this.$t('pub.sureBtn'),
            cancelButtonText: this.$t('pub.cancelBtn'),
            type: "warning"
          })
          .then(() => {
            this.$refs.multipleTable.clearSelection();
            this.$router.push({
              name: 'ChoiceAddFinancialDocuments',
              query: {
                'Type': 2,
                'searchTitle': this.$t('objFill.monthlypayment'),
                'blank': 'y',
                'orderObj': JSON.stringify(orderObj),
              }
            });
          })
      }
    }
  }

</script>