consumptionLog.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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.consumptionStatusName }}{{ [3,4].includes(item.consumptionStatus) ? "(" + item.generateUserName +")" : ""}} {{ item.consumptionStatus === 1 ? "(金额:" + points2point(item.practicalConsumptionPoints)+")" : ""}}
  14. <text style="float: right;" class="color-red"
  15. :class="{'color-green':item.consumptionPoints < 0}" >
  16. {{item.consumptionPoints > 0 ? '+'+points2point(item.consumptionPoints) : points2point(item.consumptionPoints)}}
  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;">余额:{{ points2point(item.afterConsumptionPoints)}}</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.getConsumptionLog({
  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. // 列表标题
  90. const title = (item) => {
  91. // {{ item.profitStatusName || '空' }}
  92. let title = item.profitStatusName + '';
  93. // 如果有返回username就显示
  94. if(item.username){
  95. title += '('+item.username+ ')'
  96. }
  97. return title;
  98. }
  99. function onLoadMore(isFreeze) {
  100. if (state.loadStatus === 'noMore') {
  101. return;
  102. }
  103. state.pagination.pageNo++;
  104. getLogList();
  105. }
  106. onReachBottom(() => {
  107. onLoadMore();
  108. });
  109. onLoad(() => {
  110. getLogList();
  111. });
  112. </script>
  113. <style lang="scss" scoped>
  114. .color-red {
  115. color: red;
  116. }
  117. .color-green {
  118. color: green;
  119. }
  120. .score-box {
  121. margin: 20rpx;
  122. border-radius: 20rpx;
  123. padding-top: 100rpx;
  124. }
  125. .avatar-box {
  126. width: 100rpx;
  127. height: 100rpx;
  128. border-radius: 50%;
  129. overflow: hidden;
  130. .avatar-img {
  131. width: 100%;
  132. height: 100%;
  133. }
  134. }
  135. .value-box {
  136. width: 100rpx;
  137. height: 100rpx;
  138. line-height: 100rpx;
  139. text-align: center;
  140. border-radius: 50%;
  141. border: 2px solid #f6f6f6;
  142. }
  143. .btn {
  144. width: 300rpx;
  145. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  146. border-radius: 20rpx;
  147. font-size: 30rpx;
  148. font-weight: 500;
  149. line-height: 80rpx;
  150. color: $white;
  151. position: relative;
  152. z-index: 1;
  153. }
  154. .header-box {
  155. width: 100%;
  156. background: linear-gradient(180deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%) no-repeat;
  157. background-size: 750rpx 100%;
  158. padding: 0 0 120rpx 0;
  159. box-sizing: border-box;
  160. .score-box {
  161. height: 100%;
  162. .all-num {
  163. font-size: 50rpx;
  164. font-weight: bold;
  165. color: #fff;
  166. font-family: OPPOSANS;
  167. }
  168. .all-title {
  169. font-size: 26rpx;
  170. font-weight: 500;
  171. color: #fff;
  172. }
  173. .cicon-help-o {
  174. color: #fff;
  175. font-size: 28rpx;
  176. }
  177. }
  178. }
  179. // 筛选
  180. .filter-box {
  181. height: 114rpx;
  182. background-color: $bg-page;
  183. .total-box {
  184. font-size: 24rpx;
  185. font-weight: 500;
  186. color: $dark-9;
  187. }
  188. .date-btn {
  189. background-color: $white;
  190. line-height: 54rpx;
  191. border-radius: 27rpx;
  192. padding: 0 20rpx;
  193. font-size: 24rpx;
  194. font-weight: 500;
  195. color: $dark-6;
  196. .ss-seldate-icon {
  197. font-size: 50rpx;
  198. color: $dark-9;
  199. }
  200. }
  201. }
  202. .list-box {
  203. // width: 600rpx;
  204. // padding: 0 30rpx;
  205. overflow-y: auto;
  206. height: 100vh;
  207. .list-item {
  208. background: #fff;
  209. // border-bottom: 1rpx solid #dfdfdf;
  210. padding: 30rpx;
  211. .name {
  212. font-size: 28rpx;
  213. font-weight: 500;
  214. color: rgba(102, 102, 102, 1);
  215. line-height: 28rpx;
  216. // margin-bottom: 20rpx;
  217. }
  218. .time {
  219. font-size: 24rpx;
  220. font-weight: 500;
  221. color: rgba(196, 196, 196, 1);
  222. line-height: 24px;
  223. }
  224. .add {
  225. font-size: 30rpx;
  226. font-weight: 500;
  227. color: #e6b873;
  228. }
  229. .minus {
  230. font-size: 30rpx;
  231. font-weight: 500;
  232. color: $dark-3;
  233. }
  234. }
  235. }
  236. </style>