hotel.vue 16 KB

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