subscribeListAll.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="content">
  3. <scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="true"
  4. :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
  5. @refresherrestore="onRestore">
  6. <u-card :head-border-bottom="false" padding="0px" margin="10px" borderRadius="40" v-for="(item, index) in tableList"
  7. :key="index" class="class-card" @click="handleJumpClick(item)">
  8. <view class="class-content" slot="head" style="padding-top: 10px;display:flex;justify-content: space-between;">
  9. <view>
  10. <view class="student-name">{{item.studentName}}</view>
  11. <view class="class-name">{{item.name}}</view>
  12. </view>
  13. <view class="class-name">{{ item.experience ? '已确认' : '未确认' }}</view>
  14. </view>
  15. <view class="class-content" slot="body">
  16. <view class="class-info-text" v-if="item.experience">
  17. <u-icon name="clock"></u-icon>
  18. {{item.experienceDate}}
  19. </view>
  20. <view class="class-info-text" v-else>
  21. <u-icon name="clock"></u-icon>
  22. {{item.experienceDate.substr(0,10)}}
  23. </view>
  24. <view class="class-info-text">
  25. <u-icon name="map"></u-icon>
  26. {{item.address}}
  27. </view>
  28. </view>
  29. <!-- <view class="class-foot" slot="foot">
  30. <u-button type="default" shape="circle" :ripple="true" :custom-style="handleDefaultCustomStyle" size="mini"
  31. :hair-line="false" plain>已预约</u-button>
  32. </view> -->
  33. </u-card>
  34. <u-divider v-if="isOver" bg-color="transparent">没有更多了</u-divider>
  35. </scroll-view>
  36. <u-top-tips ref="uTips"></u-top-tips>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. mapGetters
  42. } from 'vuex'
  43. const NET = require('@/utils/request')
  44. const API = require('@/config/api')
  45. export default {
  46. computed: {
  47. ...mapGetters([
  48. 'handleDefaultCustomStyle',
  49. ])
  50. },
  51. data() {
  52. return {
  53. triggered: false,
  54. isOver: false,
  55. pageIndex: 1,
  56. tableList: [],
  57. }
  58. },
  59. onLoad(options) {
  60. console.log(options);
  61. // 二维码中场馆id
  62. },
  63. onShow() {
  64. this.tableList = []
  65. this.getTableList()
  66. },
  67. onReady() {},
  68. methods: {
  69. // 跳转详情
  70. handleJumpClick(item) {
  71. uni.navigateTo({
  72. url: '/pagesMain/subscribeInfo?item=' + encodeURIComponent(JSON.stringify(item))
  73. })
  74. },
  75. // 下拉刷新
  76. onRefresh() {
  77. this.triggered = true
  78. this.isOver = false
  79. this.pageIndex = 1
  80. this.tableList = []
  81. this.getTableList()
  82. },
  83. // 重置下拉刷新状态
  84. onRestore() {
  85. this.triggered = 'restore'
  86. this.triggered = false
  87. },
  88. // 懒加载
  89. handleLoadMore() {
  90. if (!this.isOver) {
  91. this.pageIndex++
  92. this.getTableList()
  93. }
  94. },
  95. // 获取列表数据
  96. getTableList() {
  97. // id:场馆id
  98. NET.request(API.getSubscribeList, {
  99. page: this.pageIndex,
  100. size: 10,
  101. }, 'POST').then(res => {
  102. this.triggered = false
  103. this.tableList = this.tableList.concat(res.data.row)
  104. this.isOver = res.data.row.length != 10
  105. }).catch(error => {
  106. this.triggered = false
  107. this.$refs.uTips.show({
  108. title: error.message,
  109. type: 'warning',
  110. })
  111. })
  112. }
  113. },
  114. }
  115. </script>
  116. <style>
  117. page {
  118. width: 100%;
  119. height: 100%;
  120. background-color: #f7f7f7;
  121. }
  122. </style>
  123. <style lang="scss" scoped>
  124. @import "@/static/css/themes.scss";
  125. .content {
  126. width: 100%;
  127. float: left;
  128. .scroll-box {
  129. width: 100%;
  130. height: 100vh;
  131. padding-bottom: 10px;
  132. box-sizing: border-box;
  133. .class-card {
  134. .class-content {
  135. padding: 5px 15px;
  136. }
  137. .student-name {
  138. height: 20px;
  139. display: inline-block;
  140. padding: 0 10px;
  141. margin-right: 5px;
  142. background-color: $mainColor;
  143. border-radius: 10px;
  144. line-height: 20px;
  145. color: #FFFFFF;
  146. }
  147. .class-name {
  148. height: 20px;
  149. display: inline-block;
  150. font-weight: bold;
  151. font-size: 14px;
  152. line-height: 20px;
  153. }
  154. .class-info-text {
  155. color: #999999;
  156. margin-bottom: 5px;
  157. /deep/.u-icon {
  158. margin-right: 5px;
  159. font-size: 14px;
  160. color: #000000;
  161. }
  162. }
  163. }
  164. .class-foot {
  165. padding: 10px 15px;
  166. text-align: right;
  167. }
  168. }
  169. }
  170. </style>