li.shaoyi 3 vuotta sitten
vanhempi
commit
94c6a22b70

+ 1 - 3
src/business/account/index.ts

@@ -1,12 +1,11 @@
 import { shallowRef, reactive } from 'vue'
-import { useUserStore, useAccountStore, useLoginStore } from '@/stores'
+import { useUserStore, useLoginStore } from '@/stores'
 import { modifyPassword } from '@/services/api/account'
 import { queryBankAccountSign } from '@/services/api/bank'
 import cryptojs from 'crypto-js'
 
 export function useAccount() {
     const { getUserDataInfo } = useUserStore()
-    const { accountInfo } = useAccountStore()
     const loginInfo = getUserDataInfo('loginAccount')
     const userInfo = getUserDataInfo('userInfo')
     const bankInfo = shallowRef<Ermcp.BankAccountSignRsp>()
@@ -34,7 +33,6 @@ export function useAccount() {
         loading,
         loginInfo,
         userInfo,
-        accountInfo,
         bankInfo,
         getBankAccountSign,
     }

+ 3 - 4
src/packages/pc/views/customs/bonded/components/advance-payment/index.vue

@@ -10,7 +10,7 @@
             <el-descriptions-item label="其它费用">{{ details.otherfee }}</el-descriptions-item>
             <el-descriptions-item label="总共">{{ details.totalfee }}</el-descriptions-item>
             <el-descriptions-item label="预付款详情文件">请下载文件“付款通知书(预付款).pdf”</el-descriptions-item>
-            <el-descriptions-item label="账户可用余额">{{ accountInfo?.balance ?? 0 }}</el-descriptions-item>
+            <el-descriptions-item label="账户可用余额">{{ avaiableMoney }}</el-descriptions-item>
         </el-descriptions>
         <template #footer>
             <el-button @click="onCancel(false)" plain>取消</el-button>
@@ -35,14 +35,13 @@ const props = defineProps({
 
 const { details, getFworderoperate } = useBSFWOrderOperate(props.selectedRow)
 const { loading, formData, formSubmit } = useBSFWMemberOperate(props.selectedRow.orderid)
-const { accountInfo } = useAccountStore()
+const { avaiableMoney } = useAccountStore()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 
 const disabled = computed(() => {
-    const { balance = 0 } = accountInfo.value ?? {}
     const { totalfee = 0 } = details.value ?? {}
-    return totalfee > balance
+    return totalfee > avaiableMoney.value
 })
 
 const onCancel = (isRefresh = false) => {

+ 3 - 5
src/packages/pc/views/customs/bonded/components/payment/index.vue

@@ -12,8 +12,7 @@
             <el-descriptions-item label="预收款">{{ details.advanceamount }}</el-descriptions-item>
             <el-descriptions-item label="应收\退款">{{ arrearage }}</el-descriptions-item>
             <el-descriptions-item label="结算费用详情文件">请下载文件“付款通知书(结算费用).pdf”</el-descriptions-item>
-            <el-descriptions-item label="账户可用余额" v-if="arrearage >= 0">{{ accountInfo?.balance ?? 0
-            }}</el-descriptions-item>
+            <el-descriptions-item label="账户可用余额" v-if="arrearage >= 0">{{ avaiableMoney }}</el-descriptions-item>
         </el-descriptions>
         <template #footer>
             <el-button @click="onCancel(false)" plain>取消</el-button>
@@ -38,7 +37,7 @@ const props = defineProps({
 
 const { details, getFworderoperate } = useBSFWOrderOperate(props.selectedRow)
 const { loading, formData, formSubmit } = useBSFWMemberOperate(props.selectedRow.orderid)
-const { accountInfo } = useAccountStore()
+const { avaiableMoney } = useAccountStore()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 
@@ -49,8 +48,7 @@ const arrearage = computed(() => {
 })
 
 const disabled = computed(() => {
-    const { balance = 0 } = accountInfo.value ?? {}
-    return arrearage.value > balance
+    return arrearage.value > avaiableMoney.value
 })
 
 const onCancel = (isRefresh = false) => {

+ 3 - 4
src/packages/pc/views/customs/exit/components/advance-payment/index.vue

@@ -11,7 +11,7 @@
             <el-descriptions-item label="其它费用">{{ details.otherfee }}</el-descriptions-item>
             <el-descriptions-item label="总共">{{ details.totalfee }}</el-descriptions-item>
             <el-descriptions-item label="预付款详情文件">请下载文件“付款通知书(预付款).pdf”</el-descriptions-item>
-            <el-descriptions-item label="账户可用余额">{{ accountInfo?.balance ?? 0 }}</el-descriptions-item>
+            <el-descriptions-item label="账户可用余额">{{ avaiableMoney }}</el-descriptions-item>
         </el-descriptions>
         <template #footer>
             <el-button @click="onCancel(false)" plain>取消</el-button>
@@ -36,14 +36,13 @@ const props = defineProps({
 
 const { details, getGzcjjcorderoperate } = useCJJCOrderOperate(props.selectedRow)
 const { loading, formData, formSubmit } = useCJJCMemberOperate(props.selectedRow.orderidstr)
-const { accountInfo } = useAccountStore()
+const { avaiableMoney } = useAccountStore()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 
 const disabled = computed(() => {
-    const { balance = 0 } = accountInfo.value ?? {}
     const { totalfee = 0 } = details.value ?? {}
-    return totalfee > balance
+    return totalfee > avaiableMoney.value
 })
 
 const onCancel = (isRefresh = false) => {

+ 3 - 5
src/packages/pc/views/customs/exit/components/payment/index.vue

@@ -13,8 +13,7 @@
             <el-descriptions-item label="预收款">{{ details.advanceamount }}</el-descriptions-item>
             <el-descriptions-item label="应收\退款">{{ arrearage }}</el-descriptions-item>
             <el-descriptions-item label="结算费用详情文件">请下载文件“付款通知书(结算费用).pdf”</el-descriptions-item>
-            <el-descriptions-item label="账户可用余额" v-if="arrearage >= 0">{{ accountInfo?.balance ?? 0
-            }}</el-descriptions-item>
+            <el-descriptions-item label="账户可用余额" v-if="arrearage >= 0">{{ avaiableMoney }}</el-descriptions-item>
         </el-descriptions>
         <template #footer>
             <el-button @click="onCancel(false)" plain>取消</el-button>
@@ -39,7 +38,7 @@ const props = defineProps({
 
 const { details, getGzcjjcorderoperate } = useCJJCOrderOperate(props.selectedRow)
 const { loading, formData, formSubmit } = useCJJCMemberOperate(props.selectedRow.orderidstr)
-const { accountInfo } = useAccountStore()
+const { avaiableMoney } = useAccountStore()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 
@@ -50,8 +49,7 @@ const arrearage = computed(() => {
 })
 
 const disabled = computed(() => {
-    const { balance = 0 } = accountInfo.value ?? {}
-    return arrearage.value > balance
+    return arrearage.value > avaiableMoney.value
 })
 
 const onCancel = (isRefresh = false) => {

+ 5 - 3
src/packages/pc/views/mine/profile/index.vue

@@ -20,8 +20,8 @@
         <el-descriptions title="签约信息" :column="2" style="padding:20px" v-if="accountInfo">
             <el-descriptions-item label="资金账号">{{ accountInfo.accountid }}</el-descriptions-item>
             <el-descriptions-item label="余额">{{ accountInfo.balance }}</el-descriptions-item>
-            <el-descriptions-item label="冻结资金">{{ accountInfo.freezemargin }}</el-descriptions-item>
-            <el-descriptions-item label="可用资金">{{ accountInfo.usedmargin }}</el-descriptions-item>
+            <el-descriptions-item label="冻结资金">{{ freezeMargin.toFixed(2) }}</el-descriptions-item>
+            <el-descriptions-item label="可用资金">{{ avaiableMoney.toFixed(2) }}</el-descriptions-item>
             <template v-if="bankInfo">
                 <el-descriptions-item label="托管银行">{{ bankInfo.cusbankname }}</el-descriptions-item>
                 <el-descriptions-item label="开户银行">{{ bankInfo.bankname }}</el-descriptions-item>
@@ -48,9 +48,11 @@ import { decryptAES } from '@/utils/websocket/crypto'
 import { handleNoneValue } from '@/filters'
 import { getCertificateTypeName } from '@/constants/certificate'
 import { SignStatus, getSignStatusName } from '@/constants/bank'
+import { useAccountStore } from '@/stores'
 import AppAuthOperation from '@pc/components/modules/auth-operation/index.vue'
 
-const { loading, loginInfo, userInfo, accountInfo, bankInfo, getBankAccountSign } = useAccount()
+const { accountInfo, avaiableMoney, freezeMargin } = useAccountStore()
+const { loading, loginInfo, userInfo, bankInfo, getBankAccountSign } = useAccount()
 
 const handleTableButtons = computed(() => {
     const buttons = ['loginPassword', 'accountPassword']

+ 15 - 1
src/stores/modules/account.ts

@@ -33,8 +33,22 @@ const store = new (class extends VueStore<StoreState> {
         return this.state.accountList.find((e) => e.accountid === this.state.accountId)
     })
 
+    /** 冻结资金 */
+    private freezeMargin = computed(() => {
+        const { freezecharge = 0, freezemargin = 0, otherfreezemargin = 0, outamountfreeze = 0 } = this.accountInfo.value ?? {}
+        return freezecharge + freezemargin + otherfreezemargin + outamountfreeze
+    })
+
+    /** 可用资金 */
+    private avaiableMoney = computed(() => {
+        const { currentbalance = 0 } = this.accountInfo.value ?? {}
+        return currentbalance - this.freezeMargin.value
+    })
+
     getters = {
-        accountInfo: this.accountInfo
+        accountInfo: this.accountInfo,
+        freezeMargin: this.freezeMargin,
+        avaiableMoney: this.avaiableMoney,
     }
 
     actions = {