<template>
  <!-- 列表 -->
    <div class="group-result-list">
      <div class="group-statis-block">
        <div class="group-share" style="display:none;"></div>
        <div class="group-statis-detail">
          <span class="title" v-if="qMsg.searchKey">{{qMsg.searchKey}} :</span>
          找到
          <span class="num"> {{qMsg.TotalCount}} </span>個行程
          <span class="pc">，目前在第<span style="color: #7f7f7f;"> {{qMsg.pageIndex}} </span>頁</span>
        </div>
      </div>
      <div>
        <div class="group-box" v-for="(item,index) in DataList" :key="index">
          <a class="group-cover">
            <img v-if="item.newCoverImg" :src="item.newCoverImg" />
          </a>
          <div class="group-main">
            <div class="group-info">
              <div class="group-name" style="margin-bottom:5px;cursor:pointer" @click="GotoDetails(item)">
                {{item.title}}
              </div>
              <div class="group-detail">
                <i class="iconfont iconaddress"></i>
                <span>{{item.countryName}}</span>
              </div>
              <div class="group-detail">
                <i class="iconfont icontime"></i>
                <span>{{item.dayNum}} 天</span>
              </div>
              <ul class="group-list">
                <li>
                  <a>{{item.startDate}}</a>
                </li>
              </ul>
            </div>
            <div class="price-info">
              <div class="price-wrap">
                <div class="price_Search">
                  <small class="price_unit">TWD$</small> {{item.b2BPrice}}
                </div>
                <a class="btn_warning" @click="GotoDetails(item)" style="cursor:pointer">更多出發日</a>
              </div>
            </div>
          </div>
        </div>
        <div style="display:flex;justify-content: center;">
          <q-pagination v-if="qMsg.PageCount>1" v-model="qMsg.pageIndex" :max="qMsg.PageCount" @input="gerOrderList()"
            :direction-links="true">
          </q-pagination>
        </div>
      </div>
    </div>

</template>
<script>
  import { inject, provide, reactive, toRefs, defineComponent,onMounted } from 'vue';
  import { useRouter } from 'vue-router'
  export default {
    props: ["DataList", "qMsg"],
    setup(props,context) {
      const $router = useRouter()
      const data= reactive({
        DataList: props.DataList,
        qMsg: props.qMsg,
      })
      const methods = {
        GotoDetails(item) {
          $router.push({ path:`/detail/${encodeURIComponent(item.id)}/${item.tcid}`})
        },
        //调用
        gerOrderList(){
          context.emit('getPage')
        }
      }
      return {
        ...toRefs(data),
        ...methods
      }
    }
  }

</script>
