jkjl.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="content">
  3. <view class="jg" style="height: 20rpx;">
  4. </view>
  5. <view class="love-item" v-for="item in list" :key="item.id" @click="navto(item)">
  6. <view class="">
  7. 证书编号:{{item.SN}}
  8. </view>
  9. <view class="">
  10. 捐赠时间:{{item.paytime | time}}
  11. </view>
  12. <view class="">
  13. 捐赠意向:{{item.order_name}}
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import { getMyloveList } from '@/api/user.js'
  20. export default {
  21. data() {
  22. return {
  23. list: [],
  24. page: 1,
  25. limit: 10,
  26. loaded: false,
  27. loadingType: 'more'
  28. }
  29. },
  30. filters: {
  31. time(val) {
  32. let str = ''
  33. if (val) {
  34. var time = new Date(val * 1000);
  35. var y = time.getFullYear();
  36. var m = time.getMonth() + 1;
  37. var d = time.getDate();
  38. var h = time.getHours();
  39. var mm = time.getMinutes();
  40. var s = time.getSeconds();
  41. str = y + '-' + m + '-' + d + ' ' + h + ":" + mm
  42. console.log(str)
  43. }
  44. return str
  45. }
  46. },
  47. onLoad() {
  48. this.getMyloveList()
  49. },
  50. onReachBottom() {
  51. this.getMyloveList()
  52. },
  53. methods:{
  54. navto(item) {
  55. let date = new Date(item.paytime*1000)
  56. let year = date.getFullYear()
  57. let month = date.getMonth() >= 9 ? date.getMonth() + 1 : '0' + (date
  58. .getMonth() + 1)
  59. let day = date.getDate() >= 10 ? date.getDate() : '0' + date.getDate()
  60. uni.navigateTo({
  61. url: '/pages/form/donaSuccess?money=' + item.amount + '&name=' + item.contact + '&time=' + year + '年' + month + '月' + day + '日'
  62. })
  63. },
  64. getMyloveList() {
  65. let obj = this
  66. getMyloveList({
  67. page: obj.page,
  68. limit: obj.limit,
  69. status: 1
  70. }).then(({data}) => {
  71. obj.list = obj.list.concat(data.data)
  72. obj.page++
  73. if(obj.limit == data.data.length) {
  74. obj.loadingType = 'more'
  75. }else {
  76. obj.loadingType = 'noMore'
  77. }
  78. obj.$set(obj,'loaded',true)
  79. })
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .love-item {
  86. padding: 10rpx;
  87. margin-bottom: 20rpx;
  88. width: 700rpx;
  89. margin: auto;
  90. border-radius: 20rpx;
  91. box-shadow: 0px 0px 5rpx rgba($color: #fa7e67, $alpha: 0.6);
  92. }
  93. </style>