pointsDetail.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. {{userData.pufaPoint}}
  13. </view>
  14. </view>
  15. </view>
  16. <mescroll-body-diy 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-diy>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import back from "@/components/back.vue"
  35. import MescrollBodyDiy from "@/uni_modules/mescroll-uni/components/mescroll-diy/xinlang/mescroll-body.vue";
  36. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  37. export default {
  38. mixins: [MescrollMixin],
  39. components: {
  40. back,
  41. MescrollBodyDiy,
  42. },
  43. data() {
  44. return {
  45. userData:{},
  46. title: '积分明细',
  47. backShow: true,
  48. downOption: {
  49. auto: false
  50. },
  51. upOption:{
  52. auto:false
  53. },
  54. list: []
  55. }
  56. },
  57. computed:{
  58. symbol(){
  59. return pointType=>{
  60. let PLUS_LIST=['PUFA_POINT_SEND']
  61. if (PLUS_LIST.includes(pointType)) {
  62. return 'plus'
  63. }else{
  64. return 'reduce'
  65. }
  66. }
  67. }
  68. },
  69. onPageScroll(res) {
  70. if (res.scrollTop > 0) {
  71. this.title = ''
  72. } else {
  73. this.title = '积分明细'
  74. }
  75. if (res.scrollTop > 100) {
  76. this.backShow = false
  77. } else {
  78. this.backShow = true
  79. }
  80. },
  81. onLoad() {
  82. this.mescroll.resetUpScroll();
  83. this.fetchPoints()
  84. },
  85. methods: {
  86. fetchPoints(){
  87. let params={
  88. id:this.vuex_userId
  89. }
  90. this.$api.loginUser.detail(params).then(res=>{
  91. this.userData=res.data.data
  92. })
  93. },
  94. downCallback() {
  95. setTimeout(() => {
  96. this.mescroll.resetUpScroll();
  97. }, 800)
  98. },
  99. upCallback(mescroll) {
  100. try {
  101. let params = {
  102. current: mescroll.num,
  103. size: mescroll.size,
  104. }
  105. this.$api.points.list(params).then(res => {
  106. let data = res.data.data.records
  107. let total = res.data.data.total
  108. mescroll.endBySize(data.length, total);
  109. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  110. this.list = this.list.concat(data); //追加新数据
  111. })
  112. } catch (e) {
  113. this.mescroll.endErr()
  114. }
  115. }
  116. }
  117. }
  118. </script>
  119. <style>
  120. .container {
  121. background-color: #FFFFFF;
  122. border-radius: 10upx;
  123. margin: 20upx;
  124. }
  125. .type {
  126. font-size: 30upx;
  127. font-family: PingFang-SC-Heavy;
  128. font-weight: bold;
  129. margin-bottom: 20upx;
  130. color: #111111;
  131. }
  132. .time {
  133. font-size: 24upx;
  134. font-family: PingFang-SC-Medium;
  135. font-weight: 400;
  136. color: #999999;
  137. }
  138. .points {
  139. font-size: 28upx;
  140. font-family: PingFang-SC-Bold;
  141. color: #111111;
  142. }
  143. </style>