hotel.vue 20 KB

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