<style>
  .page_iisMgdetail {
    width: 830px;
    background-color: white;
    padding: 10px;
    position: relative;
  }

  .page_iisMgdetail>p {
    font-size: 18px;
    text-align: center;
    padding-bottom: 15px;
  }

  .page_iisMgdetail p.iisMgdetail_status {
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 14px;
  }

  .page_iisMgdetail .page_iisMgdetail_table {
    width: 100%;
    font-size: 14px;
    text-align: center;
  }

  .page_iisMgdetail .page_iisMgdetail_table td {
    padding: 10px;
  }

  .page_iisMgdetail .page_iisMgdetail_table .page_iisMgdetail_bank td._bank_td {
    width: 679px;
  }

  .iis_save {
    text-align: right;
    padding: 10px 0 0 0;
  }

  .page_iisMgdetail .page_iisMgdetail_table tr td.font-weight {
    font-weight: 800;
  }

  .page_iisMgdetail .cursorpointer {
    text-decoration: underline;
  }

  .page_iisMgdetail .imd_img_box {
    position: absolute;
    right: -400px;
    top: 0;
    width: 400px;
    /* background-color: #eaeaea; */
  }

  .page_iisMgdetail .imd_img_box .querenhan,
  .page_iisMgdetail .bg_white {
    background-color: white;
  }

  .page_iisMgdetail .imd_img_box .querenhan {
    margin-top: 50px;
  }

  .page_iisMgdetail .imd_img_box .querenhan>p {
    padding: 10px 25px 15px 25px;
    font-size: 14px;
  }

  .page_iisMgdetail_red {
    color: #FF0000;
  }

  .page_iisMgdetail_blue {
    color: #0000FF;
  }

  .page_iisMgdetail_green {
    color: #008000;
  }

  .page_iisMgdetail_black {
    color: #000000;
  }

  .page_iisMgdetail ._fujian_zhankai {
    color: white;
    width: 64px;
    height: 0;
    font-size: 12px;
    border-top: 26px solid #E95252;
    border-right: 15px solid transparent;
    border-left: 15px solid transparent;
    -webkit-transform: rotate(-90deg);
    transform: rotate(-90deg);
    position: relative;
    left: -18px;
    bottom: -27px;
  }

  .page_iisMgdetail ._fujian_zhankai>span {
    display: inline-block;
    height: 100%;
    width: 50%;
    position: absolute;
    left: 25px;
    bottom: 15px;
    -webkit-transform: rotate(90deg);
    transform: rotate(90deg);
  }

  .page_iisMgdetail ._fujian_zhankai>span:nth-child(2) {
    left: 18px;
    bottom: 3px;
  }

  .page_iisMgdetail ._fujian_box_tit {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #333333;
  }

  .page_iisMgdetail ._fujian_box_tit .iconfont {
    font-size: 14px;
    display: inline-block;
    margin-right: 8px;
  }

  .page_iisMgdetail ._fujian_box_tit .iconfont.icon-bangdingzhagnhuxinxi {
    color: #E95252;
  }

  .page_iisMgdetail ._fujian_box_tit .iconfont.icon-gengduo {
    transform: rotate(90deg);
    font-size: 12px;
  }

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

  .page_iisMgdetail ._wenjian {
    padding: 15px;
    width: 91px;
    height: 80px;
    border: 1px solid rgba(221, 221, 221, 1);
    float: left;
    cursor: pointer;
    margin-right: 10px;
    margin-top: 10px;
  }

  .page_iisMgdetail ._wenjian_P {
    font-size: 30px;
    text-align: center;
    color: #41D2A1;
  }

  .page_iisMgdetail .el-carousel__item {
    align-items: center;
    justify-content: center;
    display: flex;
  }

  .page_iisMgdetail ._addUpload_tips {
    margin-top: 20px;
    font-size: 12px;
    color: #999999;
  }

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

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

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

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

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

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

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

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

  .page_iisMgdetail .el-upload-dragger {
    font-size: 28px;
    color: #8c939d;
    width: 126px;
    height: 80px;
    line-height: 41px;
    text-align: center;
  }

</style>
<template>
  <div class="page_iisMgdetail" v-loading="loading">
    <p>{{$t('ios.fpkjsqdan')}} </p>
    <p class="iisMgdetail_status">
      <span v-if="detail.InvoiceApplyState === 1" class="page_iisMgdetail_green">{{$t('salesModule.Appling')}}</span>
      <span v-if="detail.InvoiceApplyState === 2" class="page_iisMgdetail_black">{{$t('pub.cancelBtn')}}</span>
      <span v-if="detail.InvoiceApplyState === 3" class="page_iisMgdetail_green">{{$t('visa.v_tongguo')}}</span>
      <span v-if="detail.InvoiceApplyState === 4" class="groupTourOrder_tickets_red">{{$t('visa.v_jujue')}}</span>
      <span v-if="detail.InvoiceApplyState === 5" class="groupTourOrder_tickets_red">{{$t('objFill.v101.FinancialModule.qianpiao')}}</span>
      <span v-if="detail.InvoiceApplyState === 6" class="page_iisMgdetail_blue">{{$t('objFill.v101.FinancialModule.fapiaozh')}}</span>
    </p>
    <table data-v-ca5157c2 border="1" class="page_iisMgdetail_table" style="border-collapse: collapse;">
      <tr>
        <td width="130">{{$t('ios.bumen')}}</td>
        <td v-if="detail.Type && detail.Type==1" width="220">{{detail.deptName}}</td>
        <td v-else>{{detail.deptName}}</td>
        <td width="130">{{$t('ios.sqren')}}</td>
        <td>{{detail.CreateBy}}</td>
      </tr>
      <tr>
        <td>{{$t('ios.kjjine')}}</td>
        <td>
          {{detail.ApplyMoney}}
        </td>
        <td>{{$t('ios.dzjine')}}</td>
        <td @click="goSaleFinacial" class="cursorpointer">
          <!---团队发票-->
          <template v-if="detail.InvoiceApplyType&&detail.InvoiceApplyType==1">
            {{orderList.moneyStr}}
          </template>
          <template v-else>
            {{detail.Income}}
          </template>
        </td>
      </tr>
      <tr v-if="!(detail.Type && detail.Type==1)">
        <td>{{$t('fnc.yszonge')}}</td>
        <td class="w600  font-weight cursorpointer">
          <span @click="goUrlO(detail.OrderId)">{{detail.PreferPrice}}</span>
        </td>
        <td>{{$t('Operation.Op_daishou')}}</td>
        <td class="w600  font-weight cursorpointer">
          <span @click="goUrlO(detail.OrderId)">{{detail.DueInMoney}}</span>
        </td>
      </tr>
      <tr class="page_iisMgdetail_bank">
        <td>{{$t('ios.dzyinhang')}}</td>
        <td colspan="3" class="_bank_td">
          {{orderList.AccountNumber}}
        </td>
      </tr>
      <tr>
        <td>{{$t('ios.sqriqi')}}</td>
        <td>
          {{detail.CreateDateStr}}
        </td>
        <td>已开票金额</td>
        <td><el-tooltip class="item" effect="dark" content="财务审核通过的发票总额" placement="top">
     <span> {{detail.PassMoney}}</span>
    </el-tooltip>
        </td>
      </tr>
      <tr>

        <td >{{$t('ios.dzriqi')}}</td>
        <td colspan="3">
          {{orderList.TradeDateStr}}
        </td>
      </tr>
      <tr v-if="!(detail.Type && detail.Type==1)">
        <template v-if="$route.query.InvoiceApplyType&&$route.query.InvoiceApplyType!=4">
          <td>{{$t('ios.tuanhao')}}</td>
          <td class="text-align-left font-weight cursorpointer" @click="goUrlT('productQuery', detail.TCNUM, '产品查询')">
            {{detail.TCNUM}}({{detail.TCID}})
          </td>
        </template>
        <td>{{$t('ios.ddanhao')}}</td>
        <td class="text-align-left font-weight cursorpointer"
          :colspan="$route.query.InvoiceApplyType&&$route.query.InvoiceApplyType==4?3:0">
          <span @click="goUrlO(detail.OrderId)">{{detail.OrderId}}</span>
        </td>
      </tr>

      <tr v-if="detail.Type && detail.Type==1">
        <td>{{$t('ios.cwdanju')}}</td>
        <td colspan="3">
          <table>
            <tr>
              <td>序号</td>
              <td>财务单号</td>
              <td>订单号</td>
              <td>团号</td>
              <td>申请金额</td>
              <td>当前手续费</td>
            </tr>
            <tr v-for="(qitem,qindex) in batchOrder">
              <td>{{qindex+1}}</td>
              <td>{{qitem.FrID}}</td>
              <td><span class="cursorpointer" @click="goUrlSFD('SalesFinancialDetail', '销售财务单据', qitem.OrderID, qitem.TCIDAndTCNUMList[0].TCNUM, qitem.TCIDAndTCNUMList[0].TCID)">{{qitem.OrderID}}</span></td>
              <td><p><span v-for="(i,ix) in qitem.TCIDAndTCNUMList">{{i.TCNUM}}（{{i.TCID}}）</span></p></td>
              <td>{{qitem.Money}}</td>
              <td>{{qitem.Fee}}</td>
            </tr>
          </table>
        </td>
      </tr>
      <tr v-else>
        <td>{{$t('ios.cwdanju')}}</td>
        <td colspan="3" class="w600 text-align-left font-weight cursorpointer">
          <template v-for="(item,index) in orderList.FrIDs">
            <span :key="index+10000"
              @click="goUrlSFD('SalesFinancialDetail', '销售财务单据', detail.OrderId, detail.TCNUM, detail.TCID)">{{item+(index<(orderList.FrIDs.length-1)?",":"")}}</span>
          </template>
          <span v-if="orderList.FrIDs && orderList.FrIDs.length<1">{{$t('ios.zanwu')}}</span>
        </td>
      </tr>
      <tr>
        <td rowspan="6">{{$t('ios.kjneirong')}}</td>
        <td>{{$t('admin.admin_company')}}</td>
        <td colspan="2" class="font-weight">
          {{detail.CompanyName}}
        </td>
      </tr>
      <tr>
        <td>{{$t('ios.shuihao')}}</td>
        <td colspan="2" class="font-weight">
          {{detail.DutyParagraph}}
        </td>
      </tr>
      <tr>
        <td>{{$t('admin.admin_address')}}</td>
        <td colspan="2">
          {{detail.Address}}
        </td>
      </tr>
      <tr>
        <td>{{$t('hotel.table_tel')}}</td>
        <td colspan="2">
          {{detail.CompanyPhone}}
        </td>
      </tr>
      <tr>
        <td>{{$t('ios.khuhang')}}</td>
        <td colspan="2">
          {{detail.OpeningBank}}
        </td>
      </tr>
      <tr>
        <td>{{$t('system.table_acc')}}</td>
        <td colspan="2">
          {{detail.BankNo}}
        </td>
      </tr>
      <tr>
        <td>{{$t('objFill.v101.FinancialModule.kaipiaonr')}}</td>
        <td colspan="3">
          {{detail.ApplyContent?detail.ApplyContent:'-'}}
        </td>
      </tr>
      <tr>
        <td>{{$t('hotel.hotel_remark')}}</td>
        <td>
          {{detail.Remarks}}
        </td>
        <td>{{$t('objFill.v101.FinancialModule.yujidzsj')}}</td>
        <td style="width: 190px;">
          {{detail.AccountingDate}}
        </td>
      </tr>
    </table>
    <el-dialog :title="$t('pub.hintMsg')" width="400px" :visible.sync="dialogFormVisible2" center
      :before-close="closeChangeMachie">
      <el-form label-width="110px">
        <el-form-item :label="$t('ios.shuihao2')">
          <el-input class="" v-model="msg.InvoiceNo" :placeholder="$t('ios.qsrshuihao')"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <button class="hollowFixedBtn" @click="dialogFormVisible2=false">{{$t('pub.cancelBtn')}}</button>
        <button class="normalBtn" type="primary" @click="setStatus(3)">{{$t('pub.sureBtn')}}</button>
      </div>
    </el-dialog>
    <div style="padding:20px 0">
      <el-row v-if="detail.InvoiceApplyState === 4">
        {{$t('visa.v_jujue')}}说明：{{detail.RefuseRemarks}}
      </el-row>
      <el-row v-if="detail.InvoiceNo">
        {{$t('ios.shuihao2')}}{{detail.InvoiceNo}}
      </el-row>
    </div>
    <div class="iis_save" v-if="!noDetail && detail.InvoiceApplyState===1">
      <button class="normalBtn" @click="dialogFormVisible2 = true">{{$t('ios.tonggei')}}</button>
      <button class="hollowFixedBtn" @click="dialogFormVisible = true">{{$t('ios.jujue')}}</button>
    </div>
    <div class="iis_save"
      v-else-if="noDetail && detail.InvoiceApplyState===1 && (EmployeeId === detail.CreateById || EmployeeId===1 || F_GeneralManager)">
      <button class="normalBtn" @click="setStatus(2)">{{$t('pub.cancelBtn')}}</button>
    </div>
    <div class="imd_img_box">
      <button class="normalBtn" v-show="EmployeeId === detail.CreateById && detail.InvoiceApplyState === 4"
        @click="goEdit()">{{$t('pub.updateMsg')}}</button>
      <div class="_fujian_box">
        <div v-if="detail.ApplyPics&&detail.ApplyPics.length>0">
          <div class="_fujian_zhankai cursorpointer" v-if="!fujianShow" @click="fujianShow = true">
            <span>{{$t('objFill.fj')}}</span>
            <span>></span>
          </div>
          <p class="_fujian_box_tit" v-if="fujianShow">
            <span>
              <i class="iconfont icon-bangdingzhagnhuxinxi"></i>
              <span>{{$t('objFill.fj')}}</span>
            </span>
            <span class="cursorpointer" @click="fujianShow = false">{{$t('fnc.shouqi')}}<i class="iconfont icon-gengduo"></i></span>
          </p>
          <div class=" clearfix" v-if="fujianShow">
            <div style="width:100%;" v-if="FuImgList.length>0">
              <el-carousel trigger="click" height="293px" width="440px" :interval="5000">
                <el-carousel-item style="height: 293px;" v-for="item in FuImgList" :key="item">
                  <img @click="showImg(item, 2)" :src="item" alt="" style="width: 100%;">
                </el-carousel-item>
              </el-carousel>
            </div>
            <div class="clearfix" v-if="detail.ApplyPics && detail.ApplyPics.length">
              <template v-for="(file,fIndex) in detail.ApplyPics" v-if="file.Type==='1'">
                <div class="_wenjian" @click="showUpLoadFile(file)" :key="fIndex+20000">
                  <p v-if="file.Type==='1'" class="_wenjian_P iconfont"
                    :class="file.Url.substring(file.Url.lastIndexOf('.')+1,file.Url.length).toUpperCase()=='PDF'? 'icon-pdf' : 'icon-excel'">
                  </p>
                </div>
              </template>
            </div>
          </div>
        </div>
        <div v-if="(!detail.ApplyPics && EmployeeId === detail.CreateById)||(IsDetail==1&&detail.InvoiceApplyState === 1)">
          <div class="_addUpload_box _addUpload_box_btm clearfix">
            <template v-for="(file,fIndex) in saveMsg">
              <div v-if="file.Type==3" :key="fIndex+30000">
                <div style="width:100%;height:100%;overflow: hidden;">
                  <img :src="file.Url?file.Url:file.Content" @click="showImg(file.Url?file.Url:file.Content)">
                </div>
                <span class="iconfont icon-guanbi1" @click="deleteUploadFile(fIndex)"></span>
              </div>
              <div v-if="file.Type==1" :key="fIndex+40000">
                <div class="iconfont _wenjian_P"
                  :class="file.Content.substring(file.Content.lastIndexOf('.')+1,file.Content.length).toUpperCase()=='PDF'? 'icon-pdf' : 'icon-excel'"
                  @click="showUpLoadFileT(file)">
                </div>
                <span class="iconfont icon-guanbi1" @click="deleteUploadFile(fIndex)"></span>
              </div>
            </template>
          </div>
          <div style="margin-top: 80px;">
            <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 class="shangchuanfujian"><button class="hollowFixedBtn" @click="upLoadFuJian">{{$t('fnc.scfujian')}}</button></div>
          </div>
        </div>



        <div class="querenhan">
          <p>{{$t('salesModule.QRH')}}</p>
          <div style="width:100%;">
            <div v-if="detail.ConfirmFileList && detail.ConfirmFileList.length>0">
              <el-carousel trigger="click" height="293px" width="440px" :interval="5000"
                v-if="detail.ConfirmFileList[0].Url.indexOf('.png')!=-1 || detail.ConfirmFileList[0].Url.indexOf('.jp')!=-1">
                <el-carousel-item style="height: 293px;">
                  <img @click="showImg(detail.ConfirmFileList[0].Url)"
                    :src="domainManager().ViittoFileUrl + detail.ConfirmFileList[0].Url" alt="" style="width: 100%;">
                </el-carousel-item>
              </el-carousel>
              <div v-else>
                <p style="padding-top: 5px;padding-left: 20px;font-size: 14px;margin-bottom: 10px;"
                  class="cursorpointer">
                  <a target="_blank" :href="domainManager().ViittoFileUrl + detail.ConfirmFileList[0].Url">下载文件</a>
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <el-dialog :title="$t('pub.hintMsg')" width="400px" :visible.sync="dialogFormVisible" center :before-close="closeChangeMachie">
      <el-form label-width="110px">
        <el-form-item label="拒绝理由">
          <el-input type="textarea" v-model="msg.RefuseRemarks" class="w216"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <button class="hollowFixedBtn" @click="dialogFormVisible=false">{{$t('pub.cancelBtn')}}</button>
        <button class="normalBtn" type="primary" @click="setStatus(4)">{{$t('pub.sureBtn')}}</button>
      </div>
    </el-dialog>
    <viewer :images="images" :options='imageOptions' @inited="inited" class="viewer" ref="viewer">
      <img v-for="src in images" :src="src" :key="src">
    </viewer>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        crmOrderObj:null,
        InvoiceApplyType: 0,
        detail: {},
        orderList: {},
        loading: true,
        dialogFormVisible: false,
        dialogFormVisible2: false,
        AccountInfo: '',
        msg: {
          RefuseRemarks: '',
          ID: 0,
          InvoiceApplyState: 0,
          InvoiceNo: '',
        },
        noDetail: false,
        EmployeeId: 0,
        images: [],
        FuImgList: [],
        imageOptions: {
          navbar: false,
          title: false
        },
        fujianShow: true,
        saveMsg: [],
        F_GeneralManager: false,
        IsDetail:0,
        batchOrder: []
      };
    },
    methods: {
      GetSupperOrderEditAuth() {
        // F_GeneralManager_Special 财务总经理副总经理权限
        var actionCode = this.$AuthCode.F_GeneralManager_Special;
        this.CheckUserAuth(actionCode, res => {
          if (res.data.resultCode == 1 && res.data.data == 1) {
            this.F_GeneralManager = true;
          }
        });
      },
      // 修改
      goEdit: function () {
        this.$router.push({
          name: 'invoicesManagerAdd',
          query: {
            id: this.detail.ID,
            OrderId: this.detail.OrderId,
            TCID: this.detail.TCID,
            CustomerId: this.detail.CustomerId,
            edit: 1,
            blank: 'y',
            tab: '修改发票单据'
          }
        })
      },
      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({
            Type: fileTypeNumber,
            Content: x.data.FilePath,
            Url: this.domainManager().ViittoFileUrl + x.data.FilePath,
          });
          this.$message.success(this.$t('tips.scchenggong'));
        });
      },
      upLoadFuJian: function () {
        if (this.saveMsg.length === 0) return this.$message.error(this.$t('objFill.qinshagchuanwj'));
        let msg = {
          ID: this.msg.ID,
          ApplyPics: this.saveMsg
        };
        this.apipost('InvoiceApply_get_UpdateInvoiceApplyInfo', msg, res => {
          if (res.data.resultCode === 1) {
            this.getDetail(this.msg.ID)
          } else {
            this.$message.error(res.data.message);
          }
        }, null)
      },
      showUpLoadFile(i) { // 预览上传文件
        if (i.Url.substring(i.Url.lastIndexOf('.') + 1, i.Url.length).toUpperCase() == 'PDF') {
          this.previewPDF(i.Url)
        } else {
          window.open("https://view.officeapps.live.com/op/view.aspx?src=" + i.Url)
        }
      },
      inited(viewer) {
        this.$viewer = viewer
      },
      showImg(src, t) {
        src = t ? src : this.domainManager().ViittoFileUrl + src;
        let isExsit = false
        this.images.forEach(x => {
          if (x == src)
            isExsit = true
        })
        if (!isExsit) {
          this.images.push(src)
        } else {
          this.$viewer.view(this.images.indexOf(src))
        }
        this.$viewer.show()
      },
      goUrlO: function (OrderId) {
        let query2 = {
          OrderId: OrderId,
          OrderType: 0,
          blank: 'y',
          tab: ''
        }
        if(this.InvoiceApplyType){
          if(this.InvoiceApplyType == 1) query2.OrderType = 2 // 团队
          if(this.InvoiceApplyType == 2) query2.OrderType = 6 // 签证
          if(this.InvoiceApplyType == 4) query2.OrderType = 1 // 机票
          if(this.InvoiceApplyType == 5) query2.OrderType = 5 // 车
          if(this.InvoiceApplyType == 6) query2.OrderType = 3 // 酒店
          if(this.InvoiceApplyType == 7) query2.OrderType = 4 // 门票
        }else{
          query2.OrderType = 2
        }
        query2.tab = '订单详情'
        this.$router.push({
          name: 'erpCustomerOrderDay',
          query: query2
        });
        return
        let query = {
          id: OrderId,
          blank: 'y',
          tab: '报名统计'
        }
        if(this.InvoiceApplyType&&this.InvoiceApplyType == 4){
            query.tab = '单机票详情'
            this.$router.push({
              name: 'CRMTicketOrderOP',
              query: query
            });
        }else {
          this.$router.push({
            name: 'enrollTotal',
            query: query
          });
        }
      },
      goUrlT: function (path, obj, title) { // 跳转团页面
        this.$router.push({
          name: path,
          query: {
            "id": obj,
            blank: 'y',
            tab: title
          }
        })
      },
      goSaleFinacial: function () { // 跳转销售财务单据
        if (this.InvoiceApplyType && this.InvoiceApplyType == 4) {
          this.$router.push({
            name: 'CRMTicketOrderOP',
            query: {
              OrderId: this.detail.OrderId,
              blank: 'y',
              tab: '单机票详情'
            }
          });
        } else {
          let obj = {
            orderId: this.detail.OrderId,
            tcnum: this.detail.TCNUM,
            tcid: this.detail.TCID
          }
          this.$router.push({
            name: 'SalesFinancialDetail',
            query: {
              blank: 'y',
              tab: '销售财务单据',
              item: JSON.stringify(obj)
            }
          });
        }
      },
      setStatus: function (type) { // 审核发票单据
        this.msg.InvoiceApplyState = type
        if (type === 3 && this.msg.InvoiceNo === '') {
          return this.$message.error('请填写税号！')
        }
        this.apipost('InvoiceApply_get_UpdateInvoiceApply', this.msg, res => {
          if (res.data.resultCode == 1) {
            this.$message.success(res.data.message)
            if (type !== 2) {
              setTimeout(() => {
                this.$router.push({
                  name: 'invoicesManager',
                });
              }, 1000)
            } else {
              setTimeout(() => {
                this.$router.push({
                  name: 'groupTourOrder',
                  query: {
                    blank: "y",
                  }
                });
              }, 1000)
            }
          }
        }, null)
      },
      getDetail(id) { // 获取详情
        this.apipost('InvoiceApply_get_GetDetails', {
          ID: id,
          InvoiceApplyType: this.InvoiceApplyType?this.InvoiceApplyType:1
        }, res => {
          if (res.data.resultCode == 1) {
            this.saveMsg=[];
            this.FuImgList=[];
            this.images=[];
            let detail = res.data.data
            if (detail.ApplyPics && detail.ApplyPics.length > 0) {
              detail.ApplyPics.forEach(x => {
                if (x.Type === '3') {
                  this.FuImgList.push(x.Url);
                  this.images.push(x.Url)
                }
                this.saveMsg.push({
            Type: x.Type,
            Content: x.Url.replace("http://192.168.5.46:8130",""),
            Url: x.Url,
          });
              })
            }
            this.detail = detail
            if(this.detail.Type && this.detail.Type==1){
              this.getBatchOrderDetail(this.detail.FrIds);
            }else{
            this.getOrderDetail();
            }
          }
          this.loading = false
        }, null)
      },
      closeChangeMachie(done) { //  转交窗口关闭
        done();
      },
      deleteUploadFile(i) { // 删除上传文件
        this.saveMsg.splice(i, 1);
      },
      getOrderDetail: function () { // 获取交易信息详情
        // let OrderResource = this.InvoiceApplyType ? 10 : 8
        let OrderResource = 8 //团队订
        if(this.InvoiceApplyType){
          if(this.InvoiceApplyType == 1) OrderResource = 8 // 团队
          if(this.InvoiceApplyType == 2) OrderResource = 10 // 签证
          if(this.InvoiceApplyType == 4) OrderResource = 12 // 机票
          if(this.InvoiceApplyType == 5) OrderResource = 5 // 车
          if(this.InvoiceApplyType == 6) OrderResource = 1 // 酒店
          if(this.InvoiceApplyType == 7) OrderResource = 3 // 门票
        }
        this.apipost(
          'InvoiceApply_get_GetOrderFinanceList', {
            OrderId: this.detail.OrderId,
            OrderResource: OrderResource,
            IsTravelMoney: 1
          },
          res => {
            if (res.data.resultCode == 1) {
              this.orderList = res.data.data
            }
          }, err => {}
        )
      },
      goUrlSFD: function (path, name, OrderId, tcnum, tcid) {
        let obj = {
          OrderId: OrderId,
          tcnum: tcnum,
          tcid: tcid
        }
        this.$router.push({
          name: path,
          query: {
            blank: 'y',
            tab: name,
            item: JSON.stringify(obj)
          }
        })
      },
      getBatchOrderDetail(frIds){
        this.apipost('Financial_post_GetSalePlatformList',{FrIDs:frIds},res=>{
              if(res.data.resultCode == 1) {
                  this.batchOrder = res.data.data.list;
                  this.orderList={
                    moneyStr : res.data.data.TotalMoney,
                    TradeDateStr:'/',
                    AccountNumber:'-',
                    FrIDs:'-',
                    fee : res.data.data.TotalFee,
                  };
                  this.msg.ApplyMoney = res.data.data.InvoiceMoney;
              }else{                  
                  this.$message.error(res.data.message);
              }
          },err=>{})
      }
    },
    created(){
      let userInfo = this.getLocalStorage();
      this.EmployeeId = userInfo.EmployeeId;
      let id
      if(this.$route.query.id){
        id = this.$route.query.id
      }

      if(this.$route.query.InvoiceApplyType){
        this.InvoiceApplyType = this.$route.query.InvoiceApplyType
      }
      if(this.$route.query.crmOrderObj){
        this.crmOrderObj = JSON.parse(this.$route.query.crmOrderObj)
        this.InvoiceApplyType = this.crmOrderObj.InvoiceApplyType
        id = this.crmOrderObj.id
      }
      if(this.$route.query.crmOrderObj){
        this.crmOrderObj = JSON.parse(this.$route.query.crmOrderObj)
        this.InvoiceApplyType = this.crmOrderObj.InvoiceApplyType
        id = this.crmOrderObj.id
      }
      if(this.$route.query.IsDetail){
        this.IsDetail = this.$route.query.IsDetail
      }
      //是否显示审核按钮
      this.noDetail = this.$route.query.noDetail ? true : false
      this.msg.ID = id
    },
    mounted() {
      this.getDetail(this.msg.ID)
      this.GetSupperOrderEditAuth();
    }
  };

</script>
