love2.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <view class="content">
  3. <view class="lists">
  4. <view class="search-wrap flex">
  5. <view class="search">
  6. <input type="text" v-model="keyword" placeholder="请输入捐赠者进行搜索" class="" @keyup.enter="getLoveList('re')" />
  7. <image src="../../static/img/search.png" class="hand" @click="getLoveList('re')">
  8. </view>
  9. </view>
  10. <view >
  11. <view class="list flex topp">
  12. <text class="">捐赠方</text>
  13. <text>捐赠金额</text>
  14. <text>捐赠日期</text>
  15. <text>捐赠意向</text>
  16. </view>
  17. </view>
  18. <view :class="{ top: animate == true }" style="padding-top: 94px;">
  19. <view class="list flex" v-for="(item,index) in loveList" :key="index">
  20. <text class="shabi clamp">{{item.name || '佚名'}}</text>
  21. <text class="shabi2 clamp">{{item.amount }}</text>
  22. <text class=" clamp">{{item.paytime | getTime}}</text>
  23. <text class="shabi clamp">{{item.order_name}}</text>
  24. </view>
  25. </view>
  26. <uni-load-more :status="loadingType"></uni-load-more>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. loveList
  33. } from '@/api/index.js';
  34. export default {
  35. data() {
  36. return {
  37. animate: false,
  38. timer: null,
  39. loveList: [],
  40. page: 1,
  41. limit: 100,
  42. loaded: false,
  43. loadingType: 'more',
  44. keyword: '',
  45. }
  46. },
  47. methods: {
  48. scroll() {
  49. this.animate = true;
  50. setTimeout(() => {
  51. this.loveList.push(this.loveList[0]);
  52. this.loveList.shift();
  53. this.animate = false;
  54. }, 1000);
  55. },
  56. getLoveList(type) {
  57. let obj = this
  58. if(type == 're') {
  59. obj.page =1
  60. obj.loveList = []
  61. obj.loadingType = 'more'
  62. }
  63. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  64. return
  65. }
  66. obj.loadingType = 'loading'
  67. loveList({
  68. page: obj.page,
  69. limit: obj.limit,
  70. key: obj.keyword
  71. }).then(({
  72. data
  73. }) => {
  74. obj.loveList = obj.loveList.concat(data.data)
  75. if (obj.limit == data.data.length) {
  76. obj.page++
  77. obj.loadingType = 'more'
  78. } else {
  79. obj.loadingType = 'noMore'
  80. }
  81. obj.loaded = true
  82. })
  83. }
  84. },
  85. filters: {
  86. getTime(val) {
  87. let date = new Date(val * 1000);
  88. let Y = date.getFullYear();
  89. let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
  90. let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
  91. return Y + '/' + M + '/' + D;
  92. },
  93. },
  94. onLoad() {
  95. if (/ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(userAgent)) {
  96. // 移动端
  97. console.log('移动端')
  98. } else {
  99. // pc端
  100. console.log('PC端')
  101. uni.navigateTo({
  102. url:'/pages/index/love3'
  103. })
  104. }
  105. },
  106. onReachBottom() {
  107. },
  108. onShow() {
  109. this.getLoveList()
  110. }
  111. }
  112. </script>
  113. <style lang="less">
  114. .content{
  115. display: flex;
  116. height: 100vh;
  117. color: #ed4530;
  118. max-width: 1160px;
  119. margin: auto;
  120. // padding: 0 30rpx;
  121. }
  122. .topp {
  123. background-color:#fef5f1;
  124. z-index: 999;
  125. position: fixed;
  126. top: 44px;
  127. width: 100%;
  128. max-width: 1160px;
  129. background-color: #ed4530;
  130. color: #fef5f1;
  131. }
  132. .lists{
  133. background-color: #fef5f1;
  134. // height: 500rpx;
  135. overflow: hidden;
  136. width: 100%;
  137. max-width: 1160px;
  138. text-align: center;
  139. }
  140. .list{
  141. height: 100rpx;
  142. display: flex;
  143. align-items: center;
  144. font-size: 26rpx;
  145. border-bottom: 1px solid #ed4530;
  146. }
  147. text{
  148. line-height: 100rpx;
  149. height: 100%;
  150. padding-left: 20rpx;
  151. width: 25%;
  152. flex-grow: 1;
  153. border: 1px solid #fef5f1;
  154. }
  155. .top {
  156. transition: all 1s;
  157. margin-top: -100rpx;
  158. }
  159. .shabi {
  160. border-left: #ed4530 1px solid;
  161. border-right: #ed4530 1px solid;
  162. }
  163. .shabi2 {
  164. border-right: #ed4530 1px solid;
  165. }
  166. .search-wrap {
  167. width: 100%;
  168. max-width: 1160px;
  169. height: 44px;
  170. position: fixed;
  171. top: 0;
  172. z-index: 999;
  173. background-color: #fef5f1;
  174. display: flex;
  175. justify-content: center;
  176. align-items: center;
  177. }
  178. .search {
  179. padding-left: 13px;
  180. padding-right: 13px;
  181. width: 295px;
  182. height: 33px;
  183. line-height: 33px;
  184. background: #FFFFFF;
  185. border: 1px solid #CCCCCC;
  186. border-radius: 10px;
  187. display: flex;
  188. justify-content: space-between;
  189. align-items: center;
  190. input {
  191. width: 235px;
  192. font-size: 16px;
  193. font-family: PingFang SC;
  194. font-weight: bold;
  195. outline: none;
  196. border: none;
  197. }
  198. image {
  199. width: 20px;
  200. height: 20px;
  201. }
  202. }
  203. .input-box {
  204. background-color: #ffffff;
  205. height: 44px;
  206. z-index: 999;
  207. position: fixed;
  208. top: 0;
  209. width: 100%;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. .rushu {
  214. border: 1px solid #333;
  215. color: red;
  216. display: block;
  217. height: 40px;
  218. width: 80%;
  219. }
  220. }
  221. </style>