searchresult.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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(a) {
  41. console.log(a);
  42. this.lat = a.lat;
  43. this.lon = a.lon;
  44. },
  45. data() {
  46. return {
  47. lat: '',
  48. lon: '',
  49. pictureUrl: this.pictureUrl,
  50. hotelist: [],
  51. searchvalue:'',
  52. page: 1
  53. }
  54. },
  55. methods: {
  56. search() {
  57. this.hotelist = [];
  58. this.gethotelist();
  59. },
  60. confirm(e) {
  61. this.searchvalue = e.detail.value;
  62. this.hotelist = [];
  63. this.gethotelist();
  64. },
  65. // 跳转到新页面 酒店详情
  66. openinfo(item) {
  67. let id = item.store_id;
  68. uni.navigateTo({
  69. url: `/pages/index/hotel?id=${id}`
  70. });
  71. },
  72. // 获取酒店列表
  73. gethotelist() {
  74. if(this.searchvalue == '') {
  75. this.$msg("关键字不能为空")
  76. return;
  77. }
  78. this.request({
  79.                 url:"/v2/entry/storeList",
  80.                 method:'get',
  81. data: {
  82. page: this.page,
  83. page_size: 10,
  84. lat: this.lat,
  85. lon: this.lon,
  86. keyword: this.searchvalue
  87. },
  88. success: (res) => {
  89. let { data,code } = res.data;
  90. if(code == 1000) {
  91. if(data.store_list.length<10) {
  92. this.ispull = false;
  93. }
  94. if(this.hotelist.length == 0) {
  95. this.hotelist = data.store_list
  96. }else {
  97. this.hotelist = this.hotelist.concat(data.store_list);
  98. }
  99. }else {
  100. this.$msg("网络错误稍后再试")
  101. }
  102. }
  103. })
  104. },
  105. }
  106. }
  107. </script>
  108. <style>
  109. .searchType .input-view {
  110. width: 80%;
  111. display: flex;
  112. background-color: #e7e7e7;
  113. height: 30px;
  114. border-radius: 15px;
  115. padding: 0 4%;
  116. flex-wrap: nowrap;
  117. margin: 7px 0;
  118. line-height: 30px;
  119. margin: 24upx 0 24upx 32upx;
  120. }
  121. .searchType .input-view .uni-icon {
  122. line-height: 30px !important;
  123. }
  124. .searchType .input-view .input {
  125. height: 30px;
  126. line-height: 30px;
  127. width: 94%;
  128. padding: 0 3%;
  129. }
  130. .van-cell__title {
  131. flex: 6!important;
  132. }
  133. .searchclass {
  134. display: flex;
  135. align-items: center;
  136. justify-content: center;
  137. }
  138. .van-cell {
  139. padding: 15upx 32upx 0 32upx!important;
  140. }
  141. .hotelList {
  142. display: flex;
  143. flex-direction: row;
  144. padding: 24upx 32upx;
  145. }
  146. .hotleLeft {
  147. width: 214upx;
  148. height: 152upx;
  149. }
  150. .hotelright {
  151. padding-left: 16upx;
  152. display: flex;
  153. flex-direction: column;
  154. width: 100%;
  155. }
  156. .undertip {
  157. display: flex;
  158. flex-direction: row;
  159. align-items: center;
  160. }
  161. .tipsTop {
  162. border: 2upx solid #BBBBBB;
  163. margin-right: 14upx;
  164. color: #BBBBBB;
  165. padding: 4upx;
  166. }
  167. /* .van-cell__title {
  168. flex: 6!important;
  169. } */
  170. </style>