hotel.vue 18 KB

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