commission-log.vue 3.9 KB

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