From b0f828f4a3c5500c14241821e9f15911d2377ee0 Mon Sep 17 00:00:00 2001 From: Dragon <13925835632@139.com> Date: Fri, 19 Jan 2024 18:41:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=A7=E9=99=86=E6=8F=90?= =?UTF-8?q?=E7=8E=B0=E6=98=AF=E5=90=A6=E6=88=90=E5=B9=B4=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/peko/modules/h5Income/js/withdrawal.js | 48 ++++++++++++++++++++- view/peko/modules/h5Income/withdrawal.html | 2 +- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/view/peko/modules/h5Income/js/withdrawal.js b/view/peko/modules/h5Income/js/withdrawal.js index 5981cb6..7014d21 100644 --- a/view/peko/modules/h5Income/js/withdrawal.js +++ b/view/peko/modules/h5Income/js/withdrawal.js @@ -34,6 +34,7 @@ var weekMaxValue;//本周剩余最大金额 var realName = false;//默认大陆未实名 var modifyId = null; var userInfo = {}//账户信息暂存 +var idCard;//获取大陆身份证号 $(function () { setTimeout(function () { getInfoFromClient() @@ -181,6 +182,7 @@ function getAccounts () { $('.account span').addClass('active'); } if (res.accountType == 2) { + idCard = res.idCardNo; updateNums = res.updateNum; isRealCertifyBool = res.isRealCertify; // 判断是否认证 @@ -208,7 +210,6 @@ function getAccounts () { $('.mainlandInfo .mainlandInfo_in p span').text(updateNums + '次'); $('.accountPub .accountPub_in ul li i').show(); } else { - console.log('次数'); $('.accountPub .accountPub_in ul li i').hide(); } // 修改大陆银行卡按钮 @@ -388,10 +389,55 @@ $('.butBig').click(function () { toastMsg('超出本周最大提领次数') return } + if (accountType == 2 && isAdult(idCard) == false) {// + toastMsg('申請提現失敗,不支援未成年人提現'); + return + } $('.withDrawalPub .withDrawalPub_in p ').html(`確認通過 ${$('.account .active').text()} 提領 ${num}金幣?`) $('.withDrawalPub .withDrawalPub_in span b ').html(`${$('.withdrawal .numBox b').text()}`) $('.withDrawalPub').show(); }) +// 判断身份证是否成年 +function isAdult (idCard) { + // // 身份证号码正则表达式 + var idCardPattern = /^\d{17}[\d|x]|\d{15}$/; + + // 验证身份证格式是否正确 + if (!idCardPattern.test(idCard)) { + // toastMsg('身份证格式有误') + return false; + } + // 获取身份证中的出生日期 + var birthday = ""; + if (idCard.length === 18) { + birthday = idCard.substring(6, 14); + } else if (idCard.length === 15) { + birthday = "19" + idCard.substring(6, 12); + } + + // 获取当前时间的年份和月份 + var today = new Date(); + var currentYear = today.getFullYear(); + var currentMonth = today.getMonth() + 1; + + // 将出生日期转换为日期对象 + var birthdate = new Date(birthday.substring(0, 4), birthday.substring(4, 6) - 1, birthday.substring(6)); + + // 计算年龄差 + var age = currentYear - birthdate.getFullYear(); + + // 如果当前月份小于出生日期的月份,年龄减一 + if (currentMonth < Number(birthday.substring(4, 6))) { + age--; + } + + // 根据年龄判断是否成年 + if (age >= 18) { + return true; + } else { + return false; + } +} // 二次确认提領按钮 $('.withDrawalPub .withDrawalPub_in .but').click(function () { var num = $('.withdrawal input').val(); diff --git a/view/peko/modules/h5Income/withdrawal.html b/view/peko/modules/h5Income/withdrawal.html index b09e11a..f4c4aa2 100644 --- a/view/peko/modules/h5Income/withdrawal.html +++ b/view/peko/modules/h5Income/withdrawal.html @@ -126,4 +126,4 @@ - \ No newline at end of file + \ No newline at end of file