index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="content">
  3. <loadSke :loading='loading' :list='applist'>
  4. <view class='list-item' v-for="(item, index) in applist" :key="index" @click="goMiniApp({appId:item.appletAddress},item)">
  5. <image class="avatar" mode="aspectFill" :src="item.appletLogoFileUrl || '/static/imgs/shmr.png'">
  6. <view class="item-right">
  7. <view class="top">
  8. <van-icon class="icon" name="/static/imgs/zf.png" size='14' />
  9. <van-icon class="icon" name="/static/imgs/bxh.png" @tap.stop='delSc(index)' size='12' />
  10. </view>
  11. <view class="center">
  12. <text class="details">{{item.appletIntroduce || '该商家暂无描述,敬请期待!'}}</text>
  13. </view>
  14. <view class="bottom">
  15. <text class="title">{{item.corporateName}}</text>
  16. </view>
  17. </view>
  18. </view>
  19. </loadSke>
  20. </view>
  21. </template>
  22. <script>
  23. import loadSke from '@/components/skeleton/index/index.vue'
  24. import {
  25. collectionList,
  26. delFavorites
  27. } from '@/api/applist.js'
  28. export default {
  29. components: {
  30. loadSke
  31. },
  32. data() {
  33. return {
  34. active: 0,
  35. current: 0,
  36. mode: 'round',
  37. applist: {},
  38. loading: true,
  39. pageNum: 1,
  40. pageSize: 10,
  41. total: 1,
  42. }
  43. },
  44. mounted() {
  45. this.initAppList()
  46. },
  47. onReachBottom(){
  48. if(this.total-this.pageNum*this.pageSize<=0){
  49. return
  50. }
  51. this.pageNum++
  52. collectionList({
  53. pageNum: this.pageNum,
  54. pageSize: this.pageSize
  55. }).then(res => {
  56. this.applist = this.applist.concat(res.rows)
  57. })
  58. },
  59. methods: {
  60. initAppList() {
  61. collectionList({
  62. pageNum: this.pageNum,
  63. pageSize: this.pageSize
  64. }).then(res => {
  65. this.applist = res.rows
  66. this.total = res.total
  67. this.$nextTick(() => {
  68. this.loading = false
  69. })
  70. })
  71. },
  72. delSc(index) {
  73. delFavorites(this.applist[index].customerId).then(res => {
  74. if (res.code == 200) {
  75. this.$set(this.applist[index], 'collectionStatus', '0')
  76. this.Toast('取消收藏成功!');
  77. delete this.applist.splice(index, 1)
  78. }
  79. })
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .content {
  86. padding-bottom: 1rpx;
  87. }
  88. .swiper-box {
  89. position: sticky;
  90. top: 0px;
  91. left: 0;
  92. height: 422rpx;
  93. z-index: 9;
  94. }
  95. .sticky-top {
  96. position: sticky;
  97. top: 192rpx;
  98. left: 0;
  99. margin: 30rpx 30rpx;
  100. border-radius: 20rpx;
  101. overflow: hidden;
  102. background-color: #4fc08d;
  103. z-index: 10;
  104. display: flex;
  105. justify-content: center;
  106. align-items: center;
  107. // border-top-left-radius: 14px;
  108. // border-top-right-radius: 14px;
  109. padding-right: 3%;
  110. .top-search {
  111. flex: 1;
  112. }
  113. }
  114. .sticky {
  115. position: sticky;
  116. top: 295rpx;
  117. left: 0;
  118. background-color: #fff;
  119. z-index: 9;
  120. margin: 30rpx 30rpx;
  121. border-radius: 20rpx;
  122. .grid {
  123. display: flex;
  124. justify-content: space-between;
  125. padding: 1% 2%;
  126. margin-bottom: 2%;
  127. border-bottom-left-radius: 10px;
  128. border-bottom-right-radius: 10px;
  129. .grid-item {
  130. width: 50px;
  131. height: 60px;
  132. display: flex;
  133. justify-content: center;
  134. flex-direction: column;
  135. align-items: center;
  136. font-size: 12px;
  137. }
  138. }
  139. }
  140. .list-item {
  141. display: flex;
  142. align-items: center;
  143. justify-content: space-between;
  144. background-color: #FFFFFF;
  145. height: 170rpx;
  146. padding: 34rpx 20rpx;
  147. margin: 24rpx 30rpx;
  148. border-radius: 20rpx;
  149. .avatar {
  150. flex-shrink: 0;
  151. width: 161rpx;
  152. height: 161rpx;
  153. margin-right: 16rpx;
  154. }
  155. .item-right {
  156. flex: 1;
  157. display: flex;
  158. flex-direction: column;
  159. justify-content: space-between;
  160. height: 200rpx;
  161. .top {
  162. .icon {
  163. margin-top: -20rpx;
  164. padding: 20rpx;
  165. }
  166. display: flex;
  167. justify-content: flex-end;
  168. }
  169. .center {
  170. align-self: flex-start;
  171. .details {
  172. width: 436rpx;
  173. height: 70rpx;
  174. font-size: 26rpx;
  175. font-family: PingFang SC;
  176. font-weight: 400;
  177. color: #0F0404;
  178. display: -webkit-box;
  179. margin-bottom: 20rpx;
  180. overflow: hidden;
  181. text-overflow: ellipsis;
  182. word-wrap: break-word;
  183. white-space: normal !important;
  184. -webkit-line-clamp: 2;
  185. -webkit-box-orient: vertical;
  186. }
  187. }
  188. .bottom {
  189. display: flex;
  190. justify-content: space-between;
  191. align-items: center;
  192. .title {
  193. padding: 3rpx 12rpx;
  194. height: 30rpx;
  195. background: #FFE6E6;
  196. border: 1rpx solid #E31818;
  197. border-radius: 2rpx;
  198. font-size: 20rpx;
  199. font-family: PingFang SC;
  200. font-weight: 400;
  201. color: #E31818;
  202. line-height: 20rpx;
  203. display: flex;
  204. justify-content: center;
  205. align-items: center;
  206. }
  207. .right {
  208. width: 170rpx;
  209. display: flex;
  210. justify-content: space-between;
  211. align-items: center;
  212. font-size: 22rpx;
  213. font-family: PingFang SC;
  214. font-weight: 400;
  215. color: #999999;
  216. line-height: 35rpx;
  217. .flex {
  218. display: flex;
  219. justify-content: center;
  220. .icon {
  221. margin-right: 5rpx;
  222. }
  223. }
  224. }
  225. }
  226. }
  227. }
  228. </style>