consumptionLog.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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 ? "("+t('wallet.balance') +":" + 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;">{{ t('wallet.balance') }}:{{ 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: t('common.click_to_load_more'),
  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. import { t } from '@/locale'
  56. const userWallet = computed(() => sheep.$store('user').userWallet);
  57. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  58. const userInfo = computed(() => sheep.$store('user').userInfo);
  59. const sys_navBar = sheep.$platform.navbar;
  60. const state = reactive({
  61. currentTab: 0,
  62. pagination: {
  63. list: [],
  64. total: 0,
  65. pageSize: 10,
  66. pageNo: 1,
  67. },
  68. loadStatus: '',
  69. showModel: false,
  70. showQueModel: false
  71. });
  72. async function getLogList() {
  73. state.loadStatus = 'loading';
  74. // isFreeze为true是冻结佣金 isFreeze为false是已拿到的佣金
  75. let {
  76. code,
  77. data
  78. } = await ConsumptionApi.getConsumptionLog({
  79. pageNo: state.pagination.pageNo,
  80. pageSize: state.pagination.pageSize,
  81. });
  82. if (code !== 0) {
  83. return;
  84. }
  85. let list = _.concat(state.pagination.list, data.list);
  86. state.pagination.list = list;
  87. state.pagination.total = data.total;
  88. state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
  89. }
  90. // 列表标题
  91. const title = (item) => {
  92. // {{ item.profitStatusName || '空' }}
  93. let title = item.profitStatusName + '';
  94. // 如果有返回username就显示
  95. if(item.username){
  96. title += '('+item.username+ ')'
  97. }
  98. return title;
  99. }
  100. function onLoadMore(isFreeze) {
  101. if (state.loadStatus === 'noMore') {
  102. return;
  103. }
  104. state.pagination.pageNo++;
  105. getLogList();
  106. }
  107. onReachBottom(() => {
  108. onLoadMore();
  109. });
  110. onLoad(() => {
  111. getLogList();
  112. });
  113. </script>
  114. <style lang="scss" scoped>
  115. .color-red {
  116. color: red;
  117. }
  118. .color-green {
  119. color: green;
  120. }
  121. .score-box {
  122. margin: 20rpx;
  123. border-radius: 20rpx;
  124. padding-top: 100rpx;
  125. }
  126. .avatar-box {
  127. width: 100rpx;
  128. height: 100rpx;
  129. border-radius: 50%;
  130. overflow: hidden;
  131. .avatar-img {
  132. width: 100%;
  133. height: 100%;
  134. }
  135. }
  136. .value-box {
  137. width: 100rpx;
  138. height: 100rpx;
  139. line-height: 100rpx;
  140. text-align: center;
  141. border-radius: 50%;
  142. border: 2px solid #f6f6f6;
  143. }
  144. .btn {
  145. width: 300rpx;
  146. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  147. border-radius: 20rpx;
  148. font-size: 30rpx;
  149. font-weight: 500;
  150. line-height: 80rpx;
  151. color: $white;
  152. position: relative;
  153. z-index: 1;
  154. }
  155. .header-box {
  156. width: 100%;
  157. background: linear-gradient(180deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%) no-repeat;
  158. background-size: 750rpx 100%;
  159. padding: 0 0 120rpx 0;
  160. box-sizing: border-box;
  161. .score-box {
  162. height: 100%;
  163. .all-num {
  164. font-size: 50rpx;
  165. font-weight: bold;
  166. color: #fff;
  167. font-family: OPPOSANS;
  168. }
  169. .all-title {
  170. font-size: 26rpx;
  171. font-weight: 500;
  172. color: #fff;
  173. }
  174. .cicon-help-o {
  175. color: #fff;
  176. font-size: 28rpx;
  177. }
  178. }
  179. }
  180. // 筛选
  181. .filter-box {
  182. height: 114rpx;
  183. background-color: $bg-page;
  184. .total-box {
  185. font-size: 24rpx;
  186. font-weight: 500;
  187. color: $dark-9;
  188. }
  189. .date-btn {
  190. background-color: $white;
  191. line-height: 54rpx;
  192. border-radius: 27rpx;
  193. padding: 0 20rpx;
  194. font-size: 24rpx;
  195. font-weight: 500;
  196. color: $dark-6;
  197. .ss-seldate-icon {
  198. font-size: 50rpx;
  199. color: $dark-9;
  200. }
  201. }
  202. }
  203. .list-box {
  204. // width: 600rpx;
  205. // padding: 0 30rpx;
  206. overflow-y: auto;
  207. height: 100vh;
  208. .list-item {
  209. background: #fff;
  210. // border-bottom: 1rpx solid #dfdfdf;
  211. padding: 30rpx;
  212. .name {
  213. font-size: 28rpx;
  214. font-weight: 500;
  215. color: rgba(102, 102, 102, 1);
  216. line-height: 28rpx;
  217. // margin-bottom: 20rpx;
  218. }
  219. .time {
  220. font-size: 24rpx;
  221. font-weight: 500;
  222. color: rgba(196, 196, 196, 1);
  223. line-height: 24px;
  224. }
  225. .add {
  226. font-size: 30rpx;
  227. font-weight: 500;
  228. color: #e6b873;
  229. }
  230. .minus {
  231. font-size: 30rpx;
  232. font-weight: 500;
  233. color: $dark-3;
  234. }
  235. }
  236. }
  237. </style>