index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <div class="capital-info">
  3. <!-- 资金信息 -->
  4. <a-select class="capitalSelect" style="width: 180px" @change="accountChange" v-model:value="selectedAccountId">
  5. <a-select-option v-for="item in getAllTaAccount()" :value="item.accountid" :key="item.accountid">{{item.accountid}}</a-select-option>
  6. </a-select>
  7. <div class="numBlocks">
  8. <div class="capitalItem">
  9. <div class="firstLine">
  10. <div>余额</div>
  11. <div>
  12. <i class="iconfont icon-zhengyan" @click="showAction"></i>
  13. </div>
  14. </div>
  15. <div class="numBar">{{showValue(data.currentbalance)}}</div>
  16. </div>
  17. <!-- <div class="capitalItem">
  18. <div class="firstLine">
  19. <div>占用</div>
  20. </div>
  21. <div class="numBar green">128,000.00</div>
  22. </div> -->
  23. <div class="capitalItem">
  24. <div class="firstLine">
  25. <div>冻结</div>
  26. </div>
  27. <div class="numBar red">{{showValue(data.freeze)}}</div>
  28. </div>
  29. <div class="capitalItem">
  30. <div class="firstLine">
  31. <div>可用</div>
  32. </div>
  33. <div class="numBar blue">{{showValue(data.canUse)}}</div>
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. <script lang="ts">
  39. import { defineComponent, ref, reactive } from 'vue';
  40. import { getAllTaAccount, getCanUseMoney, getFreeze, getSelectedAccount, setSelectedAccount } from '@/services/bus/account';
  41. import { AccountListItem } from '@/services/dataCenter/interafce/account';
  42. import Bus from '@/utils/eventBus/index';
  43. import { getTaAccount } from '@/services/go/TaAccount';
  44. export default defineComponent({
  45. name: 'capital-info',
  46. setup(props, context) {
  47. const selectedAccount = getSelectedAccount();
  48. const selectedAccountId = ref<number>(selectedAccount.accountid);
  49. const data = reactive(getMoney(selectedAccount));
  50. const show = ref<boolean>(true);
  51. function showAction() {
  52. show.value = !show.value;
  53. }
  54. function showValue(value: number) {
  55. return show.value ? value : '******';
  56. }
  57. function getMoney(value: AccountListItem) {
  58. const { currentbalance } = value;
  59. return { currentbalance, freeze: getFreeze(value, true), canUse: getCanUseMoney(value) };
  60. }
  61. function accountChange(id: number) {
  62. const item = getAllTaAccount().find((e) => e.accountid === id) as AccountListItem;
  63. Object.assign(data, getMoney(item));
  64. setSelectedAccount(item);
  65. // 通知资金账户变化
  66. Bus.$emit('taAccountChangedNtf');
  67. }
  68. // 资金变化,重新加载数据
  69. Bus.$on('moneyChangedNtf_UI', () => {
  70. getTaAccount().then(() => {
  71. accountChange(selectedAccountId.value);
  72. });
  73. });
  74. return {
  75. getAllTaAccount,
  76. selectedAccountId,
  77. accountChange,
  78. data,
  79. show,
  80. showValue,
  81. showAction,
  82. };
  83. },
  84. });
  85. </script>
  86. <style lang="less">
  87. .capital-info {
  88. width: 100%;
  89. height: 100%;
  90. background: @m-grey6;
  91. .ant-select.capitalSelect {
  92. .ant-select-selector {
  93. width: 180px;
  94. height: 40px;
  95. line-height: 40px;
  96. background: @m-grey6;
  97. border: 1px solid @m-blue0;
  98. .ant-select-selection-item {
  99. font-size: 14px;
  100. color: @m-white0;
  101. line-height: 40px;
  102. }
  103. }
  104. }
  105. .numBlocks {
  106. padding: 10px 12px 18px 12px;
  107. }
  108. .capitalItem {
  109. width: 100%;
  110. padding-top: 10px;
  111. font-size: 14px;
  112. color: @m-grey1;
  113. .firstLine {
  114. width: 100%;
  115. .inlineflex;
  116. justify-content: space-between;
  117. height: 18px;
  118. line-height: 18px;
  119. .iconfont {
  120. font-size: 18px;
  121. color: @m-black3;
  122. }
  123. }
  124. .numBar {
  125. width: 100%;
  126. margin-top: 12px;
  127. height: 16px;
  128. line-height: 16px;
  129. font-size: 16px;
  130. text-align: left;
  131. color: @m-white0;
  132. margin-bottom: 8px;
  133. }
  134. .green {
  135. color: @m-green0;
  136. }
  137. .red {
  138. color: @m-red1;
  139. }
  140. .blue {
  141. color: @m-blue0;
  142. }
  143. }
  144. .capitalCollapse {
  145. height: 100%;
  146. background: transparent;
  147. .ant-collapse-item {
  148. height: 100%;
  149. border: 0;
  150. .ant-collapse-header {
  151. width: 100%;
  152. padding: 0 25px 0 12px;
  153. height: 40px;
  154. line-height: 40px;
  155. border: 1px solid @m-blue0;
  156. border-left: 0;
  157. font-size: 14px;
  158. font-family: Adobe Heiti Std;
  159. color: @m-white0;
  160. .ellipse;
  161. .ant-collapse-arrow {
  162. right: 10px;
  163. }
  164. }
  165. .ant-collapse-content {
  166. height: calc(100% - 60px);
  167. overflow: auto;
  168. .ant-collapse-content-box {
  169. padding: 10px 12px;
  170. .flex();
  171. flex-direction: column;
  172. }
  173. }
  174. }
  175. }
  176. }
  177. </style>;