hotel.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  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 @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. ]),
  215. },
  216. methods: {
  217. // 入住酒店反馈
  218. gofeedback() {
  219. if(this.hoteldetail.can_feedback == 0) {
  220. this.$msg(this.hoteldetail.feedback_msg);
  221. return;
  222. }
  223. let store_id = this.goodId;
  224. uni.navigateTo({
  225. url: `/pages/index/feedback?store_id=${store_id}`
  226. });
  227. },
  228. // 搜说
  229. gotosearch() {
  230. let store_id = this.goodId;
  231. uni.navigateTo({
  232. url: `/pages/index/hotelsearch?store_id=${store_id}`
  233. });
  234. },
  235. // 收藏
  236. gocollect() {
  237. if(this.hasLogin) {
  238. this.request({
  239. url: '/v1/favorites/collect',
  240. method: 'post',
  241. data: {
  242. type:'store',
  243. fav_id: this.goodId
  244. },
  245. success: () => {
  246. this.gethoteil()
  247. }
  248. })
  249. }else {
  250. this.showdialog = true;
  251. }
  252. },
  253. // 关闭弹窗
  254. cancelDiaolog() {
  255. this.showdialog = false;
  256. },
  257. // 确定
  258. confirmDiaolog() {
  259. this.showdialog = false;
  260. },
  261. choseType(e) {
  262. this.tabIndex = e;
  263. this.goods_list = [];
  264. if(this.tabIndex == 1) { // 服务
  265. this.istopclick = 0;
  266. this.gc_id_1 = '';
  267. this.goods_price = '';
  268. this.goods_commonid = '';
  269. }else if(this.tabIndex == 2){ //伤
  270. this.chosegoods_price = true;
  271. console.log(this.chosegoods_commonid);
  272. this.istopclick = this.chosegoods_commonid?1:2;
  273. this.goods_price = '';
  274. this.goods_commonid = this.chosegoods_commonid?'asc':'desc';
  275. this.gc_id_1 = '';
  276. this.chosegoods_commonid = !this.chosegoods_commonid;
  277. }else if(this.tabIndex == 3){ // 价格
  278. this.chosegoods_commonid = true;
  279. console.log(this.chosegoods_price);
  280. this.istopclick = this.chosegoods_price?3:4;
  281. this.goods_price = this.chosegoods_price?'desc':'asc';
  282. this.goods_commonid = '';
  283. this.gc_id_1 = '';
  284. this.chosegoods_price = !this.chosegoods_price;
  285. }else if(this.tabIndex ==4) { // 分类
  286. this.istopclick = 0;
  287. this.goods_price = '';
  288. this.goods_commonid = '';
  289. this.chosegoods_price = true;
  290. this.chosegoods_commonid = true;
  291. }
  292. this.getshopdetail();
  293. },
  294. // 点击切换上下
  295. changeisclick(e) {
  296. },
  297. godetail(item) {
  298. console.log(item);
  299. let id = item.gc_id; // 一级菜单id
  300. let store_id = this.goodId;
  301. let gc_name = item.gc_name;
  302. uni.navigateTo({
  303. url: `/pages/index/hoteldetail?id=${id}&gc_name=${gc_name}&store_id=${store_id}`
  304. });
  305. },
  306. // 获取商品详情
  307. getshopdetail() {
  308. this.request({
  309.                 url:"/v2/entry/storeGoods",
  310.                 method:'get',
  311. data: {
  312. store_id: this.goodId,
  313. page: this.page,
  314. goods_commonid: this.goods_commonid, // 上新排序
  315. goods_price: this.goods_price,
  316. gc_id_1: this.gc_id_1
  317. },
  318. success: (res) => {
  319. this.goods_list = this.goods_list.concat(res.data.data.goods_list);
  320. if(res.data.data.goods_list.length < 10) {
  321. this.isDetail = 2;
  322. }
  323. },
  324. })
  325. },
  326. // 一级菜单
  327. hotelmenu() {
  328. let _this = this;
  329. this.request({
  330.                 url:"/v1/entry/storeCategory",
  331.                 method:'get',
  332. data: {
  333. store_id: this.goodId,
  334. },
  335. success: function(res) {
  336. let { category_list } = res.data.data;
  337. category_list.forEach((item,idx) => {
  338. item.text = item.gc_name;
  339. item.value = idx;
  340. })
  341. _this.category_list = category_list;
  342. },
  343. })
  344. },
  345. onChange(event) {
  346. this.activeindex = event.detail.name;
  347. this.page = 1;
  348. if(event.detail.name == 1) {
  349. this.getcomment();
  350. }else if(event.detail.name == 0) {
  351. this.getshopdetail()
  352. }
  353. },
  354. // 获取酒店评价
  355. getcomment() {
  356. this.request({
  357. url:'/v1/store/feedbackList',
  358. method: 'POST',
  359. data: {
  360. page: this.page,
  361. page_size: 10,
  362. store_id: this.goodId
  363. },
  364. success: (res) => {
  365. this.feedback_list = res.data.data.feedback_list;
  366. if(res.data.data.feedback_list.length < 10) {
  367. this.isnexttwo = 2;
  368. }
  369. }
  370. })
  371. },
  372. // 获取酒店信息
  373. gethoteil() {
  374. this.request({
  375. url:'/v1/store/info',
  376. method:'get',
  377. data: {
  378. store_id: this.goodId
  379. },
  380. success: (res) => {
  381. let { data } = res.data;
  382. this.hoteldetail = data;
  383. this.hotelitle = data.store_name;
  384. this.store_slide = data.store_slide;
  385. this.store_summary = data.store_summary;
  386. this.store_description = data.store_description;
  387. this.has_collected = data.has_collected; // 是否收藏
  388. }
  389. })
  390. },
  391. changemenu(e) {
  392. },
  393. confirm(e) {
  394. this.tabIndex = 0;
  395. this.gc_id_1 = e.gc_id;
  396. this.getshopdetail();
  397. },
  398. upper(e) {
  399. console.log("顶部")
  400. },
  401. // 滚到底部
  402. lower(e) {
  403. console.log(this.activeindex)
  404. console.log(this.isDetail)
  405. if(this.activeindex == 1) {
  406. if(this.isnexttwo == 1) {
  407. this.page = this.page + 1;
  408. }
  409. this.getcomment();
  410. }else if(this.activeindex == 0 && this.isDetail == 1) {
  411. this.page = this.page + 1;
  412. this.getshopdetail();
  413. }
  414. },
  415. // 滚动时触发
  416. scroll(e) {
  417. this.old.scrollTop = e.detail.scrollTop
  418. if(e.detail.scrollTop > 160) {
  419. this.iScrolltop = 2;
  420. }else {
  421. this.iScrolltop = 1;
  422. }
  423. },
  424. // 返回上一页
  425. goback() {
  426. uni.navigateBack()
  427. },
  428. }
  429. }
  430. </script>
  431. <style scoped>
  432. .scrollswiper {
  433. width: 100%;
  434. position: relative;
  435. }
  436. .titleFixed {
  437. position: absolute;
  438. top: 0;
  439. left: 0;
  440. z-index: 99;
  441. padding-top: 0;
  442. }
  443. .van-nav-bar {
  444. padding-top: 0!important;
  445. /* background: #000000!important; */
  446. /* opacity: 0.2; */
  447. background:rgba(0,0,0,0.2)!important;
  448. }
  449. .swiper {
  450. height: 300upx;
  451. }
  452. .swiper-item {
  453. display: block;
  454. height: 100%!important;
  455. line-height: 300upx;
  456. text-align: center;
  457. }
  458. .tip {
  459. display: flex;
  460. justify-content: space-between;
  461. padding: 36upx 32upx;
  462. }
  463. .giveList {
  464. padding: 10upx 12upx;
  465. display: flex;
  466. flex-wrap: wrap;
  467. }
  468. .giveItem {
  469. height: 120rpx;
  470. flex: 1;
  471. width: 20%;
  472. min-width: 20%;
  473. max-width: 20%;
  474. margin: 24rpx 0 25rpx 4%;
  475. }
  476. .active {
  477. color: #F76260;
  478. }
  479. .typeItem {
  480. width: 25%;
  481. display: inline-block;
  482. text-align: center;
  483. }
  484. .iconClass {
  485. display: flex;
  486. flex-direction: row;
  487. align-items: center;
  488. justify-content: center;
  489. }
  490. .hotlItem {
  491. padding: 22upx 30upx;
  492. border-bottom: 1px solid #EEEEEE;
  493. display: flex;
  494. justify-content: space-between;
  495. }
  496. .bottomButton {
  497. width: 95%;
  498. left: 2.5%;
  499. position: fixed;
  500. bottom: 2.5%;
  501. }
  502. .titeTop {
  503. display: flex;
  504. /* justify-content: space-between; */
  505. align-items: center;
  506. position: absolute;
  507. top: 10upx;
  508. width: 100%;
  509. }
  510. .topleft {
  511. }
  512. .topright {
  513. }
  514. .input-view {
  515. width: 85%;
  516. display: flex;
  517. height: 30px;
  518. border-radius: 15px;
  519. padding: 0 4%;
  520. flex-wrap: nowrap;
  521. margin: 7px 0;
  522. line-height: 30px;
  523. margin: 24upx auto;
  524. background:rgba(0,0,0,1);
  525. border-radius:15px;
  526. opacity:0.4;
  527. }
  528. .input-view .uni-icon {
  529. line-height: 30px !important;
  530. }
  531. .input-view .input {
  532. height: 30px;
  533. line-height: 30px;
  534. width: 94%;
  535. padding: 0 3%;
  536. }
  537. .activeColor {
  538. background: #fff!important;
  539. position: sticky;
  540. background-color: #fff;
  541. top: 50upx;
  542. z-index: 99;
  543. }
  544. .listType {
  545. }
  546. </style>