index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view class="favorite">
  3. <view class="search-box">
  4. <zs-search></zs-search>
  5. </view>
  6. <zs-list mt="100rpx" @load="loadMore" :status="status">
  7. <view class="favorite-item" v-for="(item,index) in list" :key="index" @click="goShopDetail(item)">
  8. <zs-img radius="full" :src="item.src" width="200rpx" height="180rpx"></zs-img>
  9. <view class="info">
  10. <view class="title">
  11. {{item.title}}
  12. </view>
  13. <view class="address" @click="handleAdress(item)">
  14. <u-icon name="tags" size="38"></u-icon>
  15. {{item.address}}·距你{{item.distance}}km
  16. </view>
  17. <view class="tags">
  18. <view class="tag-item">
  19. <view class="label">
  20. </view>
  21. <view class="value">
  22. 满200享8折
  23. </view>
  24. </view>
  25. </view>
  26. <view class="like" @click="handleLike(item)">
  27. <u-icon :name="item.isLike?'heart-fill':'heart'" color="red" size="48"></u-icon>
  28. </view>
  29. </view>
  30. </view>
  31. </zs-list>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. status:'more',
  39. loading:false,
  40. list: [{
  41. src: 'https://mstatic.gzstv.com/media/images/2021/06/09/w1nrZC8_x-PQ.jpg',
  42. title: '万安加油站(中石化)',
  43. isLike:true,
  44. time: '2023-07-30 10:00:00',
  45. distance: 13.62,
  46. address:'贵州省贵阳市观山湖区金清路',
  47. },
  48. {
  49. src: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fss2.meipian.me%2Fusers%2F159660028%2Fb327e4a2a3e1473a82e2a53b5a5d2db2.jpeg%3Fmeipian-raw%2Fbucket%2Fivwen%2Fkey%2FdXNlcnMvMTU5NjYwMDI4L2IzMjdlNGEyYTNlMTQ3M2E4MmUyYTUzYjVhNWQyZGIyLmpwZWc%3D%2Fsign%2Fcec9ce1dfb5e0c3e627e30fb099899da.jpg&refer=http%3A%2F%2Fss2.meipian.me&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1693560973&t=7b7dfb1cbf6a6759e70f868c894888c9',
  50. title: '万安加油站(中石化)',
  51. time: '2023-07-30 10:00:00',
  52. isLike:true,
  53. address:'贵州省贵阳市观山湖区金清路',
  54. distance: 13.62
  55. },
  56. {
  57. id: 2,
  58. src:'https://img-md.veimg.cn/meadinindex/img5/2021/11/69F51D249ADA446EB5507352AA4ABD6E.jpg',
  59. title: '泊斯曼酒店',
  60. isLike:true,
  61. time: '2023-07-30 10:00:00',
  62. address:'贵州省贵阳市观山湖区金清路',
  63. distance: 5.23,
  64. },
  65. {
  66. id: 3,
  67. src:'https://file.gzl.cn/group1/M00/32/54/wKkBH1_7uBKAaWm1AAMJ4gwToRo237.jpg',
  68. title: '贵阳万丽酒店',
  69. isLike:true,
  70. time: '2023-07-30 10:00:00',
  71. address:'贵州省贵阳市观山湖区金清路',
  72. distance: 5.23,
  73. },
  74. ]
  75. }
  76. },
  77. methods: {
  78. handleLike(item) {
  79. item.isLike = !item.isLike
  80. },
  81. goShopDetail(item) {
  82. uni.setStorageSync('shopInfo', JSON.stringify(item))
  83. uni.navigateTo({
  84. url: `../../detail/shopDetail/shopDetail`
  85. })
  86. },
  87. loadMore(){
  88. this.status = 'loading'
  89. setTimeout(()=>{
  90. this.status = 'more'
  91. this.list.push({
  92. id: 3,
  93. src:'https://img2.baidu.com/it/u=242243300,1128843585&fm=253&fmt=auto&app=138&f=JPEG?w=696&h=500',
  94. title: '贵阳万丽酒店',
  95. isLike:true,
  96. time: '2023-07-30 10:00:00',
  97. address:'贵州省贵阳市观山湖区金清路',
  98. distance: 5.23,
  99. })
  100. },1000)
  101. },
  102. jump(){
  103. }
  104. },
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .favorite{
  109. background: #efefef;
  110. padding: 30rpx;
  111. min-height: 100vh;
  112. .search-box{
  113. position: fixed;
  114. top: 0%;
  115. left: 0%;
  116. width: 100%;
  117. padding: 20rpx 0;
  118. background: #fff;
  119. z-index: 9;
  120. }
  121. .favorite-item {
  122. display: flex;
  123. padding: 20rpx 30rpx;
  124. background: #FFFFFF;
  125. border-radius: 16rpx;
  126. margin-bottom: 20rpx;
  127. .icon{
  128. width: 200rpx;
  129. height: 180rpx;
  130. border-radius: 8px;
  131. }
  132. .info{
  133. flex: 1;
  134. padding-left: 20rpx;
  135. display: flex;
  136. flex-direction: column;
  137. justify-content: space-between;
  138. position: relative;
  139. .title{
  140. font-size: 28rpx;
  141. font-weight: bold;
  142. }
  143. .address{
  144. color: #bebebe;
  145. display: flex;
  146. align-items: center;
  147. font-size: 24rpx;
  148. padding: 15rpx 0;
  149. .u-icon{
  150. align-self: flex-start;
  151. }
  152. }
  153. .tags{
  154. display: flex;
  155. align-items: center;
  156. .tag-item{
  157. line-height: 50rpx;
  158. border-radius: 8rpx;
  159. padding: 6rpx 0;
  160. font-size: 24rpx;
  161. margin-left: 10rpx;
  162. display: flex;
  163. .label{
  164. background: #FE5B47;
  165. color: #fff;
  166. padding: 0 10rpx;
  167. border-radius: 8rpx 0 0 8rpx;
  168. }
  169. .value{
  170. color: #FE5B47;
  171. background: rgba(254,91,71,0.1);
  172. padding: 0 14rpx;
  173. border-radius: 0 8rpx 8rpx 0;
  174. }
  175. }
  176. }
  177. .like{
  178. position: absolute;
  179. top: 0%;
  180. right: 10rpx;
  181. }
  182. }
  183. }
  184. }
  185. </style>