微信

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <div class="mainPage">
  3. <scroll ref='scroll' :isloading='isloading' class='wrapper' :data='courseOrderList.list' :pullUpLoad='pullUpLoadObj' :startY='parseInt(startY)' @pullingUp='getList'>
  4. <div class="box">
  5. <div class="order-card flex-h" v-for="(item,index) in courseOrderList.list" :key='index' :class="{'opacity' : item.status === 1}" @click="toDetail(item)">
  6. <div class="card-pic">
  7. <div :class="{'gray-location' : item.status === 1}"><span>{{item.LocationName}}</span></div>
  8. <img src="" class="cover" width="100%" height="100%" alt="">
  9. </div>
  10. <div class="card-msg">
  11. <div class="title">{{item.CourseName}}</div>
  12. <div class="text">付款方式:{{item.CourseObtaimType === 'cheng-coin' ? '城币支付' : '优惠券抵用'}}</div>
  13. <div class="text">下单时间:{{toolClass.dateFormat(item.CreateDate)}}</div>
  14. </div>
  15. <div class="card-price">
  16. <div class="price" style="white-space: nowrap;">¥ {{item.Price}}</div>
  17. <div class="type" :class="{'un-use' : item.IsDone === 0}">{{item.IsDone === 0 ? '未使用' : '已使用'}}</div>
  18. </div>
  19. </div>
  20. <!-- <noMore v-if="hasPic"></noMore> -->
  21. </div>
  22. </scroll>
  23. </div>
  24. </template>
  25. <script>
  26. // 上拉加载组件
  27. import scroll from '../../../components/scroll/scroll'
  28. import noMore from '../../../components/noMore/noMore'
  29. import { mapState, createNamespacedHelpers } from 'vuex'
  30. const { mapActions: mapUserActions, mapState: mapUserState } = createNamespacedHelpers('userCenter')
  31. export default {
  32. data () {
  33. return {
  34. hasPic: false,
  35. pullUpLoad: true,
  36. pullUpLoadThreshold: 40,
  37. startY: 0,
  38. page: 1,
  39. isloading: true,
  40. hasMore: true,
  41. list: []
  42. }
  43. },
  44. components: {
  45. scroll,
  46. noMore
  47. },
  48. created () {
  49. var _that = this
  50. this.getCourseLocationList().then((res) => {
  51. console.log(JSON.stringify(res))
  52. this.getCourseOrderList({ page: this.page })
  53. })
  54. },
  55. computed: {
  56. ...mapUserState({
  57. courseOrderList: x => x.courseOrderList,
  58. courseLocationList: x => x.courseLocationList,
  59. }),
  60. pullUpLoadObj: function () {
  61. return this.pullUpLoad
  62. ? {
  63. threshold: parseInt(this.pullUpLoadThreshold),
  64. txt: {
  65. more: this.pullUpLoadMoreTxt,
  66. noMore: this.pullUpLoadNoMoreTxt
  67. }
  68. }
  69. : false
  70. }
  71. },
  72. methods: {
  73. ...mapUserActions([
  74. 'getCourseOrderList',
  75. 'getCourseLocationList',
  76. ]),
  77. getList () {
  78. var _that = this
  79. Math.ceil(this.courseOrderList.pagenum / this.courseOrderList.pagesize) > this.page ? this.hasMore = true : this.hasMore = false
  80. // this.list.length <= 8 ? this.hasMore = true : this.hasMore = false
  81. if (this.hasMore) {
  82. setTimeout(() => {
  83. this.getCourseOrderList({
  84. page: _that.page + 1
  85. }).then((res) => {
  86. if(res.list.length){
  87. _that.page += 1
  88. }
  89. })
  90. }, 1000)
  91. } else {
  92. this.$refs.scroll.forceUpdate()
  93. return false
  94. }
  95. },
  96. toDetail () {
  97. this.$router.push({ name: 'lessonDetail' })
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss" scoped>
  103. @import 'page.scss';
  104. </style>