consumptionLog.vue 7.4 KB

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