orderList.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view class="content">
  3. <scroll-view scroll-y class="scroll-box" :refresher-enabled="true" :refresher-triggered="triggered"
  4. :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh" @refresherrestore="onRestore">
  5. <u-card :head-border-bottom="false" :foot-border-top="false" padding="0px" margin="10px" borderRadius="40" v-for="(item, index) in tableList"
  6. :key="index" class="class-card" @click="goToOrderDetail(item)">
  7. <view class="class-content" slot="head" style="padding-top: 10px;">
  8. <view class="class-name">{{item.studentName}}</view>
  9. </view>
  10. <view class="class-content" slot="body">
  11. <view class="class-info-text">
  12. <u-icon name="order"></u-icon>
  13. 订单号:{{item.orderNo}}
  14. </view>
  15. <view class="class-info-text">
  16. <u-icon name="clock"></u-icon>
  17. 报名时间:{{item.applyTime}}
  18. </view>
  19. </view>
  20. </u-card>
  21. <u-divider v-if="isOver" bg-color="transparent">没有更多了</u-divider>
  22. </scroll-view>
  23. <u-top-tips ref="uTips"></u-top-tips>
  24. </view>
  25. </template>
  26. <script>
  27. import {
  28. mapGetters
  29. } from 'vuex'
  30. const NET = require('@/utils/request')
  31. const API = require('@/config/api')
  32. export default {
  33. computed: {
  34. ...mapGetters([])
  35. },
  36. data() {
  37. return {
  38. id: '',
  39. triggered: false,
  40. isOver: false,
  41. tableList: [],
  42. }
  43. },
  44. onLoad(options) {
  45. this.id = options.id
  46. this.getTableList()
  47. },
  48. onReady() {},
  49. methods: {
  50. // 下拉刷新
  51. onRefresh() {
  52. this.triggered = true
  53. this.isOver = false
  54. this.getTableList()
  55. },
  56. // 重置下拉刷新状态
  57. onRestore() {
  58. this.triggered = 'restore'
  59. this.triggered = false
  60. },
  61. // 获取列表数据
  62. getTableList() {
  63. NET.request(API.getOrderList, {
  64. id: this.id
  65. }, 'POST').then(res => {
  66. this.triggered = false
  67. this.tableList = res.data
  68. this.isOver = true
  69. }).catch(error => {
  70. this.triggered = false
  71. this.$refs.uTips.show({
  72. title: error.message,
  73. type: 'warning',
  74. })
  75. })
  76. },
  77. // 跳转订单详情
  78. goToOrderDetail(item) {
  79. uni.navigateTo({
  80. url: '/pagesMain/orderDetail?id=' + item.id
  81. });
  82. }
  83. },
  84. }
  85. </script>
  86. <style>
  87. page {
  88. width: 100%;
  89. height: 100%;
  90. background-color: #f7f7f7;
  91. }
  92. </style>
  93. <style lang="scss" scoped>
  94. @import "@/static/css/themes.scss";
  95. .content {
  96. width: 100%;
  97. float: left;
  98. .scroll-box {
  99. width: 100%;
  100. height: 100vh;
  101. padding-bottom: 10px;
  102. box-sizing: border-box;
  103. .class-card {
  104. .class-content {
  105. padding: 5px 15px;
  106. }
  107. .class-name {
  108. height: 20px;
  109. display: inline-block;
  110. font-weight: bold;
  111. font-size: 14px;
  112. line-height: 20px;
  113. }
  114. .class-info-text {
  115. color: #999999;
  116. margin-bottom: 5px;
  117. /deep/.u-icon {
  118. margin-right: 5px;
  119. font-size: 14px;
  120. color: #000000;
  121. }
  122. }
  123. }
  124. }
  125. }
  126. </style>