index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view class="container">
  3. <!-- 搜索框区域 -->
  4. <uv-row custom-style="margin: 10px 0px" gutter="10">
  5. <view class="address">
  6. <view class="">靖安县</view>
  7. <img src="../../static/index/bottom.png" />
  8. </view>
  9. <view class="search">
  10. <view class="add">
  11. <image class="img" src="../../static/index/search.png" mode="aspectFit"></image>
  12. </view>
  13. <input class="inp" type="text" v-model="keywords" placeholder="请输入关键字搜索" />
  14. <view class="btnSearch" @click="searchHandler()">搜索</view>
  15. </view>
  16. </uv-row>
  17. <!-- 名宿列表区域 -->
  18. <view class="body">
  19. <!-- 每一个名宿区域 -->
  20. <view class="item" v-for="item in hotelList" :key="item.id" @click="goPageDetail(item)">
  21. <image class="item-img" :src="item.imgUrl" mode="scaleToFill"></image>
  22. <view class="descrition">
  23. <text class="title">{{ item.hotelName }}</text>
  24. <text class="type">{{ item.type }}</text>
  25. <text class="distance">距您直线{{ item.distance }}公里</text>
  26. <view class="detail">
  27. <img class="img" src="../../static/index/hotel.png" />
  28. <view class="price">
  29. <text class="txt1">¥{{ item.price }}</text>
  30. <text class="txt2">起</text>
  31. </view>
  32. <!-- <text class="score">5.0分</text> -->
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. // 搜索框绑定数据
  44. keywords: '',
  45. // 名宿列表数组
  46. hotelList: [
  47. {
  48. id: 1,
  49. imgUrl: '../../static/search/img.png',
  50. hotelName: '双溪镇抱朴小院',
  51. type: '舒适型',
  52. distance: '3.2',
  53. price: 180
  54. },
  55. {
  56. id: 2,
  57. imgUrl: '../../static/search/img.png',
  58. hotelName: '幸福乡宿',
  59. type: '舒适型',
  60. distance: '3.2',
  61. price: 190
  62. },
  63. {
  64. id: 3,
  65. imgUrl: '../../static/search/img.png',
  66. hotelName: '健康乡宿',
  67. type: '舒适型',
  68. distance: '3.2',
  69. price: 150
  70. },
  71. {
  72. id: 4,
  73. imgUrl: '../../static/search/img.png',
  74. hotelName: '开心乡宿',
  75. type: '舒适型',
  76. distance: '3.2',
  77. price: 180
  78. },
  79. {
  80. id: 5,
  81. imgUrl: '../../static/search/img.png',
  82. hotelName: '快乐乡宿',
  83. type: '舒适型',
  84. distance: '3.2',
  85. price: 280
  86. }
  87. ]
  88. }
  89. },
  90. onLoad() {},
  91. methods: {
  92. // 搜索按钮点击回调
  93. searchHandler() {
  94. console.log(this.keywords)
  95. },
  96. // 点击每一个名宿卡片回调
  97. goPageDetail(item) {
  98. // console.log(item)
  99. const info = JSON.stringify(item)
  100. uni.navigateTo({
  101. url: `/pages/detail/detail?info=${info}`
  102. })
  103. }
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .container {
  109. display: flex;
  110. flex-direction: column;
  111. width: 750rpx;
  112. padding: 0 30rpx;
  113. box-sizing: border-box;
  114. background-color: #ebeced;
  115. .address {
  116. display: flex;
  117. width: 152rpx;
  118. font-size: 28rpx;
  119. img {
  120. width: 48rpx;
  121. height: 48rpx;
  122. }
  123. }
  124. .search {
  125. display: flex;
  126. justify-content: space-between;
  127. align-items: center;
  128. width: 538rpx;
  129. height: 80rpx;
  130. opacity: 1;
  131. border-radius: 70px;
  132. background-color: #fff;
  133. .add {
  134. display: flex;
  135. justify-content: center;
  136. align-items: center;
  137. margin-left: 10rpx;
  138. width: 60rpx;
  139. font-size: 50rpx;
  140. height: 60rpx;
  141. line-height: 60rpx;
  142. color: rgba(30, 125, 251, 1);
  143. .img {
  144. width: 30rpx;
  145. height: 30rpx;
  146. }
  147. }
  148. .inp {
  149. height: 60rpx;
  150. line-height: 60rpx;
  151. flex-grow: 1;
  152. font-size: 28rpx;
  153. }
  154. .btnSearch {
  155. width: 100rpx;
  156. text-align: center;
  157. margin-right: 10rpx;
  158. height: 60rpx;
  159. line-height: 60rpx;
  160. opacity: 1;
  161. font-size: 28rpx;
  162. font-weight: 400;
  163. height: 2rem;
  164. color: #096562;
  165. }
  166. }
  167. .body {
  168. display: flex;
  169. justify-content: space-between;
  170. flex-wrap: wrap;
  171. .item {
  172. width: 335rpx;
  173. box-sizing: border-box;
  174. margin-bottom: 20rpx;
  175. .item-img {
  176. width: 100%;
  177. height: 223rpx;
  178. border-radius: 18rpx 18rpx 0 0;
  179. box-sizing: border-box;
  180. }
  181. .descrition {
  182. display: flex;
  183. flex-direction: column;
  184. width: 100%;
  185. border-radius: 0 0 18rpx 18rpx;
  186. box-sizing: border-box;
  187. background: rgba(255, 255, 255, 1);
  188. margin-top: -10rpx;
  189. .title {
  190. font-size: 28rpx;
  191. font-weight: 600;
  192. padding: 20rpx 20rpx 10rpx;
  193. color: rgba(0, 0, 0, 1);
  194. }
  195. .type {
  196. padding: 5rpx 20rpx;
  197. font-size: 24rpx;
  198. color: #a6a6a6;
  199. }
  200. .distance {
  201. padding: 10rpx 20rpx;
  202. font-size: 24rpx;
  203. color: #a6a6a6;
  204. }
  205. .detail {
  206. display: flex;
  207. flex-direction: row;
  208. justify-content: space-between;
  209. align-items: center;
  210. padding: 0 20rpx 20rpx 20rpx;
  211. color: rgba(0, 0, 0, 1);
  212. .img {
  213. width: 40rpx;
  214. height: 40rpx;
  215. }
  216. .price {
  217. .txt1 {
  218. font-size: 36rpx;
  219. font-weight: 600;
  220. color: rgba(255, 87, 51, 1);
  221. }
  222. .txt2 {
  223. font-size: 24rpx;
  224. font-weight: 400;
  225. color: #a6a6a6;
  226. }
  227. }
  228. .score {
  229. font-size: 24rpx;
  230. font-weight: 400;
  231. padding-top: 10rpx;
  232. color: rgba(166, 166, 166, 1);
  233. }
  234. }
  235. }
  236. }
  237. }
  238. }
  239. </style>