<style>
  .quick-banner-block {
    position: fixed;
    display: flex;
    justify-content: center;
    /* top: 60px; */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 99;
    text-align: center;
    box-shadow: 0 3px 7px rgba(150, 150, 150, .38);
  }

  .quick-banner-block.orange {
    background-image: linear-gradient(-60deg, rgba(245, 112, 112, .9) 0, rgba(245, 168, 57, .87843137) 100%);
  }

  .quick-banner-block.blue {
    background-image: linear-gradient(-60deg, rgba(74, 216, 190, .92) 0, rgba(31, 161, 228, .91) 100%);
  }

  .quick-banner-block.green {
    background-image: linear-gradient(-20deg, rgba(78, 78, 78, .95) 0, #7da5a3 100%);
  }

  .quick-banner-block.dark {
    background-image: linear-gradient(-225deg, rgba(78, 69, 119, .87058824) 0, rgba(51, 135, 173, .89) 51%, rgba(43, 216, 195, .89019608) 100%);
  }

  .quick-banner-block.yellow {
    background-image: linear-gradient(80deg, rgba(255, 193, 19, .9) 0, rgba(93, 183, 121, .9) 100%);
  }

  .quick-banner-block .quick-item {
    display: flex;
    justify-content: space-around;
    color: #fff;
    width: 100%;
  }

  .quick-banner-block .quick-item>* {
    display: inline-block;
    width: 100%;
    height: 50px;
    line-height: 50px;
    text-align: center;
    color: #fff;
    font-weight: 700;
    -webkit-transition: background-color .3s;
    -moz-transition: background-color .3s;
    -o-transition: background-color .3s;
    transition: background-color .3s;
    text-decoration: none;
  }

  .quick-banner-block.orange .quick-item>.active {
    background-color: rgba(65, 130, 160, .82);
  }

  .quick-banner-block.blue .quick-item>.active {
    background-color: #057ea2;
  }

  .quick-banner-block.green .quick-item>.active {
    background-color: rgba(30, 69, 78, .82);
  }

  .quick-banner-block.dark .quick-item>.active {
    background-color: rgba(4, 70, 101, .82);
  }

  .quick-banner-block.yellow .quick-item>.active {
    background-color: rgba(102, 162, 121, .82);
  }

  .detail_loadingDiv {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
  }
  .text-h6Detail {
    text-align: center;
    font-size: 18px;
    color: #333;
    font-weight: 700;
    position: relative;
    width:100%;
    height:50px;
  }
  .text-h6Detail i {
    position: absolute;
    right:20px;
    top:10px;
    cursor: pointer;
    font-size:23px;
  }

</style>
<template>
  <q-page ref="orderview">
    <!-- loading -->
    <!-- <div class="detail_loadingDiv" v-if="isLoading">
      <q-spinner color="primary" size="3em" :thickness="10" />
    </div> -->
    <template v-if="isShow">
      <!-- 顶部大图 -->
      <headStyle1 :dataList="dataList" v-if="TripConfig.TripConfig.IsShowBgImg==1"></headStyle1>
      <!-- 行程介绍 -->
      <headStyle2 :dataList="dataList" id="tour_intro" ref="tour_intro" @showDialog="showDialog"></headStyle2>
      <template v-for="(item,index) in TripConfig.TripConfig.SortList">
        <!-- 行程資訊 -->
        <!-- TripListStyle 1月历 2列表 -->
        <tripList v-if="item.Id=='TripList'&&TripConfig.TripConfig.TripListStyle==2" :key="index+100"
          :plugData="dataList.priceList" @showDialog="showDialog"></tripList>
        <tripcalendar v-if="item.Id=='TripList'&&TripConfig.TripConfig.TripListStyle==1" :key="index+200"
          :dateData="dataList.priceList" :priceInfo="dataList.currentPriceInfo" @showDialog="showDialog"></tripcalendar>
        <!-- 每日行程 -->
        <!-- TripDayStyle 1竖起排 2横起 -->

        <headStyle3 v-if="item.Id=='TripDay' && TripConfig.TripConfig.TripDayStyle==2" id="tour_detail"
          ref="tour_detail" :tripList="dayList" :isDirect="isDirect" :key="index+300"></headStyle3>
        <headStyle6 v-if="item.Id=='TripDay' && TripConfig.TripConfig.TripDayStyle==1" :tripList="dayList"
          :isDirect="isDirect" :key="index+400"></headStyle6>
        <!-- 行程特色 -->
        <headStyle4 v-if="item.Id=='TripFeature'" ref="feature" id="feature" :dataList="dataList" :key="index+500">
        </headStyle4>
        <!-- 注意事项 -->
        <headStyle5 v-if="item.Id=='Notice'" id="note" ref="note" :dataList="dataList" :key="index+600"></headStyle5>
        <!-- 需求单 -->
        <diyForm v-if="item.Id=='Order'" :key="index+700" :TCID="msg.tcid"></diyForm>
      </template>
    </template>
    <div class="quick-banner-block" v-if="isShowNav" :class="{'orange':TripConfig.TripConfig.TripBottonStyle==1
    ,'blue':TripConfig.TripConfig.TripBottonStyle==2,'green':TripConfig.TripConfig.TripBottonStyle==3
    ,'dark':TripConfig.TripConfig.TripBottonStyle==4,'yellow':TripConfig.TripConfig.TripBottonStyle==5}">
      <div class="quick-item">
        <a class="scroll-link" :class="{'active':clickIndex==1}" @click="clickIndex=1,goNavList('tour_intro')">行程介紹</a>
        <a class="scroll-link" :class="{'active':clickIndex==2}" @click="clickIndex=2,goNavList('tour_detail')">每日行程</a>
        <a class="scroll-link" :class="{'active':clickIndex==3}" @click="clickIndex=3,goNavList(3)">立即預訂</a>
        <a class="scroll-link" :class="{'active':clickIndex==4}" @click="clickIndex=4,goNavList('feature')">行程特色</a>
        <a class="scroll-link" :class="{'active':clickIndex==5}" @click="clickIndex=5,goNavList('note')">注意事項</a>
      </div>
    </div>
    <q-dialog v-model="isShowDialog">
      <q-card style="width:100%">
        <div class="text-h6Detail">
          <i class="iconfont iconbaseline-close-px" @click="isShowDialog=false"></i>
        </div>
        <q-separator />
        <div style="max-height: 600px;padding:20px 30px 30px 30px" class="scroll">
          <diyForm :TCID="msg.tcid" @closeDialog="closeDialog"></diyForm>
        </div>
        <q-separator />
      </q-card>
    </q-dialog>

  </q-page>
</template>
<script>
  import headStyle1 from "../components/trip/style1";
  import headStyle2 from "../components/trip/style2";
  import headStyle3 from "../components/trip/style3";
  import headStyle4 from "../components/trip/style4";
  import headStyle5 from "../components/trip/style5";

  //每日行程横放组件
  import headStyle6 from "../components/trip/style6";
  import diyForm from "../components/label_other/diy-form";


  //出團表 group -Start
  import tripList from "../components/trip/tripList";
  import tripcalendar from "../components/trip/tripcalendar"
  //出團表 group -End

  export default {
    props: [],
    data() {
      return {
        msg: {
          configId: '',
          cityId: 0,
          preview: 0,
          tcid: 0,
          teamType: 0,
          isGetPriceFlight: true,
          pType: 1,//类型 1 来源B2C
          newConfigId: 0,//列表里的configId
        },
        isShow: false,
        dataList: {},
        dayList: [],
        isDirect: 1,
        TripConfig: {},
        isShowNav: false,
        clickIndex: 1,
        isLoading: false,
        isShowDialog:false
      };
    },
    components: {
      headStyle1,
      headStyle2,
      headStyle3,
      headStyle4,
      headStyle5,
      headStyle6,
      tripList,
      tripcalendar,
      diyForm
    },
    created() {
      if (this.$route.params.id) {
        this.msg.configId = decodeURIComponent(this.$route.params.id)
      }
      if (this.$route.params.tcid) {
        this.msg.tcid = decodeURIComponent(this.$route.params.tcid)
      }
      if (this.$route.params.newConfigId) {
        this.msg.newConfigId = decodeURIComponent(this.$route.params.newConfigId)
      }
    },
    mounted() {
      if (localStorage.baseifo) {
        this.TripConfig = JSON.parse(window.localStorage.getItem('baseifo'));
      }
      this.getData();
      window.addEventListener('scroll', this.menu)
    },
    methods: {
      showDialog(){
        this.isShowDialog=true;
      },
      //关闭弹窗
      closeDialog(){
        this.isShowDialog=false;
      },
      getData() {
        this.$q.loading.show();
        this.apipost('b2b_get_GetB2BTravelInfoV1', this.msg, r => {
          this.$q.loading.hide();
          if (r.data.resultCode == 1) {
            this.dataList = r.data.data;
            if (this.dataList.dayList && this.dataList.dayList.length > 0) {
              this.dataList.dayList.forEach(item => {
                item.slide = 0;
              });
            }
            this.dayList = this.dataList.dayList;
            this.isShow = true;
            this.isDirect = this.dataList.isDirect;
          } else {
            this.$message.error(r.data.message)
          }
        }, null)
      },
      menu() {
        this.scroll = document.documentElement.scrollTop || document.body.scrollTop;
        if (this.scroll > 300) {
          this.isShowNav = true;
        } else {
          this.isShowNav = false;
        }
      },
      goNavList(val) {
        let newval = "#" + val
        document.querySelector(newval).scrollIntoView(true);
      },
    },
  };

</script>
