li.shaoyi 5 月之前
父節點
當前提交
c4709b46ef
共有 1 個文件被更改,包括 28 次插入25 次删除
  1. 28 25
      src/packages/mobile/views/account/certification/Index.vue

+ 28 - 25
src/packages/mobile/views/account/certification/Index.vue

@@ -12,23 +12,26 @@
                     <template #input>
                         <app-select v-model="formData.cardtype"
                             :placeholder="$t('user.authentication.pleaseselectthecardtype')"
-                            :options="getCerTypePersonList()" />
+                            :options="cerTypePersonList" />
                     </template>
                 </Field>
                 <Field v-model="formData.cardnum" name="cardnum" :label="$t('user.authentication.cardnum')"
                     :placeholder="$t('user.authentication.pleaseenterthecardnum')" :rules="formRules.cardnum" />
-                <Field v-if="formData.mobilephone != ''" name="mobilephone" v-model="formData.mobilephone" :label="$t('user.register.mobile')" readonly />
-                <Field v-else v-model="formData.mobilephone" type="digit" name="mobilephone" :placeholder="$t('user.register.tips1')" :rules="formRules.mobilephone">
+                <Field v-if="formData.mobilephone != ''" name="mobilephone" v-model="formData.mobilephone"
+                    :label="$t('user.register.mobile')" readonly />
+                <Field v-else v-model="formData.mobilephone" type="digit" name="mobilephone"
+                    :placeholder="$t('user.register.tips1')" :rules="formRules.mobilephone">
                     <template #label>
                         <span>{{ $t('user.register.mobile') }}</span>
                         <span style="margin-left: 10px;" @click="show = true">{{ countryCode }}</span>
                         <Popup v-model:show="show" position="bottom" teleport="body" round>
                             <Picker :columns="datalist" @cancel="onCancel" @confirm="onConfirm"
-                                :confirm-button-text="$t('operation.confirm')" :cancel-button-text="$t('operation.cancel')">
+                                :confirm-button-text="$t('operation.confirm')"
+                                :cancel-button-text="$t('operation.cancel')">
                                 <template #option="{ text, index }">
-                                <slot name="option" :row="datalist[index]" :index="index">
-                                    {{ text }}
-                                </slot>
+                                    <slot name="option" :row="datalist[index]" :index="index">
+                                        {{ text }}
+                                    </slot>
                                 </template>
                             </Picker>
                         </Popup>
@@ -64,7 +67,7 @@
                     :label="$t('user.authentication.modifyremark')" />
             </CellGroup>
         </Form>
-        <img v-if="oem != 'tss'" src="../../../assets/images/certification.png" />
+        <!-- <img v-if="oem != 'tss'" src="../../../assets/images/certification.png" /> -->
         <template #footer>
             <div class="g-form__footer inset">
                 <Button type="danger" @click="formRef?.submit" round block>{{ $t('user.authentication.submit')
@@ -98,13 +101,14 @@ const { router } = useNavigation()
 const { global: { t } } = i18n
 
 const userStore = useUserStore()
+const cerTypePersonList = getCerTypePersonList() // 证件类型列表
 
 // 是否弹出选择器
-const show = shallowRef(false) 
+const show = shallowRef(false)
 const datalist = computed(() => {
-  return getCountryCodeList().map(e => {
-    return { text: e.value, value: e.value }
-  })
+    return getCountryCodeList().map(e => {
+        return { text: e.value, value: e.value }
+    })
 })
 const countryCode = ref(datalist.value[0]?.value.toString() ?? '')
 
@@ -117,12 +121,12 @@ const oem = service.getConfig('oem')
 const { banklist } = useQueryCusBankSignBank()
 
 const onCancel = () => {
-  show.value = false
+    show.value = false
 }
 
 const onConfirm = ({ selectedValues: [value] }: PickerConfirmEventParams) => {
-  show.value = false
-  countryCode.value = value.toString()
+    show.value = false
+    countryCode.value = value.toString()
 }
 
 // 获取网上开户配置
@@ -160,17 +164,16 @@ const formRules: { [key: string]: FieldRule[] } = {
         required: true,
         message: t("user.authentication.pleaseenterthecardnum"),
         validator: (val) => {
-            if (formData.cardtype != 0) {
-                return true
-            } else {
-                if (validateRules.cardno.validate(val)) {
-                    if (getIdCardAge(val)) {
-                        return t("user.authentication.openfailure")
-                    }
-                    return true
-                }
-                return validateRules.cardno.message
+            // if (getIdCardAge(val)) {
+            //     return t("user.authentication.openfailure")
+            // }
+
+            // 待优化
+            const enumItem = cerTypePersonList.find((e) => e.enumitemname === formData.cardtype)
+            if (enumItem) {
+                return new RegExp(enumItem.param1).test(val) || t('regex.cardno')
             }
+            return t('regex.cardno')
         }
     }],
     cardbackphotourl: [{