detail.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="container">
  3. <view class="detail-header">
  4. <view class="amount" :class="{'income': detail.amount > 0, 'expense': detail.amount < 0}">
  5. {{detail.amount > 0 ? '+' : ''}}{{detail.amount}}
  6. </view>
  7. <view class="type">{{getTypeText(detail.transactionType)}}</view>
  8. </view>
  9. <view class="detail-card">
  10. <view class="card-item">
  11. <view class="item-label">交易单号</view>
  12. <view class="item-value">{{detail.transactionNo}}</view>
  13. </view>
  14. <view class="card-item">
  15. <view class="item-label">交易时间</view>
  16. <view class="item-value">{{detail.createTime}}</view>
  17. </view>
  18. <view class="card-item" v-if="detail.orderNo">
  19. <view class="item-label">关联订单</view>
  20. <view class="item-value">{{detail.orderNo}}</view>
  21. </view>
  22. <view class="card-item">
  23. <view class="item-label">交易后余额</view>
  24. <view class="item-value">{{detail.balance}}</view>
  25. </view>
  26. <view class="card-item">
  27. <view class="item-label">交易来源</view>
  28. <view class="item-value">{{getSourceText(detail.transactionSource)}}</view>
  29. </view>
  30. <view class="card-item">
  31. <view class="item-label">交易状态</view>
  32. <view class="item-value">{{getStatusText(detail.status)}}</view>
  33. </view>
  34. <view class="card-item" v-if="detail.remark">
  35. <view class="item-label">备注</view>
  36. <view class="item-value">{{detail.remark}}</view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. detail: {}
  46. };
  47. },
  48. onLoad(options) {
  49. this.getDetail(options.id);
  50. },
  51. methods: {
  52. getDetail(id) {
  53. uni.showLoading({ title: '加载中...' });
  54. this.request("get", `rider/wallet/transaction/${id}`, this.$store.state.token)
  55. .then(res => {
  56. if (res.code === 200) {
  57. this.detail = res.data;
  58. }
  59. })
  60. .finally(() => {
  61. uni.hideLoading();
  62. });
  63. },
  64. getTypeText(type) {
  65. const types = {
  66. 1: '收入',
  67. 2: '支出',
  68. 3: '提现',
  69. 4: '退款'
  70. };
  71. return types[type] || '未知';
  72. },
  73. getSourceText(source) {
  74. const sources = {
  75. 1: '配送费',
  76. 2: '小费',
  77. 3: '系统调整',
  78. 4: '其他'
  79. };
  80. return sources[source] || '未知';
  81. },
  82. getStatusText(status) {
  83. const statusMap = {
  84. 1: '成功',
  85. 2: '处理中',
  86. 3: '失败'
  87. };
  88. return statusMap[status] || '未知';
  89. }
  90. }
  91. };
  92. </script>
  93. <style lang="scss" scoped>
  94. .container {
  95. padding: 20rpx;
  96. }
  97. .detail-header {
  98. display: flex;
  99. flex-direction: column;
  100. align-items: center;
  101. padding: 40rpx 0;
  102. background-color: $uni-bg-color;
  103. border-radius: 14rpx;
  104. margin-bottom: 20rpx;
  105. .amount {
  106. font-size: 48rpx;
  107. font-weight: bold;
  108. margin-bottom: 20rpx;
  109. &.income {
  110. color: $uni-color-success;
  111. }
  112. &.expense {
  113. color: $uni-color-error;
  114. }
  115. }
  116. .type {
  117. font-size: $uni-font-size-base;
  118. color: $font-color-light;
  119. }
  120. }
  121. .detail-card {
  122. background-color: $uni-bg-color;
  123. border-radius: 14rpx;
  124. padding: 0 30rpx;
  125. .card-item {
  126. display: flex;
  127. justify-content: space-between;
  128. padding: 25rpx 0;
  129. border-bottom: 1rpx solid $uni-border-color;
  130. &:last-child {
  131. border-bottom: none;
  132. }
  133. .item-label {
  134. color: $font-color-light;
  135. font-size: $uni-font-size-base;
  136. }
  137. .item-value {
  138. color: $font-color-black;
  139. font-size: $uni-font-size-base;
  140. }
  141. }
  142. }
  143. </style>