Authored by 毕凯

Merge remote-tracking branch 'origin/master' into release/6.0.2

... ... @@ -176,10 +176,22 @@ class BuyNowController {
// 是否开发票
if (req.body.invoice && req.body.invoice === 'true') {
let invoicePayableType = _.parseInt(req.body.invoice_payable_type);
let invoicesTitlePersonal = req.body.invoices_title_personal ? req.body.invoices_title_personal : '个人';
params.invoice = true;
params.invoices_type = req.body.invoices_type; // 发票类型:纸质 1,电子 2
params.invoices_title = req.body.invoices_title || '个人'; // 发票抬头,个人前端不传此值
params.receiverMobile = req.body.receiverMobile; // 接收人电话
params.invoice_payable_type = req.body.invoice_payable_type; // 区分个人或企业发票
if (invoicePayableType === 1) {
// 开个人发票
params.invoices_title = invoicesTitlePersonal;
} else {
// 开公司发票
params.invoices_title = req.body.invoices_title;
params.buyerTaxNumber = req.body.buyerTaxNumber;
}
// 购买方纳税人识别号
if (req.body.buyerTaxNumber) {
... ...
... ... @@ -202,18 +202,24 @@ exports.orderSub = (req, res, next) => {
// 电子发票信息数组
let invoices = {};
// 是否有发票数据
if (orderInfo && orderInfo.invoice) {
let invoices_title_personal = orderInfo.invoices_title_personal ? orderInfo.invoices_title_personal : '个人';
let invoicePayableType = _.parseInt(orderInfo.invoice_payable_type);
let invoicesTitlePersonal = 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_personal
invoice_payable_type: orderInfo.invoice_payable_type // 区分个人或企业发票
};
// 购买方纳税人识别号
if (orderInfo.buyerTaxNumber) {
if (invoicePayableType === 1) {
// 开个人发票
invoices.invoices_title = invoicesTitlePersonal;
} else {
// 开公司发票
invoices.invoices_title = orderInfo.invoices_title;
invoices.buyerTaxNumber = orderInfo.buyerTaxNumber;
}
}
... ...
... ... @@ -137,6 +137,11 @@ class BuyNowModel extends global.yoho.BaseModel {
finalParams.invoices_type = params.invoices_type;
}
// 发票类型:个人 1, 企业 2
if (params.invoice_payable_type) {
finalParams.invoice_payable_type = params.invoice_payable_type;
}
// 发票抬头
if (params.invoices_title) {
finalParams.invoices_title = params.invoices_title;
... ...
... ... @@ -185,6 +185,11 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime,
params.invoices_type = invoices.invoices_type;
}
// 发票类型:个人 1, 企业 2
if (invoices.invoice_payable_type) {
params.invoice_payable_type = invoices.invoice_payable_type;
}
// 收票人手机号码
if (invoices.receiverMobile) {
params.receiverMobile = invoices.receiverMobile;
... ...
{
"name": "m-yohobuy-node",
"version": "6.0.12",
"version": "6.0.13",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -275,9 +275,16 @@ function submitOrder() {
invoice: orderInfo('invoice'),
invoices_title: orderInfo('invoices_title'), // 发票抬头
invoices_type: orderInfo('invoices_type'), // 发票类型 1 纸质 2 电子
invoice_payable_type: orderInfo('invoice_payable_type'), // 发票类型 1 个人 2 企业
receiverMobile: orderInfo('receiverMobile'), // 接收人电话
buyerTaxNumber: orderInfo('buyerTaxNumber') // 购买方纳税人识别号,需要开具
});
if (orderInfo('invoices_title_personal')) {
Object.assign(postData, {
invoices_title_personal: orderInfo('invoices_title_personal')
});
}
}
$.ajax({
... ...
... ... @@ -127,10 +127,18 @@ 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 : '');
if (title === '单位') {
orderInfo('invoice_payable_type', 2);
orderInfo('invoices_title', company);
orderInfo('invoices_title_personal', null);
orderInfo('buyerTaxNumber', buyerTaxNumber);
} else {
orderInfo('invoice_payable_type', 1);
orderInfo('invoices_title', null);
orderInfo('invoices_title_personal', company);
}
if (isModifyTel && $copyTel !== tel) {
orderInfo('isModifyTel', true);
... ...
... ... @@ -2,7 +2,6 @@
* @Author: Targaryen
* @Date: 2017-06-22 13:51:16
* @Last Modified by: Targaryen
* @Last Modified time: 2017-06-26 17:47:49
*/
require('common');
let info = window.cookie('buynow_info');
... ...
... ... @@ -127,10 +127,18 @@ 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 : '');
if (title === '单位') {
orderInfo('invoice_payable_type', 2);
orderInfo('invoices_title', company);
orderInfo('invoices_title_personal', null);
orderInfo('buyerTaxNumber', buyerTaxNumber);
} else {
orderInfo('invoice_payable_type', 1);
orderInfo('invoices_title', null);
orderInfo('invoices_title_personal', company);
}
if (isModifyTel && $copyTel !== tel) {
orderInfo('isModifyTel', true);
... ...