li.shaoyi il y a 1 an
Parent
commit
4dafe59aad

+ 3 - 2
src/business/bank/index.ts

@@ -144,7 +144,7 @@ export function useDoBankSign() {
     const cusSignBank = shallowRef<Model.CusBankSignBankRsp>() /// 托管银行信息
     const system_1013 = shallowRef(getSystemParamValue('1013') ?? '30')
 
-    const extendInfo = shallowRef<{ [key: string]: string }>({}) // 银行扩展信息
+    const extendInfo = ref<{ [key: string]: string }>({}) // 银行扩展信息
 
     /// 数据
     const formData = reactive<Partial<Proto.t2bBankSignReq>>({
@@ -244,7 +244,8 @@ export function useDoBankSign() {
             data: {
                 ...formData,
                 OperateType: signstatus === SignStatus.Unsigned ? 1 : 2,
-                ExtOperatorID: new Date().getTime()
+                ExtOperatorID: new Date().getTime(),
+                extendInfo: JSON.stringify(extendInfo.value)
             }
         }).finally(() => {
             loading.value = false

+ 3 - 5
src/packages/mobile/views/bank/sign/components/edit/Index.vue

@@ -156,13 +156,13 @@ const onSearchBankChange = (item: Model.BankBranChnumInfoRsp) => {
             extendInfo.value['bank_branch_name'] = item.branchname
         }
         if (e.fieldcode === '100') {
-            extendInfo.value['100'] = item.branchname
+            extendInfo.value['100'] = item.branchnum
         }
         if (e.fieldcode === '101') {
-            extendInfo.value['101'] = item.branchname
+            extendInfo.value['101'] = item.branchprovince
         }
         if (e.fieldcode === '102') {
-            extendInfo.value['102'] = item.branchname
+            extendInfo.value['102'] = item.branchcity
         }
     })
 }
@@ -229,8 +229,6 @@ const formSubmit = () => {
             }
         })
 
-        formData.extendInfo = JSON.stringify(extendInfo.value)
-
         onSubmit().then(() => {
             hideLoading()
             dialog(props.isedit ? t('banksign.submitsuccess1') : t('banksign.submitsuccess2')).then(() => {

+ 45 - 51
src/packages/pc/views/account/sign/components/sign/index.vue

@@ -1,7 +1,7 @@
 <!-- 账户管理-签约账号管理-签约 -->
 <template>
-    <app-drawer :title="bankInfo?.signstatus != undefined ? t('banksign.modifybanksign') : t('banksign.addbanksign') " :width="800" v-model:show="show"
-        :loading="loading" :refresh="refresh">
+    <app-drawer :title="bankInfo?.signstatus != undefined ? t('banksign.modifybanksign') : t('banksign.addbanksign')"
+        :width="800" v-model:show="show" :loading="loading" :refresh="refresh">
         <el-form ref="formRef" class="el-form--horizontal" label-width="120px" :model="formData" :rules="formRules">
             <el-form-item :label="t('banksign.OpenBankAccId')" prop="OpenBankAccId">
                 <el-select effect="dark" v-model="formData.OpenBankAccId" :readonly="bankaccount != ''">
@@ -10,16 +10,17 @@
                 </el-select>
             </el-form-item>
             <el-form-item :label="t('banksign.bankaccountno')" prop="BankAccountNo">
-                <el-input type="number" name="BankAccountNo" :readonly="bankaccount != ''" :placeholder="t('banksign.bankaccountno')"
-                    :maxlength="30" v-model="formData.BankAccountNo" :rules="formRules.BankAccountNo" />
+                <el-input type="number" name="BankAccountNo" :readonly="bankaccount != ''"
+                    :placeholder="t('banksign.bankaccountno')" :maxlength="30" v-model="formData.BankAccountNo"
+                    :rules="formRules.BankAccountNo" />
             </el-form-item>
             <el-form-item :label="t('banksign.accountname')" prop="AccountName">
-                <el-input name="AccountName" readonly :placeholder="t('banksign.accountname1')" v-model="formData.AccountName"
-                    :rules="formRules.AccountName" />
+                <el-input name="AccountName" readonly :placeholder="t('banksign.accountname1')"
+                    v-model="formData.AccountName" :rules="formRules.AccountName" />
             </el-form-item>
             <el-form-item :label="t('banksign.mobilephone')" prop="MobilePhone">
-                <el-input name="MobilePhone" :readonly="mobile2 != ''" maxlength="50" :placeholder="t('banksign.Pleaseenteryourmobilephonenumber')"
-                    v-model="formData.MobilePhone" />
+                <el-input name="MobilePhone" :readonly="mobile2 != ''" maxlength="50"
+                    :placeholder="t('banksign.Pleaseenteryourmobilephonenumber')" v-model="formData.MobilePhone" />
             </el-form-item>
         </el-form>
         <el-form ref="extendRef" class="el-form--horizontal" label-width="120px" :model="extendModel"
@@ -28,8 +29,8 @@
                 <template v-if="(item.fieldcode === 'verify_code')">
                     <el-form-item :label="item.fieldname" :prop="item.fieldcode"
                         v-if="bankInfo === undefined && showExtendInfo(item)">
-                        <el-input :placeholder="t('common.pleaseenter')" type="number" v-model="item.value"
-                            :rules="formRules.vcode">
+                        <el-input :placeholder="t('common.pleaseenter')" type="number"
+                            v-model="extendInfo[item.fieldcode]" :rules="formRules.vcode">
                             <template #append>
                                 <el-button size="small" type="primary" :disabled="isCountdown" @click="sendVerifyCode">
                                     <span v-if="isCountdown">{{ t('banksign.sendagain') }}({{ seconds }})</span>
@@ -40,10 +41,11 @@
                     </el-form-item>
                 </template>
                 <template v-else-if="(item.fieldcode === 'bank_branch_name')">
-                    <el-form-item :label="t('banksign.branchbankname')" :prop="item.fieldcode" v-if="showExtendInfo(item)">
-                        <el-select effect="dark" :placeholder="t('common.pleaseenter')" v-model="item.value"
-                            value-key="branchnum" :loading="searchLoading" :remote-method="remoteMethod" filterable
-                            remote clearable allow-create @change="onBankChange" @clear="dataList = []">
+                    <el-form-item :label="t('banksign.branchbankname')" :prop="item.fieldcode"
+                        v-if="showExtendInfo(item)">
+                        <el-select effect="dark" :placeholder="t('common.pleaseenter')"
+                            v-model="extendInfo[item.fieldcode]" value-key="branchnum" :loading="searchLoading"
+                            :remote-method="remoteMethod" filterable remote allow-create @change="onSearchBankChange">
                             <template v-for="(item, index) in dataList" :key="index">
                                 <el-option :label="item.branchname" :value="item" />
                             </template>
@@ -53,13 +55,13 @@
                 <template v-else-if="(item.fieldcode === '100')">
                     <el-form-item :label="item.fieldname" :prop="item.fieldcode" v-if="showExtendInfo(item)">
                         <el-input maxlength="50" type="number" :placeholder="t('common.pleaseenter')"
-                            v-model="item.value" />
+                            v-model="extendInfo[item.fieldcode]" />
                     </el-form-item>
                 </template>
                 <template v-else>
                     <el-form-item :label="item.fieldname" :prop="item.fieldcode" v-if="showExtendInfo(item)">
                         <el-input :readonly="item.fieldcode === 'legal_name' && legalpersonname != ''" maxlength="50"
-                            :placeholder="t('common.pleaseenter')" v-model="item.value" />
+                            :placeholder="t('common.pleaseenter')" v-model="extendInfo[item.fieldcode]" />
                     </el-form-item>
                 </template>
             </template>
@@ -73,7 +75,7 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, computed, shallowRef } from 'vue'
+import { ref, computed } from 'vue'
 import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { validateRules } from '@/constants/regex'
 import { useRequest } from '@/hooks/request'
@@ -85,7 +87,7 @@ import AppDrawer from '@pc/components/base/drawer/index.vue'
 
 const { t } = i18n.global
 
-const { formData, onSubmit, banklist, bankInfo, loading, system_1010, smsVerificationCode } = useDoBankSign()
+const { formData, onSubmit, banklist, bankInfo, extendInfo, loading, system_1010, smsVerificationCode } = useDoBankSign()
 const { configs } = useDoCusBankExtendConfigs(1)
 
 const userStore = useUserStore()
@@ -95,13 +97,12 @@ const formRef = ref<FormInstance>()
 const extendRef = ref<FormInstance>()
 const seconds = ref(60) //倒计时剩余时间
 const isCountdown = ref(false) // 是否正在倒计时
-/// 短信验证码交易中心信息
-const CenterErrMsg = shallowRef('')
+
 const { legalpersonname, mobile2, bankaccount, userinfotype } = userStore.userInfo
 
 // 表单数据对象
 const extendModel = computed(() => {
-    const obj = Object.create(null)
+    const obj = Object.create({})
     configs.value.forEach((e) => {
         if (e.fieldcode) {
             obj[e.fieldcode] = e.value
@@ -113,6 +114,7 @@ const extendModel = computed(() => {
 const formRules = computed(() => {
     const rules: FormRules = {
         OpenBankAccId: [{
+            required: true,
             message: t('banksign.tips11'),
             validator: () => {
                 return !!formData.OpenBankAccId
@@ -150,7 +152,10 @@ const formRules = computed(() => {
         if (e.fieldcode) {
             rules[e.fieldcode] = [{
                 required: true,
-                message: t('common.pleaseenter') + e.fieldname,
+                validator: (rule, value, callback) => {
+                    const message = t('common.pleaseenter') + e.fieldname
+                    extendInfo.value[e.fieldcode] ? callback() : callback(new Error(message))
+                }
             }]
         }
     })
@@ -176,21 +181,19 @@ const remoteMethod = (query: string) => {
 }
 
 // 选择支行时触发
-const onBankChange = (item: Model.BankBranChnumInfoRsp) => {
+const onSearchBankChange = (item: Model.BankBranChnumInfoRsp) => {
     configs.value.forEach((e) => {
-        switch (e.fieldcode) {
-            case 'bank_branch_name':
-                e.value = typeof item === 'string' ? item : item.branchname
-                break
-            case '100':
-                e.value = item.branchnum
-                break
-            case '101':
-                e.value = item.branchprovince
-                break
-            case '102':
-                e.value = item.branchcity
-                break
+        if (e.fieldcode === 'bank_branch_name') {
+            extendInfo.value['bank_branch_name'] = typeof item === 'string' ? item : item.branchname
+        }
+        if (e.fieldcode === '100') {
+            extendInfo.value['100'] = item.branchnum
+        }
+        if (e.fieldcode === '101') {
+            extendInfo.value['101'] = item.branchprovince
+        }
+        if (e.fieldcode === '102') {
+            extendInfo.value['102'] = item.branchcity
         }
     })
 }
@@ -213,8 +216,8 @@ const sendVerifyCode = () => {
         if (valid) {
             service.onReady().then(() => {
                 smsVerificationCode().then((res) => {
-                    if (res.CenterErrMsg != '') {
-                        CenterErrMsg.value = res.CenterErrMsg ?? ''
+                    if (res.CenterErrMsg) {
+                        extendInfo.value['smsSerialNo'] = res.CenterErrMsg
                     }
                     isCountdown.value = true
                     // 开始倒计时
@@ -241,29 +244,20 @@ const formSubmit = () => {
             extendRef.value?.validate((extendValid) => {
                 if (extendValid) {
                     if (formData.CusBankID) {
-                        const obj: { [key: string]: unknown } = Object.create({})
                         configs.value.forEach((e) => {
-                            if (e.value) {
-                                obj[e.fieldcode] = e.value
-                            }
                             if (e.fieldcode === 'bank_branch_name') {
-                                formData.OpenBankName = e.value
+                                formData.OpenBankName = extendInfo.value['bank_branch_name']
                             }
                             if (e.fieldcode === '100') {
-                                formData.OpenBankNo = e.value
+                                formData.OpenBankNo = extendInfo.value['100']
                             }
                             if (e.fieldcode === '101') {
-                                formData.BankProvince = e.value
+                                formData.BankProvince = extendInfo.value['101']
                             }
                             if (e.fieldcode === '102') {
-                                formData.BankCity = e.value
+                                formData.BankCity = extendInfo.value['102']
                             }
                         })
-                        /// 如果需要短信验证码
-                        if (CenterErrMsg.value != '') {
-                            obj['smsSerialNo'] = CenterErrMsg.value
-                        }
-                        formData.extendInfo = JSON.stringify(obj)
 
                         onSubmit().then(() => {
                             ElMessage.success(bankInfo.value?.signstatus != undefined ? t('common.tips13') : t('common.tips14'))