orderList.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. if(res.data) {
  96. this.triggered = false
  97. this.tableList = this.tableList.concat(res.data.row)
  98. this.isOver = res.data.row.length != 10
  99. }
  100. }).catch(error => {
  101. this.triggered = false
  102. this.$refs.uTips.show({
  103. title: error.message,
  104. type: 'warning',
  105. })
  106. })
  107. },
  108. // 查看二维码
  109. checkQRCode(item) {
  110. this.qrCodeShow = true
  111. this.qrCodeUrl = item.qrCodeUrl
  112. },
  113. // 复制订单号
  114. copyOrderNumber(item) {
  115. uni.setClipboardData({
  116. data: item.orderNumber,
  117. success: () => {
  118. this.$refs.uTips.show({
  119. title: '复制成功',
  120. type: 'success',
  121. })
  122. }
  123. });
  124. },
  125. // 查看合同
  126. checkContract(item) {
  127. uni.downloadFile({
  128. url: item.url,
  129. success: (res) => {
  130. uni.openDocument({
  131. filePath: res.tempFilePath,
  132. });
  133. }
  134. })
  135. },
  136. },
  137. }
  138. </script>
  139. <style>
  140. page {
  141. width: 100%;
  142. height: 100%;
  143. background-color: #f7f7f7;
  144. }
  145. </style>
  146. <style lang="scss" scoped>
  147. @import "@/static/css/themes.scss";
  148. .content {
  149. width: 100%;
  150. float: left;
  151. .scroll-box {
  152. width: 100%;
  153. height: 100vh;
  154. padding-bottom: 10px;
  155. box-sizing: border-box;
  156. .class-card {
  157. .class-content {
  158. padding: 5px 15px;
  159. }
  160. .class-name {
  161. height: 20px;
  162. display: inline-block;
  163. font-weight: bold;
  164. font-size: 14px;
  165. line-height: 20px;
  166. }
  167. .class-info-text {
  168. color: #999999;
  169. margin-bottom: 5px;
  170. /deep/.u-icon {
  171. margin-right: 5px;
  172. font-size: 14px;
  173. color: #000000;
  174. }
  175. }
  176. }
  177. }
  178. }
  179. </style>