238 lines
8.0 KiB
Vue
238 lines
8.0 KiB
Vue
<template>
|
|
<view class="waper">
|
|
<u-navbar :autoBack="true" :bgColor="scrollTop > 10 ? '#fff' : 'transparent'" :leftIconColor="scrollTop > 10 ? '#303133' : '#fff'">
|
|
<view slot='center' class="navbar_title">{{scrollTop > 10 ? '房型' : ''}}</view>
|
|
</u-navbar>
|
|
<view class="swiper">
|
|
<swiper :autoplay="true" :current="current" circular @change="changeSwiper">
|
|
<swiper-item v-for="(i, index) in image" :key="index">
|
|
<image :src="i" @tap="previewImg(index)" mode=""></image>
|
|
</swiper-item>
|
|
</swiper>
|
|
<view class="current">{{current + 1}}/{{imageLength}}</view>
|
|
</view>
|
|
<view class="content">
|
|
<view class="specs">
|
|
<view class="title">{{detail.level2Name}}</view>
|
|
<view class="list_box">
|
|
<view class="item" v-if="detail.area">
|
|
<image src="../../static/image/hotel/area.png" mode=""></image>
|
|
<view>{{detail.area}}㎡</view>
|
|
</view>
|
|
<view class="item" v-if="detail.bedType">
|
|
<image src="../../static/image/hotel/bedType.png" mode=""></image>
|
|
<view>{{detail.bedType}}</view>
|
|
</view>
|
|
<view class="item" v-if="detail.window">
|
|
<image src="../../static/image/hotel/window.png" mode=""></image>
|
|
<view>{{detail.window}}</view>
|
|
</view>
|
|
<view class="item" v-if="detail.wifi">
|
|
<image src="../../static/image/hotel/wifi.png" mode=""></image>
|
|
<view>{{detail.wifi}}</view>
|
|
</view>
|
|
<view class="item" v-if="detail.floor">
|
|
<image src="../../static/image/hotel/floor.png" mode=""></image>
|
|
<view>{{detail.floor}}层</view>
|
|
</view>
|
|
<view class="item" v-if="detail.breakfast">
|
|
<image src="../../static/image/hotel/breakfast.png" mode=""></image>
|
|
<view>{{detail.breakfast}}</view>
|
|
</view>
|
|
<view class="item" v-if="detail.limitedLivePerson">
|
|
<image src="../../static/image/hotel/limitedLivePerson.png" mode=""></image>
|
|
<view>{{detail.limitedLivePerson}}人</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="policy">
|
|
<view class="title">订房必读</view>
|
|
<view class="list">
|
|
<view class="item">
|
|
<view class="label">城市通知</view>
|
|
<u-parse :content="hotelDetail.importantNotice"></u-parse>
|
|
</view>
|
|
<view class="item">
|
|
<view class="label">入住限制</view>
|
|
<view class="text">{{hotelDetail.checkInWay}}</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="label">取消规则</view>
|
|
<view class="text" v-if="detail.cancelRuleType == 3">
|
|
{{cancelRule}}
|
|
</view>
|
|
<view class="text" v-else>{{detail.cancelRuleTypeDesc}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="footer" :style="'padding-bottom: ' + windowBottom + 'px;'">
|
|
<view class="price" v-if="detail.quantity"><text class="unit">¥</text>{{detail.datePrices[0].price}}</view>
|
|
<view class="btn" v-if="detail.quantity" @click="predetermine">立即预订</view>
|
|
<view class="btn btn1" v-else>已订完</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data () {
|
|
return {
|
|
scrollTop: 0,
|
|
windowBottom: 0,
|
|
id: '',
|
|
hotelId: '',
|
|
|
|
// 全日房
|
|
startTime: '',
|
|
endTime: '',
|
|
// 钟点房
|
|
hourDate: '',
|
|
|
|
detail: {},
|
|
hotelDetail: {},
|
|
image: [],
|
|
current: 0,
|
|
imageLength: 0,
|
|
cancelRule: ''
|
|
}
|
|
},
|
|
onPageScroll(e) {
|
|
this.scrollTop = e.scrollTop;
|
|
},
|
|
onLoad (options) {
|
|
this.id = options.id;
|
|
this.hotelId = options.hotelId;
|
|
this.hourDate = options.hourDate;
|
|
this.windowBottom = this.$safeAreaBottom || uni.upx2px(24);
|
|
if (!this.hourDate) {
|
|
if (uni.getStorageSync('hotel_date')) {
|
|
let hotelDate = uni.getStorageSync('hotel_date');
|
|
this.startTime = hotelDate[0];
|
|
this.endTime = hotelDate[1];
|
|
}
|
|
}
|
|
this.getDetail();
|
|
this.getHotelDetail();
|
|
},
|
|
|
|
methods: {
|
|
async getDetail() {
|
|
let params = {
|
|
roomClassifyId: this.id,
|
|
startTime: this.hourDate || this.startTime,
|
|
endTime: this.hourDate || this.endTime
|
|
}
|
|
let res=null;
|
|
if (this.hourDate) {
|
|
// 钟点房
|
|
res = await this.$http.hourClassifyDetail(params);
|
|
} else {
|
|
// 全日房
|
|
res = await this.$http.classifyDetail(params);
|
|
}
|
|
this.detail=res.data;
|
|
if (this.detail.image) {
|
|
let arr = this.detail.image.split(',')
|
|
arr.forEach(e => {
|
|
this.image.push(this.$utils.setImgUrl(e))
|
|
})
|
|
this.imageLength = this.image.length;
|
|
}
|
|
if (this.detail.cancelRuleType == 3) {
|
|
let cancelRuleContent = JSON.parse(this.detail.cancelRuleContent);
|
|
if (Number(cancelRuleContent[0].handlingFee)) {
|
|
this.cancelRule = `入住当天${cancelRuleContent[0].start}后取消,将收取额外费用`;
|
|
} else {
|
|
this.cancelRule = `入住当天${cancelRuleContent[0].end}前可免费取消,超期将收取额外费用`;
|
|
}
|
|
}
|
|
},
|
|
// 酒店详情
|
|
async getHotelDetail() {
|
|
let res=await this.$http.homestayId(this.hotelId);
|
|
this.hotelDetail=res.data;
|
|
},
|
|
changeSwiper(e) {
|
|
this.current = e.detail.current;
|
|
},
|
|
previewImg(index) {
|
|
uni.previewImage({
|
|
urls: this.image,
|
|
current: index,
|
|
indicator: 'default'
|
|
})
|
|
},
|
|
async predetermine() {
|
|
let info = await this.$http.getUserInfo()
|
|
if (info.code === 200) {
|
|
if (info.data.isBlack) {
|
|
uni.showToast({ mask: true, title: '您是黑名单用户禁止购票', icon: 'none' })
|
|
} else if (!info.data.mobile || !info.data.name) {
|
|
uni.showToast({ mask: true, title: '请完善个人信息', icon: 'none' })
|
|
setTimeout(() => {
|
|
uni.navigateTo({ url: '/pages/my/myProfile' })
|
|
}, 1500)
|
|
} else {
|
|
if (this.hourDate) {
|
|
uni.navigateTo({ url: `/pages/hotel/confirmOrder?id=${this.id}&hotelId=${this.hotelId}&hourDate=${this.hourDate}` });
|
|
} else {
|
|
uni.navigateTo({ url: `/pages/hotel/confirmOrder?id=${this.id}&hotelId=${this.hotelId}` });
|
|
}
|
|
}
|
|
} else {
|
|
uni.$u.toast(info.msg);
|
|
}
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.waper { min-height: 100vh; }
|
|
.swiper{
|
|
width: 100%; height: 806rpx; position: relative;
|
|
swiper{ width: 100%; height: 100%; }
|
|
.current{ padding: 0 20rpx; height: 40rpx; line-height: 40rpx; color: #fff; background: rgba(0, 0, 0, 0.5); font-size: 24rpx; border-radius: 50rpx; position: absolute; right: 24rpx; top: 324rpx; }
|
|
}
|
|
.content{
|
|
width: 100%; position: relative; z-index: 5; margin-top: -416rpx; background: #F6F6F6; border-radius: 40rpx 40rpx 0 0; padding-bottom: 150rpx;
|
|
.specs {
|
|
background: #FFFFFF; padding: 32rpx 24rpx 24rpx; box-sizing: border-box;
|
|
.title { font-weight: 500; font-size: 36rpx; color: rgba(0,0,0,0.85); margin-bottom: 6rpx; }
|
|
.list_box {
|
|
display: flex; align-items: center; flex-wrap: wrap;
|
|
.item {
|
|
margin-top: 18rpx; width: 33.33%; display: flex; align-items: center;
|
|
image { width: 28rpx; height: 28rpx; }
|
|
view {
|
|
margin-left: 12rpx; font-size: 24rpx; color: rgba(0,0,0,0.85);
|
|
.text { color: #03AE80; }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.policy {
|
|
margin-top: 20rpx; background: #FFFFFF; padding: 32rpx 24rpx 0; box-sizing: border-box;
|
|
.title { font-weight: 500; font-size: 36rpx; color: rgba(0,0,0,0.85); padding-bottom: 7rpx; }
|
|
.list {
|
|
.item {
|
|
border-bottom: 2rpx solid #ECEAEA; padding: 24rpx 0;
|
|
&:last-child { border-bottom: none; }
|
|
.label { font-weight: 500; font-size: 28rpx; color: rgba(0,0,0,0.85); margin-bottom: 16rpx; }
|
|
.text { font-size: 24rpx; color: rgba(0,0,0,0.45); line-height: 28rpx; }
|
|
u-parse { font-size: 24rpx; color: rgba(0,0,0,0.45); line-height: 28rpx; }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.footer {
|
|
width: 100%; background: #FFFFFF; padding: 24rpx 24rpx 0; box-sizing: border-box; position: fixed; left: 0; bottom: 0; display: flex; align-items: center; justify-content: flex-end; z-index: 9;
|
|
.price {
|
|
font-weight: bold; font-size: 48rpx; color: #E54042; margin-right: 20rpx;
|
|
.unit { font-size: 24rpx; color: #E54042; }
|
|
}
|
|
.btn { width: 270rpx; height: 68rpx; background: #03AE80; border-radius: 60rpx; line-height: 68rpx; text-align: center; font-weight: 500; font-size: 32rpx; color: #FFFFFF; }
|
|
.btn1 {background-color: #BFBFBF;}
|
|
}
|
|
</style> |