sign_list.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. {extend name="public/container"}
  2. {block name="title"}我的报名{/block}
  3. {block name="content"}
  4. <style>
  5. body {
  6. background-color: #f5f5f5;
  7. }
  8. .loading {
  9. font-size: .4rem;
  10. text-align: center;
  11. color: #999;
  12. }
  13. .loaded {
  14. font-size: .28rem;
  15. line-height: .72rem;
  16. text-align: center;
  17. color: #999;
  18. }
  19. .nothing {
  20. position: absolute;
  21. top: 30%;
  22. left: 50%;
  23. width: 4rem;
  24. height: 4rem;
  25. -webkit-transform: translate(-50%, -50%);
  26. transform: translate(-50%, -50%);
  27. }
  28. </style>
  29. <div v-cloak id="app">
  30. <div class="activity_list">
  31. <div class="nav-bar">
  32. <div v-for="(item, index) in navs" :key="index" :class="{ active: navActive === index }" class="item" @click="navActives(index)">{{ item }}</div>
  33. </div>
  34. <div v-if="activityList.length" class="list">
  35. <a v-for="(item, index) in activityList" :key="index" :href="activityDetails(item.order_id)"
  36. class="activitys">
  37. <div class="items">单号:{{item.order_id}}</div>
  38. <div class="item">
  39. <div class="image">
  40. <img :src="item.activity.image" class="img">
  41. </div>
  42. <div class="text">
  43. <div class="names">{{ item.activity.title }}</div>
  44. <div class="time">
  45. <span class="knowledge icondidian"></span>{{ item.activity.province }}{{ item.activity.city }}{{ item.activity.district }}{{ item.activity.detail }}
  46. </div>
  47. <div class="group">
  48. <div class="money">
  49. ¥<span class="num">{{ item.pay_price }}</span>
  50. </div>
  51. <span class="status-txt off fr" v-if="item.activity.status<=2 && item.status==0">未核销</span>
  52. <span class="status-txt off fr" v-else-if="item.activity.status<=2 && item.status==1">已核销</span>
  53. <span class="status-txt off fr" v-else-if="item.activity.status==3 && item.status==0">活动中,未核销</span>
  54. <span class="status-txt off fr" v-else-if="item.activity.status==3 && item.status==1">活动中,已核销</span>
  55. <span class="status-txt off fr" v-else-if="item.activity.status==4 && item.status==0">已结束,未核销</span>
  56. <span class="status-txt off fr" v-else-if="item.activity.status==4 && item.status==1">已结束,已核销</span>
  57. </div>
  58. </div>
  59. </div>
  60. </a>
  61. </div>
  62. <div v-show="loading" class="loading">
  63. <span class="fa fa-spinner"></span>
  64. </div>
  65. <div v-if="loadend && activityList.length" class="loaded">{{loadTitle}}</div>
  66. <div v-if="!activityList.length && !loading">
  67. <img class="nothing" src="/wap/first/zsff/images/no_data_available.png">
  68. </div>
  69. </div>
  70. <shortcut></shortcut>
  71. </div>
  72. <script>
  73. require(['vue', 'store', 'helper', '{__WAP_PATH}zsff/js/shortcut.js'], function (Vue, store, $h) {
  74. var app = new Vue({
  75. el: '#app',
  76. data: {
  77. navs: ['全部', '未核销', '已核销'],
  78. navActive: 0,
  79. activityList: [],
  80. loading: false,
  81. loadend: false,
  82. page: 1,
  83. limit: 20,
  84. loadTitle:''
  85. },
  86. mounted: function () {
  87. this.getActivitySignList();
  88. this.$nextTick(function () {
  89. this.init();
  90. });
  91. },
  92. methods: {
  93. navActives: function (index) {
  94. var that = this;
  95. that.navActive = index;
  96. that.page = 1;
  97. that.loading = false;
  98. that.loadend = false;
  99. that.activityList = [];
  100. that.getActivitySignList();
  101. },
  102. init: function () {
  103. var that = this;
  104. window.addEventListener('scroll', function () {
  105. var clientHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
  106. scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight,
  107. scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  108. if (clientHeight + scrollTop >= scrollHeight) {
  109. that.getActivitySignList();
  110. }
  111. });
  112. },
  113. activityDetails: function (order_id) {
  114. return $h.U({ c: 'my', a: 'sign_order', q: { type: 1, order_id: order_id } });
  115. },
  116. // 获取活动列表
  117. getActivitySignList: function () {
  118. var that = this;
  119. if (that.loading) return;
  120. if (that.loadend) return;
  121. that.loading = true;
  122. store.baseGet($h.U({ c: 'activity', a: 'activitySignInList', p: { page: that.page, limit: that.limit, navActive: that.navActive } }), function (res) {
  123. var list = res.data.data;
  124. that.activityList.push.apply(that.activityList, list);
  125. that.loadend = list.length < that.limit;
  126. that.loadTitle = that.loadend ? '已全部加载' : '上拉加载更多';
  127. that.page = that.page + 1;
  128. that.loading = false;
  129. that.$set(this, 'activityList', that.activityList);
  130. }, function (res) {
  131. that.loadTitle = '上拉加载更多';
  132. that.loading = false;
  133. });
  134. }
  135. }
  136. });
  137. });
  138. </script>
  139. {/block}