Authored by 郝肖肖

判断手机提示语

... ... @@ -261,7 +261,7 @@
<input value="{{invoice_mobile}}" class='input invoice-mobile' type="text" maxlength="11" placeholder="请填写收票人手机">
<span class="input-tip invoice-mobile-tip blue hide">
<span class="iconfont">&#xe60c;</span>
请输入正确的手机号
<em>手机号码不正确</em>
</span>
</div>
</div>
... ...
... ... @@ -22,16 +22,23 @@ function validateInvoice($el) {
var name = $.trim($el.find('.invoice-title-input').val());
var mobile = $.trim($invoiceMobile.val());
//隐藏所有错误提示
$el.find('.input-tip').addClass('hide');
// 发票抬头为单位
if ($el.invoiceTitleType === 2 && name === '') {
pass = false;
$el.find('.invoice-title-tip').removeClass('hide');
}
if ($el.invoiceType === 2 && $('#address-list li.address.focus').data('mobile') !== mobile) {
if (!/[1][34578][0-9]{9}/.test(mobile)) {
if ($el.invoiceType === 2 && (mobile === '' ||
$('#address-list li.address.focus').data('mobile') !== mobile)) {
if (mobile === '') {
pass = false;
$el.find('.invoice-mobile-tip').removeClass('hide').find('em').html('请填写手机号码');
} else if (!/[1][34578][0-9]{9}/.test(mobile)) {
pass = false;
$el.find('.invoice-mobile-tip').removeClass('hide');
$el.find('.invoice-mobile-tip').removeClass('hide').find('em').html('手机号码不正确');
}
}
... ... @@ -152,7 +159,9 @@ function showInvoiceDialog() {
}
// 设置默认收货地址手机号
$invoiceMobile.val(mobile.toString().substr(0, 3) + '****' + mobile.toString().substr(7));
if (mobile) {
$invoiceMobile.val(mobile.toString().substr(0, 3) + '****' + mobile.toString().substr(7));
}
// 设置radio选中
$('[data-value=' + invoiceTitleType + '].invoice-title-radio').find('.radio').addClass('checked');
... ...