...
|
...
|
@@ -3,9 +3,19 @@ |
|
|
* @time: 2015/12/21
|
|
|
*/
|
|
|
|
|
|
var $ = require('yoho.jquery');
|
|
|
var $ = require('yoho.jquery'),
|
|
|
$invoiceCheck = $('.invoice'),
|
|
|
$receiptInfo = $('.receipt-info'),
|
|
|
$receiptInfoSaveBtn = $('.receipt-info .save-receipt'),
|
|
|
$receiptInfoCancelBtn = $('.receipt-info .cancel-receipt'),
|
|
|
$eReceiptBtn = $('.receipt-type .e-receipt'),
|
|
|
$paperReceiptBtn = $('.receipt-type .paper-receipt');
|
|
|
|
|
|
var address = require('./address');
|
|
|
|
|
|
var address = require('./address'),
|
|
|
receiptTitle = "个人",
|
|
|
receiptMobile = $('#input-mobile').val(),
|
|
|
receiptMobileStar;
|
|
|
|
|
|
var dialog = require('../common/dialog');
|
|
|
|
...
|
...
|
@@ -852,3 +862,148 @@ $('.bag').find('ul').each(function() { |
|
|
$next.hide();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$invoiceCheck.click(function(){
|
|
|
|
|
|
if ($invoiceCheck.hasClass('active')) {
|
|
|
$invoiceCheck.removeAttr('checked');
|
|
|
$invoiceCheck.removeClass('active');
|
|
|
}
|
|
|
|
|
|
if ($invoiceCheck.attr('checked')) {
|
|
|
$invoiceCheck.addClass('active');
|
|
|
if ($('.invoice-content').hasClass('hide')) {
|
|
|
$receiptInfo.removeClass('hide');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//电子发票
|
|
|
|
|
|
(function receiptMobileToStarString(numb) {
|
|
|
receiptMobileStar = numb.substr(0, 3) + '****' + numb.substr(7);
|
|
|
$('#input-mobile').val(receiptMobileStar);
|
|
|
}(receiptMobile));
|
|
|
|
|
|
function saveReceiptInfo() {
|
|
|
var passInfoVerify = true,
|
|
|
receiptType,
|
|
|
receiptContent,
|
|
|
verifymobile,
|
|
|
receiptTypeID,
|
|
|
invoiceTypeInt,
|
|
|
finalReceiptMobile;
|
|
|
|
|
|
if ($eReceiptBtn.hasClass('receipt-type-selected')) {
|
|
|
receiptType = "电子发票";
|
|
|
invoiceTypeInt = '2';
|
|
|
} else {
|
|
|
receiptType = "纸质发票";
|
|
|
invoiceTypeInt = '1';
|
|
|
}
|
|
|
|
|
|
if (receiptTitle === "单位") {
|
|
|
$('.input-line').each(function(){
|
|
|
if ($(this).find('input').val() === '') {
|
|
|
$(this).find('.enpty-input').removeClass('hide');
|
|
|
passInfoVerify = false;
|
|
|
};
|
|
|
})
|
|
|
};
|
|
|
|
|
|
finalReceiptMobile = $('#input-mobile').val();
|
|
|
if (finalReceiptMobile === receiptMobileStar) {
|
|
|
finalReceiptMobile = receiptMobile;
|
|
|
} else {
|
|
|
verifymobile = /[0-9]{11}/;
|
|
|
if (!verifymobile.test(finalReceiptMobile)) {
|
|
|
$('.invoice-phone .enpty-input').removeClass('hide');
|
|
|
if (finalReceiptMobile.length === 0) {
|
|
|
$('.invoice-phone .enpty-input').html(' 请填写手机号码');
|
|
|
} else {
|
|
|
$('.invoice-phone .enpty-input').html(' 手机号码不正确');
|
|
|
}
|
|
|
passInfoVerify = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!passInfoVerify) {
|
|
|
return;
|
|
|
} else {
|
|
|
$('.invoice-title .enpty-input').addClass('hide');
|
|
|
$('.invoice-phone .enpty-input').addClass('hide');
|
|
|
if (receiptTitle === "单位") {
|
|
|
receiptTitle = $('#input-organization-name').val();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
receiptContent = $('input[name="content"]:checked').val();
|
|
|
receiptTypeID = $('input[name="content"]:checked').data('receiptid');
|
|
|
|
|
|
$('.invoice-type').html(receiptType);
|
|
|
$('.invoice-partment').html(receiptTitle);
|
|
|
$('.invoice-kind').html(receiptContent);
|
|
|
|
|
|
$('.invoice-upload-type').html(invoiceTypeInt);
|
|
|
$('.invoice-upload-content').html(receiptTypeID);
|
|
|
$('.invoice-upload-mobile').html(finalReceiptMobile);
|
|
|
$('.invoice-upload-title').html(receiptTitle);
|
|
|
|
|
|
$receiptInfo.addClass('hide');
|
|
|
$('.invoice-content').removeClass('hide');
|
|
|
}
|
|
|
$receiptInfoSaveBtn.click(function(){
|
|
|
saveReceiptInfo();
|
|
|
});
|
|
|
|
|
|
$receiptInfoCancelBtn.click(function(){
|
|
|
$receiptInfo.addClass('hide');
|
|
|
|
|
|
if ($('.invoice-content').hasClass('hide')) {
|
|
|
$invoiceCheck.removeAttr('checked');
|
|
|
$invoiceCheck.removeClass('active');
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$('.revise').click(function(){
|
|
|
$receiptInfo.removeClass('hide');
|
|
|
});
|
|
|
|
|
|
$eReceiptBtn.click(function(){
|
|
|
$eReceiptBtn.addClass('receipt-type-selected');
|
|
|
$paperReceiptBtn.removeClass('receipt-type-selected');
|
|
|
$('.e-receipt-desc').removeClass('hide');
|
|
|
});
|
|
|
|
|
|
$paperReceiptBtn.click(function(){
|
|
|
$paperReceiptBtn.addClass('receipt-type-selected');
|
|
|
$eReceiptBtn.removeClass('receipt-type-selected');
|
|
|
$('.e-receipt-desc').addClass('hide');
|
|
|
});
|
|
|
|
|
|
$('.invoice-title').change(function(){
|
|
|
var selectType = $('input[name="title"]:checked').val();
|
|
|
if (selectType === "1") {
|
|
|
receiptTitle = "个人";
|
|
|
$('.invoice-title').addClass('invoice-title-personal-hight');
|
|
|
$('.invoice-title .input-line').addClass('hide');
|
|
|
} else {
|
|
|
receiptTitle = "单位";
|
|
|
$('.invoice-title').removeClass('invoice-title-personal-hight');
|
|
|
$('.invoice-title .input-line').removeClass('hide');
|
|
|
}
|
|
|
})
|
|
|
|
|
|
$('#input-organization-name').bind('input propertychange', function() {
|
|
|
if ($(this).val().length >= 1) {
|
|
|
$('.invoice-title .enpty-input').addClass('hide');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$('#input-mobile').bind('input propertychange', function() {
|
|
|
if ($(this).val().length >= 1) {
|
|
|
$('.invoice-phone .enpty-input').addClass('hide');
|
|
|
}
|
|
|
}); |
...
|
...
|
|