score-balance.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <!-- 积分余额 -->
  2. <template>
  3. <view class="page_box">
  4. <view class="head_box">
  5. <shopro-navbar :background="{ background: 'none' }" backText="积分余额" backIconColor="#333"></shopro-navbar>
  6. <view class="all-box u-flex-col u-row-center u-col-center">
  7. <text class="all-num">{{ userInfo.score || 0 }}</text>
  8. <text class="all-title u-m-b-30">当前积分</text>
  9. <image class="score-card-bg" :src="$IMG_URL + '/imgs/score/score_wallet_bg.png'" mode=""></image>
  10. </view>
  11. <view class="tab-box u-flex">
  12. <view class="tab-item u-flex u-row-center " @tap="onTab('all')"><view class="tab-name" :class="{ 'tab-active': tabCur === 'all' }">全部</view></view>
  13. <view class="tab-item u-flex u-row-center" @tap="onTab('add')"><view class="tab-name" :class="{ 'tab-active': tabCur === 'add' }">收入</view></view>
  14. <view class="tab-item u-flex u-row-center" @tap="onTab('reduce')"><view class="tab-name" :class="{ 'tab-active': tabCur === 'reduce' }">支出</view></view>
  15. </view>
  16. </view>
  17. <view class="content_box">
  18. <scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box">
  19. <view class="item-box u-flex u-row-between" v-for="log in scoreLog" :key="log.id">
  20. <view class="u-flex-col">
  21. <view class="name">{{ log.type_name }}</view>
  22. <view class="time">{{ $u.timeFormat(log.createtime) }}</view>
  23. </view>
  24. <view class="num font-OPPOSANS" v-if="log.wallet >= 0">{{ log.wallet }}</view>
  25. <view class="num font-OPPOSANS" v-else>{{ log.wallet }}</view>
  26. </view>
  27. <!-- 空置页 -->
  28. <shopro-empty v-if="isEmpty" marginTop="200rpx" :image="$IMG_URL + '/imgs/empty/comment_empty.png'" tipText="暂无数据~"></shopro-empty>
  29. <!-- 更多 -->
  30. <u-loadmore v-if="scoreLog.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
  31. </scroll-view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import { mapMutations, mapActions, mapState, mapGetters } from 'vuex';
  37. export default {
  38. components: {},
  39. data() {
  40. return {
  41. isEmpty: false,
  42. tabCur: 'all',
  43. scoreLog: [],
  44. loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
  45. currentPage: 1,
  46. lastPage: 1
  47. };
  48. },
  49. computed: {
  50. ...mapGetters(['userInfo'])
  51. },
  52. onLoad() {
  53. this.getScoreLog();
  54. },
  55. methods: {
  56. loadMore() {
  57. if (this.currentPage < this.lastPage) {
  58. this.currentPage += 1;
  59. this.getScoreLog();
  60. }
  61. },
  62. onTab(type) {
  63. if (this.tabCur !== type) {
  64. this.tabCur = type;
  65. this.scoreLog = [];
  66. this.currentPage = 1;
  67. this.getScoreLog();
  68. }
  69. },
  70. // 积分明细
  71. getScoreLog(type) {
  72. let that = this;
  73. that.loadStatus = 'loading';
  74. that.$http('money.walletLog', {
  75. wallet_type: 'score',
  76. status: that.tabCur,
  77. page: that.currentPage
  78. }).then(res => {
  79. if (res.code === 1) {
  80. that.scoreLog = [...that.scoreLog, ...res.data.wallet_logs.data];
  81. that.lastPage = res.data.last_page;
  82. that.isEmpty = !that.scoreLog.length;
  83. that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
  84. }
  85. });
  86. }
  87. }
  88. };
  89. </script>
  90. <style lang="scss">
  91. .page_box {
  92. background: #fff;
  93. .head_box {
  94. width: 750rpx;
  95. height: 480rpx;
  96. background: linear-gradient(180deg, rgba(239, 196, 128, 1) 0%, rgba(248, 220, 165, 1) 40%, rgba(255, 255, 255, 1) 100%) no-repeat;
  97. position: relative;
  98. .all-box {
  99. height: 360rpx;
  100. padding-bottom: var(--status-bar-height);
  101. .all-num {
  102. font-size: 50rpx;
  103. font-weight: 500;
  104. color: #a8700d;
  105. margin-bottom: 20rpx;
  106. }
  107. .all-title {
  108. font-size: 24rpx;
  109. font-weight: 500;
  110. color: rgba(168, 112, 13, 1);
  111. }
  112. .score-card-bg {
  113. width: 100%;
  114. height: 90rpx;
  115. }
  116. }
  117. .tab-box {
  118. position: absolute;
  119. left: 50%;
  120. bottom: 0;
  121. transform: translateX(-50%);
  122. width: 710rpx;
  123. height: 90rpx;
  124. background: rgba(255, 255, 255, 1);
  125. border-radius: 30rpx 30rpx 0px 0px;
  126. border-bottom: 1rpx solid #dfdfdf;
  127. padding: 0 30rpx;
  128. .tab-item {
  129. flex: 1;
  130. .tab-name {
  131. display: inline-block;
  132. font-size: 30rpx;
  133. font-family: Noto Sans S Chinese;
  134. font-weight: 400;
  135. color: rgba(51, 51, 51, 1);
  136. border-bottom: 4rpx solid transparent;
  137. line-height: 86rpx;
  138. }
  139. .tab-active {
  140. border-bottom: 4rpx solid rgba(213, 166, 90, 1);
  141. }
  142. }
  143. }
  144. }
  145. }
  146. .item-box {
  147. background: #fff;
  148. min-height: 150rpx;
  149. border-bottom: 1rpx solid #dfdfdf;
  150. padding: 30rpx;
  151. .name {
  152. font-size: 28rpx;
  153. font-weight: 500;
  154. color: rgba(102, 102, 102, 1);
  155. line-height: 28rpx;
  156. margin-bottom: 20rpx;
  157. }
  158. .time {
  159. font-size: 24rpx;
  160. font-weight: 500;
  161. color: rgba(196, 196, 196, 1);
  162. line-height: 24px;
  163. }
  164. .num {
  165. font-size: 30rpx;
  166. font-weight: 500;
  167. color: #e6b873;
  168. }
  169. }
  170. </style>