Showing
1 changed file
with
22 additions
and
0 deletions
@@ -83,6 +83,28 @@ $addressForm.on('submit', function() { | @@ -83,6 +83,28 @@ $addressForm.on('submit', function() { | ||
83 | if (isSubmiting) { | 83 | if (isSubmiting) { |
84 | return false; | 84 | return false; |
85 | } | 85 | } |
86 | + | ||
87 | + // 简单的表单校验 | ||
88 | + if (!$(this).find('[name="consignee"]').val()) { | ||
89 | + tip.show('收件人不能为空'); | ||
90 | + $(this).find('[name="consignee"]').focus(); | ||
91 | + return false; | ||
92 | + } | ||
93 | + if (!$(this).find('[name="mobile"]').val()) { | ||
94 | + tip.show('手机号不能为空'); | ||
95 | + $(this).find('[name="mobile"]').focus(); | ||
96 | + return false; | ||
97 | + } | ||
98 | + if (!$(this).find('[name="area_code"]').val() || !$(this).find('[name="area"]').val()) { | ||
99 | + tip.show('省市区不能为空'); | ||
100 | + return false; | ||
101 | + } | ||
102 | + if (!$(this).find('[name="address"]').val()) { | ||
103 | + tip.show('地址不能为空'); | ||
104 | + $(this).find('[name="address"]').focus(); | ||
105 | + return false; | ||
106 | + } | ||
107 | + | ||
86 | isSubmiting = true; | 108 | isSubmiting = true; |
87 | $.ajax({ | 109 | $.ajax({ |
88 | method: 'POST', | 110 | method: 'POST', |
-
Please register or login to post a comment