Authored by xuqi

validate of address

... ... @@ -326,7 +326,7 @@
收货人:
</label>
<input class="input address-name" type="text" placeholder="请输入您的姓名" maxlength="10" value="\{{name}}">
<span class="blue error-tips hide">
<span class="blue error-tips">
{{> icon/error-round}}
<em></em>
</span>
... ... @@ -337,7 +337,7 @@
所在区域:
</label>
<div id="address" class="clearfix"></div>
<span class="blue error-tips hide">
<span class="blue error-tips">
{{> icon/error-round}}
所在区域不能为空
</span>
... ... @@ -348,7 +348,7 @@
详细地址:
</label>
<input class="input address-detail" type="text" placeholder="街道名称或小区名称" maxlength="60" value="\{{detail}}">
<span class="blue error-tips hide">
<span class="blue error-tips">
{{> icon/error-round}}
<em></em>
</span>
... ... @@ -359,7 +359,7 @@
手机号码:
</label>
<input class="input address-mobile" type="text" placeholder="请输入手机号码(重要必填)" maxlength="11" value="\{{mobile}}">
<span class="blue error-tips hide">
<span class="blue error-tips">
{{> icon/error-round}}
<em></em>
</span>
... ... @@ -367,7 +367,7 @@
<div class="form-group">
<label class="label-name">电话号码:</label>
<input class="input address-phone" type="text" placeholder="请输入电话号码(选填)" value="\{{phone}}">
<span class="blue error-tips hide">
<span class="blue error-tips">
{{> icon/error-round}}
<em></em>
</span>
... ...
... ... @@ -59,7 +59,7 @@ function validateAddress($el) {
err: '手机号码不能为空'
},
{
regx: /\d+/,
regx: /^\d+$/,
err: '手机号码格式不正确'
}
],
... ... @@ -94,13 +94,24 @@ function validateAddress($el) {
(vaRegx.skipWhenEmpty ? !(cur === '' || vaRegx.regx.test(cur)) : !vaRegx.regx.test(cur))
)) {
pass = false;
$cur.siblings('.error-tips').find('em').text(vaRegx.err).end().removeClass('hide');
$cur.siblings('.error-tips').find('em').text(vaRegx.err).end().show();
break;
}
// 否则隐藏提示
$cur.siblings('.error-tips').hide();
}
}
}
// 区域判断
if (!$el.address.getAreaLabels()) {
pass = false;
$('.cascading-address + .error-tips').show();
} else {
$('.cascading-address + .error-tips').hide();
}
return pass;
}
... ...