新增提现未成年限制
This commit is contained in:
2
view/peko/modules/h5Income/js/moment.js
Normal file
2
view/peko/modules/h5Income/js/moment.js
Normal file
File diff suppressed because one or more lines are too long
@@ -389,7 +389,16 @@ $('.butBig').click(function () {
|
||||
toastMsg('超出本周最大提领次数')
|
||||
return
|
||||
}
|
||||
if (accountType == 2 && isAdult(idCard) == false) {//
|
||||
let birthday = idCard.substring(6, 14);
|
||||
let nowTime = moment(new Date()).format('YYYY-MM-DD');
|
||||
birthday = moment(birthday).format('YYYY-MM-DD');
|
||||
// return
|
||||
if (accountType == 2 && isRealCertifyBool == 0) {
|
||||
toastMsg('請先進行實名認證')
|
||||
return
|
||||
}
|
||||
// console.log(isAdult(idCard));
|
||||
if (accountType == 2 && (moment(nowTime).isBefore(moment(birthday).add(18, 'years')))) {//
|
||||
toastMsg('申請提現失敗,不支援未成年人提現');
|
||||
return
|
||||
}
|
||||
@@ -397,47 +406,6 @@ $('.butBig').click(function () {
|
||||
$('.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();
|
||||
|
@@ -126,4 +126,5 @@
|
||||
<script src="../../common/js/vconsole.min.js"></script>
|
||||
<script src="../../common/js/route-constant.js"></script>
|
||||
<script src="../../common/js/svga.min.js"></script>
|
||||
<script src="./js/moment.js"></script>
|
||||
<script src="./js/withdrawal.js?v=2.1"></script>
|
Reference in New Issue
Block a user