Authored by 李靖

开发完成

... ... @@ -202,13 +202,17 @@ exports.orderSub = (req, res, next) => {
let invoices = {};
if (orderInfo && orderInfo.invoice) {
let invoices_title_personal = orderInfo.invoices_title_personal ? orderInfo.invoices_title_personal : '个人';
invoices = {
invoices_type_id: 12, // 发票类型写死【明细】
invoices_type: orderInfo.invoices_type, // 区分电子发票还是纸质发票
receiverMobile: orderInfo.receiverMobile, // 电话
invoices_title: orderInfo.invoices_title ? orderInfo.invoices_title : '个人' // 发票抬头,没有是个人
invoices_title: orderInfo.invoices_title ? orderInfo.invoices_title : invoices_title_personal
};
console.log(invoices);
// 购买方纳税人识别号
if (orderInfo.buyerTaxNumber) {
invoices.buyerTaxNumber = orderInfo.buyerTaxNumber;
... ...
... ... @@ -6,6 +6,7 @@ const crypto = global.yoho.crypto;
const processInvoiceData = (orderInfo, mobile, addresslist) => {
let invoices_title = false;
let invoices_title_personal = false;
let invoices_type = '2';
let addressId = orderInfo.addressId &&
parseInt(crypto.encryption('', orderInfo.addressId), 10) || 0;
... ... @@ -28,13 +29,15 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => {
invoices_type = orderInfo.invoices_type * 1;
}
invoices_title_personal = orderInfo.invoices_title_personal || '个人(可修改)';
let isCompany = invoices_title && invoices_title !== '个人';
return {
phone: mobile ? mobile : '',
completeTel: mobile,
isCompany: isCompany,
companyName: isCompany ? invoices_title : '个人(不可修改)',
companyName: isCompany ? invoices_title : invoices_title_personal,
buyerTaxNumber: orderInfo.buyerTaxNumber,
isPaper: invoices_type === 1,
invoicesType: [
... ...
... ... @@ -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"{{#unless isCompany}} disabled{{/unless}}></li>
<input type="text" name="company" class="company" value="{{companyName}}" placeholder="请输入个人/单位名称" maxlength="30"></li>
<li class="tax-number"{{#unless isCompany}} style="display: none;"{{/unless}}>
<span class="title">税号</span>
<input type="text" id="buyerTaxNumber" name="buyerTaxNumber" class="number" value="{{buyerTaxNumber}}" placeholder="请输入正确的纳税人识别号" maxlength="30">
... ...
... ... @@ -106,11 +106,11 @@ function confirmAction() {
tip.show('请输入正确手机号');
$tel.focus();
return false;
} else if (title === '单位' && company.length === 0) {
} else if (company.length === 0) {
tip.show('请填写发票抬头');
$company.focus();
return false;
} else if (title === '单位' && company.length > 30) {
} else if (company.length > 30) {
tip.show('发票抬头不得超过30个汉字');
$company.focus();
return false;
... ... @@ -128,6 +128,7 @@ function confirmAction() {
}, function() {
orderInfo('invoices_type', eInvoiceType);
orderInfo('invoices_title', title === '单位' ? company : '');
orderInfo('invoices_title_personal', title === '个人' ? company : '');
orderInfo('receiverMobile', tel);
orderInfo('buyerTaxNumber', title === '单位' ? buyerTaxNumber : '');
... ... @@ -163,8 +164,7 @@ $('.invoice-top span, .invoice-cont li').not('.invoice-cont .cont-title').on('to
}
if ($(this).text() === '个人') {
$company.val('个人(不可修改)');
$company.attr('disabled', 'true');
$company.val('');
$taxNumber.slideUp();
}
switchBtnStatus();
... ...
... ... @@ -106,11 +106,11 @@ function confirmAction() {
tip.show('请输入正确手机号');
$tel.focus();
return false;
} else if (title === '单位' && company.length === 0) {
} else if (company.length === 0) {
tip.show('请填写发票抬头');
$company.focus();
return false;
} else if (title === '单位' && company.length > 30) {
} else if (company.length > 30) {
tip.show('发票抬头不得超过30个汉字');
$company.focus();
return false;
... ... @@ -128,6 +128,7 @@ function confirmAction() {
}, function() {
orderInfo('invoices_type', eInvoiceType);
orderInfo('invoices_title', title === '单位' ? company : '');
orderInfo('invoices_title_personal', title === '个人' ? company : '');
orderInfo('receiverMobile', tel);
orderInfo('buyerTaxNumber', title === '单位' ? buyerTaxNumber : '');
... ... @@ -163,8 +164,7 @@ $('.invoice-top span, .invoice-cont li').not('.invoice-cont .cont-title').on('to
}
if ($(this).text() === '个人') {
$company.val('个人(不可修改)');
$company.attr('disabled', 'true');
$company.val('');
$taxNumber.slideUp();
}
switchBtnStatus();
... ...
... ... @@ -266,7 +266,8 @@ function tranformPayment(data, orderInfo, cartType, skuList, orderComputeData) {
result.invoiceText = `电子发票(${orderInfo.invoices_title})`;
} else {
result.invoiceText = '电子发票(个人)';
result.invoiceText = orderInfo.invoices_title_personal ?
`电子发票(${orderInfo.invoices_title_personal})` : '电子发票(个人)';
}
}
}
... ...