huangbin 4 years ago
parent
commit
3adb8c810c
1 changed files with 15 additions and 5 deletions
  1. 15 5
      src/common/components/capitalInfo/index.vue

+ 15 - 5
src/common/components/capitalInfo/index.vue

@@ -14,10 +14,11 @@
         <div class="firstLine">
           <div>余额</div>
           <div>
-            <i class="iconfont icon-zhengyan"></i>
+            <i class="iconfont icon-zhengyan"
+               @click="showAction"></i>
           </div>
         </div>
-        <div class="numBar">{{data.currentbalance}}</div>
+        <div class="numBar">{{showValue(data.currentbalance)}}</div>
       </div>
       <!-- <div class="capitalItem">
         <div class="firstLine">
@@ -29,13 +30,13 @@
         <div class="firstLine">
           <div>冻结</div>
         </div>
-        <div class="numBar red">{{data.freeze}}</div>
+        <div class="numBar red">{{showValue(data.freeze)}}</div>
       </div>
       <div class="capitalItem">
         <div class="firstLine">
           <div>可用</div>
         </div>
-        <div class="numBar blue">{{data.canUse}}</div>
+        <div class="numBar blue">{{showValue(data.canUse)}}</div>
       </div>
     </div>
   </div>
@@ -54,7 +55,13 @@ export default defineComponent({
         const selectedAccount = getSelectedAccount();
         const selectedAccountId = ref<number>(selectedAccount.accountid);
         const data = reactive(getMoney(selectedAccount));
-
+        const show = ref<boolean>(true);
+        function showAction() {
+            show.value = !show.value;
+        }
+        function showValue(value: number) {
+            return show.value ? value : '******';
+        }
         function getMoney(value: AccountListItem) {
             const { currentbalance } = value;
             return { currentbalance, freeze: getFreeze(value, true), canUse: getCanUseMoney(value) };
@@ -75,6 +82,9 @@ export default defineComponent({
             selectedAccountId,
             accountChange,
             data,
+            show,
+            showValue,
+            showAction,
         };
     },
 });