hotel.vue 16 KB

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