commission-log.vue 4.2 KB

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