hotel.vue 17 KB

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