orderList.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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-popup v-model="contractShow" mode="center" border-radius="30" width="600rpx" height="500px">
  39. <view class="common-title">合同列表</view>
  40. <view class="menber-box" style="overflow-y: auto;height:390px;">
  41. <template v-for="(item, index) in contractUrls">
  42. <view class="card-item" :key="index" @click="handleContractShowClick(item)">
  43. {{ item.name }}
  44. </view>
  45. </template>
  46. </view>
  47. <view class="button-box">
  48. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="contractShow = false">确定</u-button>
  49. </view>
  50. </u-popup>
  51. <u-top-tips ref="uTips"></u-top-tips>
  52. </view>
  53. </template>
  54. <script>
  55. import {
  56. mapGetters
  57. } from 'vuex'
  58. const NET = require('@/utils/request')
  59. const API = require('@/config/api')
  60. export default {
  61. computed: {
  62. ...mapGetters([
  63. 'customStyle',
  64. 'handleCustomStyle',
  65. 'handleDefaultCustomStyle',
  66. ])
  67. },
  68. data() {
  69. return {
  70. qrCodeShow: false,
  71. qrCodeUrl: '',
  72. contractShow: false,
  73. contractUrls: [],
  74. triggered: false,
  75. isOver: false,
  76. pageIndex: 1,
  77. tableList: [],
  78. }
  79. },
  80. onLoad() {
  81. this.getTableList()
  82. },
  83. onReady() {},
  84. methods: {
  85. // 下拉刷新
  86. onRefresh() {
  87. this.triggered = true
  88. this.isOver = false
  89. this.pageIndex = 1
  90. this.tableList = []
  91. this.getTableList()
  92. },
  93. // 重置下拉刷新状态
  94. onRestore() {
  95. this.triggered = 'restore'
  96. this.triggered = false
  97. },
  98. // 懒加载
  99. handleLoadMore() {
  100. if (!this.isOver) {
  101. this.pageIndex++
  102. this.getTableList()
  103. }
  104. },
  105. // 获取列表数据
  106. getTableList() {
  107. NET.request(API.getOrderList, {
  108. page: this.pageIndex,
  109. size: 10,
  110. }, 'POST').then(res => {
  111. if(res.data) {
  112. this.triggered = false
  113. this.tableList = this.tableList.concat(res.data.row)
  114. this.isOver = res.data.row.length != 10
  115. }
  116. }).catch(error => {
  117. this.triggered = false
  118. this.$refs.uTips.show({
  119. title: error.message,
  120. type: 'warning',
  121. })
  122. })
  123. },
  124. // 查看二维码
  125. checkQRCode(item) {
  126. this.qrCodeShow = true
  127. this.qrCodeUrl = item.qrCodeUrl
  128. },
  129. // 复制订单号
  130. copyOrderNumber(item) {
  131. uni.setClipboardData({
  132. data: item.orderNumber,
  133. success: () => {
  134. this.$refs.uTips.show({
  135. title: '复制成功',
  136. type: 'success',
  137. })
  138. }
  139. });
  140. },
  141. // 查看合同
  142. handleContractShowClick(item) {
  143. uni.downloadFile({
  144. url: item.url,
  145. success: (res) => {
  146. console.log(res);
  147. uni.openDocument({
  148. filePath: res.tempFilePath,
  149. });
  150. }
  151. })
  152. },
  153. // 显示合同列表
  154. checkContract(item) {
  155. this.contractUrls = item.url
  156. this.contractShow = true
  157. },
  158. },
  159. }
  160. </script>
  161. <style>
  162. page {
  163. width: 100%;
  164. height: 100%;
  165. background-color: #f7f7f7;
  166. }
  167. </style>
  168. <style lang="scss" scoped>
  169. @import "@/static/css/themes.scss";
  170. .content {
  171. width: 100%;
  172. float: left;
  173. .scroll-box {
  174. width: 100%;
  175. height: 100vh;
  176. padding-bottom: 10px;
  177. box-sizing: border-box;
  178. .class-card {
  179. .class-content {
  180. padding: 5px 15px;
  181. }
  182. .class-name {
  183. height: 20px;
  184. display: inline-block;
  185. font-weight: bold;
  186. font-size: 14px;
  187. line-height: 20px;
  188. }
  189. .class-info-text {
  190. color: #999999;
  191. margin-bottom: 5px;
  192. /deep/.u-icon {
  193. margin-right: 5px;
  194. font-size: 14px;
  195. color: #000000;
  196. }
  197. }
  198. }
  199. }
  200. }
  201. .menber-box {
  202. width: 100%;
  203. padding: 10px 15px;
  204. .menber-col {
  205. width: 100%;
  206. padding: 15px;
  207. display: inline-block;
  208. background-color: #FFFFFF;
  209. border-radius: 15px;
  210. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  211. position: relative;
  212. overflow: hidden;
  213. box-sizing: border-box;
  214. .menber-label {
  215. width: 100%;
  216. font-size: 14px;
  217. // line-height: 20px;
  218. }
  219. .menber-num {
  220. width: 100%;
  221. font-size: 26px;
  222. line-height: 28px;
  223. color: $mainColor;
  224. }
  225. }
  226. }
  227. .common-title {
  228. width:100%;
  229. text-align: center;
  230. font-size: 20px;
  231. padding: 10px 0;
  232. }
  233. .button-box {
  234. // width: 100%;
  235. padding: 10px 15px;
  236. box-sizing: border-box;
  237. }
  238. .card-item {
  239. width: 100%;
  240. padding:8px;
  241. border-radius: 10px;
  242. background-color: #ff6e3e;
  243. margin-bottom: 8px;
  244. }
  245. </style>