<style scoped>
  @import url('../../../assets/trip/block/index.css');
</style>
<template>
  <div class="block-item">
    <div class="one-block">
      <div class="item big row items-center">
        <div class="row no-wrap col-12">
          <div class="col" style="position: relative; top: 0; left: 0">
            <template
              v-if="
                day.details[0].fileType && day.details[0].fileType == '.mp4'
              "
            >
              <video
                ref="myVideo"
                width="100%"
                height="100%"
                :src="day.details[0].videoPath"
                controls="controls"
              ></video>
            </template>
            <template v-else>
              <q-img @click="showImageHandler(day.details[0].img)"
                v-if="day.details[0].img"
                :src="day.details[0].img"
                :ratio=" 16/9 "
                fit="cover"
                height="100%"
              >
                <template v-slot:error>
                  <div
                    class="absolute-full flex flex-center bg-blue-1 text-dark"
                  >
                    {{$t('v103.scheduledTripDetails.style.nodata')}}
                  </div>
                </template>
              </q-img>
              <q-img @click="showImageHandler(day.details[0].img)"
                v-else
                src="../../../assets/img/nll.jpg"
                :ratio=" 16/9 "
                fit="cover"
                height="100%"
              ></q-img>
            </template>
          </div>
          <div
            class="right col-4"
            style="border: 1px solid #ccc; border-left: 0"
          >
            <div class="details">
              <div
                v-if="day.details[0].title != ''"
                class="text-h6 text-bold q-pb-sm"
                v-html="day.details[0].title"
                @click.stop="goUrl(day.details[0].url)"
                style="cursor: pointer"
              ></div>
              <div
                class="playInfo"
                v-if="
                  day.details[0].playTimeHour || day.details[0].playTimeMinutes
                "
              >
                <span
                  class="playInfo-item"
                  v-if="day.details[0].ticketName != ''"
                >
                  <!--<i class="iconfont icon-menpiao"></i>-->
                  <!--{{day.details[0].ticketName}}-->
                </span>
                <span
                  class="playInfo-item"
                  v-if="
                    day.details[0].playTimeHour ||
                    day.details[0].playTimeMinutes
                  "
                >
                  <i class="iconfont icon-shijian1"></i>
                  {{$t('v103.scheduledTripDetails.style.d1')}}
                  <span v-if="day.details[0].playTimeHour"
                    >{{ day.details[0].playTimeHour }}{{$t('v103.scheduledTripDetails.style.d2')}}
                  </span>
                  <span v-if="day.details[0].playTimeMinutes"
                    >{{ day.details[0].playTimeMinutes }}{{$t('v103.scheduledTripDetails.style.d3')}}</span
                  >
                </span>
              </div>
              <span v-html="day.details[0].content"></span>
            </div>
          </div>
        </div>
        <div
          class="col-12 item row justify-between no-wrap q-mt-sm"
          style="background: #f6f6f6"
        >
          <div
            class="col row no-wrap"
            style="position: relative; top: 0; left: 0"
          >
            <div class="col-6" style="border: 1px solid #ccc">
              <div class="up" style="height: 260px">
                <template
                  v-if="
                    day.details[1].fileType && day.details[1].fileType == '.mp4'
                  "
                >
                  <video
                    ref="myVideo"
                    width="100%"
                    height="100%"
                    :src="day.details[1].videoPath"
                    controls="controls"
                  ></video>
                </template>
                <template v-else>
                  <q-img @click="showImageHandler(day.details[1].img)"
                    v-if="day.details[1].img"
                    :src="day.details[1].img"
                    :ratio=" 16/9 "
                    fit="cover"
                    height="100%"
                  >
                    <template v-slot:error>
                      <div
                        class="absolute-full flex flex-center bg-blue-1 text-dark"
                      >
                        {{$t('v103.scheduledTripDetails.style.nodata')}}
                      </div>
                    </template>
                  </q-img>
                  <q-img @click="showImageHandler(day.details[1].img)"
                    v-else
                    src="../../../assets/img/nll.jpg"
                    :ratio=" 16/9 "
                    fit="cover"
                    height="100%"
                  ></q-img>
                </template>
              </div>
              <div class="down q-ma-lg">
                <div
                  v-if="day.details[1].title != ''"
                  class="text-h6 text-bold q-pb-sm"
                  v-html="day.details[1].title"
                  @click.stop="goUrl(day.details[1].url)"
                  style="cursor: pointer"
                ></div>
                <div
                  class="playInfo"
                  v-if="
                    day.details[1].playTimeHour ||
                    day.details[1].playTimeMinutes
                  "
                >
                  <span
                    class="playInfo-item"
                    v-if="day.details[1].ticketName != ''"
                  >
                  </span>
                  <span
                    class="playInfo-item"
                    v-if="
                      day.details[1].playTimeHour ||
                      day.details[1].playTimeMinutes
                    "
                  >
                    <i class="iconfont icon-shijian1"></i>
                    {{$t('v103.scheduledTripDetails.style.d1')}}
                    <span v-if="day.details[1].playTimeHour"
                      >{{ day.details[1].playTimeHour }}{{$t('v103.scheduledTripDetails.style.d2')}}
                    </span>
                    <span v-if="day.details[1].playTimeMinutes"
                      >{{ day.details[1].playTimeMinutes }}{{$t('v103.scheduledTripDetails.style.d3')}}
                    </span>
                  </span>
                </div>
                <span v-html="day.details[1].content"></span>
              </div>
            </div>
            <div class="col q-ml-sm" style="border: 1px solid #ccc">
              <div class="up" style="height: 260px">
                <template
                  v-if="
                    day.details[2].fileType && day.details[2].fileType == '.mp4'
                  "
                >
                  <video
                    ref="myVideo"
                    width="100%"
                    height="100%"
                    :src="day.details[2].videoPath"
                    controls="controls"
                  ></video>
                </template>
                <template v-else>
                  <q-img @click="showImageHandler(day.details[2].img)"
                    v-if="day.details[2].img"
                    :src="day.details[2].img"
                    :ratio=" 16/9 "
                    fit="cover"
                    height="100%"
                  >
                    <template v-slot:error>
                      <div
                        class="absolute-full flex flex-center bg-blue-1 text-dark"
                      >
                        {{$t('v103.scheduledTripDetails.style.nodata')}}
                      </div>
                    </template>
                  </q-img>
                  <q-img @click="showImageHandler(day.details[2].img)"
                    v-else
                    src="../../../assets/img/nll.jpg"
                    :ratio=" 16/9 "
                    fit="cover"
                    height="100%"
                  ></q-img>
                </template>
              </div>
              <div class="down q-ma-lg">
                <div
                  v-if="day.details[2].title != ''"
                  class="text-h6 text-bold q-pb-sm"
                  v-html="day.details[2].title"
                  @click.stop="goUrl(day.details[2].url)"
                  style="cursor: pointer"
                ></div>
                <div
                  class="playInfo"
                  v-if="
                    day.details[2].playTimeHour ||
                    day.details[2].playTimeMinutes
                  "
                >
                  <span
                    class="playInfo-item"
                    v-if="day.details[2].ticketName != ''"
                  >
                  </span>
                  <span
                    class="playInfo-item"
                    v-if="
                      day.details[2].playTimeHour ||
                      day.details[2].playTimeMinutes
                    "
                  >
                    <i class="iconfont icon-shijian1"></i>
                    {{$t('v103.scheduledTripDetails.style.d1')}}
                    <span v-if="day.details[2].playTimeHour"
                      >{{ day.details[2].playTimeHour }}{{$t('v103.scheduledTripDetails.style.d2')}}
                    </span>
                    <span v-if="day.details[2].playTimeMinutes"
                      >{{ day.details[2].playTimeMinutes }}{{$t('v103.scheduledTripDetails.style.d3')}}
                    </span>
                  </span>
                </div>
                <span v-html="day.details[2].content"></span>
              </div>
            </div>
          </div>
          <div class="col-4">
            <div class="q-ml-sm" style="border: 1px solid #ccc">
              <div class="up" style="height: 260px">
                <template
                  v-if="
                    day.details[3].fileType && day.details[3].fileType == '.mp4'
                  "
                >
                  <video
                    ref="myVideo"
                    width="100%"
                    height="100%"
                    :src="day.details[3].videoPath"
                    controls="controls"
                  ></video>
                </template>
                <template v-else>
                  <q-img @click="showImageHandler(day.details[3].img)"
                    v-if="day.details[3].img"
                    :src="day.details[3].img"
                    :ratio=" 16/9 "
                    fit="cover"
                    height="100%"
                  >
                    <template v-slot:error>
                      <div
                        class="absolute-full flex flex-center bg-blue-1 text-dark"
                      >
                        {{$t('v103.scheduledTripDetails.style.nodata')}}
                      </div>
                    </template>
                  </q-img>
                  <q-img @click="showImageHandler(day.details[3].img)"
                    v-else
                    src="../../../assets/img/nll.jpg"
                    :ratio=" 16/9 "
                    fit="cover"
                    height="100%"
                  ></q-img>
                </template>
              </div>
              <div class="down q-ma-lg">
                <div
                  v-if="day.details[3].title != ''"
                  class="text-h6 text-bold q-pb-sm"
                  v-html="day.details[3].title"
                  @click.stop="goUrl(day.details[3].url)"
                  style="cursor: pointer"
                ></div>
                <div
                  class="playInfo"
                  v-if="
                    day.details[3].playTimeHour ||
                    day.details[3].playTimeMinutes
                  "
                >
                  <span
                    class="playInfo-item"
                    v-if="day.details[3].ticketName != ''"
                  >
                  </span>
                  <span
                    class="playInfo-item"
                    v-if="
                      day.details[3].playTimeHour ||
                      day.details[3].playTimeMinutes
                    "
                  >
                    <i class="iconfont icon-shijian1"></i>
                    {{$t('v103.scheduledTripDetails.style.d1')}}
                    <span v-if="day.details[3].playTimeHour"
                      >{{ day.details[3].playTimeHour }}{{$t('v103.scheduledTripDetails.style.d2')}}
                    </span>
                    <span v-if="day.details[3].playTimeMinutes"
                      >{{ day.details[3].playTimeMinutes }}{{$t('v103.scheduledTripDetails.style.d3')}}
                    </span>
                  </span>
                </div>
                <span v-html="day.details[3].content"></span>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="item flex q-mt-sm q-pa-lg" v-if="day.tips.length > 0">
        <h4>{{$t('v103.scheduledTripDetails.style.d4')}}</h4>
        <div class="remark">
          <span v-for="(t, k) in day.tips" :key="k" v-html="t.content"></span>
        </div>
      </div>
      <div
        class="restaurant"
        :class="{
          'row justify-between wrap': $q.platform.is.desktop,
          column: $q.platform.is.mobile,
        }"
      >
        <div class="restaurant-item">
          <div class="key">
            <img src="../../../assets/img/daily_breakfast.png" />
          </div>
          <div class="val">{{ day.can.breakfirst }}</div>
        </div>
        <div class="restaurant-item">
          <div class="key">
            <img src="../../../assets/img/daily_lunch.png" />
          </div>
          <div class="val">{{ day.can.lanuch }}</div>
        </div>
        <div class="restaurant-item">
          <div class="key">
            <img src="../../../assets/img/daily_dinner.png" />
          </div>
          <div class="val">{{ day.can.dinner }}</div>
        </div>
      </div>
      <div class="restaurant">
        <div class="restaurant-item col-24 row">
          <div class="key">
            <img src="../../../assets/img/daily_hotel-1.png" />
          </div>
          <div class="val" v-if="day.jiu2.length > 0">
            <span
              v-for="(t, k) in day.jiu2"
              @click.stop="goUrl(t.url)"
              style="cursor: pointer"
              :key="k"
            >
              {{ k == day.jiu2.length - 1 ? t.name : t.name + " / " }}
            </span>
            {{ getHotelSuffix() }}
          </div>
          <div class="val" v-else>{{$t('v103.scheduledTripDetails.style.d5')}}</div>
        </div>
      </div>
    </div>
  </div>
  <q-dialog class="no-padding" v-model="showImagePriview" persistent>
    <image-preview :current="currentImage" :images="images"></image-preview>
  </q-dialog>
</template>
<script lang="ts">
  import ImagePreview from "../../common/ImagePreview.vue";
import { date,useQuasar } from "quasar";
import { inject, reactive, toRefs, defineComponent,onMounted,ref,watch, getCurrentInstance  } from 'vue';
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { DirtionmaryHelper } from 'src/config/dictionary'
import scheduledTripService from 'src/api/scheduledTrip'
import { ApiResult } from 'src/@types/enumHelper'
import message from 'src/utils/message'
export default defineComponent({
  components: { ImagePreview },
  props: ['day','isDirect'],
  setup(props) {
    const $router = useRouter()
    const { t } = useI18n()
    const $q = useQuasar()
    let {ctx:that, proxy} = getCurrentInstance()
    const data= reactive({
      showImagePriview:false,
      currentImage:'',
      images:[],
      day: props.day,
      isDirect: props.isDirect,
    })
    props.day.details.forEach(x=>{
      if(x.img){
        data.images.push(x.img)
      }
    })
    const methods = {
      showImageHandler(url: string) {
        data.currentImage = url
        data.showImagePriview = true
      },
      
      getHotelSuffix() {
        let suffix = "";
        if (props.day.jiu2.length > 1) {
          if (props.isDirect === 1) {
            suffix = t('v103.scheduledTripDetails.style.d6');
          }
        } else {
          if (
            props.day.jiu2.length == 1 &&
            props.day.jiu2[0].name != t('v103.scheduledTripDetails.style.d7') &&
            props.day.jiu2[0].name != t('v103.scheduledTripDetails.style.d8')
          ) {
            if (props.day.jiu2[0].status == 1) {
              suffix = t('v103.scheduledTripDetails.style.d9');
            } else {
              if (props.isDirect === 1) {
                suffix = t('v103.scheduledTripDetails.style.d10');
              }
            }
          }
        }
        return suffix;
      },
      goUrl(url) {
        if (url != null && url.length > 0) {
            window.open(url, "_blank");
          }
        },
    }
    return {
      ...toRefs(data),
      ...methods,
    }
  }
})
</script>
