hotel.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. <template>
  2. <view>
  3. <view style="height: 65upx;"></view>
  4. <scroll-view style="height: 95vh;" class="floor-list"
  5. :scroll-top="scrollTop" scroll-y="true" @scroll="scroll" @scrolltoupper="upper" @scrolltolower="lower"
  6. :refresher-enabled="false">
  7. <view class="scrollswiper">
  8. <swiper class="swiper"
  9. indicator-dots
  10. circular=true
  11. :autoplay="autoplay"
  12. :interval="interval"
  13. :duration="duration"
  14. >
  15. <swiper-item v-for="(item,index) in store_slide" :key="index">
  16. <view style="height: 100%;" class="swiper-item">
  17. <image style="height: 100%;width: 100%;" :src='item' />
  18. </view>
  19. </swiper-item>
  20. </swiper>
  21. </view>
  22. <view class="titeTop" :class="iScrolltop == 2?'activeColor' : ''">
  23. <view @tap="goback()" class="topleft">
  24. <uniIcon type="back" size="22" color="#666666" />
  25. </view>
  26. <view @click="gotosearch">
  27. <view class="input-view">
  28. <uniIcon type="search" size="22" color="#666666" />
  29. <input confirm-type="search" class="input" type="text" placeholder="输入搜索关键词" @confirm="confirm" />
  30. </view>
  31. </view>
  32. <!-- <view class="topright">
  33. <uniIcon type="arrowright" size="22" color="#666666" />
  34. </view> -->
  35. </view>
  36. <view class="tip">
  37. <view style="font-size: 36upx;color: #303133;">{{hotelitle}}</view>
  38. <view >
  39. <van-icon name="star-o" @click="gocollect" v-if="has_collected == 0" size="22" />
  40. <van-icon name="star-o" @click="gocollect" v-if="has_collected == 1" size="22" color= "#D9332E" />
  41. </view>
  42. </view>
  43. <view v-if="store_summary" style="color: #666;padding: 0 32upx 10upx 32upx;">{{store_summary}}</view>
  44. <view>
  45. <van-tabs v-model="activeindex" @click.stop="onChange">
  46. <van-tab :name="0" title="服务项目">
  47. <view>
  48. <!-- background: #909399 -->
  49. <view class="giveList">
  50. <view class="giveItem" v-for="(item,index) in category_list" :key="index" @click.stop="godetail(item)">
  51. <image :src="item.pic"
  52. style="width:100%;height: 100upx;">
  53. </image>
  54. <p style="text-align: center;">{{item.gc_name}}</p>
  55. </view>
  56. </view>
  57. <view style="padding: 0upx 18upx;">
  58. <view style="width: 95%;margin: 0 auto;">
  59. <view @click.stop="choseType(1)" :class="tabIndex==1 ? 'active' : ''" class="typeItem">
  60. 综合
  61. </view>
  62. <view@click.stop="choseType(2)" class="typeItem">
  63. <view class="iconClass">
  64. <view :class="tabIndex==2 ? 'active' : ''">上新</view>
  65. <view style="display: flex;flex-direction: column;margin-left: 10rpx;">
  66. <view v-if="istopclick==0">
  67. <!-- <van-icon size="8px" name="arrow-up" :class="istopclick==1 ? 'active' : ''" /> -->
  68. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort.png' />
  69. </view>
  70. <view v-if="istopclick==1">
  71. <!-- <van-icon size="8px" name="arrow-up" :class="istopclick==1 ? 'active' : ''" /> -->
  72. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort_down.png' />
  73. </view>
  74. <view v-if="istopclick==2">
  75. <!-- <van-icon :class="istopclick==2 ? 'active' : ''" size="8px" name="arrow-down" /> -->
  76. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort_up.png' />
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view @click.stop="choseType(3)" class="typeItem">
  82. <view class="iconClass">
  83. <view :class="tabIndex==3 ? 'active' : ''">价格</view>
  84. <view style="display: flex;flex-direction: column;margin-left: 10rpx;">
  85. <!-- <view @click.stop="changeisclick(3)" >
  86. <van-icon :class="istopclick==3 ? 'active' : ''" size="8px" name="arrow-up" />
  87. </view>
  88. <view @click.stop="changeisclick(4)">
  89. <van-icon :class="istopclick==4 ? 'active' : ''" size="8px" name="arrow-down" />
  90. </view> -->
  91. <view v-if="isprice==0">
  92. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort.png' />
  93. </view>
  94. <view v-if="isprice==3">
  95. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort_down.png' />
  96. </view>
  97. <view v-if="isprice==4">
  98. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort_up.png' />
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <view @click.stop="choseType(4)" class="typeItem">
  104. <view :class="tabIndex==4 ? 'active' : ''">分类
  105. <img v-if="tabIndex != 4" style="width: 36upx;height: 36upx;" src='../../static/sortb.png' />
  106. <img v-if="tabIndex == 4" style="width: 36upx;height: 36upx;" src='../../static/sortb_up.png' />
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. <view v-if="tabIndex==4">
  112. <view style="margin: 18upx 36upx;float: left;width: 110upx;text-align: center;"
  113. v-for="(item, index) in classify" :key="index"
  114. @click.stop="confirm(item)" >
  115. {{item.gc_name}}
  116. </view>
  117. </view>
  118. <!-- 商品列表 -->
  119. <shopList :productList="goods_list" />
  120. </view>
  121. </van-tab>
  122. <van-tab :name="1" :title="'评价' +' '+hoteldetail.feedback_count">
  123. <!-- 评价列表 -->
  124. <assess :feedback_list="feedback_list" />
  125. </van-tab>
  126. <van-tab :name="2" title="酒店信息">
  127. <view style="padding: 20upx 32upx 0upx 32upx;margin-bottom: 200upx;">
  128. <rich-text :nodes="store_description"></rich-text>
  129. </view>
  130. </van-tab>
  131. </van-tabs>
  132. </view>
  133. </scroll-view>
  134. <view v-if="activeindex == 2" class="bottomButton">
  135. <button type="warn" @click="gofeedback">您的入住意见反馈(反馈送圈币)</button>
  136. </view>
  137. <Gobacktop @getop="getop" v-if="isTop" />
  138. </view>
  139. </template>
  140. <script>
  141. import {
  142. mapMutations,mapState
  143. } from 'vuex'
  144. import uniIcon from '@/component/uni-icon/uni-icon.vue'
  145. import uniNavBar from '@/component/uni-nav-bar/uni-nav-bar.vue'
  146. import commoNar from '@/component/commoNar.vue' // 筛选栏
  147. import shopList from '@/component/shopList.vue' // 商品列表
  148. import assess from '@/component/assess.vue' // 评价列表
  149. import Gobacktop from '@/component/Gobacktop.vue'
  150. export default {
  151. components: {
  152. uniIcon,
  153. uniNavBar,
  154. commoNar,
  155. assess,
  156. shopList,
  157. Gobacktop
  158. },
  159. data() {
  160. return {
  161. isTop: 0,
  162. hoteldetail: {},
  163. has_collected: 0, // 收藏酒店
  164. chosegoods_commonid: true,
  165. chosegoods_price: true,
  166. firstwo: 1,
  167. isDetail: 1,
  168. pictureUrl: this.pictureUrl,
  169. showdialog: false,
  170. store_description: '', //酒店信息
  171. store_summary:'', // 标签
  172. store_slide: [], //banner
  173. goods_list:[], // 首页酒店商品列表
  174. isnexttwo: 1,
  175. feedback_list:[], // 评价列表
  176. hotelitle: '', // 酒店名称
  177. istopclick: 0,
  178. page: 1,
  179. goodId: 0,
  180. page_size: 10,
  181. gc_id_1:'',// 一级分类id
  182. gc_id_2:'',// 二级分类id
  183. goods_commonid:'',// 上新排序 desc-降序 asc-尚需
  184. goods_price :'',// 价格排序 desc-降序 asc-尚需
  185. praise :'',// 好评率排序 desc-降序 asc-尚需
  186. keyword:'',//g 关键字搜索
  187. category_list: [{gc_id_1:'',gc_name:'全部'}], // 一级菜单栏
  188. tabIndex: 1,
  189. isprice:0,
  190. menu: [{
  191. name: '综合',
  192. id: '0'
  193. }, {
  194. name: '上新',
  195. id: '1'
  196. }, {
  197. name: '价格',
  198. id: '2'
  199. },
  200. {
  201. name:'分类',
  202. id:'3'
  203. }
  204. ],
  205. classify: [],
  206. background: ['color1', 'color2', 'color3'],
  207. indicatorDots: true,
  208. autoplay: true,
  209. interval: 2000,
  210. duration: 500,
  211. activeindex: 0,
  212. scrollTop: 0,
  213. old: {
  214. scrollTop: 0
  215. },
  216. value1: 0,
  217. iScrolltop: 1
  218. }
  219. },
  220. onShareAppMessage(res) {
  221. uni.showShareMenu({
  222. withShareTicket: true
  223. });
  224. let that = this;
  225. let id = this.goodId; // 商品Id
  226. if (res.from === 'button') {
  227. // 来自页面内分享按钮
  228. }
  229. return {
  230. title: that.hotelitle,
  231. path: `/pages/index/shop?id=${id}`,
  232. imageUrl:that.store_slide[0]
  233. }
  234. },
  235. // 初次渲染进来关闭分享菜单栏
  236. onReady:function(){
  237. // uni.hideShareMenu({
  238. // success(res) {
  239. // console.log(res)
  240. // console.log("kkkkkkkkkkkk")
  241. // },
  242. // fail(res){
  243. // console.log(res)
  244. // console.log("dddddd")
  245. // }
  246. // });
  247. },
  248. onLoad(options){
  249. console.log("jjdddjeee")
  250. this.goodId = options.id; // 商品和酒店Id
  251. this.activeindex = 0;
  252. this.getshopdetail(); // 获取商品详情
  253. this.hotelmenu(); // 一级菜单
  254. this.gethoteil(); // 获取酒店信息
  255. },
  256. computed:{
  257. ...mapState([
  258. 'hasLogin',
  259. 'userInfo',
  260. 'successlogion'
  261. ]),
  262. },
  263. methods: {
  264. getop() {
  265. this.scrollTop = this.old.scrollTop
  266.                 this.$nextTick(function(){
  267.                     this.scrollTop=0;
  268.                 });
  269. this.isTop = false;
  270. },
  271. // 入住酒店反馈
  272. gofeedback() {
  273. if(this.hoteldetail.can_feedback == 0) {
  274. this.$msg(this.hoteldetail.feedback_msg);
  275. return;
  276. }
  277. let store_id = this.goodId;
  278. uni.navigateTo({
  279. url: `/pages/index/feedback?store_id=${store_id}`
  280. });
  281. },
  282. // 搜说
  283. gotosearch() {
  284. let store_id = this.goodId;
  285. uni.navigateTo({
  286. url: `/pages/index/hotelsearch?store_id=${store_id}`
  287. });
  288. },
  289. // 收藏
  290. gocollect() {
  291. if(this.hasLogin && this.successlogion) {
  292. this.request({
  293. url: '/v1/favorites/collect',
  294. method: 'post',
  295. data: {
  296. type:'store',
  297. fav_id: this.goodId
  298. },
  299. success: () => {
  300. this.gethoteil()
  301. }
  302. })
  303. }else {
  304. // this.showdialog = true;
  305. uni.navigateTo({
  306. url:'/pages/myCenter/logion'
  307. })
  308. }
  309. },
  310. // 关闭弹窗
  311. // cancelDiaolog() {
  312. // this.showdialog = false;
  313. // },
  314. // // 确定
  315. // confirmDiaolog() {
  316. // this.showdialog = false;
  317. // },
  318. choseType(e) {
  319. this.tabIndex = e;
  320. this.isDetail = 1;
  321. this.page = 1;
  322. //this.goods_list = [];
  323. if(this.tabIndex == 1) { // 服务
  324. this.istopclick = 0;
  325. this.isprice = 0;
  326. this.gc_id_1 = '';
  327. this.goods_price = '';
  328. this.goods_commonid = '';
  329. this.getshopdetail(2);
  330. }else if(this.tabIndex == 2){ //伤
  331. this.chosegoods_price = true;
  332. this.istopclick = this.chosegoods_commonid?1:2;
  333. this.isprice = 0;
  334. this.goods_price = '';
  335. this.goods_commonid = this.chosegoods_commonid?'asc':'desc';
  336. this.chosegoods_commonid = !this.chosegoods_commonid;
  337. this.getshopdetail(2);
  338. }else if(this.tabIndex == 3){ // 价格
  339. this.chosegoods_commonid = true;
  340. this.istopclick = 0;
  341. this.isprice = this.chosegoods_price?3:4;
  342. this.goods_price = this.chosegoods_price?'desc':'asc';
  343. this.goods_commonid = '';
  344. this.chosegoods_price = !this.chosegoods_price;
  345. this.getshopdetail(2);
  346. }else if(this.tabIndex ==4) { // 分类
  347. this.istopclick = 0;
  348. this.isprice = 0;
  349. this.goods_price = '';
  350. this.goods_commonid = '';
  351. this.chosegoods_price = true;
  352. this.chosegoods_commonid = true;
  353. }
  354. },
  355. // 点击切换上下
  356. changeisclick(e) {
  357. },
  358. godetail(item) {
  359. let id = item.gc_id; // 一级菜单id
  360. let store_id = this.goodId;
  361. let gc_name = item.gc_name;
  362. uni.navigateTo({
  363. url: `/pages/index/hoteldetail?id=${id}&gc_name=${gc_name}&store_id=${store_id}`
  364. });
  365. },
  366. // 获取商品详情
  367. getshopdetail(e) {
  368. this.request({
  369.                 url:"/v2/entry/storeGoods",
  370.                 method:'get',
  371. data: {
  372. store_id: this.goodId,
  373. page: this.page,
  374. goods_commonid: this.goods_commonid, // 上新排序
  375. goods_price: this.goods_price,
  376. gc_id_1: this.gc_id_1
  377. },
  378. success: (res) => {
  379. if(e == 2) {
  380. this.goods_list = [];
  381. }
  382. this.goods_list = this.goods_list.concat(res.data.data.goods_list);
  383. if(res.data.data.goods_list.length < 10) {
  384. this.isDetail = 2;
  385. }
  386. },
  387. })
  388. },
  389. // 一级菜单
  390. hotelmenu() {
  391. let _this = this;
  392. this.request({
  393.                 url:"/v1/entry/storeCategory",
  394.                 method:'get',
  395. data: {
  396. store_id: this.goodId,
  397. },
  398. success: function(res) {
  399. let { category_list } = res.data.data;
  400. category_list.forEach((item,idx) => {
  401. item.text = item.gc_name;
  402. item.value = idx;
  403. })
  404. let array = [{gc_id:'',gc_name:'全部'}];
  405. _this.classify = array.concat(category_list);
  406. _this.category_list = category_list.splice(0,10);
  407. },
  408. })
  409. },
  410. onChange(event) {
  411. this.activeindex = event.detail.name;
  412. this.page = 1;
  413. if(event.detail.name == 1) {
  414. this.getcomment();
  415. }else if(event.detail.name == 0) {
  416. this.getshopdetail()
  417. }
  418. },
  419. // 获取酒店评价
  420. getcomment() {
  421. this.request({
  422. url:'/v1/store/feedbackList',
  423. method: 'POST',
  424. data: {
  425. page: this.page,
  426. page_size: 10,
  427. store_id: this.goodId
  428. },
  429. success: (res) => {
  430. this.feedback_list = res.data.data.feedback_list;
  431. if(res.data.data.feedback_list.length < 10) {
  432. this.isnexttwo = 2;
  433. }
  434. }
  435. })
  436. },
  437. // 获取酒店信息
  438. gethoteil() {
  439. this.request({
  440. url:'/v1/store/info',
  441. method:'get',
  442. data: {
  443. store_id: this.goodId
  444. },
  445. success: (res) => {
  446. let { data } = res.data;
  447. this.store_slide = [];
  448. this.hoteldetail = data;
  449. this.hotelitle = data.store_name;
  450. data.store_slide.forEach(item => {
  451. if(item.indexOf('jpg')!= -1) {
  452. this.store_slide.push(item);
  453. }
  454. })
  455. this.store_summary = data.store_summary;
  456. const regex = new RegExp('<img', 'gi');
  457. data.store_description = data.store_description.replace(regex,
  458. `<img style="width: 100%;height: auto;display: block;text-align: center;`);
  459. this.store_description = data.store_description;
  460. this.has_collected = data.has_collected; // 是否收藏
  461. }
  462. })
  463. },
  464. changemenu(e) {
  465. },
  466. confirm(e) {
  467. this.tabIndex = 0;
  468. this.gc_id_1 = e.gc_id;
  469. this.getshopdetail(2);
  470. },
  471. upper(e) {
  472. },
  473. // 滚到底部
  474. lower(e) {
  475. // if(this.activeindex == 1) {
  476. if(this.isnexttwo == 1 && this.activeindex == 1) {
  477. this.page = this.page + 1;
  478. //}
  479. this.getcomment();
  480. // this.activeindex == 0 &&
  481. }else if( this.isDetail == 1) {
  482. this.page = this.page + 1;
  483. this.getshopdetail();
  484. }
  485. },
  486. // 滚动时触发
  487. scroll(e) {
  488. if(e.detail.scrollTop > 400) {
  489. this.isTop = true;
  490. }else{ //当距离小于500时显示回到顶部按钮
  491. this.isTop = false;
  492. }
  493. if(e.detail.scrollTop > 160) {
  494. this.iScrolltop = 2;
  495. }else {
  496. this.iScrolltop = 1;
  497. }
  498. this.old.scrollTop = e.detail.scrollTop
  499. },
  500. // 返回上一页
  501. goback() {
  502. uni.navigateBack()
  503. },
  504. }
  505. }
  506. </script>
  507. <style scoped>
  508. .scrollswiper {
  509. width: 100%;
  510. position: relative;
  511. }
  512. .titleFixed {
  513. position: absolute;
  514. top: 0;
  515. left: 0;
  516. z-index: 99;
  517. padding-top: 0;
  518. }
  519. .van-nav-bar {
  520. padding-top: 0!important;
  521. /* background: #000000!important; */
  522. /* opacity: 0.2; */
  523. background:rgba(0,0,0,0.2)!important;
  524. }
  525. .swiper {
  526. height: 380upx;
  527. }
  528. .swiper-item {
  529. display: block;
  530. height: 100%!important;
  531. line-height: 300upx;
  532. text-align: center;
  533. }
  534. .tip {
  535. display: flex;
  536. justify-content: space-between;
  537. padding: 36upx 32upx;
  538. }
  539. .giveList {
  540. padding: 10upx 12upx;
  541. display: flex;
  542. flex-wrap: wrap;
  543. }
  544. .giveItem {
  545. height: 120rpx;
  546. flex: 1;
  547. width: 16%;
  548. min-width: 16%;
  549. max-width: 16%;
  550. /* margin: 24rpx 0 25rpx 4%; */
  551. margin: 24upx 2%;
  552. }
  553. .active {
  554. color: #F76260;
  555. }
  556. .typeItem {
  557. width: 25%;
  558. display: inline-block;
  559. text-align: center;
  560. }
  561. .iconClass {
  562. display: flex;
  563. flex-direction: row;
  564. align-items: center;
  565. justify-content: center;
  566. }
  567. .hotlItem {
  568. padding: 22upx 30upx;
  569. border-bottom: 1px solid #EEEEEE;
  570. display: flex;
  571. justify-content: space-between;
  572. }
  573. .bottomButton {
  574. width: 95%;
  575. left: 2.5%;
  576. position: fixed;
  577. bottom: 2.5%;
  578. }
  579. .titeTop {
  580. display: flex;
  581. /* justify-content: space-between; */
  582. align-items: center;
  583. position: absolute;
  584. top: 10upx;
  585. width: 100%;
  586. }
  587. .topleft {
  588. }
  589. .topright {
  590. }
  591. .input-view {
  592. width: 85%;
  593. display: flex;
  594. height: 30px;
  595. border-radius: 15px;
  596. padding: 0 4%;
  597. flex-wrap: nowrap;
  598. margin: 7px 0;
  599. line-height: 30px;
  600. margin: 24upx auto;
  601. background:rgba(0,0,0,1);
  602. border-radius:15px;
  603. opacity:0.4;
  604. }
  605. .input-view .uni-icon {
  606. line-height: 30px !important;
  607. }
  608. .input-view .input {
  609. height: 30px;
  610. line-height: 30px;
  611. width: 94%;
  612. padding: 0 3%;
  613. }
  614. .activeColor {
  615. background: #fff!important;
  616. position: fixed;
  617. background-color: #fff;
  618. top: 65upx;
  619. left: 0;
  620. z-index: 99;
  621. }
  622. .listType {
  623. }
  624. .changeimg {
  625. width: 100%;
  626. height: auto!important;
  627. display: block;
  628. text-align: center;
  629. }
  630. </style>