searchresult.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. isLoad:true,
  49. };
  50. },
  51. methods: {
  52. intToFloat(val) {
  53. return new Number(val).toFixed(1);
  54. },
  55. search() {
  56. uni.navigateBack()
  57. },
  58. confirm(e) {
  59. if(e.detail.value){
  60. this.hotelist = [];
  61. this.searchvalue = e.detail.value;
  62. if(this.isLoad){
  63. this.gethotelist();
  64. }
  65. }else{
  66. this.hotelist = [];
  67. }
  68. },
  69. // 跳转到新页面 酒店详情
  70. openinfo(item) {
  71. let id = item.store_id;
  72. uni.navigateTo({
  73. url: `/pages/index/hotel?id=${id}`
  74. });
  75. },
  76. // 获取酒店列表
  77. gethotelist() {
  78. this.isLoad=false;
  79. uni.showLoading();
  80. this.request({
  81. url: '/v2/entry/storeList',
  82. method: 'get',
  83. data: {
  84. page: this.page,
  85. page_size: 10,
  86. lat: this.lat,
  87. lon: this.lon,
  88. keyword: this.searchvalue ? this.searchvalue : ''
  89. },
  90. success: res => {
  91. uni.hideLoading();
  92. let { data, code } = res.data;
  93. if (code == 1000) {
  94. if (data.store_list.length < 10) {
  95. this.ispull = false;
  96. }
  97. if (this.hotelist.length == 0) {
  98. this.hotelist = data.store_list;
  99. } else {
  100. this.hotelist = this.hotelist.concat(data.store_list);
  101. }
  102. } else {
  103. this.$msg('网络错误稍后再试');
  104. }
  105. this.isLoad=true;
  106. }
  107. });
  108. }
  109. }
  110. };
  111. </script>
  112. <style>
  113. .tops {
  114. position: fixed;
  115. top: 0;
  116. left: 0;
  117. right: 0;
  118. z-index: 999;
  119. background: #fff;
  120. border-bottom: 1px solid #f1f1f1;
  121. }
  122. .search {
  123. color: #999;
  124. padding: 0 32rpx;
  125. }
  126. .noData {
  127. margin-top: 30%;
  128. text-align: center;
  129. color: #999;
  130. }
  131. .searchType .input-view {
  132. width: 80%;
  133. display: flex;
  134. background-color: #e7e7e7;
  135. height: 30px;
  136. border-radius: 15px;
  137. padding: 0 4%;
  138. flex-wrap: nowrap;
  139. margin: 7px 0;
  140. line-height: 30px;
  141. margin: 24upx 0 24upx 32upx;
  142. }
  143. .searchType .input-view .uni-icon {
  144. line-height: 30px !important;
  145. }
  146. .searchType .input-view .input {
  147. height: 30px;
  148. line-height: 30px;
  149. width: 94%;
  150. padding: 0 3%;
  151. }
  152. .van-cell__title {
  153. flex: 6 !important;
  154. }
  155. .searchclass {
  156. display: flex;
  157. align-items: center;
  158. justify-content: center;
  159. position: sticky;
  160. top: 0;
  161. }
  162. .van-cell {
  163. padding: 15upx 32upx 0 32upx !important;
  164. }
  165. .hotelList {
  166. display: flex;
  167. flex-direction: row;
  168. padding: 24upx 32upx;
  169. }
  170. .hotleLeft {
  171. width: 214upx;
  172. height: 152upx;
  173. }
  174. .hotelright {
  175. padding-left: 16upx;
  176. display: flex;
  177. flex-direction: column;
  178. width: 100%;
  179. }
  180. .undertip {
  181. display: flex;
  182. flex-direction: row;
  183. align-items: center;
  184. }
  185. .tipsTop {
  186. border: 2upx solid #bbbbbb;
  187. margin-right: 14upx;
  188. color: #bbbbbb;
  189. padding: 4upx;
  190. }
  191. /* .van-cell__title {
  192. flex: 6!important;
  193. } */
  194. </style>