searchresult.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view class="searchType" style="background: #fff">
  3. <view class="flex-box flex-v-ce tops">
  4. <view class="input-view flex-1">
  5. <uni-icon type="search" size="22" color="#666666" />
  6. <input confirm-type="search" class="input" type="text" placeholder="输入搜索关键词" @input="confirm" @confirm="confirm" />
  7. </view>
  8. <view @click="search" class="search">取消</view>
  9. </view>
  10. <view style="margin-top: 108upx;">
  11. <view class="hotelList" v-for="(item, index) in hotelist" :key="index" @click="openinfo(item)">
  12. <view class="hotleLeft"><image style="width: 214upx;height: 152upx;" :src="pictureUrl + '/uploads/home/store/' + item.store_id + '/' + item.store_banner" /></view>
  13. <view class="hotelright">
  14. <view style="font-size: 32upx;color: #303133;font-weight: 550;">{{ item.store_name }}</view>
  15. <view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;padding: 10rpx 0;">
  16. <view style="font-size: 32upx; color: #303133;font-weight: 550;">{{ intToFloat(item.store_servicecredit) }}</view>
  17. <view style="color: #606266;font-size: 24upx;">月访客{{ item.store_visitor }}</view>
  18. <view style="color: #606266;font-size: 24upx;">{{ item.distance }}</view>
  19. </view>
  20. <view v-if="item.tages.length != 1" class="undertip">
  21. <view v-for="(items, index) in item.tages" :key="index" class="tipsTop">{{ items }}</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view v-if="hotelist.length == 0" class="noData">未找到内容</view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import uniIcon from '@/component/uni-icon/uni-icon.vue';
  31. export default {
  32. components: {
  33. uniIcon
  34. },
  35. onLoad(a) {
  36. this.lat = a.lat;
  37. this.lon = a.lon;
  38. // this.gethotelist();
  39. },
  40. data() {
  41. return {
  42. lat: '',
  43. lon: '',
  44. pictureUrl: this.pictureUrl,
  45. hotelist: [],
  46. searchvalue: '',
  47. page: 1
  48. };
  49. },
  50. methods: {
  51. intToFloat(val) {
  52. return new Number(val).toFixed(1);
  53. },
  54. search() {
  55. uni.navigateBack()
  56. },
  57. confirm(e) {
  58. if(e.detail.value){
  59. this.hotelist = [];
  60. this.searchvalue = e.detail.value;
  61. this.gethotelist();
  62. }else{
  63. this.hotelist = [];
  64. }
  65. },
  66. // 跳转到新页面 酒店详情
  67. openinfo(item) {
  68. let id = item.store_id;
  69. uni.navigateTo({
  70. url: `/pages/index/hotel?id=${id}`
  71. });
  72. },
  73. // 获取酒店列表
  74. gethotelist() {
  75. uni.showLoading();
  76. this.request({
  77. url: '/v2/entry/storeList',
  78. method: 'get',
  79. data: {
  80. page: this.page,
  81. page_size: 10,
  82. lat: this.lat,
  83. lon: this.lon,
  84. keyword: this.searchvalue ? this.searchvalue : ''
  85. },
  86. success: res => {
  87. uni.hideLoading();
  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. .tops {
  109. position: fixed;
  110. top: 0;
  111. left: 0;
  112. right: 0;
  113. z-index: 999;
  114. background: #fff;
  115. border-bottom: 1px solid #f1f1f1;
  116. }
  117. .search {
  118. color: #999;
  119. padding: 0 32rpx;
  120. }
  121. .noData {
  122. margin-top: 30%;
  123. text-align: center;
  124. color: #999;
  125. }
  126. .searchType .input-view {
  127. width: 80%;
  128. display: flex;
  129. background-color: #e7e7e7;
  130. height: 30px;
  131. border-radius: 15px;
  132. padding: 0 4%;
  133. flex-wrap: nowrap;
  134. margin: 7px 0;
  135. line-height: 30px;
  136. margin: 24upx 0 24upx 32upx;
  137. }
  138. .searchType .input-view .uni-icon {
  139. line-height: 30px !important;
  140. }
  141. .searchType .input-view .input {
  142. height: 30px;
  143. line-height: 30px;
  144. width: 94%;
  145. padding: 0 3%;
  146. }
  147. .van-cell__title {
  148. flex: 6 !important;
  149. }
  150. .searchclass {
  151. display: flex;
  152. align-items: center;
  153. justify-content: center;
  154. position: sticky;
  155. top: 0;
  156. }
  157. .van-cell {
  158. padding: 15upx 32upx 0 32upx !important;
  159. }
  160. .hotelList {
  161. display: flex;
  162. flex-direction: row;
  163. padding: 24upx 32upx;
  164. }
  165. .hotleLeft {
  166. width: 214upx;
  167. height: 152upx;
  168. }
  169. .hotelright {
  170. padding-left: 16upx;
  171. display: flex;
  172. flex-direction: column;
  173. width: 100%;
  174. }
  175. .undertip {
  176. display: flex;
  177. flex-direction: row;
  178. align-items: center;
  179. }
  180. .tipsTop {
  181. border: 2upx solid #bbbbbb;
  182. margin-right: 14upx;
  183. color: #bbbbbb;
  184. padding: 4upx;
  185. }
  186. /* .van-cell__title {
  187. flex: 6!important;
  188. } */
  189. </style>