hotel.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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-o" @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="'评价' +' '+hoteldetail.feedback_count">
  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.isDetail = 1;
  314. this.page = 1;
  315. //this.goods_list = [];
  316. if(this.tabIndex == 1) { // 服务
  317. this.istopclick = 0;
  318. this.isprice = 0;
  319. this.gc_id_1 = '';
  320. this.goods_price = '';
  321. this.goods_commonid = '';
  322. this.getshopdetail(2);
  323. }else if(this.tabIndex == 2){ //伤
  324. this.chosegoods_price = true;
  325. console.log(this.chosegoods_commonid);
  326. this.istopclick = this.chosegoods_commonid?1:2;
  327. this.isprice = 0;
  328. this.goods_price = '';
  329. this.goods_commonid = this.chosegoods_commonid?'asc':'desc';
  330. this.chosegoods_commonid = !this.chosegoods_commonid;
  331. this.getshopdetail(2);
  332. }else if(this.tabIndex == 3){ // 价格
  333. this.chosegoods_commonid = true;
  334. console.log(this.chosegoods_price);
  335. this.istopclick = 0;
  336. this.isprice = this.chosegoods_price?3:4;
  337. this.goods_price = this.chosegoods_price?'desc':'asc';
  338. this.goods_commonid = '';
  339. this.chosegoods_price = !this.chosegoods_price;
  340. this.getshopdetail(2);
  341. }else if(this.tabIndex ==4) { // 分类
  342. this.istopclick = 0;
  343. this.isprice = 0;
  344. this.goods_price = '';
  345. this.goods_commonid = '';
  346. this.chosegoods_price = true;
  347. this.chosegoods_commonid = true;
  348. }
  349. },
  350. // 点击切换上下
  351. changeisclick(e) {
  352. },
  353. godetail(item) {
  354. console.log(item);
  355. let id = item.gc_id; // 一级菜单id
  356. let store_id = this.goodId;
  357. let gc_name = item.gc_name;
  358. uni.navigateTo({
  359. url: `/pages/index/hoteldetail?id=${id}&gc_name=${gc_name}&store_id=${store_id}`
  360. });
  361. },
  362. // 获取商品详情
  363. getshopdetail(e) {
  364. this.request({
  365.                 url:"/v2/entry/storeGoods",
  366.                 method:'get',
  367. data: {
  368. store_id: this.goodId,
  369. page: this.page,
  370. goods_commonid: this.goods_commonid, // 上新排序
  371. goods_price: this.goods_price,
  372. gc_id_1: this.gc_id_1
  373. },
  374. success: (res) => {
  375. if(e == 2) {
  376. this.goods_list = [];
  377. }
  378. this.goods_list = this.goods_list.concat(res.data.data.goods_list);
  379. if(res.data.data.goods_list.length < 10) {
  380. this.isDetail = 2;
  381. }
  382. },
  383. })
  384. },
  385. // 一级菜单
  386. hotelmenu() {
  387. let _this = this;
  388. this.request({
  389.                 url:"/v1/entry/storeCategory",
  390.                 method:'get',
  391. data: {
  392. store_id: this.goodId,
  393. },
  394. success: function(res) {
  395. let { category_list } = res.data.data;
  396. category_list.forEach((item,idx) => {
  397. item.text = item.gc_name;
  398. item.value = idx;
  399. })
  400. let array = [{gc_id:'',gc_name:'全部'}];
  401. _this.classify = array.concat(category_list);
  402. _this.category_list = category_list.splice(0,10);
  403. console.log(_this.category_list)
  404. },
  405. })
  406. },
  407. onChange(event) {
  408. this.activeindex = event.detail.name;
  409. this.page = 1;
  410. if(event.detail.name == 1) {
  411. this.getcomment();
  412. }else if(event.detail.name == 0) {
  413. this.getshopdetail()
  414. }
  415. },
  416. // 获取酒店评价
  417. getcomment() {
  418. this.request({
  419. url:'/v1/store/feedbackList',
  420. method: 'POST',
  421. data: {
  422. page: this.page,
  423. page_size: 10,
  424. store_id: this.goodId
  425. },
  426. success: (res) => {
  427. this.feedback_list = res.data.data.feedback_list;
  428. if(res.data.data.feedback_list.length < 10) {
  429. this.isnexttwo = 2;
  430. }
  431. }
  432. })
  433. },
  434. // 获取酒店信息
  435. gethoteil() {
  436. this.request({
  437. url:'/v1/store/info',
  438. method:'get',
  439. data: {
  440. store_id: this.goodId
  441. },
  442. success: (res) => {
  443. let { data } = res.data;
  444. this.hoteldetail = data;
  445. this.hotelitle = data.store_name;
  446. this.store_slide = data.store_slide;
  447. this.store_summary = data.store_summary;
  448. this.store_description = data.store_description;
  449. this.has_collected = data.has_collected; // 是否收藏
  450. }
  451. })
  452. },
  453. changemenu(e) {
  454. },
  455. confirm(e) {
  456. this.tabIndex = 0;
  457. this.gc_id_1 = e.gc_id;
  458. this.getshopdetail(2);
  459. },
  460. upper(e) {
  461. console.log("顶部")
  462. },
  463. // 滚到底部
  464. lower(e) {
  465. console.log(this.activeindex)
  466. console.log(this.isDetail)
  467. // if(this.activeindex == 1) {
  468. if(this.isnexttwo == 1 && this.activeindex == 1) {
  469. this.page = this.page + 1;
  470. //}
  471. this.getcomment();
  472. // this.activeindex == 0 &&
  473. }else if( this.isDetail == 1) {
  474. this.page = this.page + 1;
  475. this.getshopdetail();
  476. }
  477. },
  478. // 滚动时触发
  479. scroll(e) {
  480. if(e.detail.scrollTop > 400) {
  481. this.isTop = true;
  482. }else{ //当距离小于500时显示回到顶部按钮
  483. this.isTop = false;
  484. }
  485. if(e.detail.scrollTop > 160) {
  486. this.iScrolltop = 2;
  487. }else {
  488. this.iScrolltop = 1;
  489. }
  490. this.old.scrollTop = e.detail.scrollTop
  491. },
  492. // 返回上一页
  493. goback() {
  494. uni.navigateBack()
  495. },
  496. }
  497. }
  498. </script>
  499. <style scoped>
  500. .scrollswiper {
  501. width: 100%;
  502. position: relative;
  503. }
  504. .titleFixed {
  505. position: absolute;
  506. top: 0;
  507. left: 0;
  508. z-index: 99;
  509. padding-top: 0;
  510. }
  511. .van-nav-bar {
  512. padding-top: 0!important;
  513. /* background: #000000!important; */
  514. /* opacity: 0.2; */
  515. background:rgba(0,0,0,0.2)!important;
  516. }
  517. .swiper {
  518. height: 380upx;
  519. }
  520. .swiper-item {
  521. display: block;
  522. height: 100%!important;
  523. line-height: 300upx;
  524. text-align: center;
  525. }
  526. .tip {
  527. display: flex;
  528. justify-content: space-between;
  529. padding: 36upx 32upx;
  530. }
  531. .giveList {
  532. padding: 10upx 12upx;
  533. display: flex;
  534. flex-wrap: wrap;
  535. }
  536. .giveItem {
  537. height: 120rpx;
  538. flex: 1;
  539. width: 16%;
  540. min-width: 16%;
  541. max-width: 16%;
  542. /* margin: 24rpx 0 25rpx 4%; */
  543. margin: 24upx 2%;
  544. }
  545. .active {
  546. color: #F76260;
  547. }
  548. .typeItem {
  549. width: 25%;
  550. display: inline-block;
  551. text-align: center;
  552. }
  553. .iconClass {
  554. display: flex;
  555. flex-direction: row;
  556. align-items: center;
  557. justify-content: center;
  558. }
  559. .hotlItem {
  560. padding: 22upx 30upx;
  561. border-bottom: 1px solid #EEEEEE;
  562. display: flex;
  563. justify-content: space-between;
  564. }
  565. .bottomButton {
  566. width: 95%;
  567. left: 2.5%;
  568. position: fixed;
  569. bottom: 2.5%;
  570. }
  571. .titeTop {
  572. display: flex;
  573. /* justify-content: space-between; */
  574. align-items: center;
  575. position: absolute;
  576. top: 10upx;
  577. width: 100%;
  578. }
  579. .topleft {
  580. }
  581. .topright {
  582. }
  583. .input-view {
  584. width: 85%;
  585. display: flex;
  586. height: 30px;
  587. border-radius: 15px;
  588. padding: 0 4%;
  589. flex-wrap: nowrap;
  590. margin: 7px 0;
  591. line-height: 30px;
  592. margin: 24upx auto;
  593. background:rgba(0,0,0,1);
  594. border-radius:15px;
  595. opacity:0.4;
  596. }
  597. .input-view .uni-icon {
  598. line-height: 30px !important;
  599. }
  600. .input-view .input {
  601. height: 30px;
  602. line-height: 30px;
  603. width: 94%;
  604. padding: 0 3%;
  605. }
  606. .activeColor {
  607. background: #fff!important;
  608. position: fixed;
  609. background-color: #fff;
  610. top: 65upx;
  611. left: 0;
  612. z-index: 99;
  613. }
  614. .listType {
  615. }
  616. </style>