pointsDetail.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view class="safe-area-inset-bottom">
  3. <back v-if="backShow" :title="title"></back>
  4. <u-navbar v-else title-color="#fff" :border-bottom="false" title="积分明细" back-icon-color="#fff"
  5. :background="{'backgroundColor': vuex_theme.shopBg}"></u-navbar>
  6. <view class="" >
  7. <view class="bg-img flex justify-center align-center"
  8. style="background-image: url('https://vote.guosen-fumao.cn/obsfile/6002585ea7d548508d5f6dcce4ed1116-mingxi.png');height: 340upx;z-index: 9999999999999;">
  9. <view class="text-center" style="margin-top: 150upx;">
  10. <view style="font-size: 26upx;color: #FFFFFF;font-weight: 400;">可用积分</view>
  11. <view style="font-size: 58upx;margin-top: 7rpx;color: #ffffff;">
  12. {{userPoint || 0}}
  13. </view>
  14. </view>
  15. </view>
  16. <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback"
  17. @up="upCallback">
  18. <view class="flex justify-between align-center container " v-for="(item, index) in list" :key="index">
  19. <view class="padding">
  20. <view v-if="item.pointType=='CMCC_POINT_EXCHANGE'" class="type">移动积分兑换道具</view>
  21. <view v-if="item.pointType=='PUFA_POINT_SEND'" class="type">普法积分赠送</view>
  22. <view v-if="item.pointType=='PUFA_POINT_EXCHANGE'" class="type">普法积分兑换</view>
  23. <view class="time">{{item.createTime}}</view>
  24. </view>
  25. <view class="padding">
  26. <view class="points" :class="symbol(item.pointType)?symbol(item.pointType):''">{{item.point}} 积分</view>
  27. </view>
  28. </view>
  29. </mescroll-body>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import back from "@/components/back.vue"
  35. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  36. export default {
  37. mixins: [MescrollMixin],
  38. components: {
  39. back,
  40. },
  41. data() {
  42. return {
  43. userPoint:0,
  44. title: '积分明细',
  45. backShow: true,
  46. downOption: {
  47. auto: false
  48. },
  49. upOption:{
  50. auto:false
  51. },
  52. list: []
  53. }
  54. },
  55. computed:{
  56. symbol(){
  57. return pointType=>{
  58. let PLUS_LIST=['PUFA_POINT_SEND']
  59. if (PLUS_LIST.includes(pointType)) {
  60. return 'plus'
  61. }else{
  62. return 'reduce'
  63. }
  64. }
  65. }
  66. },
  67. onPageScroll(res) {
  68. if (res.scrollTop > 0) {
  69. this.title = ''
  70. } else {
  71. this.title = '积分明细'
  72. }
  73. if (res.scrollTop > 100) {
  74. this.backShow = false
  75. } else {
  76. this.backShow = true
  77. }
  78. },
  79. onLoad() {
  80. this.mescroll.resetUpScroll();
  81. this.fetchUserPufaPoint()
  82. },
  83. methods: {
  84. fetchUserPufaPoint() {
  85. if (!this.vuex_phone) {
  86. return
  87. }
  88. let params = {
  89. phone: this.vuex_phone
  90. }
  91. this.$api.loginUser.userHeatValueAndPufaPoint(params).then(res => {
  92. this.userPoint=res.data.data.userPufaPoint
  93. })
  94. },
  95. downCallback() {
  96. setTimeout(() => {
  97. this.mescroll.resetUpScroll();
  98. }, 800)
  99. },
  100. upCallback(mescroll) {
  101. try {
  102. let params = {
  103. current: mescroll.num,
  104. size: mescroll.size,
  105. userId: this.vuex_userId
  106. }
  107. this.$api.points.list(params).then(res => {
  108. let data = res.data.data.records
  109. let total = res.data.data.total
  110. mescroll.endBySize(data.length, total);
  111. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  112. this.list = this.list.concat(data); //追加新数据
  113. })
  114. } catch (e) {
  115. this.mescroll.endErr()
  116. }
  117. }
  118. }
  119. }
  120. </script>
  121. <style>
  122. .container {
  123. background-color: #FFFFFF;
  124. border-radius: 10upx;
  125. margin: 20upx;
  126. }
  127. .type {
  128. font-size: 30upx;
  129. font-family: PingFang-SC-Heavy;
  130. font-weight: bold;
  131. margin-bottom: 20upx;
  132. color: #111111;
  133. }
  134. .time {
  135. font-size: 24upx;
  136. font-family: PingFang-SC-Medium;
  137. font-weight: 400;
  138. color: #999999;
  139. }
  140. .points {
  141. font-size: 28upx;
  142. font-family: PingFang-SC-Bold;
  143. color: #111111;
  144. }
  145. </style>