fix: allow optional digital RMB code and inline payment password setup
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
v-model.trim="bank.digital_rmb_code"
|
||||
inputmode="numeric"
|
||||
maxlength="32"
|
||||
placeholder="请输入数字编码"
|
||||
placeholder="请输入数字编码(选填)"
|
||||
/></label>
|
||||
<section class="m-qr-field">
|
||||
<h3>微信二维码</h3>
|
||||
@@ -276,16 +276,26 @@
|
||||
}
|
||||
async function saveBank() {
|
||||
error.value = '';
|
||||
if (
|
||||
!bank.holder_name ||
|
||||
!/^[1-9]\d{14}(?:\d{2}[\dXx])?$/.test(bank.identity_no.replace(/[ -]/g, '')) ||
|
||||
!/^[0-9 -]{8,36}$/.test(bank.account_no) ||
|
||||
!bank.bank_name ||
|
||||
!/^\d{6,32}$/.test(bank.digital_rmb_code.replace(/[ -]/g, '')) ||
|
||||
!bank.wechat_qr_attachment_id ||
|
||||
!bank.alipay_qr_attachment_id
|
||||
) {
|
||||
error.value = '请完整填写绑卡信息并上传微信、支付宝二维码';
|
||||
const identityNo = bank.identity_no.replace(/[ -]/g, '');
|
||||
const accountNo = bank.account_no.replace(/[ -]/g, '');
|
||||
const digitalRMBCode = bank.digital_rmb_code.replace(/[ -]/g, '');
|
||||
const validationError =
|
||||
bank.holder_name.length < 2
|
||||
? '请输入至少 2 个字符的姓名'
|
||||
: !/^[1-9]\d{14}(?:\d{2}[\dXx])?$/.test(identityNo)
|
||||
? '请输入正确的 15 位或 18 位身份证号'
|
||||
: !/^\d{8,32}$/.test(accountNo)
|
||||
? '请输入 8 至 32 位银行卡号'
|
||||
: bank.bank_name.length < 2
|
||||
? '请输入开户行'
|
||||
: digitalRMBCode && !/^\d{6,32}$/.test(digitalRMBCode)
|
||||
? '数字人民币编码须为 6 至 32 位数字,也可留空'
|
||||
: !bank.wechat_qr_attachment_id || !bank.alipay_qr_attachment_id
|
||||
? '请上传微信和支付宝二维码'
|
||||
: '';
|
||||
if (validationError) {
|
||||
error.value = validationError;
|
||||
window.$message?.error(validationError);
|
||||
return;
|
||||
}
|
||||
submitting.value = true;
|
||||
|
||||
Reference in New Issue
Block a user