withdraw-detail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="withdraw-detail">
  3. <!-- 列表区域 -->
  4. <page-scroll @updateList="handleUpdateList" ref="pageRef" slotEmpty url="/token/user/withdrawList">
  5. <view class="detail-list">
  6. <view class="detail-item" v-for="(item, index) in detailList" :key="index" @click="goToDetail(item)">
  7. <view class="item-left">
  8. <text class="title">{{ item.title }}</text>
  9. <text class="time">{{ item.createTime }}</text>
  10. </view>
  11. <view class="item-right">
  12. <text class="amount">-{{ item.changeMoney }}</text>
  13. <text class="status">{{ item.desc }}</text>
  14. </view>
  15. </view>
  16. </view>
  17. </page-scroll>
  18. </view>
  19. </template>
  20. <script>
  21. import PageScroll from '@/components/pageScroll/index.vue'
  22. export default {
  23. components: {
  24. PageScroll
  25. },
  26. data() {
  27. return {
  28. detailList: []
  29. }
  30. },
  31. // #ifdef MP-ALIPAY
  32. onPullDownRefresh() {
  33. this.$refs.pageRef?.loadData(true)
  34. },
  35. // #endif
  36. onLoad(){
  37. this.$refs.pageRef?.loadData(true)
  38. },
  39. methods: {
  40. handleUpdateList(data) {
  41. this.detailList = data
  42. },
  43. goToDetail(item) {
  44. if (item.desc == '待确认收款') {
  45. uni.$u.http.post('/token/user/withdrawConfirm', {
  46. orderNo: item.orderNo
  47. }).then(res => {
  48. if (res.code === 200) {
  49. this.handleConfirmReceipt(res.data)
  50. }
  51. }).catch(err => {
  52. uni.showToast({
  53. title: err.message || '确认失败',
  54. icon: 'none'
  55. });
  56. });
  57. }
  58. },
  59. //执行微信确认收款操作
  60. handleConfirmReceipt(data) {
  61. if (wx.canIUse('requestMerchantTransfer')) {
  62. wx.requestMerchantTransfer({
  63. mchId: data.mchId,
  64. appId: data.appId,
  65. package: data.packageStr,
  66. success: (res) => {
  67. // res.err_msg将在页面展示成功后返回应用时返回ok,并不代表付款成功
  68. uni.showToast({
  69. title: '确认收款成功',
  70. icon: 'none'
  71. })
  72. // 刷新列表
  73. this.$refs.pageRef.loadData(true);
  74. },
  75. fail: (res) => {
  76. console.log('fail:', res);
  77. },
  78. });
  79. } else {
  80. wx.showModal({
  81. content: '你的微信版本过低,请更新至最新版本。',
  82. showCancel: false,
  83. });
  84. }
  85. },
  86. }
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .withdraw-detail {
  91. min-height: 100vh;
  92. background: #F5F5F5;
  93. padding: 20rpx;
  94. .detail-list {
  95. max-height: 100vh;
  96. overflow-y: auto;
  97. .detail-item {
  98. background: #FFFFFF;
  99. border-radius: 12rpx;
  100. padding: 30rpx;
  101. margin-bottom: 20rpx;
  102. display: flex;
  103. justify-content: space-between;
  104. align-items: center;
  105. .item-left {
  106. .title {
  107. font-size: 28rpx;
  108. color: #333;
  109. display: block;
  110. margin-bottom: 10rpx;
  111. }
  112. .time {
  113. font-size: 24rpx;
  114. color: #999;
  115. }
  116. }
  117. .item-right {
  118. text-align: right;
  119. .amount {
  120. font-size: 32rpx;
  121. color: #38C148;
  122. font-weight: 500;
  123. display: block;
  124. margin-bottom: 10rpx;
  125. }
  126. .status {
  127. font-size: 24rpx;
  128. color: #999;
  129. }
  130. }
  131. }
  132. }
  133. .load-more {
  134. text-align: center;
  135. color: #999;
  136. font-size: 24rpx;
  137. padding: 30rpx 0;
  138. &::before,
  139. &::after {
  140. content: '';
  141. display: inline-block;
  142. width: 100rpx;
  143. height: 1px;
  144. background: #EEEEEE;
  145. vertical-align: middle;
  146. margin: 0 20rpx;
  147. }
  148. }
  149. }
  150. </style>