Handy_Cao 9 kuukautta sitten
vanhempi
commit
02d44201c7

+ 3 - 3
public/locales/en-US.json

@@ -1274,8 +1274,8 @@
         "accountname": "Name",
         "accountname1": "BankCard AccountName",
         "OpenBankAccId": "Bank Account",
-        "cardtype": "Document Type",
-        "cardno": "Document Number",
+        "cardtype": "Card-Type",
+        "cardno": "Card-Number",
         "cusbankname": "Custodian Bank",
         "bankaccountno1": "Contract bank account number",
         "currency": "Currency",
@@ -1291,7 +1291,7 @@
         "signagreement": "Agreement signing",
         "cancel": "Cancel",
         "modify": "Modify",
-        "bankchannel": "Bank Channel",
+        "bankchannel": "Channel",
         "addbanksign": "Add Bank Sign",
         "modifybanksign": "Modify Bank Sign",
         "Pleaseselectyourbank": "Please select the bank account",

+ 51 - 18
src/business/bank/index.ts

@@ -33,11 +33,15 @@ export function useDoWithdraw() {
     const loading = shallowRef(false)
     /// 获取当前是否已签约
     const bankAccountSign = shallowRef<Model.BankAccountSignRsp[]>([])
+
     const hybrids = shallowRef<Model.PaymentCenterHybridConfigs[]>([])
-    const bank_code = shallowRef('')
-    const channel_code = shallowRef('')
+    const method_types = shallowRef<string[]>([])
     const channel_banks = shallowRef<Model.HybridBank[]>([])
 
+    const channel_code = shallowRef('')
+    const method_type = shallowRef('')
+    const bank_code  = shallowRef('')
+
     const sign = computed<Partial<Model.BankAccountSignRsp>>(() => {
         if (bankAccountSign.value.length) {
             return bankAccountSign.value[0]
@@ -69,13 +73,19 @@ export function useDoWithdraw() {
     // 获取支付中心混合支付渠道配置信息列表 泰商所采用
     getHybridConfigs().then((res) => {
         if (res.data.length) {
-            hybrids.value = res.data.filter(e => e.can_amt_out === 1 && e.bank_infos.length != 0)
+            hybrids.value = res.data.filter(e => e.can_amt_in === 1)
             if (hybrids.value.length) {
+                // 默认选中第一个银行的 code
                 channel_code.value = hybrids.value[0].channel_code ?? ''
-                // 默认选中第一个
-                channel_banks.value = hybrids.value.filter(e => e.channel_code === channel_code.value)[0].bank_infos.filter(e => e.out_in_flag === 0 && e.is_enabled === 1) ?? []
-                if (channel_banks.value.length != 0) {
-                    bank_code.value = channel_banks.value[0].bank_code ?? ''
+                // 默认选中第一个下面的银行类型
+                method_types.value = getMethodTypeKeys(hybrids.value[0].out_bank_infos)
+                if (method_types.value.length != 0) {
+                    method_type.value = method_types.value[0]
+
+                    channel_banks.value = hybrids.value[0].out_bank_infos[method_type.value]
+                    if (channel_banks.value.length != 0) {
+                        bank_code.value = channel_banks.value[0].bank_code
+                    }
                 }
             }
         }
@@ -102,8 +112,10 @@ export function useDoWithdraw() {
         sign,
         hybrids,
         bank_code,
-        channel_code,
-        channel_banks
+        method_types,
+        method_type,
+        channel_banks,
+        channel_code
     }
 }
 
@@ -112,11 +124,15 @@ export function useDoDeposit(userid?: number) {
     const loading = shallowRef(false)
     /// 获取当前是否已签约
     const bankAccountSign = shallowRef<Model.BankAccountSignRsp[]>([])
+
     const hybrids = shallowRef<Model.PaymentCenterHybridConfigs[]>([])
-    const bank_code = shallowRef('')
-    const channel_code = shallowRef('')
+    const method_types = shallowRef<string[]>([])
     const channel_banks = shallowRef<Model.HybridBank[]>([])
 
+    const channel_code = shallowRef('')
+    const method_type = shallowRef('')
+    const bank_code  = shallowRef('')
+
     const sign = computed<Partial<Model.BankAccountSignRsp>>(() => {
         if (bankAccountSign.value.length) {
             return bankAccountSign.value[0]
@@ -146,13 +162,19 @@ export function useDoDeposit(userid?: number) {
     // 获取支付中心混合支付渠道配置信息列表 泰商所采用
     getHybridConfigs().then((res) => {
         if (res.data.length) {
-            hybrids.value = res.data.filter(e => e.can_amt_in === 1 && e.bank_infos.length != 0)
+            hybrids.value = res.data.filter(e => e.can_amt_in === 1)
             if (hybrids.value.length) {
+                // 默认选中第一个银行的 code
                 channel_code.value = hybrids.value[0].channel_code ?? ''
-                // 默认选中第一个
-                channel_banks.value = hybrids.value.filter(e => e.channel_code === channel_code.value)[0].bank_infos.filter(e => e.out_in_flag === 1 && e.is_enabled === 1) ?? []
-                if (channel_banks.value.length != 0) {
-                    bank_code.value = channel_banks.value[0].bank_code ?? ''
+                // 默认选中第一个下面的银行类型
+                method_types.value = getMethodTypeKeys(hybrids.value[0].in_bank_infos)
+                if (method_types.value.length != 0) {
+                    method_type.value = method_types.value[0]
+
+                    channel_banks.value = hybrids.value[0].in_bank_infos[method_type.value]
+                    if (channel_banks.value.length != 0) {
+                        bank_code.value = channel_banks.value[0].bank_code
+                    }
                 }
             }
         }
@@ -178,9 +200,20 @@ export function useDoDeposit(userid?: number) {
         sign,
         hybrids,
         bank_code,
-        channel_code,
-        channel_banks
+        method_types,
+        method_type,
+        channel_banks,
+        channel_code
+    }
+}
+
+// 获取对应属性的 key 集合
+export function getMethodTypeKeys(config: Model.MethodType): string[] {
+    const allKeys = new Set<string>()
+    for (const key in config) {
+        allKeys.add(key)
     }
+    return Array.from(allKeys)
 }
 
 /// 银行签约请求

+ 35 - 9
src/packages/tss/views/bank/wallet/components/deposit/Index.vue

@@ -32,13 +32,18 @@
                 <Cell v-if="sign.ismix === 0" :title="$t('banksign.wallet.withdraw.bankname')" :value="handleNoneValue(sign.bankname)" />
                 <Cell v-if="sign.ismix === 0" :title="$t('banksign.wallet.withdraw.bankaccountno')"
                     :value="handleNoneValue(sign.bankaccountno)" />
-                <Field v-if="sign.ismix === 1" label="银行渠道" name="channel_code" is-link >
+                <Field v-if="sign.ismix === 1" :label="$t('banksign.bankchannel')" name="channel_code" is-link >
                     <template #input>
                         <app-select v-model="channel_code" :options="hybrids"
                             :optionProps="{ label: 'channel_name', value: 'channel_code' }" @confirm="onHibirdChange"/>
                     </template>
                 </Field>
-                <Field v-if="sign.ismix === 1 && bank_code != ''" label="银行名称" name="bank_code" is-link >
+                <Field v-if="sign.ismix === 1" label="银行类型" name="channel_code" is-link >
+                    <template #input>
+                        <app-select v-model="method_type" :options="methodTypes" @confirm="onMethodTypeChange"/>
+                    </template>
+                </Field>
+                <Field v-if="sign.ismix === 1 && bank_code != ''" :label="$t('banksign.bankname1')" name="bank_code" is-link >
                     <template #input>
                         <app-select v-model="bank_code" :options="channel_banks"
                             :optionProps="{ label: 'bank_name', value: 'bank_code' }" />
@@ -89,10 +94,10 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, ref, defineAsyncComponent, onMounted } from 'vue'
+import { shallowRef, ref, defineAsyncComponent, onMounted, computed } from 'vue'
 import { Form, Field, Cell, CellGroup, Button, FieldRule, FormInstance, RadioGroup, Radio, showToast, showFailToast } from 'vant'
 import { fullloading, dialog } from '@/utils/vant'
-import { useDoDeposit, useDoCusBankExtendConfigs } from '@/business/bank'
+import { useDoDeposit, useDoCusBankExtendConfigs, getMethodTypeKeys } from '@/business/bank'
 import { getServerTime } from '@/services/api/common'
 import { useUserStore, useAccountStore, i18n } from '@/stores'
 import { useComponent } from '@/hooks/component'
@@ -102,7 +107,7 @@ import AppSelect from '@mobile/components/base/select/index.vue'
 import moment from 'moment'
 
 const formRef = shallowRef<FormInstance>()
-const { formData, onSubmit, sign, hybrids, channel_code, bank_code, channel_banks } = useDoDeposit()
+const { formData, onSubmit, sign, hybrids, channel_code, bank_code, method_type, method_types, channel_banks } = useDoDeposit()
 const { getSystemParamValue } = useUserStore()
 const { configs, cusBank, startTime, endTime } = useDoCusBankExtendConfigs(2)
 const certificate_photo_url = ref('')
@@ -133,11 +138,32 @@ const onRadioChange = (value: number) => {
     formData.Amount = value
 }
 
+const methodTypes = computed(() => {
+    return method_types.value.map(e => { return { label: e, value: e } })
+})
+
 const onHibirdChange = (code: string) => {
-    // 银行信息
-    channel_banks.value = hybrids.value.find(e => e.channel_code === code)?.bank_infos.filter(e => e.out_in_flag === 1 && e.is_enabled === 1) ?? []
-    // 默认选中第一个
-    if(channel_banks.value.length) { bank_code.value = channel_banks.value[0].bank_code ?? '' }
+    // 默认选择第一个下面的银行类型
+    const hybird = hybrids.value.filter(e => e.channel_code === code)[0]
+    method_types.value = getMethodTypeKeys(hybird.in_bank_infos)
+    if (method_types.value.length != 0) {
+        method_type.value = method_types.value[0]
+        // 默认去下面的银行信息
+        channel_banks.value = hybird.in_bank_infos[method_type.value]
+        if (channel_banks.value.length != 0) {
+            bank_code.value = channel_banks.value[0].bank_code
+            console.log(method_types.value, method_type.value, hybird.in_bank_infos[method_type.value], bank_code.value)
+        }
+    }
+}
+
+const onMethodTypeChange = (code: string) => {
+     // 默认选择第一个下面的银行类型
+     const hybird = hybrids.value.filter(e => e.channel_code === channel_code.value)[0]
+    channel_banks.value = hybird.in_bank_infos[code]
+    if (channel_banks.value.length != 0) {
+        bank_code.value = channel_banks.value[0].bank_code
+    }
 }
 
 // 表单验证规则

+ 40 - 13
src/packages/tss/views/bank/wallet/components/withdraw/Index.vue

@@ -25,22 +25,28 @@
                 <Cell v-if="sign.ismix === 0" :title="$t('banksign.wallet.withdraw.bankaccountname')" :value="handleNoneValue(sign.bankaccountname)" />
                 <Cell v-if="sign.ismix === 0" :title="$t('banksign.wallet.withdraw.bankname')" :value="handleNoneValue(sign.bankname)" />
                 <Cell v-if="sign.ismix === 0" :title="$t('banksign.wallet.withdraw.bankaccountno')" :value="handleNoneValue(sign.bankaccountno)" />
-                <Field v-if="sign.ismix === 1" name="bankaccountname" :label="$t('banksign.wallet.withdraw.bankaccountname')" v-model.trim="sign.bankaccountname" @click="showReciver = true" is-link readonly />
-                <Field v-if="sign.ismix === 1" type="number" name="phone_number" label="电话号码" maxlength="30" v-model.trim="onboard.phone_number" :placeholder="$t('banksign.Pleaseenterbankaccountno')"
-                        :rules="formRules.phone_number" />
-                <Field v-if="sign.ismix === 1" type="number" name="cert_no" label="证件号码" maxlength="30" v-model.trim="onboard.cert_no" placeholder="请输入证件号码" :rules="formRules.cert_no" />
-                <Field v-if="sign.ismix === 1" label="银行渠道" name="channel_code" is-link >
+                <Field v-if="sign.ismix === 1" name="bankaccountname" :label="$t('banksign.wallet.withdraw.bankaccountname')" 
+                    v-model.trim="sign.bankaccountname" @click="showReciver = true" is-link readonly />
+                <Field v-if="sign.ismix === 1" type="number" name="phone_number" :label="$t('banksign.mobilephone')" maxlength="30" v-model.trim="onboard.phone_number" :placeholder="$t('banksign.Pleaseenterbankaccountno')"
+                    :rules="formRules.phone_number" />
+                <Field v-if="sign.ismix === 1" type="number" name="cert_no" :label="$t('banksign.cardno')" maxlength="30" v-model.trim="onboard.cert_no" :placeholder="$t('user.authentication.pleaseenterthecardnum')" :rules="formRules.cert_no" />
+                <Field v-if="sign.ismix === 1" :label="$t('banksign.bankchannel')" name="channel_code" is-link >
                     <template #input>
                         <app-select v-model="channel_code" :options="hybrids" :optionProps="{ label: 'channel_name', value: 'channel_code' }" 
                           @confirm="onHibirdChange"/>
                     </template>
                 </Field>
-                <Field v-if="sign.ismix === 1 && channel_banks.length != 0" label="银行名称" name="bank_code" is-link >
+                <Field v-if="sign.ismix === 1" label="银行类型" name="channel_code" is-link >
+                    <template #input>
+                        <app-select v-model="method_type" :options="methodTypes" @confirm="onMethodTypeChange"/>
+                    </template>
+                </Field>
+                <Field v-if="sign.ismix === 1 && channel_banks.length != 0" :label="$t('banksign.bankname1')" name="bank_code" is-link >
                     <template #input>
                         <app-select v-model="bank_code" :options="channel_banks" :optionProps="{ label: 'bank_name', value: 'bank_code' }" />
                     </template>
                 </Field>
-                <Field v-if="sign.ismix === 1" type="number" name="bank_account" label="银行卡号" maxlength="30" v-model.trim="onboard.bank_account" :placeholder="$t('banksign.Pleaseenterbankaccountno')"
+                <Field v-if="sign.ismix === 1" type="number" name="bank_account" :label="$t('banksign.bankno')" maxlength="30" v-model.trim="onboard.bank_account" :placeholder="$t('banksign.Pleaseenterbankaccountno')"
                         :rules="formRules.bank_account" />
             </CellGroup>
             <CellGroup v-if="msg_317">
@@ -72,10 +78,10 @@
 </template>
 
 <script lang="ts" setup>
-import { reactive, shallowRef, defineAsyncComponent } from 'vue'
+import { reactive, shallowRef, defineAsyncComponent, computed } from 'vue'
 import { Form, Field, Cell, CellGroup, FormInstance, Button, FieldRule } from 'vant'
 import { fullloading, dialog, } from '@/utils/vant'
-import { useDoWithdraw, useAccountFundInfo, useDoCusBankExtendConfigs } from '@/business/bank'
+import { useDoWithdraw, useAccountFundInfo, useDoCusBankExtendConfigs, getMethodTypeKeys } from '@/business/bank'
 import { getServerTime } from '@/services/api/common'
 import { useNavigation } from '@mobile/router/navigation'
 import { useUserStore, i18n } from '@/stores'
@@ -83,7 +89,7 @@ import { handleNoneValue } from '@/filters'
 import moment from 'moment'
 import AppSelect from '@mobile/components/base/select/index.vue'
 
-const { formData, onSubmit, sign, hybrids, channel_code, bank_code, channel_banks } = useDoWithdraw()
+const { formData, onSubmit, sign, hybrids, channel_code, bank_code, method_type, method_types, channel_banks } = useDoWithdraw()
 const { configs, cusBank, startTime, endTime } = useDoCusBankExtendConfigs(3)
 
 /// 资金账户信息
@@ -105,6 +111,10 @@ const onboard = reactive<Partial<Model.HybridReceiverOnboard>>({
     receiver_type: userinfotype === 1 ? 'Individual' : 'Organization'
 })
 
+const methodTypes = computed(() => {
+    return method_types.value.map(e => { return { label: e, value: e } })
+})
+
 // 选择接收人信息
 const onChange = (item: Model.HybridReceiverOnboard) => {
     channel_code.value = item.channel_code
@@ -117,9 +127,26 @@ const onChange = (item: Model.HybridReceiverOnboard) => {
 }
 
 const onHibirdChange = (code: string) => {
-    channel_banks.value = hybrids.value.find(e => e.channel_code === code)?.bank_infos.filter(e => e.out_in_flag === 0 && e.is_enabled === 1) ?? []
-    if(channel_banks.value.length && bank_code.value) {
-        bank_code.value = channel_banks.value[0].bank_code ?? ''
+    // 默认选择第一个下面的银行类型
+    const hybird = hybrids.value.filter(e => e.channel_code === code)[0]
+    method_types.value = getMethodTypeKeys(hybird.out_bank_infos)
+    if (method_types.value.length != 0) {
+        method_type.value = method_types.value[0]
+        // 默认去下面的银行信息
+        channel_banks.value = hybird.out_bank_infos[method_type.value]
+        if (channel_banks.value.length != 0) {
+            bank_code.value = channel_banks.value[0].bank_code
+            console.log(method_types.value, method_type.value, hybird.out_bank_infos[method_type.value], bank_code.value)
+        }
+    }
+}
+
+const onMethodTypeChange = (code: string) => {
+     // 默认选择第一个下面的银行类型
+     const hybird = hybrids.value.filter(e => e.channel_code === channel_code.value)[0]
+    channel_banks.value = hybird.out_bank_infos[code]
+    if (channel_banks.value.length != 0) {
+        bank_code.value = channel_banks.value[0].bank_code
     }
 }
 

+ 6 - 1
src/types/model/bank.d.ts

@@ -570,13 +570,18 @@ declare namespace Model {
     }
 
     interface PaymentCenterHybridConfigs {
-        bank_infos: HybridBank[]
+        in_bank_infos: MethodType // 入金银行
+        out_bank_infos: MethodType // 出金银行
         can_amt_in: number   // 入金是否可用 0-不可用 1-可用
         can_amt_out: number  // 出金是否可用 0-不可用 1-可用
         channel_code: string // 渠道代码
         channel_name: string // 渠道名称
     }
 
+    interface MethodType {
+        [method_type: string]: HybridBank[]
+    }
+
     interface HybridBank {
         bank_code: string    // 银行代码
         bank_name: string    // 银行名称