commission-log.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!-- 分销首页:明细列表 -->
  2. <template>
  3. <view class="distribution-log-wrap">
  4. <view class="header-box">
  5. <image class="header-bg" :src="sheep.$url.static('/static/images/title2.png')" />
  6. <view class="ss-flex header-title">
  7. <view class="title">实时动态</view>
  8. <text class="cicon-forward" />
  9. </view>
  10. </view>
  11. <scroll-view scroll-y="true" @scrolltolower="loadmore" class="scroll-box log-scroll"
  12. scroll-with-animation="true">
  13. <view v-if="state.pagination.list">
  14. <view class="log-item-box ss-flex ss-row-between" v-for="item in state.pagination.list" :key="item.id">
  15. <view class="log-item-wrap">
  16. <view class="log-item ss-flex ss-ellipsis-1 ss-col-center">
  17. <view class="ss-flex ss-col-center">
  18. <image class="log-img" :src="sheep.$url.static('/static/images/notice.png')" mode="aspectFill" />
  19. </view>
  20. <view class="log-text ss-ellipsis-1">
  21. {{ item.title }} {{ fen2yuan(item.price) }} 元
  22. </view>
  23. </view>
  24. </view>
  25. <text class="log-time">{{ dayjs(item.createTime).fromNow() }}</text>
  26. </view>
  27. </view>
  28. <!-- 加载更多 -->
  29. <uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" color="#333333"
  30. @tap="loadmore" />
  31. </scroll-view>
  32. </view>
  33. </template>
  34. <script setup>
  35. import sheep from '@/sheep';
  36. import { reactive } from 'vue';
  37. import _ from 'lodash';
  38. import dayjs from 'dayjs';
  39. import BrokerageApi from '@/sheep/api/trade/brokerage';
  40. import { fen2yuan } from '../../../sheep/hooks/useGoods';
  41. const state = reactive({
  42. loadStatus: '',
  43. pagination: {
  44. list: [],
  45. total: 0,
  46. pageNo: 1,
  47. pageSize: 1,
  48. },
  49. });
  50. async function getLog() {
  51. state.loadStatus = 'loading';
  52. const { code, data } = await BrokerageApi.getBrokerageRecordPage({
  53. pageNo: state.pagination.pageNo,
  54. pageSize: state.pagination.pageSize
  55. });
  56. if (code !== 0) {
  57. return;
  58. }
  59. state.pagination.list = _.concat(state.pagination.list, data.list);
  60. state.pagination.total = data.total;
  61. state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
  62. }
  63. getLog();
  64. // 加载更多
  65. function loadmore() {
  66. if (state.loadStatus === 'noMore') {
  67. return;
  68. }
  69. state.pagination.pageNo++;
  70. getLog();
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. .distribution-log-wrap {
  75. width: 690rpx;
  76. margin: 0 auto;
  77. margin-bottom: 20rpx;
  78. border-radius: 12rpx;
  79. z-index: 3;
  80. position: relative;
  81. .header-box {
  82. width: 690rpx;
  83. height: 76rpx;
  84. position: relative;
  85. .header-bg {
  86. width: 690rpx;
  87. height: 76rpx;
  88. }
  89. .header-title {
  90. position: absolute;
  91. left: 20rpx;
  92. top: 24rpx;
  93. }
  94. .title {
  95. font-size: 28rpx;
  96. font-weight: 500;
  97. color: #ffffff;
  98. line-height: 30rpx;
  99. }
  100. .cicon-forward {
  101. font-size: 30rpx;
  102. font-weight: 400;
  103. color: #ffffff;
  104. line-height: 30rpx;
  105. }
  106. }
  107. .log-scroll {
  108. height: 600rpx;
  109. background: #fdfae9;
  110. padding: 10rpx 20rpx 0;
  111. box-sizing: border-box;
  112. border-radius: 0 0 12rpx 12rpx;
  113. .log-item-box {
  114. margin-bottom: 20rpx;
  115. .log-time {
  116. // margin-left: 30rpx;
  117. text-align: right;
  118. font-size: 24rpx;
  119. font-family: OPPOSANS;
  120. font-weight: 400;
  121. color: #c4c4c4;
  122. }
  123. }
  124. .loadmore-wrap {
  125. // line-height: 80rpx;
  126. }
  127. .log-item {
  128. // background: rgba(#ffffff, 0.2);
  129. border-radius: 24rpx;
  130. padding: 6rpx 20rpx 6rpx 12rpx;
  131. .log-img {
  132. width: 40rpx;
  133. height: 40rpx;
  134. border-radius: 50%;
  135. margin-right: 10rpx;
  136. }
  137. .log-text {
  138. max-width: 480rpx;
  139. font-size: 24rpx;
  140. font-weight: 500;
  141. color: #333333;
  142. }
  143. }
  144. }
  145. }
  146. </style>