You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
3.6 KiB

3 weeks ago
  1. <template>
  2. <div class="payment-table-container">
  3. <h3 class="table-title">支付记录详情</h3>
  4. <div class="filter-container">
  5. <el-date-picker
  6. v-model="selectedDate"
  7. type="date"
  8. placeholder="选择日期"
  9. value-format="YYYYMMDD"
  10. format="YYYY-MM-DD"
  11. />
  12. <el-button type="primary" @click="fetchPaymentList">查询</el-button>
  13. </div>
  14. <el-table :data="paymentList" style="width: 100%" v-loading="loading">
  15. <el-table-column prop="type" label="交易类型" align="center" width="120" />
  16. <el-table-column prop="provider" label="支付渠道" align="center" width="120" />
  17. <el-table-column prop="request_reference" label="请求编号" align="center" width="120" show-overflow-tooltip/>
  18. <el-table-column prop="merchant_reference" label="商户订单号" align="center" width="120" show-overflow-tooltip/>
  19. <el-table-column prop="provider_reference" label="渠道参考号" align="center" width="120" show-overflow-tooltip />
  20. <el-table-column prop="currency" label="货币类型" align="center" width="100" />
  21. <el-table-column
  22. prop="order_amount"
  23. label="订单金额"
  24. align="center"
  25. width="120"
  26. />
  27. <el-table-column
  28. prop="charge"
  29. label="手续费"
  30. align="center"
  31. width="120"
  32. />
  33. <el-table-column
  34. prop="net_amount"
  35. label="净收入"
  36. align="center"
  37. width="120"
  38. />
  39. <el-table-column prop="status" label="交易状态" align="center" width="120">
  40. <template #default="scope">
  41. <el-tag :type="scope.row.status === 'SUCCESS' ? 'success' : 'danger'" size="small">
  42. {{ scope.row.status }}
  43. </el-tag>
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="created_time" label="创建时间" align="center" width="180" />
  47. <el-table-column prop="completed_time" label="完成时间" align="center" width="180" />
  48. </el-table>
  49. </div>
  50. </template>
  51. <script setup>
  52. import { ref, onMounted } from 'vue'
  53. import { ElMessage } from 'element-plus'
  54. import API from '@/util/http'
  55. import 'element-plus/dist/index.css'
  56. const paymentList = ref([])
  57. const selectedDate = ref('')
  58. const loading = ref(false)
  59. // 金额格式化
  60. const formatAmount = (row, column) => {
  61. const value = row[column.prop]
  62. return `${row.currency} ${Number(value).toFixed(2)}`
  63. }
  64. // 获取支付数据
  65. const fetchPaymentList = async () => {
  66. if (!selectedDate.value) {
  67. ElMessage.warning('请先选择日期')
  68. return
  69. }
  70. loading.value = true
  71. try {
  72. const res = await API({
  73. url: '/admin/cash/bank/payment',
  74. data: { time: selectedDate.value },
  75. })
  76. if (res.code === 200) {
  77. paymentList.value = res.data.paymentDTOList || []
  78. } else {
  79. ElMessage.error(res.msg || '加载失败')
  80. }
  81. } catch (err) {
  82. console.error(err)
  83. ElMessage.error('请求出错,请稍后再试')
  84. } finally {
  85. loading.value = false
  86. }
  87. }
  88. // 默认加载今天数据
  89. onMounted(() => {
  90. const today = new Date()
  91. const y = today.getFullYear()
  92. const m = String(today.getMonth() + 1).padStart(2, '0')
  93. const d = String(today.getDate()).padStart(2, '0')
  94. selectedDate.value = `${y}${m}${d}`
  95. fetchPaymentList()
  96. })
  97. </script>
  98. <style scoped>
  99. .payment-table-container {
  100. padding: 20px;
  101. max-width: 1400px;
  102. margin: 0 auto;
  103. }
  104. .table-title {
  105. margin-bottom: 16px;
  106. color: #1989fa;
  107. font-weight: 500;
  108. }
  109. .filter-container {
  110. margin-bottom: 16px;
  111. display: flex;
  112. align-items: center;
  113. gap: 10px;
  114. }
  115. </style>