hotel.vue 20 KB

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