pointsDetail.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="safe-area-inset-bottom" :style="vuex_skin">
  3. <!-- #ifdef MP-WEIXIN -->
  4. <back v-if="backShow" :title="title"></back>
  5. <u-navbar v-else title-color="#fff" :border-bottom="false" title="积分明细" back-icon-color="#fff"
  6. :background="{'backgroundColor': vuex_theme.shopBg}"></u-navbar>
  7. <!-- #endif -->
  8. <view class="">
  9. <view class="bg-img flex justify-center align-center"
  10. :class="isH5?'marginTop':''"
  11. style="height: 340upx;z-index: 999;">
  12. <view class="text-center" style="margin-top: 150upx;">
  13. <view style="font-size: 26upx;color: #FFFFFF;font-weight: 400;">可用积分</view>
  14. <view style="font-size: 58upx;margin-top: 7rpx;color: #ffffff;">
  15. {{userPoint || 0}}
  16. </view>
  17. </view>
  18. </view>
  19. <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback"
  20. @up="upCallback">
  21. <view class="flex justify-between align-center container " v-for="(item, index) in list" :key="index">
  22. <view class="padding">
  23. <view v-if="item.pointType=='CMCC_POINT_EXCHANGE'" class="type">移动积分兑换道具</view>
  24. <view v-if="item.pointType=='PUFA_POINT_SEND'" class="type">平台积分赠送</view>
  25. <view v-if="item.pointType=='PUFA_POINT_EXCHANGE'" class="type">平台积分兑换</view>
  26. <view class="time">{{item.createTime}}</view>
  27. </view>
  28. <view class="padding">
  29. <view class="points" :class="symbol(item.pointType)?symbol(item.pointType):''">{{item.point}} 积分
  30. </view>
  31. </view>
  32. </view>
  33. </mescroll-body>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import back from "@/components/back.vue"
  39. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  40. export default {
  41. mixins: [MescrollMixin],
  42. components: {
  43. back,
  44. },
  45. data() {
  46. return {
  47. isH5:false,
  48. userPoint: 0,
  49. title: '积分明细',
  50. backShow: true,
  51. downOption: {
  52. auto: false
  53. },
  54. upOption: {
  55. auto: false
  56. },
  57. list: []
  58. }
  59. },
  60. computed: {
  61. symbol() {
  62. return pointType => {
  63. let PLUS_LIST = ['PUFA_POINT_SEND']
  64. if (PLUS_LIST.includes(pointType)) {
  65. return 'plus'
  66. } else {
  67. return 'reduce'
  68. }
  69. }
  70. }
  71. },
  72. onPageScroll(res) {
  73. if (res.scrollTop > 0) {
  74. this.title = ''
  75. } else {
  76. this.title = '积分明细'
  77. }
  78. if (res.scrollTop > 100) {
  79. this.backShow = false
  80. } else {
  81. this.backShow = true
  82. }
  83. },
  84. onLoad() {
  85. this.fetchUserPufaPoint()
  86. // #ifdef MP-WEIXIN
  87. this.mescroll.resetUpScroll();
  88. // #endif
  89. // #ifdef H5
  90. this.isH5 = true
  91. //h5端要延时才能获取到mescroll对象
  92. setTimeout(() => {
  93. this.mescroll.resetUpScroll();
  94. }, 20)
  95. // #endif
  96. },
  97. methods: {
  98. fetchUserPufaPoint() {
  99. if (!this.vuex_phone) {
  100. return
  101. }
  102. let params = {
  103. phone: this.vuex_phone
  104. }
  105. this.$api.loginUser.userHeatValueAndPufaPoint(params).then(res => {
  106. this.userPoint = res.data.data.userPufaPoint
  107. })
  108. },
  109. downCallback() {
  110. setTimeout(() => {
  111. this.mescroll.resetUpScroll();
  112. }, 800)
  113. },
  114. upCallback(mescroll) {
  115. try {
  116. let params = {
  117. current: mescroll.num,
  118. size: mescroll.size,
  119. userId: this.vuex_userId
  120. }
  121. this.$api.points.list(params).then(res => {
  122. let data = res.data.data.records
  123. let total = res.data.data.total
  124. mescroll.endBySize(data.length, total);
  125. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  126. this.list = this.list.concat(data); //追加新数据
  127. })
  128. } catch (e) {
  129. this.mescroll.endErr()
  130. }
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="scss" scoped>
  136. .container {
  137. background-color: #FFFFFF;
  138. border-radius: 10upx;
  139. margin: 20upx;
  140. }
  141. .marginTop{
  142. margin-top: -80rpx;
  143. }
  144. .type {
  145. font-size: 30upx;
  146. font-family: PingFang-SC-Heavy;
  147. font-weight: bold;
  148. margin-bottom: 20upx;
  149. color: #111111;
  150. }
  151. .time {
  152. font-size: 24upx;
  153. font-family: PingFang-SC-Medium;
  154. font-weight: 400;
  155. color: #999999;
  156. }
  157. .points {
  158. font-size: 28upx;
  159. font-family: PingFang-SC-Bold;
  160. color: #111111;
  161. }
  162. .bg-img{
  163. position: relative;
  164. &::after {
  165. content: '';
  166. width: 140%;
  167. height: 200px;
  168. position: absolute;
  169. left: 50%;
  170. transform: translateX(-50%);
  171. z-index: -1;
  172. bottom: 0;
  173. border-radius: 0 0 50% 50%;
  174. background: var(--bgColor);
  175. }
  176. }
  177. </style>