orderList.vue 4.6 KB

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