consumptionTransfersLog.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <!-- 消费分转账 -->
  3. <s-layout class="wallet-wrap" :bgStyle="{'backgroundColor':'#ffffff'}" title="" navbar="normal">
  4. <view class="model-box ss-flex-col">
  5. <scroll-view class="list-box" scroll-y="true" @touchmove.stop>
  6. <view v-if="state.pagination.total > 0" style="padding: 20rpx;">
  7. <view class="list-item ss-flex ss-col-center ss-row-between "
  8. v-for="(item,index) in state.pagination.list" :key="item.id"
  9. style="padding:0;padding: 20rpx 0;border-bottom: 1px solid #c4c4c4;">
  10. <view class="ss-flex ss-col-center" style="width: 100%;">
  11. <view class="ss-flex ss-m-t-10"
  12. style="flex-direction: column;align-items: flex-start;width: 100%;">
  13. <view class="name" style="width: 100%;"> {{ item.transferUserName+ ' > ' + item.recipientUserName }}
  14. <text style="float: right;" class="color-red"
  15. :class="{'color-green':formatChangeValue(item) < 0}" >
  16. {{ formatChangeValue(item) }}
  17. </text>
  18. </view>
  19. <view class="time " style="width: 100%;">
  20. {{sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM')}}
  21. <text style="float: right;">余额:{{ formatValue(item)}}</text>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <s-empty v-else text="暂无数据" paddingTop="200" icon="/static/data-empty.png" />
  28. <uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
  29. contentdown: '点击加载更多',
  30. }" @tap="onLoadMore(true)" @scrolltolower="onLoadMore(true)" />
  31. </scroll-view>
  32. </view>
  33. </s-layout>
  34. </template>
  35. <script setup>
  36. import sheep from '@/sheep';
  37. import {
  38. onLoad,
  39. onReachBottom
  40. } from '@dcloudio/uni-app';
  41. import {
  42. computed,
  43. reactive
  44. } from 'vue';
  45. import {
  46. points2point
  47. } from '@/sheep/hooks/useGoods';
  48. import _ from 'lodash';
  49. import dayjs from 'dayjs';
  50. import PointApi from '@/sheep/api/member/point';
  51. import {
  52. resetPagination
  53. } from '@/sheep/util';
  54. import ConsumptionApi from '@/sheep/api/distri/consumption';
  55. const userWallet = computed(() => sheep.$store('user').userWallet);
  56. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  57. const userInfo = computed(() => sheep.$store('user').userInfo);
  58. const sys_navBar = sheep.$platform.navbar;
  59. const state = reactive({
  60. currentTab: 0,
  61. pagination: {
  62. list: [],
  63. total: 0,
  64. pageSize: 10,
  65. pageNo: 1,
  66. },
  67. loadStatus: '',
  68. showModel: false,
  69. showQueModel: false
  70. });
  71. async function getLogList() {
  72. state.loadStatus = 'loading';
  73. // isFreeze为true是冻结佣金 isFreeze为false是已拿到的佣金
  74. let {
  75. code,
  76. data
  77. } = await ConsumptionApi.getConsumptionTransfersLog({
  78. pageNo: state.pagination.pageNo,
  79. pageSize: state.pagination.pageSize,
  80. });
  81. if (code !== 0) {
  82. return;
  83. }
  84. let list = _.concat(state.pagination.list, data.list);
  85. state.pagination.list = list;
  86. state.pagination.total = data.total;
  87. state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
  88. }
  89. const currentUserId = userWallet.value.integralDO.userId;
  90. // 变化的值
  91. const formatChangeValue = (item) => {
  92. if(currentUserId === item.recipientUserId){
  93. return points2point(item.recipientPoints)
  94. }else{
  95. return points2point(item.consumptionPoints)
  96. }
  97. }
  98. const formatValue = (item) => {
  99. if(currentUserId === item.recipientUserId){
  100. return points2point(item.afterRecipientConsumptionPoints)
  101. }else{
  102. return points2point(item.afterTransferConsumptionPoints)
  103. }
  104. }
  105. function onLoadMore(isFreeze) {
  106. if (state.loadStatus === 'noMore') {
  107. return;
  108. }
  109. state.pagination.pageNo++;
  110. getLogList();
  111. }
  112. onReachBottom(() => {
  113. onLoadMore();
  114. });
  115. onLoad(() => {
  116. getLogList();
  117. });
  118. </script>
  119. <style lang="scss" scoped>
  120. .color-red {
  121. color: red;
  122. }
  123. .color-green {
  124. color: green;
  125. }
  126. .score-box {
  127. margin: 20rpx;
  128. border-radius: 20rpx;
  129. padding-top: 100rpx;
  130. }
  131. .avatar-box {
  132. width: 100rpx;
  133. height: 100rpx;
  134. border-radius: 50%;
  135. overflow: hidden;
  136. .avatar-img {
  137. width: 100%;
  138. height: 100%;
  139. }
  140. }
  141. .value-box {
  142. width: 100rpx;
  143. height: 100rpx;
  144. line-height: 100rpx;
  145. text-align: center;
  146. border-radius: 50%;
  147. border: 2px solid #f6f6f6;
  148. }
  149. .btn {
  150. width: 300rpx;
  151. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  152. border-radius: 20rpx;
  153. font-size: 30rpx;
  154. font-weight: 500;
  155. line-height: 80rpx;
  156. color: $white;
  157. position: relative;
  158. z-index: 1;
  159. }
  160. .header-box {
  161. width: 100%;
  162. background: linear-gradient(180deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%) no-repeat;
  163. background-size: 750rpx 100%;
  164. padding: 0 0 120rpx 0;
  165. box-sizing: border-box;
  166. .score-box {
  167. height: 100%;
  168. .all-num {
  169. font-size: 50rpx;
  170. font-weight: bold;
  171. color: #fff;
  172. font-family: OPPOSANS;
  173. }
  174. .all-title {
  175. font-size: 26rpx;
  176. font-weight: 500;
  177. color: #fff;
  178. }
  179. .cicon-help-o {
  180. color: #fff;
  181. font-size: 28rpx;
  182. }
  183. }
  184. }
  185. // 筛选
  186. .filter-box {
  187. height: 114rpx;
  188. background-color: $bg-page;
  189. .total-box {
  190. font-size: 24rpx;
  191. font-weight: 500;
  192. color: $dark-9;
  193. }
  194. .date-btn {
  195. background-color: $white;
  196. line-height: 54rpx;
  197. border-radius: 27rpx;
  198. padding: 0 20rpx;
  199. font-size: 24rpx;
  200. font-weight: 500;
  201. color: $dark-6;
  202. .ss-seldate-icon {
  203. font-size: 50rpx;
  204. color: $dark-9;
  205. }
  206. }
  207. }
  208. .list-box {
  209. // width: 600rpx;
  210. // padding: 0 30rpx;
  211. overflow-y: auto;
  212. height: 100vh;
  213. .list-item {
  214. background: #fff;
  215. // border-bottom: 1rpx solid #dfdfdf;
  216. padding: 30rpx;
  217. .name {
  218. font-size: 28rpx;
  219. font-weight: 500;
  220. color: rgba(102, 102, 102, 1);
  221. line-height: 28rpx;
  222. // margin-bottom: 20rpx;
  223. }
  224. .time {
  225. font-size: 24rpx;
  226. font-weight: 500;
  227. color: rgba(196, 196, 196, 1);
  228. line-height: 24px;
  229. }
  230. .add {
  231. font-size: 30rpx;
  232. font-weight: 500;
  233. color: #e6b873;
  234. }
  235. .minus {
  236. font-size: 30rpx;
  237. font-weight: 500;
  238. color: $dark-3;
  239. }
  240. }
  241. }
  242. </style>