loveList.vue 5.2 KB

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