hotel.vue 17 KB

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