activity.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="safe-area-inset-bottom">
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  4. :up="upOption">
  5. <card :list="dataList" ></card>
  6. </mescroll-body>
  7. </view>
  8. </template>
  9. <script>
  10. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  11. import card from "./comps/card.vue"
  12. export default {
  13. mixins: [MescrollMixin],
  14. components:{
  15. card
  16. },
  17. data() {
  18. return {
  19. id:'',
  20. dataList:[]
  21. }
  22. },
  23. onLoad(options) {
  24. this.id=options.id
  25. console.log(options.id);
  26. },
  27. methods:{
  28. downCallback(){
  29. this.mescroll.resetUpScroll();
  30. },
  31. upCallback(mescroll) {
  32. let params = {
  33. auditStatus:'PASS',
  34. current:mescroll.num,
  35. size:mescroll.size,
  36. mallId:this.id,
  37. }
  38. try {
  39. this.$api.activity.list(params).then(res => {
  40. let data = res.data.records
  41. let total = res.data.total
  42. mescroll.endBySize(data.length, total);
  43. if (mescroll.num == 1) this.dataList = []; //如果是第一页需手动制空列表
  44. this.dataList = this.dataList.concat(data); //追加新数据
  45. })
  46. } catch (e) {
  47. this.mescroll.endErr()
  48. }
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. </style>