love3.vue 4.9 KB

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