detail.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <view class="container">
  3. <!-- 金额显示 -->
  4. <view class="amount-section">
  5. <text class="amount">{{ balanceDetail.prefix == 1 ? "+" : "-" }}{{ balanceDetail.amount }}</text>
  6. <text class="description">{{ balanceDetail.description }}</text>
  7. </view>
  8. <!-- 交易信息 -->
  9. <view class="details-section">
  10. <view class="detail-item">
  11. <text class="label">交易类型</text>
  12. <text class="value">{{ balanceDetail.prefix == 1 ? "收入" : "支出" }}</text>
  13. </view>
  14. <view class="detail-item">
  15. <text class="label">交易时间</text>
  16. <text class="value">{{ common.timestampToString(balanceDetail.insert_time) }}</text>
  17. </view>
  18. <view class="detail-item">
  19. <text class="label">记录编码</text>
  20. <text class="value">{{ balanceDetail.id_code }}</text>
  21. </view>
  22. <view class="detail-item">
  23. <text class="label">交易后余额</text>
  24. <text class="value">¥{{ balanceDetail.balance }}</text>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script setup>
  30. import { ref } from "vue";
  31. import { onLoad } from "@dcloudio/uni-app";
  32. import http from "@/utils/request";
  33. import common from "@/utils/common";
  34. const balanceDetail = ref({});
  35. onLoad((options) => {
  36. // 获取传递的参数
  37. _getBalanceDetail(options.record_id);
  38. });
  39. const _getBalanceDetail = async (record_id) => {
  40. const callback = await http.request("api/custom_amount/get_record_info", { record_id });
  41. if (callback.code == "success") {
  42. balanceDetail.value = callback.data;
  43. }
  44. };
  45. </script>
  46. <style scoped>
  47. /* 容器样式 */
  48. .container {
  49. padding: 16px;
  50. background-color: #ffffff;
  51. min-height: 100vh;
  52. font-size: 16px;
  53. }
  54. /* 金额显示样式 */
  55. .amount-section {
  56. margin: 20px 0;
  57. text-align: center;
  58. display: flex;
  59. flex-direction: column;
  60. }
  61. .amount {
  62. font-size: 32px;
  63. color: #ff5e00;
  64. font-weight: bold;
  65. }
  66. .description {
  67. font-size: 16px;
  68. color: #666;
  69. margin-top: 5px;
  70. }
  71. /* 交易详情样式 */
  72. .details-section {
  73. margin-top: 20px;
  74. }
  75. .detail-item {
  76. display: flex;
  77. justify-content: space-between;
  78. padding: 10px 0;
  79. }
  80. .label {
  81. color: #666;
  82. }
  83. .value {
  84. color: #333;
  85. }
  86. </style>