li.shaoyi 2 месяцев назад
Родитель
Сommit
faa2907465

+ 30 - 62
src/business/bank/index.ts

@@ -63,7 +63,7 @@ export function useDoWithdraw() {
 
     const onSubmit = async () => {
         await request,
-        loading.value = true
+            loading.value = true
 
         return t2bBankWithdraw({
             data: {
@@ -113,7 +113,7 @@ export function useDoDeposit(userid?: number) {
             formData.AccountCode = data.accountcode
             formData.BankAccoutNum = data.bankaccountno2
         }
-    }) 
+    })
 
     const onSubmit = async () => {
         await request
@@ -144,7 +144,7 @@ export function useHybridConfigs(in_out_type: number) {
 
     const channel_code = shallowRef('')
     const method_type = shallowRef('')
-    const bank_code  = shallowRef('')
+    const bank_code = shallowRef('')
 
     // 获取支付中心混合支付渠道配置信息列表 泰商所采用
     getHybridConfigs().then((res) => {
@@ -154,7 +154,7 @@ export function useHybridConfigs(in_out_type: number) {
                 // 默认选中第一个银行的 code
                 channel_code.value = hybrids.value[0].channel_code ?? ''
                 // 默认选中第一个下面的银行类型
-                method_types.value = getMethodTypeKeys( in_out_type === 0 ? hybrids.value[0].in_bank_infos : hybrids.value[0].out_bank_infos)
+                method_types.value = getMethodTypeKeys(in_out_type === 0 ? hybrids.value[0].in_bank_infos : hybrids.value[0].out_bank_infos)
                 if (method_types.value.length != 0) {
                     method_type.value = method_types.value[0]
 
@@ -165,7 +165,7 @@ export function useHybridConfigs(in_out_type: number) {
                 }
             }
         }
-    }) 
+    })
 
     return {
         hybrids,
@@ -226,7 +226,7 @@ export function useDoBankSign() {
     })
 
     /// 查询签约银行信息 任务 #6605
-    const request = system_1016.value === '1' ?  queryMemberCusBankInfo().then((res) => {
+    const request = system_1016.value === '1' ? queryMemberCusBankInfo().then((res) => {
         if (res.data.length) {
             // 设置信息
             setCusBankInfo(res.data ?? [])
@@ -421,64 +421,32 @@ export function useDoCusBankExtendConfigs(extendbiztype: number) {
     const startTime = shallowRef(getSystemParamValue('012') ?? '')
     const endTime = shallowRef(getSystemParamValue('013') ?? '')
 
-    const banAccountSign = shallowRef<Model.BankAccountSignRsp>()
-    
     /// 判断是否有签约信息 有就做修改
     queryBankAccountSign().then((res) => {
-        if (res.data.length != 0) {
-            banAccountSign.value = res.data.filter(obj => {
-                return ![SignStatus.Rescinded].includes(obj.signstatus)
-            })[0]
-            // 查询托管银行信息
-            queryCusBankSignBank().then((res) => {
-                if (banAccountSign.value) {
-                    cusBank.value = res.data.filter(e => e.cusbankid === banAccountSign.value?.cusbankid)[0] ?? {}
-                } else {
-                    cusBank.value = res.data[0]
-                }
-                if (cusBank.value) {
-                    /// 不为空 入金取 318 出金取 319
-                    const time = getSystemParamValue(extendbiztype === 2 ? '318' : '319') ?? ''
-                    endTime.value = time != '' ? time : endTime.value
-                    /// 查询配置信息
-                    queryBankCusBankExtendConfigs({
-                        data: {
-                            cusbankid: cusBank.value.cusbankid,
-                            extendbiztype: extendbiztype
-                        },
-                    }).then((res) => {
-                        configs.value = res.data.map(obj => ({
-                            ...obj,
-                            value: obj.fieldcode === 'legal_name' ? (useStore.userInfo?.legalpersonname ?? '') : ''
-                        }))
-                    })
-                }
-            })
-        } else {
-            // 查询托管银行信息
-            queryCusBankSignBank().then((res) => {
-                if (res.data) {
-                    cusBank.value = res.data[0]
-                }
-                if (cusBank.value) {
-                    /// 不为空 入金取 318 出金取 319
-                    const time = getSystemParamValue(extendbiztype === 2 ? '318' : '319') ?? ''
-                    endTime.value = time != '' ? time : endTime.value
-                    /// 查询配置信息
-                    queryBankCusBankExtendConfigs({
-                        data: {
-                            cusbankid: cusBank.value.cusbankid,
-                            extendbiztype: extendbiztype
-                        },
-                    }).then((res) => {
-                        configs.value = res.data.map(obj => ({
-                            ...obj,
-                            value: obj.fieldcode === 'legal_name' ? (useStore.userInfo?.legalpersonname ?? '') : ''
-                        }))
-                    })
-                }
-            })
-        }
+        const banAccountSign = res.data.find(e => e.signstatus !== SignStatus.Rescinded)
+
+        // 查询托管银行信息
+        queryCusBankSignBank().then((res) => {
+            cusBank.value = res.data.find(e => e.cusbankid === banAccountSign?.cusbankid) ?? res.data[0]
+
+            if (cusBank.value) {
+                /// 不为空 入金取 318 出金取 319
+                const time = getSystemParamValue(extendbiztype === 2 ? '318' : '319') ?? ''
+                endTime.value = time != '' ? time : endTime.value
+                /// 查询配置信息
+                queryBankCusBankExtendConfigs({
+                    data: {
+                        cusbankid: cusBank.value.cusbankid,
+                        extendbiztype: extendbiztype
+                    },
+                }).then((res) => {
+                    configs.value = res.data.map(obj => ({
+                        ...obj,
+                        value: obj.fieldcode === 'legal_name' ? (useStore.userInfo?.legalpersonname ?? '') : ''
+                    }))
+                })
+            }
+        })
     })
 
     return {

+ 7 - 3
src/packages/pc/views/account/sign/components/sign/index.vue

@@ -94,7 +94,8 @@ import AppDrawer from '@pc/components/base/drawer/index.vue'
 const { t } = i18n.global
 
 const { formData, onSubmit, bankInfo, extendInfo, loading, system_1010, swsFormData, smsVerificationCode, cusBanks } = useDoBankSign()
-const { configs } = useDoCusBankExtendConfigs(bankInfo.value?.signstatus != undefined ? 4 : 1)
+
+const configs = ref<(Model.BankCusBankExtendConfigRsp & { value: string })[]>([])
 
 const userStore = useUserStore()
 const show = ref(true)
@@ -296,8 +297,11 @@ const formSubmit = () => {
 }
 
 // 待优化
-watch(configs, (data) => {
-    if (data.some((e) => e.fieldcode === 'legal_name')) {
+watch(() => bankInfo.value, (value) => {
+    const extend = useDoCusBankExtendConfigs(value ? 4 : 1)
+    configs.value = extend.configs.value
+
+    if (configs.value.some((e) => e.fieldcode === 'legal_name')) {
         // 初始化默认值
         extendInfo.value['legal_name'] = legalpersonname
     }