orderList.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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">
  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. <view class="class-content" slot="foot" style="padding-top: 10px;padding-bottom: 10px;text-align: right;">
  26. <u-button type="default" shape="circle" :ripple="true" :custom-style="handleDefaultCustomStyle" size="mini"
  27. :hair-line="false" plain @click.stop="copyOrderNumber(item)">复制订单号</u-button>
  28. <u-button type="warning" shape="circle" :ripple="true" :custom-style="handleCustomStyle" size="mini" @click.stop="checkContract(item)">查看合同</u-button>
  29. </view>
  30. </u-card>
  31. <u-divider v-if="isOver" bg-color="transparent">没有更多了</u-divider>
  32. </scroll-view>
  33. <u-top-tips ref="uTips"></u-top-tips>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. mapGetters
  39. } from 'vuex'
  40. const NET = require('@/utils/request')
  41. const API = require('@/config/api')
  42. export default {
  43. computed: {
  44. ...mapGetters([
  45. 'handleCustomStyle',
  46. 'handleDefaultCustomStyle',
  47. ])
  48. },
  49. data() {
  50. return {
  51. triggered: false,
  52. isOver: false,
  53. pageIndex: 1,
  54. tableList: [],
  55. }
  56. },
  57. onLoad() {
  58. this.getTableList()
  59. },
  60. onReady() {},
  61. methods: {
  62. // 下拉刷新
  63. onRefresh() {
  64. this.triggered = true
  65. this.isOver = false
  66. this.pageIndex = 1
  67. this.tableList = []
  68. this.getTableList()
  69. },
  70. // 重置下拉刷新状态
  71. onRestore() {
  72. this.triggered = 'restore'
  73. this.triggered = false
  74. },
  75. // 懒加载
  76. handleLoadMore() {
  77. if (!this.isOver) {
  78. this.pageIndex++
  79. this.getTableList()
  80. }
  81. },
  82. // 获取列表数据
  83. getTableList() {
  84. NET.request(API.getOrderList, {
  85. page: this.pageIndex,
  86. size: 10,
  87. }, 'POST').then(res => {
  88. this.triggered = false
  89. this.tableList = this.tableList.concat(res.data.row)
  90. this.isOver = res.data.row.length != 10
  91. }).catch(error => {
  92. this.triggered = false
  93. this.$refs.uTips.show({
  94. title: error.message,
  95. type: 'warning',
  96. })
  97. })
  98. },
  99. // 复制订单号
  100. copyOrderNumber(item) {
  101. uni.setClipboardData({
  102. data: item.orderNumber,
  103. success: () => {
  104. this.$refs.uTips.show({
  105. title: '复制成功',
  106. type: 'success',
  107. })
  108. }
  109. });
  110. },
  111. // 查看合同
  112. checkContract(item) {
  113. uni.downloadFile({
  114. url: item.url,
  115. success: (res) => {
  116. uni.openDocument({
  117. filePath: res.tempFilePath,
  118. });
  119. }
  120. })
  121. },
  122. },
  123. }
  124. </script>
  125. <style>
  126. page {
  127. width: 100%;
  128. height: 100%;
  129. background-color: #f7f7f7;
  130. }
  131. </style>
  132. <style lang="scss" scoped>
  133. @import "@/static/css/themes.scss";
  134. .content {
  135. width: 100%;
  136. float: left;
  137. .scroll-box {
  138. width: 100%;
  139. height: 100vh;
  140. padding-bottom: 10px;
  141. box-sizing: border-box;
  142. .class-card {
  143. .class-content {
  144. padding: 5px 15px;
  145. }
  146. .class-name {
  147. height: 20px;
  148. display: inline-block;
  149. font-weight: bold;
  150. font-size: 14px;
  151. line-height: 20px;
  152. }
  153. .class-info-text {
  154. color: #999999;
  155. margin-bottom: 5px;
  156. /deep/.u-icon {
  157. margin-right: 5px;
  158. font-size: 14px;
  159. color: #000000;
  160. }
  161. }
  162. }
  163. }
  164. }
  165. </style>