Authored by 郭成尧

btn-status

... ... @@ -21,7 +21,7 @@
</li>
<li class="company-area">
<span class="title">发票抬头</span>
<input type="text" name="company" class="company" value="{{companyName}}" placeholder="填写单位名称" maxlength="30"></li>
<input type="text" name="company" class="company" value="{{companyName}}" placeholder="填写发票抬头" maxlength="30"></li>
<li class="tax-number" {{#isCompany}}style="display: none;"{{/isCompany}}>
<span class="title">税号</span>
<input type="text" id="buyerTaxNumber" name="buyerTaxNumber" class="number" value="{{taxNumber}}" placeholder="请输入正确的纳税人识别号" maxlength="30">
... ...
... ... @@ -16,12 +16,13 @@ let $invoiceNotice = $('.invoice-notice'),
$tel = $('.tel'),
$company = $('.company'),
$copyTel = $('.copy-tel');
let $confirmBtn = $('.confirm-btn');
let $buyerTaxNumber = $('#buyerTaxNumber');
let eInvoiceType = $('#eInvoices').data('id');
let orderInfo = order.orderInfo;
let linkUrl = document.referrer;
let isModifyTel = false;
let myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
let C_ID = window._ChannelVary[window.cookie('_Channel')] || 1;
require('common');
... ... @@ -39,6 +40,46 @@ function goToBack() {
}
}
/**
* 切换确认按钮激活状态
*/
function switchBtnStatus() {
if ($('.invoice-top').find('.on').text() === '单位') {
if ($buyerTaxNumber.val() && $company.val() && $tel.val()) {
$confirmBtn.addClass('active');
} else {
$confirmBtn.removeClass('active');
}
} else {
if ($company.val() && $tel.attr('data-tel')) {
$confirmBtn.addClass('active');
} else {
$confirmBtn.removeClass('active');
}
}
}
/**
* 发票抬头输入监听
*/
$company.bind('input', function() {
switchBtnStatus();
});
/**
* 手机号输入监听
*/
$tel.bind('input', function() {
switchBtnStatus();
});
/**
* 税号输入监听
*/
$buyerTaxNumber.bind('input', function() {
switchBtnStatus();
});
// 单选效果
function chooseAction(pDom, dom) {
if (dom.hasClass('icon-cb-radio')) {
... ... @@ -55,16 +96,12 @@ function chooseAction(pDom, dom) {
// 确认表单事件
function confirmAction() {
let title = $('.invoice-top').find('.on').text(),
buyerTaxNumber = $('#buyerTaxNumber').val(),
buyerTaxNumber = $buyerTaxNumber.val(),
tel = $tel.attr('data-tel'),
company = $company.val();
if ($editFlag.val() === 'true') {
if (!myreg.test($tel.attr('data-tel'))) {
tip.show('请输入正确手机号');
$tel.focus();
return false;
} else if (title === '单位' && company.length === 0) {
if (title === '单位' && company.length === 0) {
tip.show('请填写发票抬头');
$company.focus();
return false;
... ... @@ -122,6 +159,7 @@ $('.invoice-top span, .invoice-cont li').not('.invoice-cont .cont-title').on('to
if ($(this).text() === '个人') {
$taxNumber.slideUp();
}
switchBtnStatus();
});
// 发票须知
... ...
... ... @@ -145,7 +145,7 @@
height: 70px;
line-height: 70px;
text-align: center;
background: #d0021b;
background: #b0b0b0;
color: #fff;
display: block;
margin: 0 auto;
... ... @@ -153,6 +153,10 @@
font-size: 28px;
margin-top: 70px;
}
.active {
background: #444;
}
}
.invoice-notice {
... ...