searchresult.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view class="searchType" style="background: #fff;height: 100vh;">
  3. <van-cell value-class="searchclass">
  4. <template slot="title">
  5. <view class="input-view">
  6. <uni-icon type="search" size="22" color="#666666" />
  7. <input confirm-type="search" class="input" type="text" placeholder="输入搜索关键词"
  8. @input="confirm" />
  9. </view>
  10. </template>
  11. <template>
  12. <view @click="search">搜索</view>
  13. </template>
  14. </van-cell>
  15. <view class="hotelList" v-for="(item,index) in hotelist" :key="index" @click="openinfo(item)">
  16. <view class="hotleLeft">
  17. <image style="width: 214upx;height: 152upx;" :src="pictureUrl+'/uploads/home/store/'+item.store_id+'/'+item.store_banner" />
  18. </view>
  19. <view class="hotelright">
  20. <view style="font-size: 32upx;color: #303133;font-weight: 550;">{{item.store_name}}
  21. </view>
  22. <view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;padding: 10rpx 0;">
  23. <view style="font-size: 32upx; color: #303133;font-weight: 550;">{{item.store_servicecredit}}</view>
  24. <view style="color: #606266;font-size: 24upx;">月访客{{item.store_visitor}}</view>
  25. <view style="color: #606266;font-size: 24upx;">{{item.distance}}</view>
  26. </view>
  27. <view v-if="item.tages.length!=1" class="undertip">
  28. <view v-for="(items,index) in item.tages" :key="index" class="tipsTop">{{items}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import uniIcon from '@/component/uni-icon/uni-icon.vue'
  36. export default {
  37. components: {
  38. uniIcon
  39. },
  40. onLoad() {
  41. //this.gethotelist();
  42. },
  43. data() {
  44. return {
  45. pictureUrl: this.pictureUrl,
  46. hotelist: [],
  47. searchvalue:'',
  48. page: 1
  49. }
  50. },
  51. methods: {
  52. search() {
  53. this.hotelist = [];
  54. this.gethotelist();
  55. },
  56. confirm(e) {
  57. this.searchvalue = e.detail.value;
  58. this.hotelist = [];
  59. this.gethotelist();
  60. },
  61. // 跳转到新页面 酒店详情
  62. openinfo(item) {
  63. let id = item.store_id;
  64. uni.navigateTo({
  65. url: `/pages/index/hotel?id=${id}`
  66. });
  67. },
  68. // 获取酒店列表
  69. gethotelist() {
  70. if(this.searchvalue == '') {
  71. this.$msg("关键字不能为空")
  72. return;
  73. }
  74. this.request({
  75.                 url:"/v2/entry/storeList",
  76.                 method:'get',
  77. data: {
  78. page: this.page,
  79. page_size: 10,
  80. keyword: this.searchvalue
  81. },
  82. success: (res) => {
  83. let { data,code } = res.data;
  84. if(code == 1000) {
  85. if(data.store_list.length<10) {
  86. this.ispull = false;
  87. }
  88. if(this.hotelist.length == 0) {
  89. this.hotelist = data.store_list
  90. }else {
  91. this.hotelist = this.hotelist.concat(data.store_list);
  92. }
  93. }else {
  94. this.$msg("网络错误稍后再试")
  95. }
  96. }
  97. })
  98. },
  99. }
  100. }
  101. </script>
  102. <style>
  103. .searchType .input-view {
  104. width: 80%;
  105. display: flex;
  106. background-color: #e7e7e7;
  107. height: 30px;
  108. border-radius: 15px;
  109. padding: 0 4%;
  110. flex-wrap: nowrap;
  111. margin: 7px 0;
  112. line-height: 30px;
  113. margin: 24upx 0 24upx 32upx;
  114. }
  115. .searchType .input-view .uni-icon {
  116. line-height: 30px !important;
  117. }
  118. .searchType .input-view .input {
  119. height: 30px;
  120. line-height: 30px;
  121. width: 94%;
  122. padding: 0 3%;
  123. }
  124. .van-cell__title {
  125. flex: 6!important;
  126. }
  127. .searchclass {
  128. display: flex;
  129. align-items: center;
  130. justify-content: center;
  131. }
  132. .van-cell {
  133. padding: 15upx 32upx 0 32upx!important;
  134. }
  135. .hotelList {
  136. display: flex;
  137. flex-direction: row;
  138. padding: 24upx 32upx;
  139. }
  140. .hotleLeft {
  141. width: 214upx;
  142. height: 152upx;
  143. }
  144. .hotelright {
  145. padding-left: 16upx;
  146. display: flex;
  147. flex-direction: column;
  148. width: 100%;
  149. }
  150. .undertip {
  151. display: flex;
  152. flex-direction: row;
  153. align-items: center;
  154. }
  155. .tipsTop {
  156. border: 2upx solid #BBBBBB;
  157. margin-right: 14upx;
  158. color: #BBBBBB;
  159. padding: 4upx;
  160. }
  161. /* .van-cell__title {
  162. flex: 6!important;
  163. } */
  164. </style>