consumptionLog.vue 7.2 KB

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