collectionList.vue 4.7 KB

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