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.

207 lines
4.0 KiB

  1. <template>
  2. <div class="cash-management">
  3. <div class="cash-title">
  4. <div class="text1"> 现金管理
  5. <span class="text1-update-time">最后更新时间{{
  6. workDataUpdateTime && workDataUpdateTime !== '1970-01-01 08:00:00' ? workDataUpdateTime : '该地区暂无数据'
  7. }}</span>
  8. </div>
  9. </div>
  10. <div class="text2"><span class="text2-income">总营收{{ cashData.totalIncome }}</span></div>
  11. <div class="chart-container">
  12. <!-- 左侧数据列表 -->
  13. <div class="market-data">
  14. <div v-for="market in cashData.markets" :key="market.name" class="market-item">
  15. <span class="market-name">{{ market.name }}:</span>
  16. <span class="market-value">{{ market.value.toLocaleString() }}</span>
  17. </div>
  18. </div>
  19. <!-- 图表区域 -->
  20. <div ref="chartRef" class="chart"></div>
  21. </div>
  22. </div>
  23. </template>
  24. <script setup>
  25. import * as echarts from 'echarts'
  26. import {ref, onMounted} from 'vue'
  27. // 模拟数据
  28. const cashData = ref({
  29. updateTime: '2025-09-24 12:00:00',
  30. totalIncome: 1200000,
  31. markets: [
  32. {name: '北京', value: 450000},
  33. {name: '上海', value: 300000},
  34. {name: '广州', value: 200000},
  35. {name: '深圳', value: 150000},
  36. {name: '其他', value: 100000}
  37. ]
  38. })
  39. const chartRef = ref(null)
  40. let chartInstance = null
  41. const renderChart = () => {
  42. if (!chartInstance && chartRef.value) {
  43. chartInstance = echarts.init(chartRef.value)
  44. }
  45. const option = {
  46. tooltip: {trigger: 'item'},
  47. legend: {
  48. bottom: 5, // 增加底部距离的
  49. left: 'center'
  50. },
  51. series: [
  52. {
  53. type: 'pie',
  54. radius: ['40%', '70%'],
  55. data: cashData.value.markets,
  56. center: ['60%', '45%'] //图表靠右一点
  57. }
  58. ]
  59. }
  60. chartInstance.setOption(option)
  61. }
  62. onMounted(() => {
  63. renderChart()
  64. })
  65. </script>
  66. <style scoped>
  67. /* 背景卡片大小 */
  68. .cash-management {
  69. margin: 10px 5px;
  70. width: 100%;
  71. height: 50vh;
  72. flex-shrink: 0;
  73. border-radius: 8px;
  74. background: #E7F4FD;
  75. box-shadow: 0 2px 2px 0 #00000040;
  76. display: flex;
  77. flex-direction: column;
  78. align-items: center;
  79. }
  80. /*
  81. .cash-card {
  82. width: 100%;
  83. }
  84. .chart {
  85. width: 100%;
  86. height: 200px;
  87. } */
  88. .cash-title {
  89. width: 100%;
  90. height: 5vh;
  91. flex-shrink: 0;
  92. border-radius: 8px;
  93. background: linear-gradient(90deg, #E4F0FC 0%, #C6ADFF 50%, #E4F0FC 100%);
  94. box-shadow: 0 2px 2px 0 #00152940;
  95. display: flex;
  96. align-items: center;
  97. justify-content: center;
  98. }
  99. .text1 {
  100. color: #040a2d;
  101. font-family: "PingFang SC";
  102. font-size: 28px;
  103. font-style: normal;
  104. font-weight: 900;
  105. line-height: 31.79px;
  106. }
  107. .text1-update-time {
  108. width: 100%;
  109. height: 26px;
  110. flex-shrink: 0;
  111. color: #040a2d;
  112. font-family: "PingFang SC";
  113. font-size: 20px;
  114. font-style: normal;
  115. font-weight: 700;
  116. line-height: 31.79px;
  117. }
  118. /* 总收入的渐变框 */
  119. .text2 {
  120. margin: 13px;
  121. width: 95%;
  122. height: 48px;
  123. flex-shrink: 0;
  124. border-radius: 8px;
  125. background: linear-gradient(90deg, #E4F0FC 0%, #C1DCF8 50%, #E4F0FC 100%);
  126. box-shadow: 0 2px 2px 0 #00152940;
  127. display: flex;
  128. align-items: center;
  129. justify-content: center;
  130. }
  131. /* 总收入字体 */
  132. .text2-income {
  133. width: 215px;
  134. height: 26px;
  135. flex-shrink: 0;
  136. color: #040a2d;
  137. font-family: "PingFang SC";
  138. font-size: 20px;
  139. font-style: normal;
  140. font-weight: 900;
  141. line-height: 31.79px;
  142. }
  143. /* 图表容器 */
  144. .chart-container {
  145. display: flex;
  146. align-items: center;
  147. width: 100%;
  148. height: 100%;
  149. padding: 10px;
  150. }
  151. /* 左侧数据列表,使用您指定的样式 */
  152. .market-data {
  153. display: flex;
  154. width: 179px;
  155. flex-direction: column;
  156. align-items: flex-start;
  157. gap: 12px;
  158. padding: 10px;
  159. margin-left: 80px;
  160. }
  161. .market-item {
  162. display: flex;
  163. justify-content: space-between;
  164. width: 100%;
  165. font-family: "PingFang SC";
  166. font-size: 16px;
  167. color: #040a2d;
  168. }
  169. .market-name {
  170. font-weight: 700;
  171. }
  172. .market-value {
  173. font-weight: 500;
  174. }
  175. /* 图表样式 */
  176. .chart {
  177. flex: 1;
  178. height: 300px;
  179. margin-top: 10px;
  180. }
  181. </style>