<style scoped>
  /deep/.el-table th.el-table__cell {
    background-color: #E6E6E6;
  }

</style>

<template>
  <div class="page_RecPayQuery">
    <div class="query-box">
      <el-form class="_info_box clearfix" label-width="110px">
        <el-row style="padding:15px 20px 0 0;">
          <el-col :span="4">
            <el-form-item :label="$t('fnc.danhao')">
              <el-input clearable placeholder="" class="" v-model="msg.FrID" @keyup.native="checkInteger(msg,'FrID')">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="$t('objFill.v101.FinancialModule.shoupfgs')">
              <el-select filterable v-model='msg.KingdeeBranchId' :disabled="!isRB_Depart_Id" class="">
                <el-option v-for='item in GetHandFeeList' :label='item.BranchName' :value='item.BranchId'
                  :key='item.BranchId'>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="$t('sm.company')">
              <el-select filterable v-model='msg.RB_Branch_Id'>
                <el-option :value="-1" :label="$t('pub.unlimitedSel')"></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.feiyongleixing')">
              <el-select filterable v-model='msg.CostTypeID'>
                <el-option :value="0" :label="$t('pub.unlimitedSel')"></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.fkduixiang')">
              <el-select filterable v-model='msg.ClientID'>
                <el-option value="" :label="$t('pub.unlimitedSel')"></el-option>
                <el-option v-for='item in ClientAccountList' :label='item.AccountAlias' :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('pub.unlimitedSel')"></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>
          <template v-if="heightQueryBox"></template>
          <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> -->
              <StartDateLimit :clearable="false" :dateTime="productionDate" @change="(startDate,endDate)=>{msg.sDate=startDate,msg.eDate=endDate}"></StartDateLimit>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="$t('fnc.jiaoyiriqi')">
              <el-date-picker class="h34" v-model="transactionDate" @change="timeAdd(3)" type="daterange"
                value-format="yyyy-MM-dd">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <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="">
              <el-checkbox :true-label="-1" :false-label="0" v-if="msg.HandFeeFrId<=0" v-model="msg.HandFeeFrId" style="margin-right:2px ;">{{$t('objFill.v101.FinancialModule.zhikanwzd')}}</el-checkbox>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <ul class="clearfix">
        <li class="hight_query">
          <button class="hollowFixedBtn" @click="resetPageIndex()">{{$t('pub.searchBtn')}}</button>
          <button class="normalBtn" @click="DocumentMaking">{{$t('objFill.preparedocument')}}</button>
          <button class="normalBtn" @click="method5()">{{$t('visa.v_daochu')}}</button>
          <button class="normalBtn" @click="GoToDetails()">{{$t('objFill.v101.FinancialModule.mingxicx')}}</button>
        </li>
      </ul>
    </div>
    <!-- 统计版块 -->
    <div style="color: black;font-size: 17px;padding: 0 0 20px 10px;border-bottom: 1px solid #EBEEF5;">
      <span>{{$t('fnc.bwbzjine')}}:
        {{total.toFixed(2)}}
      </span>
      <span style="margin-left: 15px;">{{$t('objFill.v101.FinancialModule.daizhidje')}}:
        {{totalBW2.toFixed(2)}}
      </span>
      <span style="margin-left: 15px;">{{$t('objFill.v101.FinancialModule.yizhidje')}}:
        {{totalBW.toFixed(2)}}
      </span>
      <span style="margin-left: 15px;">{{$t('objFill.v101.FinancialModule.yuanbizje')}}:
        {{totalYB.toFixed(2)}}
      </span>
    </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.FinanceId" @close="handleClose([multipleSelection[index]])"
            :type="x.CostTypeId==1851?'warning':''">
            {{x.FinanceId}}/{{x.CurrencyName+':'+x.OriginalMoney}}
          </el-tag>
        </template>
        <template v-else>
          {{$t('fnc.no')}}
      </template>
      </div>
      <div style="margin-left: 20px;flex-shrink: 0;">
        {{$t('fnc.a_zongjine')}}:{{totalZD+totalZDFY}}
      </div>
    </div>
    <div class="_fnDm_content" v-loading='loading'>
      <el-table ref="multipleTable" :data="DataList" tooltip-effect="dark"
       style="width: 100%" row-key="FinanceId"
        @selection-change="handleSelectionChange">
        <el-table-column type="selection" :reserve-selection="true" :selectable="selectable" width="55">
        </el-table-column>
        <el-table-column prop="" :label="$t('sm.company')" width="120">
          <template slot-scope="scope">{{ scope.row.BranchName }}</template>
        </el-table-column>
        <el-table-column prop="FinanceId" :label="$t('fnc.danhao')" width="80">
          <template slot-scope="scope">
            <span style="cursor: pointer;color: #00C6FF;"
              @click="openDetails(scope.row)">{{ scope.row.FinanceId }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="CostTypeName" :label="$t('fnc.feiyongleixing')">
        </el-table-column>
        <el-table-column prop="" :label="$t('hotel.hotel_corrlelatition')" width="200">
          <template slot-scope="scope">
            <template v-if="scope.row.TCNUM">{{scope.row.TCNUM}}</template>
            <template v-if="scope.row.TCID">({{scope.row.TCID}})</template>
            <template v-if="!scope.row.TCNUM||!scope.row.TCID">-</template>
          </template>
        </el-table-column>
        <el-table-column prop="" :label="$t('fnc.fkduixiang')" show-overflow-tooltip>
          <template slot-scope="scope">
            <p>{{scope.row.AccountNumber}}</p>
          </template>
        </el-table-column>
        <el-table-column prop="TradeDate" :label="$t('fnc.jiaoyiriqi')" show-overflow-tooltip width="100">
          <template slot-scope="scope">
            <p>{{scope.row.TradeDate?scope.row.TradeDate:'-'}}</p>
          </template>
        </el-table-column>
        <el-table-column prop="CurrencyName" :label="$t('hotel.hotel_Currency')" width="80">
        </el-table-column>
        <el-table-column prop="OriginalMoney" :label="$t('objFill.originalamount')" width="100">
        </el-table-column>
        <el-table-column prop="Rate" :label="$t('hotel.hotel_CurrentRate')" width="80">
        </el-table-column>
        <el-table-column prop="Money" :label="$t('fnc.bwbjine')" width="100">
        </el-table-column>
        <el-table-column prop="" :label="$t('fnc.zdrenyuan')" width="100">
          <template slot-scope="scope">{{scope.row.CreateByName}}
            <p>{{scope.row.CreateDate}}</p>
          </template>
        </el-table-column>
        <el-table-column prop="Remark" :label="$t('pub.pubRemark')" show-overflow-tooltip></el-table-column>
        <el-table-column prop="" :label="$t('admin.admin_status')">
          <template slot-scope="scope">
            <span v-if="scope.row.Status==1" style="color: red;">{{$t('fnc.a_shezhong')}}</span>
            <span v-if="scope.row.Status==2" style="color: #2BB87C;">{{$t('visa.v_tongguo')}}</span>
            <span v-if="scope.row.Status==3" style="color: wheat">{{$t('fnc.bohui')}}</span>
            <span v-if="scope.row.Status==4" style="color: orange">{{$t('active.cl_zuofei')}}</span>
            <span v-if="scope.row.Status==5" style="color: #00C6FF">{{$t('fnc.a_cnzancun')}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="HandFeeFrId" :label="$t('objFill.v101.FinancialModule.guanldfd')" width="120">
          <template slot-scope="scope">
            <template v-if="scope.row.HandFeeFrId">{{scope.row.HandFeeFrId}}</template>
            <p v-else style="cursor: pointer;color: #00C6FF;"
              @click="isshezhiBox=true,shezhiMsg.FinanceId=scope.row.FinanceId">{{$t('objFill.v101.FinancialModule.shezhigl')}}</p>
          </template>
        </el-table-column>
        <el-table-column prop="" :label="$t('objFill.v101.FinancialModule.guanlspfsrd')" show-overflow-tooltip width="150">
          <template slot-scope="scope">
            {{scope.row.HandFeeIncomeFrId?scope.row.HandFeeIncomeFrId:'-'}}
          </template>
        </el-table-column>
      </el-table>
    </div>

    <el-dialog custom-class='w400' :title="$t('objFill.v101.FinancialModule.shoupeifzd')" :visible.sync="iszhidanBox" center>
      <template>
        <div style="color: black;font-size: 17px;padding: 0 0 10px 10px;border-bottom: 1px solid #EBEEF5;">
          <p>{{$t('objFill.v101.FinancialModule.yixuanzhong')}}{{multipleSelection.length}}{$t('objFill.v101.FinancialModule.tiaoshuju')}}</p>
          <p style="margin-top: 15px;" v-if="totalZD">{{$t('objFill.v101.FinancialModule.shoupfze')}}:
            {{totalZD.toFixed(2)}}
          </p>
          <p style="margin-top: 15px;" v-if="totalZDFY">{{$t('objFill.v101.FinancialModule.fanyongzje')}}:
            {{totalZDFY.toFixed(2)}}
          </p>
        </div>
        <div slot="footer" class="dialog-footer">
          <button class="hollowFixedBtn" @click="iszhidanBox=false">{{$t('pub.cancelBtn')}}</button>
          <el-button class="normalBtn" type="primary" @click="getMaking()"
          :loading="loadingStandard">{{$t('pub.sureBtn')}}</el-button>
        </div>
      </template>
    </el-dialog>
    <el-dialog custom-class='w400' :title="$t('objFill.v101.FinancialModule.shezspfgl')" :visible.sync="isshezhiBox" center>
      <template>
        <el-form label-width="120px" :model="shezhiMsg" :rules="rules" ref="shezhiMsg">
          <el-form-item :label="$t('objFill.v101.FinancialModule.guanlspfdh')" prop="HandFeeFrId">
            <el-input v-model="shezhiMsg.HandFeeFrId" :placeholder="$t('objFill.v101.FinancialModule.qingsrglspfdh')"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <button class="hollowFixedBtn" @click="isshezhiBox=false">{{$t('pub.cancelBtn')}}</button>
          <button class="normalBtn" type="primary" @click="setHandFeeFr()">{{$t('pub.sureBtn')}}</button>
        </div>
      </template>
    </el-dialog>
    <!-- 已选制单列表 -->
    <!--
        <template v-if="showDialog">
          <selectListData
            :BillMakingMsg="BillMakingMsg"
            :totalZD="totalZD"
            :totalBWZD="totalBWZD"
            :multipleSelection="multipleSelection"
            @success="showDialog=false,getPageList()"
            @close="showDialog=false"></selectListData>
        </template> -->
  </div>
</template>
<script>
  import myBill from "../FinancialSubmodule/BillModule.vue";
  import myrbvBill from "../FinancialSubmodule/ReceivablesModule.vue";
  import myhrBill from "../FinancialSubmodule/MergeBillModule.vue";
  import Vue from 'vue'
  import selectListData from "./components/selectListData";
  import StartDateLimit from '../../public/StartDateLimit.vue';
  export default {
    data() {
      return {
        loadingStandard: false,
        showDialog: false,
        shezhiMsg: {
          FinanceId: 0,
          HandFeeFrId: null
        },
        isshezhiBox: false,
        GetHandFeeList: [],
        multipleSelection: [],
        showID: false,
        active: 1,
        userId: 0,
        iszhidanBox: false,
        searchList: [],
        ClientAccountList: [], //付款对象
        msg: {
          FrID: '',
          CostTypeID: 0, //费用类型ID
          RB_Branch_Id: -1, //	公司ID
          sDate: '', //制单起始日期
          eDate: '',
          sTradeDate: '', //交易起始日期
          eTradeDate: '',
          QEndDate: '', //出团起始日期
          QStartDate: '',
          ClientID: '', //付款对象ID
          Status: '-1', //状态
          KingdeeBranchId: 0, //当前登录人的公司
          HandFeeFrId: 0,
        },
        isRB_Depart_Id: false,
        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,
        },
        zhuanMsg: {
          AuditEmId: null,
          WorkFlowId: 0,
        },
        //转交信息
        zhuanjiaoMsg: {
          CreateBy: '',
          FrIDList: []
        },
        DataList: [],
        GetFinancLogList: [],
        StatusList: [],
        accountList: [],
        CompanyList: [],
        productionDate: [],
        approvalDate: [],
        transactionDate: [],
        missionDate: [],
        GetCostTypeList: [],
        checkList: [],
        checkAllList: [],
        dateStart: '',
        dateEnd: '',
        dateArr: '',
        status: '1',
        type: '1',
        loading: false,
        LogLoading: false,
        currentPage: 1,
        total: 0,
        totalYB: 0,
        totalBW: 0,
        totalBW2: 0,
        totalZD: 0,
        totalBWZD: 0,
        totalZDFY: 0,
        totalBWZDFY: 0,
        ChineseStr: '',
        mathNumber: '',
        DepartIDs: '',
        tableData: [],

        heightQueryBox: false,
        BillMakingMsg: {
          OtherType: 0,
          StandardCurrencyName: "",
          Money: 0,
          IsUploadPic: 1,
        },
        rules: {
          HandFeeFrId: [{
            required: true,
            message: this.$t('objFill.v101.FinancialModule.qingsrglspfdh'),
            trigger: 'blur'
          }],
        }
      }
    },
    created() {
      if (this.$route.query.FrID) {
        this.msg.FrID = this.$route.query.FrID;
      }
      if (this.$route.query.HandFeeFrId) {
        this.msg.HandFeeFrId = this.$route.query.HandFeeFrId
      } else {
        let sDate = this.FormartDate(new Date(this.getBeforeDate(1)));
        let eDate = this.FormartDate(new Date(this.getBeforeDate(0)));
        this.productionDate = [sDate, eDate]
        this.msg.sDate = sDate;
        this.msg.eDate = eDate;
      }
    },
    components: {
      "my-Bill": myBill,
      "my-RVB-Bill": myrbvBill,
      selectListData,
      StartDateLimit
    },
    mounted() {
      let userInfo = this.getLocalStorage();
      let ActionMenuCode = userInfo.ActionMenuCode;
      if (ActionMenuCode.indexOf('F_Query_AllIncomPay') != -1 || ActionMenuCode.indexOf('S_CheckAllOrder') != -1) {
        this.isRB_Depart_Id = 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.userId = userInfo.EmployeeId;
      this.financeinfo_post_GetCostTypeList();
      this.getCompanyList(); //获取公司列表
      this.FinancialFlowTemplate_post_GetStatusList();
      this.getFKList() //付款对象
      this.GetHandFee() //手配费公司
    },
    methods: {
      //跳转到明细
      GoToDetails() {
        var path = "/HandFeeQuery";
        var params = {};
        this.OpenNewPage(path, params)
      },
      getMoney() {
        let Money = 0
        let totalZD = 0
        let totalBWZD = 0
        let totalZDFY = 0
        let totalBWZDFY = 0
        this.multipleSelection.forEach(x => {
          if(x.CostTypeId==1851){
            totalZDFY += (x.OriginalMoney * 100)
            totalBWZDFY += (x.Money * 100)
          }else{
            totalZD += (x.OriginalMoney * 100)
            totalBWZD += (x.Money * 100)
          }

        })
        if(totalZD){
          this.totalZD = totalZD / 100
          this.totalBWZD = totalBWZD / 100
        }
        if(totalZDFY){
          this.totalZDFY = totalZDFY / 100
          this.totalBWZDFY = totalBWZDFY / 100
        }
      },
      handleClose(rows) {
        if (rows) {
          rows.forEach(row => {
            this.$refs.multipleTable.toggleRowSelection(row);
          });
        }
        this.getMoney()
        // this.multipleSelection.splice(index,1)
      },
      // 单据详情
      openDetails(item) {
        let query = {
          id: item.FinanceId,
          blank: "y",
        };
        this.$router.push({
          path: "/FinancialDocumentsDetail",
          query
        });
      },
      // 设置手配费关联
      setHandFeeFr() {
        this.$refs['shezhiMsg'].validate((valid) => {
          if (valid) {
            this.apipost('Financial_post_SetFinanceHandFeeRelevance', this.shezhiMsg, res => {
              if (res.data.resultCode == 1) {
                this.isshezhiBox = false
                this.getPageList()
              } else {
                this.Error(res.data.message);
              }
            }, err => {})
          } else {
            return false;
          }
        });
      },
      DocumentMaking() {
        let ids = this.multipleSelection.map(x => {
          return x.FinanceId
        })
        if (ids.length == 0) {
          return this.$message.error(this.$t('objFill.v101.FinancialModule.qinggxxyzddsj'));
        }
        this.getMoney()
        if(this.totalZD){
          this.BillMakingMsg.Money = this.totalZD
          this.BillMakingMsg.CostType = 130
        }
        if(this.totalZDFY){
          this.BillMakingMsg.CostType2 = 1851
          this.BillMakingMsg.Money2 = this.totalZDFY
          // this.BillMakingMsg.hiddenAddType = true
        }
        this.iszhidanBox = true
        this.loadingStandard = true
        this.apipost('Financial_post_SetFinanceHandFeeCode', {
          FrIds: ids.join(',')
        }, res => {
          if (res.data.resultCode == 1) {
            this.BillMakingMsg.StandardCurrencyName = res.data.data
            this.loadingStandard = false
            // this.showDialog = true
          } else {
            this.Error(res.data.message);
          }
        }, err => {})

      },
      selectable(row, index) {
        if (!row.HandFeeIncomeFrId) {
          return true
        } else {
          return false
        }
      },
      handleSelectionChange(val) {
        this.multipleSelection = val;
        this.getMoney()
      },
      GetHandFee() {
        this.apipost(
          "handfee_post_GetHandFeeList", {
            BranchId: -1
          },
          res => {
            if (res.data.resultCode == 1) {
              this.GetHandFeeList = res.data.data;
              this.GetHandFeeList.forEach(x => {
                if (x.BranchId == this.msg.KingdeeBranchId) {
                  this.msg.KingdeeBranchId = x.BranchId
                }
              })
              if (this.msg.KingdeeBranchId <= 0) {
                this.msg.KingdeeBranchId = this.GetHandFeeList[0].BranchId
              }
              this.getPageList();
            }
          },
          err => {}
        );
      },
      //获取付款列表
      getFKList() {
        let msg = {
          ID: 0,
          Type: 0,
          ObjID: 0,
          CardNum: ''
        }
        this.apipost(
          "financeinfo_post_GetClientAccountList", msg,
          res => {
            if (res.data.resultCode == 1) {
              this.ClientAccountList = res.data.data;
            }
          }
        );
      },
      //设置转交
      getMaking() {
        if(!this.loadingStandard&&this.BillMakingMsg.StandardCurrencyName){
          this.iszhidanBox = false;
          this.makeAdocument(1)
        }
      },
      // 制作单据
      makeAdocument(num, StandardCurrencyName) {
        let type = 0
        if (num == 3) {
          type = 2
        } else {
          type = num
        }
        this.BillMakingMsg.OtherType = 71;
        let text = "";
        if (num == 1) {
          text = "收款";
        } else if (num == 2) {
          text = "付款";
        }
        let query = {
          blank: "y",
          tab: `新增${text}单据`,
          Name: 'PIC手配费月结收款单',
          Type: type,
          id: 271,
          orderObj: JSON.stringify(this.BillMakingMsg),
        };
        this.$router.push({
          path: "/addReceivablesDocuments",
          query
        });
        return
        this.$store.commit("ChoiceAddFinancialDocuments");
        this.$router.push({
          path: "/ChoiceAddFinancialDocuments",
          query
        });
      },
      resetPageIndex() { // 重置页码
        this.msg.pageIndex = 1;
        this.currentPage = 1;
        this.getPageList()
      },
      getPageList() { // 获取列表数据
        this.loading = true;
        this.apipost('Financial_post_GetFinanceHandFeeList', this.msg, res => {
          if (res.data.resultCode == 1) {
            let data = res.data.data
            this.total = 0;
            this.totalYB = 0
            this.totalBW = 0
            this.totalBW2 = 0
            this.DataList = data;
            this.DataList.forEach(x => {
              this.totalYB += x.OriginalMoney
              if (x.HandFeeIncomeFrId) {
                this.totalBW += x.OriginalMoney
              } else {
                this.totalBW2 += x.OriginalMoney
              }
              this.total += x.Money
            })
            this.loading = false;
          } else {
            this.loading = false;
            this.$message.error(res.data.message);
          }
        }, err => {})
      },
      method5() {
        let msg = JSON.parse(JSON.stringify(this.msg))
        let userInfo = this.getLocalStorage();
        msg.EmployeeId = userInfo.EmployeeId
        this.GetLocalFile("Financial_post_GetFinanceHandFeeListToExcel", msg, this.$t('objFill.v101.FinancialModule.shoupfdj')+".xls");
      },
      FinancialFlowTemplate_post_GetStatusList() { // 获取审核状态枚举
        this.apipost('FinancialFlowTemplate_post_GetStatusList', {}, res => {
          if (res.data.resultCode == 1) {
            this.StatusList = res.data.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 => {})
        }

      },
      getCompanyList() { //获取公司列表
        this.apipost('admin_get_BranchGetList', this.getCompanyMsg, res => {
          if (res.data.resultCode == 1) {
            this.CompanyList = res.data.data;
          } else {}
        }, err => {})
      },
      financeinfo_post_GetCostTypeList() { // 费用类型
        this.apipost('financeinfo_post_GetCostTypeList', {
          Name: '',
          type: 0,
          DepartIDs: this.DepartIDs
        }, res => {
          if (res.data.resultCode == 1) {
            this.GetCostTypeList = 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 == 2) { //审批日期
          if (!this.approvalDate) {
            this.dateStart = '';
            this.dateEnd = '';
            return
          }
          this.dateStart = this.approvalDate[0];
          this.dateEnd = this.approvalDate[1];
        }
        if (t == 3) { //交易日期
          if (!this.transactionDate) {
            this.msg.sTradeDate = '';
            this.msg.eTradeDate = '';
            return
          }
          this.msg.sTradeDate = this.transactionDate[0];
          this.msg.eTradeDate = this.transactionDate[1];
        }
        if (t == 4) { //发团日期
          if (!this.missionDate) {
            this.dateStart = '';
            this.dateEnd = '';
            return
          }
          this.msg.QStartDate = this.missionDate[0];
          this.msg.QEndDate = this.missionDate[1];
        }
      },

    }
  }

</script>