list.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="content">
  3. <view class="order-wrap" v-for="item in list">
  4. <view class="tit">
  5. 订单编号:{{item.subscribe_id || item.order_id}}
  6. </view>
  7. <view class="tit" v-if="type == 1">
  8. 支付方式:{{item.pay_type == 'yue'?'余额': (item.pay_type == 'weixin'?'微信':'支付宝')}}
  9. </view>
  10. <view class="tit" v-if="type == 1">
  11. 打赏金额:{{item.pay_price}}
  12. </view>
  13. <view class="tit" v-if="type == 2">
  14. 投诉原因:{{item.reason}}
  15. </view>
  16. <view class="tit">
  17. {{type == 1? '打赏时间':'投诉时间'}}:{{showTime( type == 1 ? item.add_time: item.create_time)}}
  18. </view>
  19. </view>
  20. <emptyPage title="暂无充值记录~" v-if="list.length == 0 && loaded"></emptyPage>
  21. </view>
  22. </template>
  23. <script>
  24. import emptyPage from '@/components/emptyPage.vue'
  25. import {
  26. getLifeOrder,
  27. getReward,
  28. getComplaint
  29. } from '@/api/three.js'
  30. export default {
  31. components: {
  32. emptyPage
  33. },
  34. data() {
  35. return {
  36. list: [],
  37. page: 1,
  38. limit: 10,
  39. loaded: false,
  40. loadingType: 'more',
  41. type: 1,
  42. }
  43. },
  44. onLoad(opt) {
  45. this.type = opt.type;
  46. this.getLifeOrder()
  47. },
  48. onShow() {
  49. },
  50. onReachBottom() {
  51. this.getLifeOrder()
  52. },
  53. onReady() {
  54. },
  55. methods: {
  56. showTime(time) {
  57. // 创建一个Date对象,参数为时间戳
  58. let timestamp = time * 1000; // 例如:时间戳为1626864000000
  59. let date = new Date(timestamp);
  60. // 获取年、月、日等信息
  61. let year = date.getFullYear();
  62. let month = date.getMonth() + 1; // 月份是从0开始计数的,所以要加1
  63. let day = date.getDate();
  64. let hours = date.getHours();
  65. let minutes = date.getMinutes();
  66. let seconds = date.getSeconds();
  67. // 格式化输出时间
  68. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  69. },
  70. getLifeOrder() {
  71. let that = this
  72. if (that.loadingType == 'loading' || that.loadingType == 'noMore') {
  73. return
  74. }
  75. that.loadingType = 'loading'
  76. let getList;
  77. if (that.type == 1) {
  78. getList = getReward
  79. } else if (that.type == 2) {
  80. getList = getComplaint
  81. }
  82. getList({
  83. page: that.page,
  84. limit: that.limit,
  85. }).then(res => {
  86. let arr = res.data.data
  87. that.list = that.list.concat(arr)
  88. if (arr.length == that.limit) {
  89. that.loadingType = 'more'
  90. that.page++
  91. } else {
  92. that.loadingType = 'noMore'
  93. }
  94. that.loaded = true
  95. })
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .content {
  102. padding-top: 20rpx;
  103. }
  104. .order-wrap {
  105. width: 690rpx;
  106. background-color: #fff;
  107. margin: 0 auto 20rpx;
  108. padding: 20rpx 34rpx;
  109. border-radius: 20rpx;
  110. .tit {
  111. font-size: 30rpx;
  112. font-weight: bold;
  113. }
  114. .price {
  115. text-align: right;
  116. }
  117. }
  118. </style>