address-username-check-step1
Showing
2 changed files
with
22 additions
and
0 deletions
@@ -59,6 +59,8 @@ $backBtn.on('touchend', function(e) { | @@ -59,6 +59,8 @@ $backBtn.on('touchend', function(e) { | ||
59 | 59 | ||
60 | // 提交表单请求 | 60 | // 提交表单请求 |
61 | $addressForm.on('submit', function() { | 61 | $addressForm.on('submit', function() { |
62 | + let username = $(this).find('[name="consignee"]').val(); | ||
63 | + | ||
62 | if (isSubmiting) { | 64 | if (isSubmiting) { |
63 | return false; | 65 | return false; |
64 | } | 66 | } |
@@ -72,6 +74,15 @@ $addressForm.on('submit', function() { | @@ -72,6 +74,15 @@ $addressForm.on('submit', function() { | ||
72 | tip.show('收件人不能为空'); | 74 | tip.show('收件人不能为空'); |
73 | return false; | 75 | return false; |
74 | } | 76 | } |
77 | + | ||
78 | + if (username && username.length > 20) { | ||
79 | + tip.show('收货人姓名最多支持20个字'); | ||
80 | + } | ||
81 | + | ||
82 | + if (username && /([^u4e00-\u9fa5])([^\p{P}])/.test(username)) { | ||
83 | + tip.show('收货人姓名不支持特殊符号'); | ||
84 | + } | ||
85 | + | ||
75 | if (!$(this).find('[name="mobile"]').val()) { | 86 | if (!$(this).find('[name="mobile"]').val()) { |
76 | tip.show('手机号不能为空'); | 87 | tip.show('手机号不能为空'); |
77 | return false; | 88 | return false; |
@@ -38,6 +38,17 @@ $area.on('click', function() { | @@ -38,6 +38,17 @@ $area.on('click', function() { | ||
38 | * 提交表单 | 38 | * 提交表单 |
39 | */ | 39 | */ |
40 | $btnSure.on('click', function() { | 40 | $btnSure.on('click', function() { |
41 | + let username = $areaForm.find('input[name=username]').val(); | ||
42 | + | ||
43 | + if (username && username.length > 20) { | ||
44 | + tip.show('收货人姓名最多支持20个字'); | ||
45 | + } | ||
46 | + | ||
47 | + if (username && /([^u4e00-\u9fa5])([^\p{P}])/.test(username)) { | ||
48 | + tip.show('收货人姓名不支持特殊符号'); | ||
49 | + return false; | ||
50 | + } | ||
51 | + | ||
41 | $.post('/home/orders/changeAddress', $areaForm.serialize(), function(result) { | 52 | $.post('/home/orders/changeAddress', $areaForm.serialize(), function(result) { |
42 | if (result && result.code === 200) { | 53 | if (result && result.code === 200) { |
43 | if (result.data && result.data.is_modified === 'Y') { | 54 | if (result.data && result.data.is_modified === 'Y') { |
-
Please register or login to post a comment