orderList.vue 3.1 KB

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