Authored by 郭成尧

invoice-modified

@@ -5,7 +5,7 @@ const _ = require('lodash'); @@ -5,7 +5,7 @@ const _ = require('lodash');
5 const crypto = global.yoho.crypto; 5 const crypto = global.yoho.crypto;
6 6
7 const processInvoiceData = (orderInfo, mobile, addresslist) => { 7 const processInvoiceData = (orderInfo, mobile, addresslist) => {
8 - let invoices_title = ''; 8 + let invoices_title = false;
9 let invoices_type = '2'; 9 let invoices_type = '2';
10 let addressId = orderInfo.addressId && 10 let addressId = orderInfo.addressId &&
11 parseInt(crypto.encryption('', orderInfo.addressId), 10) || 0; 11 parseInt(crypto.encryption('', orderInfo.addressId), 10) || 0;
@@ -23,16 +23,18 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => { @@ -23,16 +23,18 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => {
23 } 23 }
24 24
25 // 发票信息处理 25 // 发票信息处理
26 - if (orderInfo.invoiceType && orderInfo.invoices_title) { 26 + if (orderInfo.invoices_type && orderInfo.invoices_title) {
27 invoices_title = orderInfo.invoices_title; 27 invoices_title = orderInfo.invoices_title;
28 invoices_type = orderInfo.invoices_type * 1; 28 invoices_type = orderInfo.invoices_type * 1;
29 } 29 }
30 30
  31 + let isCompany = invoices_title && invoices_title !== '个人';
  32 +
31 return { 33 return {
32 phone: mobile ? mobile : '', 34 phone: mobile ? mobile : '',
33 completeTel: mobile, 35 completeTel: mobile,
34 - isCompany: invoices_title !== '个人',  
35 - companyName: invoices_title === '个人' ? '个人(不可修改)' : invoices_title, 36 + isCompany: isCompany,
  37 + companyName: isCompany ? invoices_title : '个人(不可修改)',
36 buyerTaxNumber: orderInfo.buyerTaxNumber, 38 buyerTaxNumber: orderInfo.buyerTaxNumber,
37 isPaper: invoices_type === 1, 39 isPaper: invoices_type === 1,
38 invoicesType: [ 40 invoicesType: [
@@ -44,11 +46,11 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => { @@ -44,11 +46,11 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => {
44 invoiceTitle: [ 46 invoiceTitle: [
45 { 47 {
46 type: '个人', 48 type: '个人',
47 - choosed: invoices_title === '个人' 49 + choosed: !isCompany
48 }, 50 },
49 { 51 {
50 type: '单位', 52 type: '单位',
51 - choosed: invoices_title !== '个人' 53 + choosed: isCompany
52 } 54 }
53 ] 55 ]
54 }; 56 };
@@ -122,9 +122,9 @@ function confirmAction() { @@ -122,9 +122,9 @@ function confirmAction() {
122 } 122 }
123 }, function() { 123 }, function() {
124 orderInfo('invoices_type', eInvoiceType); 124 orderInfo('invoices_type', eInvoiceType);
125 - orderInfo('invoices_title', company); 125 + orderInfo('invoices_title', title === '单位' ? company : '');
126 orderInfo('receiverMobile', tel); 126 orderInfo('receiverMobile', tel);
127 - orderInfo('buyerTaxNumber', buyerTaxNumber); 127 + orderInfo('buyerTaxNumber', title === '单位' ? buyerTaxNumber : '');
128 128
129 if (isModifyTel && $copyTel !== tel) { 129 if (isModifyTel && $copyTel !== tel) {
130 orderInfo('isModifyTel', true); 130 orderInfo('isModifyTel', true);