TemporaryFundForm.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. <view class="common-section-card">
  7. <view class="section-title">基本信息</view>
  8. <view class="info-row"><text class="label">单据编号</text><text class="value">{{ form.applicationNo || '-' }}</text></view>
  9. <view class="info-row"><text class="label">申请人</text><text class="value">{{ form.applicantName || '-' }}</text></view>
  10. <view class="info-row"><text class="label">申请时间</text><text class="value">{{ form.createdTime || '-' }}</text></view>
  11. <view class="info-row"><text class="label">所属部门</text><text class="value">{{ form.departmentName || '-' }}</text></view>
  12. <view class="info-row"><text class="label">项目名称</text><text class="value">{{ form.projectName || '-' }}</text></view>
  13. <view class="info-row">
  14. <text class="label">项目类型</text>
  15. <text class="value">{{ getProjectTypeLabel(form.projectType) }}</text>
  16. </view>
  17. <view class="info-row"><text class="label">经费卡号</text><text class="value">{{ form.cardNo || '-' }}</text></view>
  18. <view class="info-row"><text class="label">费用科目</text><text class="value">{{ form.expenseSubjectName || '-' }}</text></view>
  19. <view class="info-row">
  20. <text class="label">暂借金额(元)</text>
  21. <text class="value red-color">¥{{ formatMoney(form.totalAmount) }}</text>
  22. </view>
  23. <view class="info-row">
  24. <text class="label">审核状态</text>
  25. <text class="value">{{ getApproveStatusLabel(form.approveStatus) }}</text>
  26. </view>
  27. <view class="info-row">
  28. <text class="label">报销状态</text>
  29. <text class="value">{{ getReimbursementStatusLabel(form.reimbursementStatus) }}</text>
  30. </view>
  31. <view class="info-row column">
  32. <text class="label">暂借事由</text>
  33. <text class="value remark">{{ form.description || '-' }}</text>
  34. </view>
  35. </view>
  36. <!-- 支付信息 -->
  37. <view class="common-section-card mt20" v-if="form.payment?.length">
  38. <view class="section-title">支付信息</view>
  39. <view class="achievement-card" v-for="(pay, index) in form.payment" :key="index">
  40. <view class="a-row">
  41. <text class="al">支付方式:</text>
  42. <text class="av">{{ getPayTypeLabel(pay.payType) }}</text>
  43. </view>
  44. <view class="a-row">
  45. <text class="al">收款人/单位:</text>
  46. <text class="av">{{ pay.receiver || '-' }}</text>
  47. </view>
  48. <view class="a-row">
  49. <text class="al">个人/单位类型:</text>
  50. <text class="av">{{ getReceiverTypeLabel(pay.receiverType) }}</text>
  51. </view>
  52. <view class="a-row">
  53. <text class="al">金额(元):</text>
  54. <text class="av red-color">¥{{ formatMoney(pay.amount) }}</text>
  55. </view>
  56. </view>
  57. </view>
  58. <!-- 附件 -->
  59. <AttachmentList :list="form.attachments" />
  60. </template>
  61. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  62. </view>
  63. </template>
  64. <script setup lang="ts">
  65. import { ref, onMounted, watch } from 'vue';
  66. import { useDocumentApi } from '@/api/document';
  67. import to from 'await-to-js';
  68. import AttachmentList from './AttachmentList.vue';
  69. const props = defineProps<{
  70. code: string;
  71. }>();
  72. const documentApi = useDocumentApi();
  73. const form = ref<any>(null);
  74. const loading = ref(false);
  75. const getProjectTypeLabel = (type: string) => {
  76. const typeMap: Record<string, string> = {
  77. '10': '上级拨款',
  78. '20': '匹配经费',
  79. '30': '横向经费',
  80. '40': '平台经费',
  81. '50': '人才经费',
  82. '60': '学科经费'
  83. }
  84. return typeMap[type] || type || '-';
  85. }
  86. const getApproveStatusLabel = (status: string) => {
  87. const statusMap: Record<string, string> = {
  88. '10': '待提交',
  89. '20': '审核中',
  90. '30': '审核通过',
  91. '40': '审核驳回',
  92. '50': '已取消',
  93. '60': '已撤回'
  94. }
  95. return statusMap[status] || status || '-';
  96. }
  97. const getReimbursementStatusLabel = (status: string) => {
  98. const statusMap: Record<string, string> = {
  99. '10': '未转报销',
  100. '20': '报销审核中',
  101. '30': '已报销',
  102. '40': '报销审核驳回'
  103. }
  104. return statusMap[status] || status || '-';
  105. }
  106. const getPayTypeLabel = (type: string) => {
  107. const typeMap: Record<string, string> = {
  108. '10': '银行转账',
  109. '20': '现金支付',
  110. '30': '微信支付',
  111. '40': '支付宝'
  112. }
  113. return typeMap[type] || type || '-';
  114. }
  115. const getReceiverTypeLabel = (type: string) => {
  116. const typeMap: Record<string, string> = {
  117. '10': '个人',
  118. '20': '单位'
  119. }
  120. return typeMap[type] || type || '-';
  121. }
  122. const formatMoney = (val: any) => {
  123. if (val === undefined || val === null || val === '') return '0.00';
  124. return Number(val).toLocaleString('zh-CN', { minimumFractionDigits: 2 });
  125. };
  126. const formatFileSize = (size: number) => {
  127. if (!size) return '0B';
  128. const units = ['B', 'KB', 'MB', 'GB'];
  129. let index = 0;
  130. while (size >= 1024 && index < units.length - 1) {
  131. size /= 1024;
  132. index++;
  133. }
  134. return `${size.toFixed(2)}${units[index]}`;
  135. };
  136. const fetchData = async () => {
  137. if (!props.code) return;
  138. loading.value = true;
  139. const [err, res] = await to(documentApi.getTemporaryFundByCode(props.code));
  140. if (!err && res?.data) {
  141. form.value = res.data;
  142. }
  143. loading.value = false;
  144. };
  145. onMounted(() => {
  146. fetchData();
  147. });
  148. watch(() => props.code, () => {
  149. fetchData();
  150. });
  151. </script>
  152. <style lang="scss" scoped>
  153. @import "./common.scss";
  154. </style>