hotel.vue 17 KB

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