orderList.vue 6.8 KB

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