<style scoped>
  ._PrintPage {
    width: 100%;
    background-color: white;
    position: absolute;
    padding-top: 20px;
  }

  ._PrintPage_box {
    width: 1000px;
    margin: 0 auto;
    padding: 0 !important;
  }

  ._PrintPage_box {
    position: relative;
  }

  ._PrintPage_box .SetDiv {
    position: absolute;
    top: 10px;
    color: #106BAF;
    left: -190px;
  }

  ._PrintPage_box .SetDiv span {
    color: #106BAF;
    cursor: pointer;
  }

</style>
<template v-loading="loading">
  <div class="_PrintPage">
    <div class="_PrintPage_box">
      <template v-if="type==='2'&&(Merge==='0' || Merge===null || (Merge==='1' && hedan==1)) ">
        <div class="SetDiv">
          <span v-if="Merge==='1' " @click="goUrl(1)">切换</span>
          <span style="margin:0 10px;" @click="disabled=false">编辑</span>
          <span @click="disabled=true">保存</span>
        </div>
        <div class="_border_1" v-for="(item,index) in 1">
          <my-Bill :loopNumN="loopNumN" :disabled.sysc="disabled" :ID="id" :width="widthSon" :isPrintPage="true"
            :color="colorSon" :OrderSource="OrderSource" :name='index+1'></my-Bill>
        </div>
      </template>
      <template v-else-if="type==='1'&&(Merge==='0'||Merge===null)">
        <div class="SetDiv">
          <span @click="disabled1=false">编辑</span>
          <span style="margin-left:10px;" @click="disabled1=true">保存</span>
        </div>
        <div class="_border_1" v-for="(item,index) in 1">
          <my-RVB-Bill :loopNumN="loopNumN" :disabled.sysc="disabled1" v-on:helloPP="numAdd" :Num="num" :ID="id"
            :width="widthSon" :isPrintPage="true" :OrderSource="OrderSource" :color="colorSon" :name='index+1'>
          </my-RVB-Bill>
        </div>
      </template>
      <template v-else-if="type==='1'&&(Merge==='1'&&hedan==1)">
        <div class="SetDiv">
          <span v-if="Merge==='1' " @click="goUrl(1)">切换</span>
          <span style="margin:0 10px;" @click="disabled1=false">编辑</span>
          <span @click="disabled1=true">保存</span>
        </div>
        <div class="_border_1" v-for="(item,index) in 1">
          <my-RVB-Bill :loopNumN="loopNumN" :disabled.sysc="disabled1" v-on:helloPP="numAdd" :Num="num" :ID="id"
            :width="widthSon" :isPrintPage="true" :OrderSource="OrderSource" :color="colorSon" :name='index+1'>
          </my-RVB-Bill>
        </div>
      </template>
      <template v-if="type==='7'&&(Merge==='0'||Merge===null)">
        <div class="_border_1" v-for="(item,index) in loopNumT">
          <my-GZ-Bill :ID="id" :width="widthSon" :isPrintPage="true" :color="colorSon" :OrderSource="OrderSource"
            :name='index+1'></my-GZ-Bill>
        </div>
      </template>
      <template v-if="(Merge==='1' && hedan==2)">
        <div class="SetDiv">
          <span @click="goUrl(2)">切换</span>
          <span style="margin:0 10px;" @click="disabled2=false">编辑</span>
          <span @click="disabled2=true">保存</span>
        </div>
        <div class="_border_1" v-for="(item,index) in 1">
          <my-HB-Bill :loopNumN="loopNumN" :disabled.sysc="disabled2" v-on:helloPP="numAdd" :Num="num" :ID="id"
            :width="widthSon" :isPrintPage="true" :color="colorSon" :name='index+1'></my-HB-Bill>
        </div>
      </template>
      <template v-if="type=='4' && CapitalState">
        <div class="SetDiv">
          <span @click="disabled3=false">编辑</span>
          <span style="margin-left:10px;" @click="disabled3=true">保存</span>
        </div>
        <div class="_border_1" v-for="(item,index) in 1">
          <my-Capital :loopNumN="loopNumN" :disabled.sysc="disabled3" v-on:helloPP="numAdd" :Num="num" :ID="id"
            :width="widthSon" :isPrintPage="true" :color="colorSon" :name='index+1'></my-Capital>
        </div>
      </template>
    </div>
  </div>
</template>
<script>
  import myBill from "../components/BillModuleNew.vue";
  import myrbvBill from "../components/ReceivablesModuleNew.vue";
  import myhrBill from "../components/MergeBillModuleNew.vue";
  import myGZBill from "../components/GZBillModule.vue";
  import myCapital from "../components/myCapital.vue";

  export default {
    data() {
      return {
        disabled3: true,
        disabled2: true,
        disabled1: true,
        disabled: true,
        loading: true,
        id: null,
        type: null,
        isKehu: null,
        widthSon: "100%",
        colorSon: "#ffffff",
        num: 0,
        loopNumN: this.$route.query.isKehu === '1' ? 3 : 2,
        loopNumT: 2,
        Merge: null,
        OrderSource: -1,
        CapitalState: false,
        hedan: 1,
      }
    },
    components: {
      'my-Bill': myBill,
      'my-RVB-Bill': myrbvBill,
      'my-HB-Bill': myhrBill,
      'my-GZ-Bill': myGZBill,
      'my-Capital': myCapital,
    },
    methods: {
      numAdd() {
        this.num = this.num + 1
      },
      goUrl(num) {
        let hedan;
        if (num == 1) {
          hedan = 2;
        } else {
          hedan = 1;
        }
        if (this.type === 1) {
          let routeData = this.$router.resolve({
            path: 'PrintPageN',
            query: {
              hedan: hedan,
              type: this.type,
              id: this.id,
              isKehu: 0,
              Merge: this.Merge,
              OrderSource: this.OrderSource ? this.OrderSource : -1
            }
          });
          window.open(routeData.href, "_blank");
        } else {
          let routeData = this.$router.resolve({
            path: 'PrintPageN',
            query: {
              hedan: hedan,
              type: this.type,
              id: this.id,
              Merge: this.Merge,
              OrderSource: this.OrderSource ? this.OrderSource : -1
            }
          });
          window.open(routeData.href, "_blank");
        }
      },
    },
    mounted() {

    },
    created() {
      this.id = this.$route.query.id;
      this.type = this.$route.query.type;
      this.isKehu = this.$route.query.isKehu;
      if (this.$route.query.hedan) {
        this.hedan = this.$route.query.hedan;
      }
      this.Merge = this.$route.query.Merge;
      this.OrderSource = this.$route.query.OrderSource;
      if (this.$route.query.Capital) {
        this.CapitalState = true;
      }

    }
  }

</script>
