You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
2.8 KiB

4 years ago
  1. <template>
  2. <view class="app">
  3. <mescroll-body
  4. ref="mescrollRef"
  5. @init="mescrollInit"
  6. :top="0"
  7. @down="downCallback"
  8. :up="upOption"
  9. @up="loadList"
  10. >
  11. <view class="item b-b" :class="{income: item.money > 0}" v-for="(item, index) in list" :key="index">
  12. <text class="mix-icon" :class="item.type==='recharge'?'icon-chongzhi':item.type==='withdraw'?'icon-tixian1':'icon-zhangdanmingxi01'"></text>
  13. <view class="left column">
  14. <text class="tit clamp">{{ item.title }}</text>
  15. <text class="time">{{ item.add_time | date('Y-m-d H:i:s') }}</text>
  16. </view>
  17. <text v-if="item.money > 0" class="price">+</text>
  18. <text class="price">{{ item.money | price }}</text>
  19. </view>
  20. </mescroll-body>
  21. <mix-loading v-if="isLoading" :type="2"></mix-loading>
  22. </view>
  23. </template>
  24. <script>
  25. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  26. export default {
  27. mixins: [MescrollMixin],
  28. data() {
  29. return {
  30. list: [],
  31. upOption:{
  32. auto: false, // 不自动加载
  33. page: {
  34. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  35. size: 15 // 每页数据的数量
  36. },
  37. noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  38. },
  39. }
  40. },
  41. methods: {
  42. async loadList(e){
  43. const res = await this.$request('payment', 'getMoneyLog', {
  44. offset: (e.num - 1) * e.size,
  45. limit: e.size,
  46. });
  47. const curList = res.data;
  48. if(e.num === 1){
  49. this.list = [];
  50. }
  51. this.list = this.list.concat(curList); //追加新数据
  52. this.mescroll.endSuccess(curList.length); //结束加载状态
  53. },
  54. mescrollInit(mescroll){
  55. this.isLoading = true;
  56. this.mescroll = mescroll;
  57. this.mescroll.resetUpScroll(false)
  58. }
  59. }
  60. }
  61. </script>
  62. <style scoped lang="scss">
  63. .item{
  64. display: flex;
  65. padding: 30rpx 30rpx 30rpx 24rpx;
  66. background-color: #fff;
  67. &:after{
  68. left: 30rpx;
  69. border-color: #e8e8e8;
  70. }
  71. .mix-icon{
  72. flex-shrink: 0;
  73. width: 72rpx;
  74. font-size: 52rpx;
  75. transform: translateY(-6rpx);
  76. }
  77. .icon-tixian1{
  78. color: #fd6663;
  79. }
  80. .icon-zhangdanmingxi01{
  81. color: #ff893a;
  82. }
  83. .icon-chongzhi{
  84. color: #39c585;
  85. }
  86. .left{
  87. flex: 1;
  88. overflow: hidden;
  89. }
  90. .tit{
  91. font-size: 30rpx;
  92. color: #333;
  93. line-height: 1.4;
  94. margin-bottom: 20rpx;
  95. }
  96. .time{
  97. font-size: 24rpx;
  98. color: #999;
  99. }
  100. .price{
  101. font-size: 32rpx;
  102. color: $base-color;
  103. font-weight: 700;
  104. }
  105. &.income{
  106. .price{
  107. color: #00c700;
  108. }
  109. .icon-zhangdanmingxi01{
  110. color: #39c585;
  111. }
  112. }
  113. }
  114. </style>