pointsDetail.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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://music.nanyue6688.com/obsfile/29a50aaf357d45cc96033d470eb2b971-bg_mingxi@2x.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. {{$cache.get('userInfo').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. title: '积分明细',
  46. backShow: true,
  47. downOption: {
  48. auto: false
  49. },
  50. upOption:{
  51. auto:false
  52. },
  53. list: []
  54. }
  55. },
  56. computed:{
  57. symbol(){
  58. return pointType=>{
  59. let PLUS_LIST=['PUFA_POINT_SEND']
  60. if (PLUS_LIST.includes(pointType)) {
  61. return 'plus'
  62. }else{
  63. return 'reduce'
  64. }
  65. }
  66. }
  67. },
  68. onPageScroll(res) {
  69. if (res.scrollTop > 0) {
  70. this.title = ''
  71. } else {
  72. this.title = '积分明细'
  73. }
  74. if (res.scrollTop > 100) {
  75. this.backShow = false
  76. } else {
  77. this.backShow = true
  78. }
  79. },
  80. onLoad() {
  81. this.mescroll.resetUpScroll();
  82. },
  83. methods: {
  84. downCallback() {
  85. setTimeout(() => {
  86. this.mescroll.resetUpScroll();
  87. }, 800)
  88. },
  89. upCallback(mescroll) {
  90. try {
  91. let params = {
  92. current: mescroll.num,
  93. size: mescroll.size,
  94. }
  95. this.$api.points.list(params).then(res => {
  96. let data = res.data.data.records
  97. let total = res.data.data.total
  98. mescroll.endBySize(data.length, total);
  99. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  100. this.list = this.list.concat(data); //追加新数据
  101. })
  102. } catch (e) {
  103. this.mescroll.endErr()
  104. }
  105. }
  106. }
  107. }
  108. </script>
  109. <style>
  110. .container {
  111. background-color: #FFFFFF;
  112. border-radius: 10upx;
  113. margin: 20upx;
  114. }
  115. .type {
  116. font-size: 30upx;
  117. font-family: PingFang-SC-Heavy;
  118. font-weight: bold;
  119. margin-bottom: 20upx;
  120. color: #111111;
  121. }
  122. .time {
  123. font-size: 24upx;
  124. font-family: PingFang-SC-Medium;
  125. font-weight: 400;
  126. color: #999999;
  127. }
  128. .points {
  129. font-size: 28upx;
  130. font-family: PingFang-SC-Bold;
  131. color: #111111;
  132. }
  133. </style>