ProjectBudget.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="module-container">
  3. <!-- 预算详细列表 -->
  4. <view class="budget-list" v-if="fundsList?.length">
  5. <view class="list-title">科目预算明细</view>
  6. <view class="budget-card" v-for="(row, index) in fundsList" :key="index">
  7. <view class="card-indicator" :class="row.fundsClass === '10' ? 'direct' : 'indirect'"></view>
  8. <view class="card-main">
  9. <view class="card-header">
  10. <view class="subj-box">
  11. <text class="subj-name">{{ row.fundsSubjName }}</text>
  12. <text class="subj-type" :class="row.fundsClass === '10' ? 'direct' : 'indirect'">
  13. {{ row.fundsClass === '10' ? '直接费用' : '间接/管理' }}
  14. </text>
  15. </view>
  16. </view>
  17. <view class="funds-breakdown">
  18. <view class="breakdown-row">
  19. <view class="info-cell">
  20. <text class="cell-label">财政拨款</text>
  21. <text class="cell-value">{{ amountUnitFormatter(row.projectFundsAmount) }}</text>
  22. </view>
  23. <view class="info-cell">
  24. <text class="cell-label">匹配经费</text>
  25. <text class="cell-value">{{ amountUnitFormatter(row.otherFundsAmount) }}</text>
  26. </view>
  27. </view>
  28. <view class="breakdown-row">
  29. <view class="info-cell">
  30. <text class="cell-label">自筹经费</text>
  31. <text class="cell-value">{{ amountUnitFormatter(row.raiseFundsAmount) }}</text>
  32. </view>
  33. <view class="info-cell total">
  34. <text class="cell-label">预算总计</text>
  35. <text class="cell-amount">{{ amountUnitFormatter(row.totalFundsAmount) }}</text>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 空状态展示 -->
  43. <view v-else class="empty-wrap">
  44. <uv-empty mode="data" text="暂无项目预算数据"></uv-empty>
  45. </view>
  46. </view>
  47. </template>
  48. <script setup lang="ts">
  49. import { computed } from 'vue';
  50. import { formatWithComma } from '@/utils/format';
  51. const props = defineProps<{
  52. projectId: number;
  53. projectType: string;
  54. projectData: any;
  55. }>();
  56. const fundsList = computed(() => {
  57. return props.projectData?.fundsList || [];
  58. });
  59. const amountUnitFormatter = (num: any) => {
  60. return formatWithComma(num);
  61. };
  62. </script>
  63. <style lang="scss" scoped>
  64. .module-container {
  65. padding: 30rpx 20rpx;
  66. background-color: #f6f8fc;
  67. min-height: 100vh;
  68. /* 列表部分 */
  69. .budget-list {
  70. .list-title {
  71. font-size: 32rpx;
  72. font-weight: bold;
  73. color: #1e293b;
  74. margin-bottom: 24rpx;
  75. padding-left: 10rpx;
  76. display: flex;
  77. align-items: center;
  78. &::before {
  79. content: '';
  80. width: 8rpx;
  81. height: 32rpx;
  82. background-color: #4f46e5;
  83. border-radius: 4rpx;
  84. margin-right: 16rpx;
  85. }
  86. }
  87. .budget-card {
  88. background-color: #fff;
  89. border-radius: 20rpx;
  90. margin-bottom: 30rpx;
  91. overflow: hidden;
  92. display: flex;
  93. box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
  94. position: relative;
  95. .card-indicator {
  96. width: 10rpx;
  97. flex-shrink: 0;
  98. &.direct { background-color: #10b981; }
  99. &.indirect { background-color: #3b82f6; }
  100. }
  101. .card-main {
  102. flex: 1;
  103. padding: 30rpx;
  104. .card-header {
  105. margin-bottom: 24rpx;
  106. .subj-box {
  107. display: flex;
  108. justify-content: space-between;
  109. align-items: flex-start;
  110. .subj-name {
  111. font-size: 32rpx;
  112. color: #1e293b;
  113. font-weight: 700;
  114. flex: 1;
  115. line-height: 1.4;
  116. margin-right: 20rpx;
  117. }
  118. .subj-type {
  119. font-size: 20rpx;
  120. padding: 6rpx 16rpx;
  121. border-radius: 8rpx;
  122. white-space: nowrap;
  123. &.direct {
  124. background-color: #ecfdf5;
  125. color: #059669;
  126. }
  127. &.indirect {
  128. background-color: #eff6ff;
  129. color: #2563eb;
  130. }
  131. }
  132. }
  133. }
  134. .funds-breakdown {
  135. background-color: #f8fafc;
  136. border-radius: 12rpx;
  137. padding: 20rpx;
  138. .breakdown-row {
  139. display: flex;
  140. justify-content: space-between;
  141. margin-bottom: 20rpx;
  142. &:last-child { margin-bottom: 0; }
  143. .info-cell {
  144. flex: 1;
  145. display: flex;
  146. flex-direction: column;
  147. gap: 4rpx;
  148. .cell-label {
  149. font-size: 22rpx;
  150. color: #64748b;
  151. }
  152. .cell-value {
  153. font-size: 28rpx;
  154. color: #ef4444;
  155. font-weight: 500;
  156. }
  157. &.total {
  158. .cell-amount {
  159. font-size: 32rpx;
  160. color: #dc2626;
  161. font-weight: 800;
  162. }
  163. }
  164. }
  165. }
  166. }
  167. }
  168. }
  169. }
  170. .empty-wrap {
  171. padding: 120rpx 0;
  172. text-align: center;
  173. background-color: #fff;
  174. border-radius: 20rpx;
  175. }
  176. }
  177. </style>