withdraw-detail.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. onLoad(){
  32. this.$refs.pageRef?.loadData(true)
  33. },
  34. methods: {
  35. handleUpdateList(data) {
  36. this.detailList = data
  37. },
  38. goToDetail(item) {
  39. if (item.desc == '待确认收款') {
  40. uni.$u.http.post('/token/user/withdrawConfirm', {
  41. orderNo: item.orderNo
  42. }).then(res => {
  43. if (res.code === 200) {
  44. this.handleConfirmReceipt(res.data)
  45. }
  46. }).catch(err => {
  47. uni.showToast({
  48. title: err.message || '确认失败',
  49. icon: 'none'
  50. });
  51. });
  52. }
  53. },
  54. //执行微信确认收款操作
  55. handleConfirmReceipt(data) {
  56. if (wx.canIUse('requestMerchantTransfer')) {
  57. wx.requestMerchantTransfer({
  58. mchId: data.mchId,
  59. appId: data.appId,
  60. package: data.packageStr,
  61. success: (res) => {
  62. // res.err_msg将在页面展示成功后返回应用时返回ok,并不代表付款成功
  63. uni.showToast({
  64. title: '确认收款成功',
  65. icon: 'none'
  66. })
  67. // 刷新列表
  68. this.$refs.pageRef.loadData(true);
  69. },
  70. fail: (res) => {
  71. console.log('fail:', res);
  72. },
  73. });
  74. } else {
  75. wx.showModal({
  76. content: '你的微信版本过低,请更新至最新版本。',
  77. showCancel: false,
  78. });
  79. }
  80. },
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .withdraw-detail {
  86. min-height: 100vh;
  87. background: #F5F5F5;
  88. padding: 20rpx;
  89. .detail-list {
  90. height: 100vh;
  91. .detail-item {
  92. background: #FFFFFF;
  93. border-radius: 12rpx;
  94. padding: 30rpx;
  95. margin-bottom: 20rpx;
  96. display: flex;
  97. justify-content: space-between;
  98. align-items: center;
  99. .item-left {
  100. .title {
  101. font-size: 28rpx;
  102. color: #333;
  103. display: block;
  104. margin-bottom: 10rpx;
  105. }
  106. .time {
  107. font-size: 24rpx;
  108. color: #999;
  109. }
  110. }
  111. .item-right {
  112. text-align: right;
  113. .amount {
  114. font-size: 32rpx;
  115. color: #38C148;
  116. font-weight: 500;
  117. display: block;
  118. margin-bottom: 10rpx;
  119. }
  120. .status {
  121. font-size: 24rpx;
  122. color: #999;
  123. }
  124. }
  125. }
  126. }
  127. .load-more {
  128. text-align: center;
  129. color: #999;
  130. font-size: 24rpx;
  131. padding: 30rpx 0;
  132. &::before,
  133. &::after {
  134. content: '';
  135. display: inline-block;
  136. width: 100rpx;
  137. height: 1px;
  138. background: #EEEEEE;
  139. vertical-align: middle;
  140. margin: 0 20rpx;
  141. }
  142. }
  143. }
  144. </style>