index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <view class="hotel-book">
  3. <!-- 自定义导航栏 -->
  4. <u-navbar :leftText='title' fixed safeAreaInsetTop :placeholder='true' :bgColor="bgColor" @leftClick='back'>
  5. </u-navbar>
  6. <!-- 背景图 -->
  7. <view class="hotel-book-img">
  8. <uni-swiper-dot :mode="mode" :info="info" :current="current1" :dots-styles="dotsStyles">
  9. <swiper class="swiper-box" @change="change1" circular>
  10. <swiper-item v-for="(item ,index) in info" :key="index" v-if="resource_type == 1 ">
  11. <view class="swiper-item">
  12. <image style="width: 100%;height:564rpx;" :src="item.img" mode="aspectFill"></image>
  13. </view>
  14. </swiper-item>
  15. <swiper-item v-if="resource_type == 2 ">
  16. <view class="swiper-item">
  17. <video class="baner-video" id="myVideo" ref="myVideo" style="width: 100%; height: 564rpx;"
  18. :src="video_url" controls :enable-progress-gesture="false">
  19. </video>
  20. </view>
  21. </swiper-item>
  22. </swiper>
  23. </uni-swiper-dot>
  24. </view>
  25. <!-- 酒店介绍 -->
  26. <view class="hotel-content">
  27. <view class="hotel-content-top">
  28. <image style="width: 48rpx;height: 48rpx;" src="/static/icon/local01.png" mode=""></image>
  29. <view class="hotel-content-top-text">
  30. <text>{{hotelDetail.name}}</text>
  31. </view>
  32. </view>
  33. <view class="hotel-content-introduce">
  34. <view class="introduce-top">
  35. <text class="introduce-top-rule1"></text>
  36. <text style="margin: 0 8rpx;">酒店介绍</text>
  37. <text class="introduce-top-rule2"></text>
  38. </view>
  39. <view class="introduce-btn-text introduce-btn">
  40. <view>
  41. <u-parse :content="hotelDetail.details"></u-parse>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="hotel-btn">
  47. <view class="hotel-btn-left">
  48. <view class="hotel-btn-left-text" @click="goIndex">
  49. <view style="width: 48rpx;height: 48rpx;display: flex;align-items: center;justify-content: center;">
  50. <image style="width: 40rpx;height: 42rpx;" src="/static/icon/home04.png" mode=""></image>
  51. </view>
  52. <text>首页</text>
  53. </view>
  54. <view class="hotel-btn-left-text" @click="goJoin">
  55. <view
  56. style="width: 48rpx;height: 48rpx; display: flex;align-items: center;justify-content: center; ">
  57. <image style="width: 52rpx;height: 46rpx;" src="/static/icon/vip02.png" mode=""></image>
  58. </view>
  59. <text>会员</text>
  60. </view>
  61. <view class="hotel-btn-left-text" @click="goLocaltion">
  62. <view style="width: 48rpx;height: 48rpx;display: flex;align-items: center;justify-content: center;">
  63. <image style=" width: 44rpx;height: 44rpx;" src="/static/icon/home03.png" mode=""></image>
  64. </view>
  65. <text>导航</text>
  66. </view>
  67. </view>
  68. <view class="hotel-btn-right" @click="goJump">
  69. <text>预订</text>
  70. </view>
  71. </view>
  72. <!-- 弹出层/核销码 -->
  73. <dialogPanel ref="dialogPanel"/>
  74. </view>
  75. </template>
  76. <script>
  77. export default {
  78. data() {
  79. return {
  80. //用户信息
  81. admin:'',
  82. //跳转h5,小程序,其他页面
  83. jump_type_vip: '',
  84. jump_config_vip: {},
  85. //轮播图
  86. info: [],
  87. //自定义导航栏
  88. bgColor: '#fff',
  89. title: '',
  90. //酒店id
  91. hotel_id: '',
  92. hotelDetail: '',
  93. jump_type: '',
  94. jump_config: '',
  95. resource_type: '',
  96. video_url: '',
  97. //指示点显示位置
  98. dotsStyles: {
  99. backgroundColor: 'rgba(255, 255, 255, .3)',
  100. border: '1px rgba(255, 255, 255, .3) solid',
  101. color: '#fff',
  102. selectedBackgroundColor: 'rgba(255, 255, 255, 1)',
  103. selectedBorder: '1px rgba(255, 255, 255, 1) solid'
  104. },
  105. //指示点显示位置
  106. current1: 0,
  107. mode: 'dot',
  108. hotel:{},
  109. }
  110. },
  111. onReady: function(res) {
  112. this.videoContext = uni.createVideoContext('myVideo')
  113. },
  114. onShow() {
  115. this.admin = this.$store.getters.userInfo
  116. },
  117. onLoad(params) {
  118. if(!this.$store.getters.userInfo){
  119. uni.redirectTo({
  120. url: '/pages/login/login'
  121. })
  122. }
  123. if (params?.hotel_id) {
  124. params.address = params.address == 'null' ? "" : params.address;
  125. this.hotel = params;
  126. this.hotel_id = params.hotel_id;
  127. this.getDetail()
  128. }
  129. //vip跳转
  130. this.advise = this.$store.getters.allset.add_member
  131. this.jump_type_vip = this.advise.value.map_jump_type
  132. if (this.jump_type_vip == 1) {
  133. this.jump_config_vip = this.advise.value.map_h5_url
  134. } else if (this.jump_type_vip == 2) {
  135. this.jump_config_vip.appid = this.advise.value.map_appid
  136. this.jump_config_vip.path = this.advise.value.map_path
  137. } else if (this.jump_type_vip == 3) {
  138. this.jump_config_vip = this.advise.value.map_other_path
  139. }
  140. },
  141. methods: {
  142. // 切换轮播图指示点
  143. change1(e) {
  144. this.current1 = e.detail.current;
  145. },
  146. //视频自动播放
  147. openVideoPlay() {
  148. this.videoContext.play()
  149. },
  150. //返回上一级
  151. back() {
  152. const pages = getCurrentPages();
  153. if (pages.length === 2) {
  154. uni.navigateBack({
  155. delta: 1
  156. });
  157. } else if (pages.length === 1) {
  158. uni.switchTab({
  159. url: '/pages/index/index',
  160. })
  161. } else {
  162. uni.navigateBack({
  163. delta: 1
  164. });
  165. }
  166. },
  167. //预约跳转
  168. goJump() {
  169. if(this.hotelDetail.reserve_jump_type == 3){
  170. this.$refs.dialogPanel.show(this.hotelDetail.reserve_jump_config);
  171. return
  172. }
  173. this.$utils.jump({
  174. jump_type: this.hotelDetail.reserve_jump_type,
  175. jump_config: this.hotelDetail.reserve_jump_config
  176. })
  177. },
  178. //获取酒店详情
  179. getDetail() {
  180. this.$api.hotel.getHotelDetail({
  181. hotel_id: this.hotel_id
  182. }).then(res => {
  183. this.hotelDetail = res.data
  184. this.title = res.data.name
  185. this.info = JSON.parse(res.data.img_urls).map(item => {
  186. return {
  187. img: item
  188. }
  189. })
  190. //跳转h5和小程序
  191. this.jump_type = res.data.jump_type,
  192. this.jump_config = res.data.jump_config
  193. //banner展示视频或者图片
  194. this.resource_type = res.data.resource_type
  195. this.video_url = res.data.video_url
  196. console.log(this.video_url, '--->this.video_url');
  197. //视频自动播放
  198. this.openVideoPlay()
  199. })
  200. },
  201. // 跳转其他小程序
  202. // goJoin() {
  203. // wx.navigateToMiniProgram({
  204. // appId: 'wx255b58f0992b3c53', //appid
  205. // path: 'newUIMain/enrollment/enrollment', //path
  206. // extraData: { //参数
  207. // foo: 'bar'
  208. // },
  209. // // envVersion: 'develop', //开发版develop 开发版 trial 体验版 release 正式版
  210. // success(res) {
  211. // console.log('成功')
  212. // // 打开成功
  213. // },
  214. // fail(e) {
  215. // console.log(e, '失败')
  216. // }
  217. // })
  218. // },
  219. // 跳转其他小程序
  220. goJoin() {
  221. let _this = this
  222. this.jumpHAppID(this.jump_type_vip, this.jump_config_vip)
  223. },
  224. // 跳转其他小程序
  225. jumpHAppID(id, urls) {
  226. if (id == 1) {
  227. const url = urls; // 跳转的外链
  228. const navtitle = 'H5'; // 这个标题是你自己可以设置的
  229. uni.navigateTo({
  230. // 跳转到webview页面
  231. url: `/pages/webview/webview?url=${url}&nav=${navtitle}`,
  232. success: () => {
  233. console.log('成功')
  234. },
  235. fail: (e) => {
  236. console.log(e, "失败")
  237. }
  238. });
  239. } else if (id == 2) {
  240. let _this = this
  241. let obj = urls;
  242. console.log(obj, '----->obj');
  243. wx.navigateToMiniProgram({
  244. appId: `${obj.appid}`, //appid
  245. path: `${obj.path}`, //path
  246. extraData: { //参数
  247. foo: 'bar'
  248. },
  249. // envVersion: 'develop', //开发版develop 开发版 trial 体验版 release 正式版
  250. success(res) {
  251. let page = '/pages/map/map'
  252. let user_id = ''
  253. if (_this.admin != null) {
  254. user_id = _this.admin.id
  255. } else {
  256. user_id = 0
  257. }
  258. _this.$api.my.userMemberAdd({
  259. user_id,
  260. page,
  261. }).then(res => {
  262. console.log(res.data);
  263. })
  264. // 打开成功
  265. },
  266. fail(e) {
  267. console.log(e, '失败')
  268. }
  269. })
  270. } else if (id == 3) {
  271. uni.redirectTo({
  272. url: urls,
  273. fail: (err) => {
  274. uni.reLaunch({
  275. url: urls
  276. })
  277. }
  278. })
  279. }
  280. },
  281. // 跳转首页
  282. goIndex() {
  283. uni.reLaunch({
  284. url: '/pages/index/index'
  285. })
  286. },
  287. goLocaltion(){
  288. console.log(this.hotel)
  289. uni.openLocation({
  290. type: "gcj02",
  291. latitude: parseFloat(this.hotel.latitude), // 纬度,浮点数,范围为90 ~ -90
  292. longitude: parseFloat(this.hotel.longitude), // 经度,浮点数,范围为180 ~ -180。
  293. scale: 12, // 地图缩放级别,整形值,范围从1~28。默认为最大
  294. name: this.hotel.name, // 位置名
  295. address: this.hotel.address, // 地址详情说明
  296. })
  297. }
  298. }
  299. }
  300. </script>
  301. <style lang="scss" scoped>
  302. $pageColor:#F9F9F9;
  303. $bgColor:#FFFFFF;
  304. @mixin flexlayout {
  305. display: flex;
  306. align-items: center;
  307. justify-content: center;
  308. }
  309. .hotel-book {
  310. height: 100%;
  311. background: #fff;
  312. }
  313. .hotel-book-img {
  314. height: 564rpx;
  315. .swiper-box {
  316. height: 564rpx;
  317. }
  318. }
  319. .hotel-btn {
  320. padding: 0 30rpx;
  321. position: fixed;
  322. bottom: 0;
  323. width: 100%;
  324. height: 148rpx;
  325. background: #FFFFFF;
  326. box-shadow: 0px -2rpx 20rpx 0px rgba(0, 0, 0, 0.04);
  327. display: flex;
  328. align-items: center;
  329. justify-content: space-between;
  330. .hotel-btn-left {
  331. display: flex;
  332. align-items: center;
  333. justify-content: space-between;
  334. .hotel-btn-left-text {
  335. display: flex;
  336. flex-direction: column;
  337. align-items: center;
  338. justify-content: flex-start;
  339. font-weight: 500;
  340. color: #999999;
  341. font-size: 22rpx;
  342. margin-right: 48rpx;
  343. }
  344. }
  345. .hotel-btn-right {
  346. width: 396rpx;
  347. height: 92rpx;
  348. background: linear-gradient(270deg, #FF6200 0%, #FF9342 100%);
  349. border-radius: 12rpx;
  350. display: flex;
  351. align-items: center;
  352. justify-content: center;
  353. font-weight: bold;
  354. color: #FFFFFF;
  355. font-size: 30rpx;
  356. }
  357. }
  358. .hotel-content {
  359. width: 100%;
  360. padding: 40rpx 30rpx 100rpx;
  361. .hotel-content-top {
  362. height: 48rpx;
  363. display: flex;
  364. align-items: center;
  365. justify-content: flex-start;
  366. .hotel-content-top-text {
  367. margin-top: -2rpx;
  368. font-weight: bold;
  369. color: #333333;
  370. font-size: 32rpx;
  371. margin-left: 8rpx;
  372. }
  373. }
  374. .hotel-content-introduce {
  375. margin-top: 32rpx;
  376. padding: 48rpx 22rpx;
  377. background: #FFFFFF;
  378. border-radius: 4rpx;
  379. border: 2rpx solid #999999;
  380. margin-bottom: 100rpx;
  381. }
  382. }
  383. .introduce-top {
  384. height: 32rpx;
  385. display: flex;
  386. align-items: center;
  387. justify-content: center;
  388. font-size: 32rpx;
  389. font-weight: bold;
  390. letter-spacing: 2rpx;
  391. .introduce-top-rule1 {
  392. width: 56rpx;
  393. height: 4rpx;
  394. background: linear-gradient(90deg, #FFFFFF 0%, #D9A94D 100%);
  395. }
  396. .introduce-top-rule2 {
  397. width: 56rpx;
  398. height: 4rpx;
  399. background: linear-gradient(-90deg, #FFFFFF 0%, #D9A94D 100%);
  400. }
  401. }
  402. .introduce-btn-text {
  403. margin-top: 72rpx;
  404. font-size: 28rpx;
  405. color: #333;
  406. font-weight: bold;
  407. line-height: 56rpx;
  408. }
  409. .introduce-btn {
  410. margin-top: 72rpx;
  411. width: 100%;
  412. display: flex;
  413. align-items: center;
  414. justify-content: center;
  415. font-size: 30rpx;
  416. color: #101010;
  417. font-weight: bold;
  418. }
  419. </style>