help-records.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view>
  3. <mescroll-body-diy ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback"
  4. @up="upCallback">
  5. <view @click="jump(item)" class="card" v-for="(item,index) in list" :key="index">
  6. <view class="card-top">
  7. <view>
  8. <text v-if="item.heatType=='HEAT_VALUE_EXCHANGE'">热力值兑换</text>
  9. <text v-if="item.heatType=='HEAT_VALUE_SEND'">热力值赠送</text>
  10. </view>
  11. <view class="flex">
  12. <image src="/static/icon/remen.png" style="width: 36rpx;height: 36rpx;margin-right: 6rpx;">
  13. </image>
  14. <text v-if="item.heatType=='HEAT_VALUE_EXCHANGE'" class="center reduce">{{heatValue}}</text>
  15. <text v-if="item.heatType=='HEAT_VALUE_SEND'" class="center plus">{{heatValue}}</text>
  16. </view>
  17. </view>
  18. <view class="card-bottom">
  19. <view class="center">{{item.createTime}}</view>
  20. </view>
  21. </view>
  22. </mescroll-body-diy>
  23. </view>
  24. </template>
  25. <script>
  26. import MescrollBodyDiy from "@/uni_modules/mescroll-uni/components/mescroll-diy/xinlang/mescroll-body.vue";
  27. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  28. export default {
  29. mixins: [MescrollMixin],
  30. components: {
  31. MescrollBodyDiy,
  32. },
  33. data() {
  34. return {
  35. downOption: {
  36. auto: false
  37. },
  38. top: 0,
  39. list: []
  40. }
  41. },
  42. methods: {
  43. jump(item){
  44. if (this.$isNotEmpty(item.activeProductId)) {
  45. uni.navigateTo({
  46. url:'/pages/activity/activityDetail?id='+item.activeProductId
  47. })
  48. }
  49. },
  50. downCallback() {
  51. setTimeout(() => {
  52. this.mescroll.resetUpScroll();
  53. }, 1000)
  54. },
  55. upCallback(mescroll) {
  56. try {
  57. let params = {
  58. userId: this.vuex_userId,
  59. current: mescroll.num,
  60. size: mescroll.size,
  61. }
  62. this.$api.heatrecord.list(params).then(res => {
  63. let data = res.data.data.records
  64. let total = res.data.data.total
  65. mescroll.endBySize(data.length, total);
  66. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  67. this.list = this.list.concat(data); //追加新数据
  68. })
  69. } catch (e) {
  70. console.error(e);
  71. this.mescroll.endErr()
  72. }
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. .card {
  79. background-color: #FFFFFF;
  80. margin: 20rpx 0;
  81. padding: 35rpx;
  82. .card-top {
  83. display: flex;
  84. justify-content: space-between;
  85. color: #353535;
  86. font-size: 32rpx;
  87. margin-bottom: 20rpx;
  88. font-family: PingFang-SC-Bold;
  89. }
  90. .card-bottom {
  91. display: flex;
  92. justify-content: space-between;
  93. margin-top: 20rpx;
  94. color: #999999;
  95. font-size: 26rpx;
  96. font-weight: 400;
  97. }
  98. }
  99. </style>