123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- <template>
- <view class="hotel-book">
- <!-- 自定义导航栏 -->
- <u-navbar :leftText='title' fixed safeAreaInsetTop :placeholder='true' :bgColor="bgColor" @leftClick='back'>
- </u-navbar>
- <!-- 背景图 -->
- <view class="hotel-book-img">
- <uni-swiper-dot :mode="mode" :info="info" :current="current1" :dots-styles="dotsStyles">
- <swiper class="swiper-box" @change="change1" circular>
- <swiper-item v-for="(item ,index) in info" :key="index" v-if="resource_type == 1 ">
- <view class="swiper-item">
- <image style="width: 100%;height:564rpx;" :src="item.img" mode="aspectFill"></image>
- </view>
- </swiper-item>
- <swiper-item v-if="resource_type == 2 ">
- <view class="swiper-item">
- <video class="baner-video" id="myVideo" ref="myVideo" style="width: 100%; height: 564rpx;"
- :src="video_url" controls :enable-progress-gesture="false">
- </video>
- </view>
- </swiper-item>
- </swiper>
- </uni-swiper-dot>
- </view>
- <!-- 酒店介绍 -->
- <view class="hotel-content">
- <view class="hotel-content-top">
- <image style="width: 48rpx;height: 48rpx;" src="/static/icon/local01.png" mode=""></image>
- <view class="hotel-content-top-text">
- <text>{{hotelDetail.name}}</text>
- </view>
- </view>
- <view class="hotel-content-introduce">
- <view class="introduce-top">
- <text class="introduce-top-rule1"></text>
- <text style="margin: 0 8rpx;">酒店介绍</text>
- <text class="introduce-top-rule2"></text>
- </view>
- <view class="introduce-btn-text introduce-btn">
- <view v-html="hotelDetail.details"></view>
- </view>
- </view>
- </view>
- <view class="hotel-btn">
- <view class="hotel-btn-left">
- <view class="hotel-btn-left-text" @click="goIndex">
- <view style="width: 48rpx;height: 48rpx;display: flex;align-items: center;justify-content: center;">
- <image style="width: 40rpx;height: 42rpx;" src="/static/icon/home04.png" mode=""></image>
- </view>
- <text>首页</text>
- </view>
- <view class="hotel-btn-left-text" @click="goJoin">
- <view
- style="width: 48rpx;height: 48rpx; display: flex;align-items: center;justify-content: center; ">
- <image style="width: 52rpx;height: 46rpx;" src="/static/icon/vip02.png" mode=""></image>
- </view>
- <text>会员</text>
- </view>
- <view class="hotel-btn-left-text">
- <view style="width: 48rpx;height: 48rpx;display: flex;align-items: center;justify-content: center;">
- <image style=" width: 44rpx;height: 44rpx;" src="/static/icon/home03.png" mode=""></image>
- </view>
- <text>导航</text>
- </view>
- </view>
- <view class="hotel-btn-right" @click="goJump">
- <text>预订</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- //轮播图
- info: [],
- //自定义导航栏
- bgColor: '#fff',
- title: '',
- //酒店id
- hotel_id: '',
- hotelDetail: '',
- jump_type: '',
- jump_config: '',
- resource_type: '',
- video_url: '',
- //指示点显示位置
- dotsStyles: {
- backgroundColor: 'rgba(255, 255, 255, .3)',
- border: '1px rgba(255, 255, 255, .3) solid',
- color: '#fff',
- selectedBackgroundColor: 'rgba(255, 255, 255, 1)',
- selectedBorder: '1px rgba(255, 255, 255, 1) solid'
- },
- //指示点显示位置
- current1: 0,
- mode: 'dot'
- }
- },
- onReady: function(res) {
- this.videoContext = uni.createVideoContext('myVideo')
- },
- onLoad(o) {
- if (o.hotel_id) {
- this.hotel_id = o.hotel_id
- this.getDetail()
- }
- },
- methods: {
- // 切换轮播图指示点
- change1(e) {
- this.current1 = e.detail.current;
- },
- //视频自动播放
- openVideoPlay() {
- this.videoContext.play()
- },
- //返回上一级
- back() {
- const pages = getCurrentPages();
- if (pages.length === 2) {
- uni.navigateBack({
- delta: 1
- });
- } else if (pages.length === 1) {
- uni.switchTab({
- url: '/pages/index/index',
- })
- } else {
- uni.navigateBack({
- delta: 1
- });
- }
- },
- //预约跳转
- goJump() {
- //跳转h5
- if (this.hotelDetail.reserve_jump_type == 1) {
- const url = this.hotelDetail.reserve_jump_config; // 跳转的外链
- const navtitle = 'H5'; // 这个标题是你自己可以设置的
- uni.navigateTo({
- // 跳转到webview页面
- url: `/pages/webview/webview?url=${url}&nav=${navtitle}`,
- success: () => {
- console.log('成功')
- },
- fail: (e) => {
- console.log(e, "失败")
- }
- });
- } else if (this.hotelDetail.reserve_jump_type == 2) {
- let obj = JSON.parse(this.hotelDetail.reserve_jump_config)
- console.log(obj);
- wx.navigateToMiniProgram({
- appId: `${obj.appid}`, //appid
- path: `${obj.path}`, //path
- extraData: { //参数
- foo: 'bar'
- },
- // envVersion: 'develop', //开发版develop 开发版 trial 体验版 release 正式版
- success(res) {
- console.log('成功')
- // 打开成功
- },
- fail(e) {
- console.log(e, '失败')
- }
- })
- }
- },
- //获取酒店详情
- getDetail() {
- this.$api.hotel.getHotelDetail({
- hotel_id: this.hotel_id
- }).then(res => {
- this.hotelDetail = res.data
- this.title = res.data.name
- this.info = JSON.parse(res.data.img_urls).map(item => {
- return {
- img: item
- }
- })
- //跳转h5和小程序
- this.jump_type = res.data.jump_type,
- this.jump_config = res.data.jump_config
- //banner展示视频或者图片
- this.resource_type = res.data.resource_type
- this.video_url = res.data.video_url
- console.log(this.video_url, '--->this.video_url');
- //视频自动播放
- this.openVideoPlay()
- })
- },
- // 跳转其他小程序
- goJoin() {
- wx.navigateToMiniProgram({
- appId: 'wx255b58f0992b3c53', //appid
- path: 'newUIMain/enrollment/enrollment', //path
- extraData: { //参数
- foo: 'bar'
- },
- // envVersion: 'develop', //开发版develop 开发版 trial 体验版 release 正式版
- success(res) {
- console.log('成功')
- // 打开成功
- },
- fail(e) {
- console.log(e, '失败')
- }
- })
- },
- // 跳转首页
- goIndex() {
- uni.reLaunch({
- url: '/pages/index/index'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- $pageColor:#F9F9F9;
- $bgColor:#FFFFFF;
- @mixin flexlayout {
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .hotel-book {
- height: 100%;
- background: #fff;
- }
- .hotel-book-img {
- height: 564rpx;
- .swiper-box {
- height: 564rpx;
- }
- }
- .hotel-btn {
- padding: 0 30rpx;
- position: fixed;
- bottom: 0;
- width: 100%;
- height: 148rpx;
- background: #FFFFFF;
- box-shadow: 0px -2rpx 20rpx 0px rgba(0, 0, 0, 0.04);
- display: flex;
- align-items: center;
- justify-content: space-between;
- .hotel-btn-left {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .hotel-btn-left-text {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: flex-start;
- font-weight: 500;
- color: #999999;
- font-size: 22rpx;
- margin-right: 48rpx;
- }
- }
- .hotel-btn-right {
- width: 396rpx;
- height: 92rpx;
- background: linear-gradient(270deg, #FF6200 0%, #FF9342 100%);
- border-radius: 12rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-weight: bold;
- color: #FFFFFF;
- font-size: 30rpx;
- }
- }
- .hotel-content {
- width: 100%;
- padding: 40rpx 30rpx 100rpx;
- .hotel-content-top {
- height: 48rpx;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- .hotel-content-top-text {
- margin-top: -2rpx;
- font-weight: bold;
- color: #333333;
- font-size: 32rpx;
- margin-left: 8rpx;
- }
- }
- .hotel-content-introduce {
- margin-top: 32rpx;
- padding: 48rpx 22rpx;
- background: #FFFFFF;
- border-radius: 4rpx;
- border: 2rpx solid #999999;
- margin-bottom: 100rpx;
- }
- }
- .introduce-top {
- height: 32rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 32rpx;
- font-weight: bold;
- letter-spacing: 2rpx;
- .introduce-top-rule1 {
- width: 56rpx;
- height: 4rpx;
- background: linear-gradient(90deg, #FFFFFF 0%, #D9A94D 100%);
- }
- .introduce-top-rule2 {
- width: 56rpx;
- height: 4rpx;
- background: linear-gradient(-90deg, #FFFFFF 0%, #D9A94D 100%);
- }
- }
- .introduce-btn-text {
- margin-top: 72rpx;
- font-size: 28rpx;
- color: #333;
- font-weight: bold;
- line-height: 56rpx;
- }
- .introduce-btn {
- margin-top: 72rpx;
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 30rpx;
- color: #101010;
- font-weight: bold;
- }
- </style>
|