index.vue 3.47 KB
<!--
 * @Date: 2022-09-19 14:11:06
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2023-12-19 15:21:03
 * @FilePath: /meihuaApp/src/pages/detail/index.vue
 * @Description: 文件描述
-->
<template>
  <view style="position: relative; height: 100vh;">
    <nut-swiper :init-page="page" :pagination-visible="true" pagination-color="#426543" auto-play="5000">
      <nut-swiper-item v-for="(item, index) in state.imgData" :key="index">
        <image @tap="showFn" style="width: 100%; height: 150px;" mode="aspectFill" :src="item.src" />
      </nut-swiper-item>
    </nut-swiper>
    <view style="padding: 1rem;">
      <view style="color: #0B0B0B; font-size: 1rem; font-weight: bold;">非凡魅力豪华总统套房</view>
      <view style="color: #7D7C7C; font-size: 0.8rem;">两室 宜住3人</view>
    </view>
    <view vif="!showBook" style="width: 100%; height: 1rpx; background-color: rgb(244, 244, 244);"></view>
    <view v-if="showBook" id="book-cal" class="book-cal">
      <calendar-select @on-dates-change="onDatesChange"></calendar-select>
    </view>
    <view style="padding: 1rem; text-align: center; font-weight: bold;">房间介绍</view>
    <view style="padding: 0 1rem;">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Quidem quibusdam nostrum numquam quaerat corporis totam similique expedita, omnis ratione aut magnam nihil. Modi repudiandae at minus enim beatae fugit. Modi.</view>
    <view v-if="showBook" style="position: fixed; bottom: 0; left: 0; right: 0; background-color: #fff; height: 4rem; padding: 30rpx 30rpx 20rpx 30rpx;box-shadow: 0px -5px 4px 0px rgba(0,0,0,0.07);">
      <nut-row>
        <nut-col :span="18">
          <view style="height: 2rem; margin-left: 0.5rem; display: flex; align-items: center;">
            <text style="color: #EB2E2E; font-size: 1.3rem; font-weight: bold;">¥980</text>
            <text style="color: #7D7C7C; text-decoration: line-through; font-size: 0.85rem; margin-left: 5px;">¥1280</text>
          </view>
        </nut-col>
        <nut-col :span="6">
          <view @tap="goToConfirm" style="background-color: #6A4925; border-radius: 1.25rem; padding: 0.25rem 0.5rem; color: #fff; text-align: center; height: 2rem; line-height: 2rem;">预定</view>
        </nut-col>
      </nut-row>
    </view>
    <nut-image-preview :show="state.showPreview" :images="state.imgData" :is-Loop="false" @close="hideFn" />
  </view>
</template>

<script setup>
import Taro from '@tarojs/taro'
import { ref, computed, reactive } from "vue";
import calendarSelect from '@/components/calendarSelect.vue'

// TODO: 到时候根据后端实际字段修改
// const book_status = ref('已约满');
const book_status = ref('');

const showBook = computed(() => {
  return book_status.value !== '已约满'
});

const onDatesChange = ({ startDate, endDate }) => {
  console.warn(startDate, endDate);
}

const page = ref(1);

const goToConfirm = () => {
  Taro.navigateTo({
    url: '/pages/confirm/index?id=123',
  })
}

const state = reactive({
  showPreview: false,
  imgData: [
    {
      src: 'https://cdn.ipadbiz.cn/meihua/img1@2x.png'
    },
    {
      src: 'https://cdn.ipadbiz.cn/meihua/banner1@2x.png'
    },
    {
      src: 'https://cdn.ipadbiz.cn/meihua/img1@2x.png'
    },
    {
      src: 'https://cdn.ipadbiz.cn/meihua/img1@2x.png'
    }
  ]
});

const showFn = () => {
  state.showPreview = true;
};

const hideFn = () => {
  state.showPreview = false;
};
</script>

<script>
import "./index.less";

export default {
  name: "detailPage",
};
</script>