Authored by 郭成尧

invoices-modified

... ... @@ -201,19 +201,17 @@ exports.orderSub = (req, res, next) => {
// 电子发票信息数组
let invoices = {};
if (orderInfo) {
if (orderInfo && orderInfo.invoice) {
invoices = {
invoices_type_id: 12, // 发票类型写死【明细】
invoices_type: orderInfo.invoicesType, // 区分电子发票还是纸质发票
invoices_type: orderInfo.invoices_type, // 区分电子发票还是纸质发票
receiverMobile: orderInfo.receiverMobile, // 电话
invoices_title: orderInfo.invoiceText ? orderInfo.invoiceText : '个人' // 发票抬头
invoices_title: orderInfo.invoices_title ? orderInfo.invoices_title : '个人' // 发票抬头,没有是个人
};
// 购买方纳税人识别号
if (orderInfo.buyerTaxNumber) {
_.assign(invoices, {
buyerTaxNumber: orderInfo.buyerTaxNumber
});
invoices.buyerTaxNumber = orderInfo.buyerTaxNumber;
}
}
... ...
... ... @@ -7,7 +7,6 @@ const crypto = global.yoho.crypto;
const processInvoiceData = (orderInfo, mobile, addresslist) => {
let invoices_title = '';
let invoices_type = '2';
let invoice_Top = '个人';
let addressId = orderInfo.addressId &&
parseInt(crypto.encryption('', orderInfo.addressId), 10) || 0;
... ... @@ -24,17 +23,17 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => {
}
// 发票信息处理
if (orderInfo.invoiceType && orderInfo.invoiceTitle) {
invoices_title = orderInfo.invoiceText;
invoices_type = orderInfo.invoicesType * 1;
invoice_Top = orderInfo.invoiceTitle;
if (orderInfo.invoiceType && orderInfo.invoices_title) {
invoices_title = orderInfo.invoices_title;
invoices_type = orderInfo.invoices_type * 1;
}
return {
phone: mobile ? mobile : '', // TODO 字符串替换 ****
phone: mobile ? mobile : '',
completeTel: mobile,
isCompany: invoice_Top !== '单位',
companyName: invoices_title,
isCompany: invoices_title !== '个人',
companyName: invoices_title === '个人' ? '个人(不可修改)' : invoices_title,
buyerTaxNumber: orderInfo.buyerTaxNumber,
isPaper: invoices_type === 1,
invoicesType: [
{
... ... @@ -45,11 +44,11 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => {
invoiceTitle: [
{
type: '个人',
choosed: invoice_Top === '个人'
choosed: invoices_title === '个人'
},
{
type: '单位',
choosed: invoice_Top === '单位'
choosed: invoices_title !== '个人'
}
]
};
... ...
... ... @@ -21,10 +21,10 @@
</li>
<li class="company-area">
<span class="title">发票抬头</span>
<input type="text" name="company" class="company" value="个人(不可修改)" placeholder="请输入单位名称" maxlength="30" disabled></li>
<li class="tax-number" {{#isCompany}}style="display: none;"{{/isCompany}}>
<input type="text" name="company" class="company" value="{{companyName}}" placeholder="请输入单位名称" maxlength="30"{{#unless isCompany}} disabled{{/unless}}></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="{{taxNumber}}" placeholder="请输入正确的纳税人识别号" maxlength="30">
<input type="text" id="buyerTaxNumber" name="buyerTaxNumber" class="number" value="{{buyerTaxNumber}}" placeholder="请输入正确的纳税人识别号" maxlength="30">
</li>
</section>
<header>收票人信息</header>
... ...
... ... @@ -213,8 +213,7 @@ function orderCompute() {
}
function submitOrder() {
let invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
msg = $('#msg').find('input').val() || orderInfo('msg');
let msg = $('#msg').find('input').val() || orderInfo('msg');
if (isSubmiting) {
return false;
... ... @@ -228,25 +227,35 @@ function submitOrder() {
}
loading.showLoadingMask();
isSubmiting = true;
let postData = {
addressId: orderInfo('addressId'),
cartType: orderInfo('cartType') || 'ordinary',
deliveryId: orderInfo('deliveryId'),
deliveryTimeId: orderInfo('deliveryTimeId'),
msg: msg,
isPrintPrice: orderInfo('isPrintPrice'),
paymentTypeId: orderInfo('paymentTypeId'),
paymentType: orderInfo('paymentType'), // 支付方式
couponCode: orderInfo('couponCode'),
yohoCoin: orderInfo('yohoCoin'),
skuList: isLimitGood() ? orderInfo('skuList') : void 0
};
if (orderInfo('invoice')) {
Object.assign(postData, {
invoice: orderInfo('invoice'),
invoices_title: orderInfo('invoices_title'), // 发票抬头
invoices_type: orderInfo('invoices_type'), // 发票类型 1 纸质 2 电子
receiverMobile: orderInfo('receiverMobile'), // 接收人电话
buyerTaxNumber: orderInfo('buyerTaxNumber') // 购买方纳税人识别号,需要开具
});
}
$.ajax({
method: 'POST',
url: '/cart/index/new/orderSub',
data: {
addressId: orderInfo('addressId'),
cartType: orderInfo('cartType') || 'ordinary',
deliveryId: orderInfo('deliveryId'),
deliveryTimeId: orderInfo('deliveryTimeId'),
invoiceText: orderInfo('invoice') ? invoiceText : null,
invoiceType: orderInfo('invoice') ? ($invoice.find('.invoice-type').val() ||
orderInfo('invoiceType')) : null,
msg: msg,
isPrintPrice: orderInfo('isPrintPrice'),
paymentTypeId: orderInfo('paymentTypeId'),
paymentType: orderInfo('paymentType'), // 支付方式
couponCode: orderInfo('couponCode'),
yohoCoin: orderInfo('yohoCoin'),
skuList: isLimitGood() ? orderInfo('skuList') : void 0
}
data: postData
}).then(function(res) {
let url;
... ...
... ... @@ -22,9 +22,8 @@ function init() {
couponCode: null,
couponName: null,
invoice: null,
invoiceText: null,
invoiceType: null,
invoiceTitle: null,
invoices_title: null,
invoices_type: null,
receiverMobile: null,
isModifyTel: false,
invoicesType: null,
... ...
... ... @@ -121,10 +121,9 @@ function confirmAction() {
rightBtnText: '确定'
}
}, function() {
orderInfo('invoiceText', (title === '单位' ? company : ''));
orderInfo('invoices_type', eInvoiceType);
orderInfo('invoices_title', company);
orderInfo('receiverMobile', tel);
orderInfo('invoicesType', eInvoiceType);
orderInfo('invoiceTitle', title);
orderInfo('buyerTaxNumber', buyerTaxNumber);
if (isModifyTel && $copyTel !== tel) {
... ...