TemporaryFundForm.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="document-form">
  3. <uv-loading-icon v-if="loading" mode="circle" text="正在加载暂借详情..."></uv-loading-icon>
  4. <template v-else-if="form">
  5. <!-- 基本信息 -->
  6. <CommonSection title="基本信息" :isFirst="true">
  7. <CommonInfoRow label="单据编号" :value="form.applicationNo" />
  8. <CommonInfoRow label="申请人" :value="form.applicantName" />
  9. <CommonInfoRow label="申请时间" :value="formatDate(form.createdTime)" />
  10. <CommonInfoRow label="所属部门" :value="form.departmentName" />
  11. <CommonInfoRow label="项目名称" :value="form.projectName" />
  12. <CommonInfoRow label="项目类型" :value="getProjectTypeLabel(form.projectType)" />
  13. <CommonInfoRow label="经费卡号" :value="form.cardNo" />
  14. <CommonInfoRow label="费用科目" :value="form.expenseSubjectName" />
  15. <CommonInfoRow label="暂借金额" :value="form.totalAmount" isAmount />
  16. <CommonInfoRow label="审核状态" :value="getApproveStatusLabel(form.approveStatus)" />
  17. <CommonInfoRow label="报销状态" :value="getReimbursementStatusLabel(form.reimbursementStatus)" />
  18. <CommonInfoRow label="暂借事由" :value="form.description" isColumn />
  19. </CommonSection>
  20. <!-- 支付信息 -->
  21. <CommonSection title="支付信息" v-if="form.payment?.length">
  22. <view class="achievement-card" v-for="(pay, index) in form.payment" :key="index">
  23. <view class="a-row">
  24. <text class="al">支付方式:</text>
  25. <text class="av">{{ getPayTypeLabel(pay.payType) }}</text>
  26. </view>
  27. <view class="a-row">
  28. <text class="al">收款人/单位:</text>
  29. <text class="av">{{ pay.receiver || '-' }}</text>
  30. </view>
  31. <view class="a-row">
  32. <text class="al">收款类型:</text>
  33. <text class="av">{{ getReceiverTypeLabel(pay.receiverType) }}</text>
  34. </view>
  35. <view class="a-row">
  36. <text class="al">金额:</text>
  37. <text class="av red-color">¥{{ formatAmount(pay.amount) }}</text>
  38. </view>
  39. </view>
  40. </CommonSection>
  41. <!-- 附件 -->
  42. <AttachmentList :list="form.attachments" />
  43. </template>
  44. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  45. </view>
  46. </template>
  47. <script setup lang="ts">
  48. import { ref, onMounted, watch } from 'vue';
  49. import { useDocumentApi } from '@/api/document';
  50. import { formatDate } from '@/utils/date';
  51. import { formatAmount } from '@/utils/format';
  52. import to from 'await-to-js';
  53. import CommonSection from '@/components/ui/CommonSection.vue';
  54. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  55. import AttachmentList from './AttachmentList.vue';
  56. const props = defineProps<{
  57. code: string;
  58. }>();
  59. const documentApi = useDocumentApi();
  60. const form = ref<any>(null);
  61. const loading = ref(false);
  62. const getProjectTypeLabel = (type: string) => {
  63. const typeMap: Record<string, string> = {
  64. '10': '上级拨款',
  65. '20': '匹配经费',
  66. '30': '横向经费',
  67. '40': '平台经费',
  68. '50': '人才经费',
  69. '60': '学科经费'
  70. }
  71. return typeMap[type] || type || '-';
  72. }
  73. const getApproveStatusLabel = (status: string) => {
  74. const statusMap: Record<string, string> = {
  75. '10': '待提交',
  76. '20': '审核中',
  77. '30': '审核通过',
  78. '40': '审核驳回',
  79. '50': '已取消',
  80. '60': '已撤回'
  81. }
  82. return statusMap[status] || status || '-';
  83. }
  84. const getReimbursementStatusLabel = (status: string) => {
  85. const statusMap: Record<string, string> = {
  86. '10': '未转报销',
  87. '20': '报销审核中',
  88. '30': '已报销',
  89. '40': '报销审核驳回'
  90. }
  91. return statusMap[status] || status || '-';
  92. }
  93. const getPayTypeLabel = (type: string) => {
  94. const typeMap: Record<string, string> = {
  95. '10': '银行转账',
  96. '20': '现金支付',
  97. '30': '微信支付',
  98. '40': '支付宝'
  99. }
  100. return typeMap[type] || type || '-';
  101. }
  102. const getReceiverTypeLabel = (type: string) => {
  103. const typeMap: Record<string, string> = {
  104. '10': '个人',
  105. '20': '单位'
  106. }
  107. return typeMap[type] || type || '-';
  108. }
  109. const fetchData = async () => {
  110. if (!props.code) return;
  111. loading.value = true;
  112. const [err, res] = await to(documentApi.getTemporaryFundByCode(props.code));
  113. if (!err && res?.data) {
  114. form.value = res.data;
  115. }
  116. loading.value = false;
  117. };
  118. onMounted(() => {
  119. fetchData();
  120. });
  121. watch(() => props.code, () => {
  122. fetchData();
  123. });
  124. </script>
  125. <style lang="scss" scoped>
  126. @import "./common.scss";
  127. </style>