BalanceDetail.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view :class="['qn-page-' + theme]">
  3. <view class="detail-ul">
  4. <view class="detail-li" v-for="(item, index) in detail_list" :key="index">
  5. <view class="ellipsis title">{{ item.purpose }}</view>
  6. <view class="time">{{ $u.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
  7. <view class="money">
  8. <text>{{ item.type === 4 ? '-' : '+' }}</text>
  9. <text>¥{{ item.money }}</text>
  10. </view>
  11. </view>
  12. <!-- 空白页 -->
  13. <Aempty text="暂无数据" src="https://onlineimg.qianniao.vip/list.png" v-if="detail_list.length === 0"></Aempty>
  14. <u-loadmore v-else :status="load_status" />
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. load_status: 'nomore',
  23. page: 1,
  24. pageSize: 10,
  25. total: 0,
  26. detail_list: []
  27. };
  28. },
  29. computed: {
  30. userId() {
  31. return this.$store.state.userStatus.id;
  32. }
  33. },
  34. onLoad() {
  35. this.getAllMemberBalanceDetail();
  36. },
  37. onPullDownRefresh() {
  38. this.page = 1;
  39. this.getAllMemberBalanceDetail();
  40. },
  41. onReachBottom() {
  42. if (this.total / this.pageSize > this.page) {
  43. this.page += 1;
  44. this.getAllMemberBalanceDetail();
  45. }
  46. },
  47. methods: {
  48. getAllMemberBalanceDetail() {
  49. this.load_status = 'loading';
  50. this.$u.api
  51. .getAllMemberBalanceDetail({
  52. page: this.page,
  53. pageSize: this.pageSize,
  54. customerId: this.userId
  55. })
  56. .then(res => {
  57. uni.stopPullDownRefresh();
  58. if (this.page === 1) {
  59. this.detail_list = res.data;
  60. } else {
  61. this.detail_list = this.detail_list.concat(res.data);
  62. }
  63. this.total = res.pageTotal;
  64. this.load_status = this.$_utils.loadStatus(this.page, this.pageSize, this.total);
  65. })
  66. .catch(res => {
  67. uni.stopPullDownRefresh();
  68. this.load_status = 'nomore';
  69. });
  70. }
  71. }
  72. };
  73. </script>
  74. <style lang="scss" scoped>
  75. .detail-ul {
  76. .detail-li {
  77. width: 710rpx;
  78. margin: 20rpx auto;
  79. background-color: #ffffff;
  80. border-radius: 16rpx;
  81. padding: 24rpx;
  82. position: relative;
  83. .title {
  84. font-weight: bold;
  85. padding-bottom: 12rpx;
  86. -webkit-line-clamp: 2;
  87. }
  88. .time {
  89. font-size: 24rpx;
  90. color: #6c6c6c;
  91. }
  92. .money {
  93. font-weight: bold;
  94. font-family: DIN-Medium;
  95. position: absolute;
  96. right: 24rpx;
  97. top: 50%;
  98. transform: translateY(-50%);
  99. color: $price-color;
  100. }
  101. }
  102. }
  103. </style>