loveList.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="content">
  3. <view class="ss-wrap flex" v-if="!showss" @click="showss = true">
  4. <image src="../../static/icon/Rectangle.png" mode=""></image>输入(捐赠者或捐赠单位)名称搜索
  5. </view>
  6. <input type="text" placeholder="输入(捐赠者或捐赠单位)名称搜索" v-model="keyword" class="ss" v-if="showss" :focus="showss" confirm-type="search" @confirm="getLoveList('reload')">
  7. <view class="love-list-wrap">
  8. <view class="tab-tit flex">
  9. <view class="tit">
  10. 捐赠时间
  11. </view>
  12. <view class="tit" style="width: 30%;">
  13. 捐献者/单位
  14. </view>
  15. <view class="tit" style="width: 20%;">
  16. 捐赠金额
  17. </view>
  18. <view class="tit">
  19. 捐赠意向
  20. </view>
  21. </view>
  22. <scroll-view scroll-y="true" :style="{'height': height}" class="love-list" @scrolltolower="getLoveList()">
  23. <espempty v-if="loaded && loveList.length == 0"></espempty>
  24. <view class="tab-tit flex tab-val" v-for="item in loveList" @click="showP(item)">
  25. <view class="tit clamp">
  26. {{item.pay_time | getTime}}
  27. </view>
  28. <view class="tit clamp" style="width: 30%;">
  29. {{item.donate_er || '佚名'}}
  30. </view>
  31. <view class="tit clamp" style="width: 20%;">
  32. {{item.money*1}}
  33. </view>
  34. <view class="tit clamp">
  35. {{item.intention || '红十字会人道事...'}}
  36. </view>
  37. </view>
  38. <uni-load-more :status="loadingType"></uni-load-more>
  39. </scroll-view>
  40. </view>
  41. <uni-popup ref="popup" type="center">
  42. <view class="zz-wrap">
  43. <view class="top">
  44. 捐赠详情
  45. </view>
  46. <view class="tit">
  47. 捐赠时间:
  48. </view>
  49. <view class="con">
  50. {{showPD.pay_time | getTime}}
  51. </view>
  52. <view class="tit">
  53. 捐献者/单位:
  54. </view>
  55. <view class="con">
  56. {{showPD.donate_er || '佚名'}}
  57. </view>
  58. <view class="tit">
  59. 捐赠金额:
  60. </view>
  61. <view class="con">
  62. {{showPD.money*1}}
  63. </view>
  64. <view class="tit">
  65. 捐赠意向:
  66. </view>
  67. <view class="con">
  68. {{showPD.intention || '红十字会人道事业'}}
  69. </view>
  70. </view>
  71. </uni-popup>
  72. </view>
  73. </template>
  74. <script>
  75. import espempty from '@/components/espempty';
  76. import {
  77. getLove
  78. } from '@/api/index.js';
  79. export default {
  80. components: {
  81. espempty
  82. },
  83. data() {
  84. return {
  85. height: '',
  86. loveList: [],
  87. page: 1,
  88. limit: 50,
  89. keyword: '',
  90. showss: false,
  91. loadingType: 'more',
  92. loaded: false,
  93. showPD:{}
  94. }
  95. },
  96. filters: {
  97. getTime(val) {
  98. let date = new Date(val * 1000);
  99. let Y = date.getFullYear();
  100. let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
  101. let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
  102. return Y + '/' + M + '/' + D;
  103. },
  104. },
  105. onLoad() {
  106. this.getLoveList()
  107. },
  108. onShow() {
  109. },
  110. onReachBottom() {
  111. },
  112. onReady(res) {
  113. var obj = this;
  114. uni.getSystemInfo({
  115. success: resu => {
  116. const query = uni.createSelectorQuery();
  117. query.select('.love-list').boundingClientRect();
  118. query.exec(function(res) {
  119. obj.height = (resu.windowHeight - res[0].top - 10) + 'px';
  120. console.log(obj.height)
  121. });
  122. },
  123. fail: res => {}
  124. });
  125. },
  126. methods: {
  127. showP(item) {
  128. this.showPD = item
  129. this.$refs.popup.open()
  130. },
  131. //获取红会爱心榜
  132. getLoveList(type) {
  133. let obj = this
  134. if(type == 'reload') {
  135. obj.page = 1
  136. obj.loveList = []
  137. obj.loadingType = 'more'
  138. obj.loaded = false
  139. }
  140. if(obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  141. return
  142. }
  143. obj.loadingType = 'loading'
  144. getLove({
  145. page: obj.page,
  146. limit: obj.limit,
  147. name: obj.keyword
  148. }).then(res => {
  149. obj.loveList = obj.loveList.concat(res.data.data)
  150. obj.page++
  151. if(obj.limit == res.data.data.length) {
  152. obj.loadingType = 'more'
  153. }else {
  154. obj.loadingType = 'noMore'
  155. }
  156. obj.loaded = true
  157. })
  158. },
  159. }
  160. }
  161. </script>
  162. <style lang="scss">
  163. page {
  164. padding-top: 20rpx;
  165. height: auto;
  166. min-height: 100%;
  167. background-color: #fff;
  168. }
  169. .ss-wrap {
  170. width: 695rpx;
  171. height: 62rpx;
  172. background: #f5f5f5;
  173. border-radius: 31rpx;
  174. margin: auto;
  175. justify-content: center;
  176. align-items: center;
  177. font-size: 26rpx;
  178. font-weight: 500;
  179. color: #99999F;
  180. image {
  181. width: 28rpx;
  182. height: 28rpx;
  183. margin-right: 15rpx;
  184. }
  185. }
  186. .ss {
  187. width: 695rpx;
  188. height: 62rpx;
  189. background: #f5f5f5;
  190. border-radius: 31rpx;
  191. margin: auto;
  192. padding-left: 30rpx;
  193. }
  194. .love-list-wrap {
  195. width: 694rpx;
  196. // height: 873rpx;
  197. background: #FFFFFF;
  198. box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.1);
  199. border-radius: 30rpx;
  200. margin: 30rpx auto;
  201. overflow: hidden;
  202. .tab-tit {
  203. line-height: 65rpx;
  204. border-bottom: 1px solid #F2F2F2;
  205. .tit {
  206. width: 25%;
  207. text-align: center;
  208. font-size: 24rpx;
  209. font-weight: bold;
  210. color: #FF4C4C;
  211. }
  212. }
  213. .tab-val {
  214. .tit {
  215. color: #101010;
  216. }
  217. }
  218. }
  219. .zz-wrap {
  220. background-color: #fff;
  221. width: 600rpx;
  222. border-radius: 20rpx;
  223. padding: 20rpx 30rpx;
  224. .top {
  225. text-align: center;
  226. padding: 20rpx;
  227. font-size: 32rpx;
  228. font-weight: bold;
  229. }
  230. .tit {
  231. font-size: 28rpx;
  232. font-weight: bold;
  233. padding-bottom: 10rpx;
  234. }
  235. .con {
  236. font-size: 28rpx;
  237. padding-bottom: 20rpx;
  238. text-indent: 2em;
  239. }
  240. }
  241. </style>