hotel.vue 17 KB

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