searchresult.vue 4.2 KB

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