<template>
  <div>
    <table class="teamRevenueExpenditureTotalTable" border="0" cellspacing="1" cellpadding="">
      <tr>
        <th width="200">{{$t('objFill.caozuotuanhao')}}</th>
        <th width="100">{{$t('Airticket.Air_reservation')}}</th>
        <th width="200">{{$t('Operation.Op_signUp')}}</th>
        <th width="100">{{$t('admin.admin_status')}}</th>
        <th width="200">{{$t('ground.dangtuan')}}OP</th>
      </tr>
      <tr v-for="item in msgList">
        <td>{{item.TCNUM}}</td>
        <td>{{item.TotalSeat}}</td>
        <td>{{item.TotalGuest}}</td>
        <td>{{numberToWord(item.TCState)}}</td>
        <td>{{item.CreateByName}}</td>
      </tr>
    </table>
    <table class="teamRevenueExpenditureTotalTable" border="0" cellspacing="1" cellpadding="">
      <tr>
        <th width="200">{{$t('salesModule.DJNum')}}</th>
        <th width="150">{{$t('hotel.hotel')}}</th>
        <th width="150">{{$t('commonPickUp.Pick_resName')}}</th>
        <th width="150">{{$t('scen.sc_piao')}}</th>
        <th width="150">{{$t('objFill.chezi')}}</th>
        <th width="150">{{$t('objFill.qita')}}</th>
        <th width="150">{{$t('ground.zongji')}}</th>
      </tr>
      <tr v-for="item in msgList">
        <td>{{item.NewCombinationNum}}</td>
        <td>{{moneyFormat(hotelPay)}}</td>
        <td>{{moneyFormat(eatPay)}}</td>
        <td>{{moneyFormat(ticketPay)}}</td>
        <td>{{moneyFormat(busPay)}}</td>
        <td>{{moneyFormat(otherPay)}}</td>
        <td>{{moneyFormat(hotelPay+eatPay+ticketPay+busPay+otherPay)}}</td>
      </tr>
    </table>
    <p class="teamRevenueExpenditureTitle">
      {{$t('hotel.hotel')}}
      <span class="fr" style="margin-top: -8px;">
        <input type="button" class="normalBtn" :value="$t('objFill.xingzengfk')" @click="goUrl(1,2)" /><input type="button" class="normalBtn"
          :value="$t('objFill.xingzengshouk')" @click="goUrl(1,1)" />
        <input type="button" class="normalBtn" :value="$t('objFill.precharge')" @click="isOffset(1,2)" />
      </span>
    </p>
    <table border="0" cellspacing="1" cellpadding="0" class="teamRevenueExpenditureTable">
      <tr>
        <th width="100">{{$t('active.ad_xuhao')}}</th>
        <th width="10%">{{$t('fnc.danhao')}}</th>
        <th width="10%">{{$t('fnc.fyshuoming')}}</th>
        <th width="10%">{{$t('fnc.fkduixiang')}}</th>
        <th width="10%">{{$t('sm.Date')}}</th>
        <th width="20%">{{$t('pub.pubRemark')}}</th>
        <th width="10%">{{$t('fnc.yingfu')}}/{{$t('objFill.yingfujine')}}</th>
        <th width="10%">{{$t('visa.v_yewuyuan')}}</th>
        <th>{{$t('objFill.fukuanpinz')}}</th>
        <th width="10%">{{$t('admin.admin_status')}}</th>
      </tr>
      <tr v-for="(item,index) in hotelList">
        <td>{{index+1}}</td>
        <td> <a style="color:blue;cursor:pointer" @click="goFinaceURL(item.FrID)"> {{item.FrID}} </a></td>
        <td>
          <span class="padding10" v-for="i in item.CostTypeList">{{i}}</span>
        </td>
        <td>{{item.ClientName}}</td>
        <td>{{item.CreateDate}}</td>
        <td>
          <div v-for="childItem in item.TradeWayList">
            {{$t('objFill.zffs')}}：{{childItem.Alias}}<span class="TB_Rate">{{$t('hotel.hotel_Currency')}}：{{childItem.CurrencyName}}</span>
            <span class="Team_Coins">{{childItem.OriginalMoney}}*{{childItem.Rate}}</span>
            <span class="TB_Rate">{{$t('hotel.hotel_CurrentRate')}}：{{childItem.Rate}}</span>
          </div>
        </td>
        <td>
          <p><span>{{$t('fnc.yuanbi')}}{{item.WBMoney}}</span></p>
          <p><span>￥{{item.Type === 2 ? '-' : ''}}{{moneyFormat(item.Money)}}</span></p>
        </td>
        <td>{{item.EmName}}</td>
        <td>
          <template v-for="(son,sIndex) in item.VorcherInos">
            <template v-if="son.Type==1||son.Type==2">
              <i class="iconfont icon-excel" @click="showUpLoadFile(son)"></i>
            </template>
            <template v-if="son.Type==3">
              <img class="vorcherInosImg" @click="showImg(item.VorcherInos)" :src="son.Content" alt="">
            </template>
          </template>
        </td>
        <td>{{item.StatusStr}}</td>
      </tr>
      <tr v-if='hotelList.length!=0'>
        <td>{{$t('objFill.chengbenzj')}}</td>
        <td style="text-align:left;padding-left:5px;" colspan="9">
          ￥{{getTotalMoney(hotelList)}}
        </td>
      </tr>
      <tr v-if='hotelList.length==0'>
        <td colspan="10" class="color666">{{$t('objFill.meiyzdnxydcw')}}</td>
      </tr>
    </table>
    <p class="teamRevenueExpenditureTitle">
      {{$t('ground.canshi')}}
      <span class="fr" style="margin-top: -8px;">
        <input type="button" class="normalBtn" :value="$t('objFill.xingzengfk')" @click="goUrl(2,2)" /><input type="button" class="normalBtn"
          :value="$t('objFill.xingzengshouk')" @click="goUrl(2,1)" />
        <input type="button" class="normalBtn" :value="$t('objFill.precharge')" @click="isOffset(2,2)" />
      </span>
    </p>
    <table border="0" cellspacing="1" cellpadding="0" class="teamRevenueExpenditureTable">
      <tr>
        <th width="100">{{$t('active.ad_xuhao')}}</th>
        <th width="10%">{{$t('fnc.danhao')}}</th>
        <th width="10%">{{$t('fnc.fyshuoming')}}</th>
        <th width="10%">{{$t('fnc.fkduixiang')}}</th>
        <th width="10%">{{$t('sm.Date')}}</th>
        <th width="20%">{{$t('pub.pubRemark')}}</th>
        <th width="10%">{{$t('fnc.yingfu')}}/{{$t('objFill.yingfujine')}}</th>
        <th width="10%">{{$t('visa.v_yewuyuan')}}</th>
        <th>{{$t('objFill.fukuanpinz')}}</th>
        <th width="10%">{{$t('admin.admin_status')}}</th>
      </tr>
      <tr v-for="(item,index) in eatList">
        <td>{{index+1}}</td>
        <td><a style="color:blue;cursor:pointer" @click="goFinaceURL(item.FrID)"> {{item.FrID}} </a></td>
        <td>
          <span class="padding10" v-for="i in item.CostTypeList">{{i}}</span>
        </td>
        <td>{{item.ClientName}}</td>
        <td>{{item.CreateDate}}</td>
        <td>
          <div v-for="childItem in item.TradeWayList">
            {{$t('objFill.zffs')}}：{{childItem.Alias}}<span class="TB_Rate">{{$t('hotel.hotel_Currency')}}：{{childItem.CurrencyName}}</span>
            <span class="Team_Coins">{{childItem.OriginalMoney}}*{{childItem.Rate}}</span>
            <span class="TB_Rate">{{$t('hotel.hotel_CurrentRate')}}：{{childItem.Rate}}</span>
          </div>
        </td>
        <td>
          <p><span>{{$t('fnc.yuanbi')}}{{item.WBMoney}}</span></p>
          <p><span>￥{{item.Type === 2 ? '-' : ''}}{{moneyFormat(item.Money)}}</span></p>
        </td>
        <td>{{item.EmName}}</td>
        <td>
          <template v-for="(son,sIndex) in item.VorcherInos">
            <template v-if="son.Type==1||son.Type==2">
              <i class="iconfont icon-excel" @click="showUpLoadFile(son)"></i>
            </template>
            <template v-if="son.Type==3">
              <img class="vorcherInosImg" @click="showImg(item.VorcherInos)" :src="son.Content" alt="">
            </template>
          </template>
        </td>
        <td>{{item.StatusStr}}</td>
      </tr>
      <tr v-if='eatList.length!=0'>
        <td>{{$t('objFill.chengbenzj')}}</td>
        <td style="text-align:left;padding-left:5px;" colspan="9">
          ￥{{getTotalMoney(eatList)}}
        </td>
      </tr>
      <tr v-if='eatList.length==0'>
        <td colspan="10" class="color666">{{$t('objFill.meiyzdnxydcw')}}</td>
      </tr>
    </table>
    <p class="teamRevenueExpenditureTitle">
      {{$t('scen.sc_piao')}}
      <span class="fr" style="margin-top: -8px;">
        <input type="button" class="normalBtn" :value="$t('objFill.xingzengfk')" @click="goUrl(3,2)" /><input type="button" class="normalBtn"
          :value="$t('objFill.xingzengshouk')" @click="goUrl(3,1)" />
        <input type="button" class="normalBtn" :value="$t('objFill.precharge')" @click="isOffset(3,2)" />
      </span>
    </p>
    <table border="0" cellspacing="1" cellpadding="0" class="teamRevenueExpenditureTable">
      <tr>
        <th width="100">{{$t('active.ad_xuhao')}}</th>
        <th width="10%">{{$t('fnc.danhao')}}</th>
        <th width="10%">{{$t('fnc.fyshuoming')}}</th>
        <th width="10%">{{$t('fnc.fkduixiang')}}</th>
        <th width="10%">{{$t('sm.Date')}}</th>
        <th width="20%">{{$t('pub.pubRemark')}}</th>
        <th width="10%">{{$t('fnc.yingfu')}}/{{$t('objFill.yingfujine')}}</th>
        <th width="10%">{{$t('visa.v_yewuyuan')}}</th>
        <th>{{$t('objFill.fukuanpinz')}}</th>
        <th width="10%">{{$t('admin.admin_status')}}</th>
      </tr>
      <tr v-for="(item,index) in ticketList">
        <td>{{index+1}}</td>
        <td><a style="color:blue;cursor:pointer" @click="goFinaceURL(item.FrID)"> {{item.FrID}} </a></td>
        <td>
          <span class="padding10" v-for="i in item.CostTypeList">{{i}}</span>
        </td>
        <td>{{item.ClientName}}</td>
        <td>{{item.CreateDate}}</td>
        <td>
          <div v-for="childItem in item.TradeWayList">
            {{$t('objFill.zffs')}}：{{childItem.Alias}}<span class="TB_Rate">{{$t('hotel.hotel_Currency')}}：{{childItem.CurrencyName}}</span>
            <span class="Team_Coins">{{childItem.OriginalMoney}}*{{childItem.Rate}}</span>
            <span class="TB_Rate">{{$t('hotel.hotel_CurrentRate')}}：{{childItem.Rate}}</span>
          </div>
        </td>
        <td>
          <p><span>{{$t('fnc.yuanbi')}}{{item.WBMoney}}</span></p>
          <p><span>￥{{item.Type === 2 ? '-' : ''}}{{moneyFormat(item.Money)}}</span></p>
        </td>
        <td>{{item.EmName}}</td>
        <td>
          <template v-for="(son,sIndex) in item.VorcherInos">
            <template v-if="son.Type==1||son.Type==2">
              <i class="iconfont icon-excel" @click="showUpLoadFile(son)"></i>
            </template>
            <template v-if="son.Type==3">
              <img class="vorcherInosImg" @click="showImg(item.VorcherInos)" :src="son.Content" alt="">
            </template>
          </template>
        </td>
        <td>{{item.StatusStr}}</td>
      </tr>
      <tr v-if='ticketList.length!=0'>
        <td>{{$t('objFill.chengbenzj')}}</td>
        <td style="text-align:left;padding-left:5px;" colspan="9">
          ￥{{getTotalMoney(ticketList)}}
        </td>
      </tr>
      <tr v-if='ticketList.length==0'>
        <td colspan="10" class="color666">{{$t('objFill.meiyzdnxydcw')}}</td>
      </tr>
    </table>
    <p class="teamRevenueExpenditureTitle">
      {{$t('objFill.chezi')}}
      <span class="fr" style="margin-top: -8px;">
        <input type="button" class="normalBtn" :value="$t('objFill.xingzengfk')" @click="goUrl(5,2)" /><input type="button" class="normalBtn"
          :value="$t('objFill.xingzengshouk')" @click="goUrl(5,1)" />
        <input type="button" class="normalBtn" :value="$t('objFill.precharge')" @click="isOffset(5,2)" />
      </span>
    </p>
    <table border="0" cellspacing="1" cellpadding="0" class="teamRevenueExpenditureTable">
      <tr>
        <th width="100">{{$t('active.ad_xuhao')}}</th>
        <th width="10%">{{$t('fnc.danhao')}}</th>
        <th width="10%">{{$t('fnc.fyshuoming')}}</th>
        <th width="10%">{{$t('fnc.fkduixiang')}}</th>
        <th width="10%">{{$t('sm.Date')}}</th>
        <th width="20%">{{$t('pub.pubRemark')}}</th>
        <th width="10%">{{$t('fnc.yingfu')}}/{{$t('objFill.yingfujine')}}</th>
        <th width="10%">{{$t('visa.v_yewuyuan')}}</th>
        <th>{{$t('objFill.fukuanpinz')}}</th>
        <th width="10%">{{$t('admin.admin_status')}}</th>
      </tr>
      <tr v-for="(item,index) in busList">
        <td>{{index+1}}</td>
        <td><a style="color:blue;cursor:pointer" @click="goFinaceURL(item.FrID)"> {{item.FrID}} </a></td>
        <td>
          <span class="padding10" v-for="i in item.CostTypeList">{{i}}</span>
        </td>
        <td>{{item.ClientName}}</td>
        <td>{{item.CreateDate}}</td>
        <td>
          <div v-for="childItem in item.TradeWayList">
            {{$t('objFill.zffs')}}：{{childItem.Alias}}<span class="TB_Rate">{{$t('hotel.hotel_Currency')}}：{{childItem.CurrencyName}}</span>
            <span class="Team_Coins">{{childItem.OriginalMoney}}*{{childItem.Rate}}</span>
            <span class="TB_Rate">{{$t('hotel.hotel_CurrentRate')}}：{{childItem.Rate}}</span>
          </div>
        </td>
        <td>
          <p><span>{{$t('fnc.yuanbi')}}{{item.WBMoney}}</span></p>
          <p><span>￥{{item.Type === 2 ? '-' : ''}}{{moneyFormat(item.Money)}}</span></p>
        </td>
        <td>{{item.EmName}}</td>
        <td>
          <template v-for="(son,sIndex) in item.VorcherInos">
            <template v-if="son.Type==1||son.Type==2">
              <i class="iconfont icon-excel" @click="showUpLoadFile(son)"></i>
            </template>
            <template v-if="son.Type==3">
              <img class="vorcherInosImg" @click="showImg(item.VorcherInos)" :src="son.Content" alt="">
            </template>
          </template>
        </td>
        <td>{{item.StatusStr}}</td>
      </tr>
      <tr v-if='busList.length!=0'>
        <td>{{$t('objFill.chengbenzj')}}</td>
        <td style="text-align:left;padding-left:5px;" colspan="9">
          ￥{{getTotalMoney(busList)}}
        </td>
      </tr>
      <tr v-if='busList.length==0'>
        <td colspan="10" class="color666">{{$t('objFill.meiyzdnxydcw')}}</td>
      </tr>
    </table>

    <p class="teamRevenueExpenditureTitle">
      {{$t('objFill.qita')}}
      <span class="fr" style="margin-top: -8px;">
        <input type="button" class="normalBtn" :value="$t('objFill.xingzengfk')" @click="goUrl(14,2)" /><input type="button"
          class="normalBtn" :value="$t('objFill.xingzengshouk')" @click="goUrl(14,1)" />
        <input type="button" class="normalBtn" :value="$t('objFill.precharge')" @click="isOffset(14,2)" />
      </span>
    </p>
    <table border="0" cellspacing="1" cellpadding="0" class="teamRevenueExpenditureTable">
      <tr>
        <th width="100">{{$t('active.ad_xuhao')}}</th>
        <th width="10%">{{$t('fnc.danhao')}}</th>
        <th width="10%">{{$t('fnc.fyshuoming')}}</th>
        <th width="10%">{{$t('fnc.fkduixiang')}}</th>
        <th width="10%">{{$t('sm.Date')}}</th>
        <th width="20%">{{$t('pub.pubRemark')}}</th>
        <th width="10%">{{$t('fnc.yingfu')}}/{{$t('objFill.yingfujine')}}</th>
        <th width="10%">{{$t('visa.v_yewuyuan')}}</th>
        <th>{{$t('objFill.fukuanpinz')}}</th>
        <th width="10%">{{$t('admin.admin_status')}}</th>
      </tr>
      <tr v-for="(item,index) in otherList">
        <td>{{index+1}}</td>
        <td><a style="color:blue;cursor:pointer" @click="goFinaceURL(item.FrID)"> {{item.FrID}} </a></td>
        <td>
          <span class="padding10" v-for="i in item.CostTypeList">{{i}}</span>
        </td>
        <td>{{item.ClientName}}</td>
        <td>{{item.CreateDate}}</td>
        <td>
          <div v-for="childItem in item.TradeWayList">
            {{$t('objFill.zffs')}}：{{childItem.Alias}}<span class="TB_Rate">{{$t('hotel.hotel_Currency')}}：{{childItem.CurrencyName}}</span>
            <span class="Team_Coins">{{childItem.OriginalMoney}}*{{childItem.Rate}}</span>
            <span class="TB_Rate">{{$t('hotel.hotel_CurrentRate')}}：{{childItem.Rate}}</span>
          </div>
        </td>
        <td>
          <p><span>{{$t('fnc.yuanbi')}}{{item.WBMoney}}</span></p>
          <p><span>￥{{item.Type === 2 ? '-' : ''}}{{moneyFormat(item.Money)}}</span></p>
        </td>
        <td>{{item.EmName}}</td>
        <td>
          <template v-for="(son,sIndex) in item.VorcherInos">
            <template v-if="son.Type==1||son.Type==2">
              <i class="iconfont icon-excel" @click="showUpLoadFile(son)"></i>
            </template>
            <template v-if="son.Type==3">
              <img class="vorcherInosImg" @click="showImg(item.VorcherInos)" :src="son.Content" alt="">
            </template>
          </template>
        </td>
        <td>{{item.StatusStr}}</td>
      </tr>
      <tr v-if='otherList.length!=0'>
        <td>{{$t('objFill.chengbenzj')}}</td>
        <td style="text-align:left;padding-left:5px;" colspan="9">
          ￥{{getTotalMoney(otherList)}}
        </td>
      </tr>
      <tr v-if='otherList.length==0'>
        <td colspan="10" class="color666">{{$t('objFill.meiyzdnxydcw')}}</td>
      </tr>
    </table>
    <div v-if='picIsShow' class="viewBigPicLayer" @click="picIsShow=false,picObj=[]">
      <el-carousel height="600px" :interval="5000" trigger="click">
        <el-carousel-item v-for="(item,index) in picObj" :key="index">
          <div class="inlineDiv ownScrollbarStyle"><img :src="item" /></div>
        </el-carousel-item>
      </el-carousel>
    </div>
    <offset :isShow="cdState" :obj="queryObj" @close="cdState=false"></offset>
  </div>
</template>

<script>
  import offset from '../../public/offset.vue';
  export default {
    components: { offset },
    data() {
      return {
        Handmsg: {
          OtherType: 7,
          ReFinanceId: 0,
          Rate: 0,
          TCNUM: '',
          czState: true,
        },
        queryObj:null,
        cdState: false,
        LineId:0,
        picIsShow: false,
        picObj: [],
        msgList: [],
        hotelList: [],
        eatList: [],
        ticketList: [],
        busList: [],
        otherList: [],
        hotelPay: 0,
        eatPay: 0,
        ticketPay: 0,
        busPay: 0,
        otherPay: 0,
        IsPrerealContrast: false,
        PrerealContrastMsg:'',
        PrerealContrastOfferId:0,
        roomZeroNum: 0
      }
    },
    methods: {
      isOffset(_orderSource, _type){
        this.goUrl(_orderSource, _type,'Offset')
      },
      // 制作单据
      makeAdocument(row, index, num, name,Offset) {
        if((num==2||num==3)&&row.Income<=0){
          this.Info(this.$t('objFill.v101.busManagement.qingxzskdzzcbtk'))
          return
        }
        if(Offset){
          this.cdState = true
        }
        let type = 0
        if(num==3){
          type = 2
        }else{
          type = num
        }
        this.BillMakingMsg.ReFinanceId = row.OrderId;
        this.BillMakingMsg.ReFinanceId2 = num;
        if (name == "Hand") {
          this.BillMakingMsg.OtherType = 62;
        } else {
          this.BillMakingMsg.OtherType = 61;
        }
        let text = "";
        let query = {};
        if (num == 1) {
          text = "收款";
        } else if (num == 2) {
          text = "付款";
        }
        query = {
            blank: "y",
            tab: `新增${text}单据`,
            Type: type,
            tradeObj: JSON.stringify(this.BillMakingMsg),
        };
        this.queryObj = query
        if(!Offset){
          this.$store.commit("ChoiceAddFinancialDocuments");
          this.$router.push({
            path: "/ChoiceAddFinancialDocuments",
            query
          });
        }
      },
      //跳转到财务页面
      goFinaceURL(id) {
        this.$router.push({
          name: 'FinancialDocumentsDetail',
          query: {
            'id': id,
            'blank': 'y',
          }
        });
      },
      numberToWord(val) {
        switch (val) {
          case 1:
            return this.$t('visa.v_dwanshan')
            break;
          case 2:
            return this.$t('Operation.Op_xiajia')
            break;
          case 3:
            return this.$t('objFill.xiaosouz')
            break;
          case 4:
            return this.$t('pub.cancelBtn')
            break;
          default:
            break;
        }
      },
      getTotalMoney(obj) {
        let money = 0
        obj.forEach(item => {
          if (item.Type == 1) {
            money += item.Money
          } else {
            money -= item.Money
          }
        })
        if (obj.length > 0) {
          switch (obj[0].OrderSource) {
            case 1:
              this.hotelPay = money
              break;
            case 2:
              this.eatPay = money
              break;
            case 3:
              this.ticketPay = money
              break;
            case 5:
              this.busPay = money
              break;
            case 14:
              this.otherPay = money
              break;
            default:
              break;
          }
        }
        return this.moneyFormat(money)
      },
      showUpLoadFile(i) { // 预览上传文件
        if (i.Content.substring(i.Content.lastIndexOf('.') + 1, i.Content.length).toUpperCase() == 'PDF') {
          this.previewPDF(i.Content)
        } else {
          window.open("https://view.officeapps.live.com/op/view.aspx?src=" + i.Content)
        }
      },
      showImg(obj) {
        obj.forEach(x => {
          if (x.Type == 3) {
            this.picObj.push(x.Content)
          }
        })
        this.picIsShow = true;
      },
      goUrl(_orderSource, _type,Offset) {
        if(this.IsPrerealContrast){
          if(_orderSource==1 && this.roomZeroNum>0){
            this.$confirm('存在用款计划酒店数据未维护价格，请维护单价后再试',  this.$t('tips.tips'), {
              confirmButtonText: this.$t('objFill.ckbjd'),
              cancelButtonText: this.$t('pub.cancelBtn'),
              type: 'warning'
            }).then(() => {
              this.$router.push({
              name: 'OfferChange',
              query: {
                'offerid':this.PrerealContrastOfferId,
                'Qtype':3,
                'blank': 'y',
              }
            });
            }).catch(() => {
              
            });
            return;
          }else if(this.PrerealContrastMsg!=''){
            this.$confirm(this.PrerealContrastMsg,  this.$t('tips.tips'), {
              confirmButtonText: this.$t('objFill.ckbjd'),
              cancelButtonText: this.$t('pub.cancelBtn'),
              type: 'warning'
            }).then(() => {
              this.$router.push({
              name: 'OfferChange',
              query: {
                'offerid':this.PrerealContrastOfferId,
                'Qtype':3,
                'blank': 'y',
              }
            });
            }).catch(() => {
              
            });
            return;
          }
        }

        let TCIDARR = []
        let id = [];
        if(this.msgList&&this.msgList.length>0&&this.msgList[0].LineId==this.LineId){

      if (_orderSource === 1 && _type === 2) {
                  id = [94]
                } else if (_orderSource === 2 && _type === 2) {
                  id = [95]
                } else if (_orderSource === 5 && _type === 2) {
                  id = [96]
                }
                // 门票
                else if (_orderSource === 3 && _type === 2) {
                  id = [97]
                }
        }
        else{

    // _orderSource 1 酒店   2餐厅   5 车资
            if (_orderSource === 1 && _type === 2) {
              id = [51, 52, 245, 246, 255, 267]
            } else if (_orderSource === 2 && _type === 2) {
              id = [54, 55, 245, 246, 255, 267]
            } else if (_orderSource === 5 && _type === 2) {
              id = [49, 50, 57, 58, 245, 246, 255, 267]
            }
            // 门票
            else if (_orderSource === 3 && _type === 2) {
              id = [88, 89, 245, 246, 255, 267]
            }
        }

        TCIDARR.push(this.$route.query.id)
        let orderObj = {
          OrderID: 0,
          OrderSource: _orderSource,
          Obj: {},
          SourceID: this.$route.query.id,
          TCIDList: TCIDARR,
          LineId : this.LineId
        }
        id = id.length > 0 ? JSON.stringify(id) : null;

        // 冲抵
        if(Offset){
          orderObj.TCIDList = [this.$route.query.id]
          let query = {
            'czmsg': this.Handmsg,
            'Type': _type,
            'path': 'teamRevenueExpenditure',
            'companyID': this.msgList&&this.msgList.length>0&&this.msgList[0].OutBranchId!=null?this.msgList[0].OutBranchId:this.$route.query.OutBranchId,
            'blank': 'y',
            'orderObj': JSON.stringify(orderObj),
            'OrderSource': _orderSource,
            'searchTitle': '分摊'
          };
          this.queryObj = query
          this.cdState = true
          return
        }

        this.$router.push({
          name: 'ChoiceAddFinancialDocuments',
          query: {
            'Type': _type,
            'path': 'teamRevenueExpenditure',
            'companyID': this.msgList&&this.msgList.length>0&&this.msgList[0].OutBranchId!=null?this.msgList[0].OutBranchId:this.$route.query.OutBranchId,
            'templateID': id,
            'blank': 'y',
            'orderObj': JSON.stringify(orderObj),
            'OrderSource': _orderSource,
          }
        });
      },
      getTuanMsg() {
        this.apipost('dmcstatistics_post_GetTeamMoneyBaseInfo', {
          TCID: this.$route.query.id
        }, res => {
          if (res.data.resultCode == 1) {
            this.msgList = res.data.data

          } else {}
        }, err => {})
      },
      getList(type) {
        this.apipost('Financial_post_GetDiJieFinanceList', {
          OrderResource: type,
          TCID: this.$route.query.id
        }, res => {
          if (res.data.resultCode == 1) {
            switch (type) {
              case 1:
                this.hotelList = res.data.data
                break;
              case 2:
                this.eatList = res.data.data
                break;
              case 3:
                this.ticketList = res.data.data
                break;
              case 5:
                this.busList = res.data.data
                break;
              case 14:
                this.otherList = res.data.data
                break;
              default:
                break;

            }
          } else {
            this.Error(res.data.message)
          }
        }, err => {})
      },
      getTravelPrerealContrast(){
        this.apipost('financestatistics_post_GetTravelPrerealContrast', {
          TCID: this.$route.query.id
        }, res => {
          if (res.data.resultCode == 1) {
             if(res.data.data.State==1){
              this.IsPrerealContrast=true;
              this.PrerealContrastMsg = res.data.data.Msg;
              this.PrerealContrastOfferId = res.data.data.OfferId;
              this.roomZeroNum = res.data.data.roomZeroNum;
             }
          } else {}
        }, err => {})
      }
    },
    mounted() {
      this.LineId = this.$route.query.lineId
      this.getList(1)
      this.getList(2)
      this.getList(3)
      this.getList(5)
      this.getList(14)
      this.getTuanMsg()
      let userInfo = this.getLocalStorage();
      if(userInfo.RB_Group_id==2 && this.LineId==14){
        this.getTravelPrerealContrast(); 
      }
    }
  }

</script>

<style>
  .teamRevenueExpenditureTotalTable {
    background: #eee;
    margin: 30px 0;
  }

  .teamRevenueExpenditureTotalTable th {
    background: #D1D1D1;
    font-weight: normal;
    font-size: 14px;
    height: 30px;
    color: #333;
  }

  .teamRevenueExpenditureTotalTable td {
    background: #fff;
    height: 36px;
    text-align: center;
    font-size: 12px;
  }

  .teamRevenueExpenditureTitle {
    border-left: 3px solid #E95252;
    text-indent: 10px;
    font-size: 14px;
    height: 14px;
    line-height: 14px;
    margin: 20px 0 10px 0;
  }

  .teamRevenueExpenditureTable {
    background: #eee;
    width: 100%;
    margin-bottom: 30px;
  }

  .teamRevenueExpenditureTable th {
    background: #D1D1D1;
    font-weight: normal !important;
    font-size: 14px;
    height: 30px;
    color: #333;
  }

  .teamRevenueExpenditureTable td {
    background: #fff;
    height: 36px;
    text-align: center;
    font-size: 12px;
  }

  .teamRevenueExpenditureTable .seeDetail:hover {
    text-decoration: underline;
    cursor: pointer;
  }

  .teamRevenueExpenditureTable .icon-excel {
    font-size: 30px;
    text-align: center;
    color: #41D2A1;
    vertical-align: middle;
  }

  .teamRevenueExpenditureTable .vorcherInosImg {
    width: 30px;
    height: 30px;
    cursor: pointer;
    vertical-align: middle;
    margin-right: 5px;
  }

</style>
