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