Authored by 李靖

开发完成

@@ -202,13 +202,17 @@ exports.orderSub = (req, res, next) => { @@ -202,13 +202,17 @@ exports.orderSub = (req, res, next) => {
202 let invoices = {}; 202 let invoices = {};
203 203
204 if (orderInfo && orderInfo.invoice) { 204 if (orderInfo && orderInfo.invoice) {
  205 + let invoices_title_personal = orderInfo.invoices_title_personal ? orderInfo.invoices_title_personal : '个人';
  206 +
205 invoices = { 207 invoices = {
206 invoices_type_id: 12, // 发票类型写死【明细】 208 invoices_type_id: 12, // 发票类型写死【明细】
207 invoices_type: orderInfo.invoices_type, // 区分电子发票还是纸质发票 209 invoices_type: orderInfo.invoices_type, // 区分电子发票还是纸质发票
208 receiverMobile: orderInfo.receiverMobile, // 电话 210 receiverMobile: orderInfo.receiverMobile, // 电话
209 - invoices_title: orderInfo.invoices_title ? orderInfo.invoices_title : '个人' // 发票抬头,没有是个人 211 + invoices_title: orderInfo.invoices_title ? orderInfo.invoices_title : invoices_title_personal
210 }; 212 };
211 213
  214 + console.log(invoices);
  215 +
212 // 购买方纳税人识别号 216 // 购买方纳税人识别号
213 if (orderInfo.buyerTaxNumber) { 217 if (orderInfo.buyerTaxNumber) {
214 invoices.buyerTaxNumber = orderInfo.buyerTaxNumber; 218 invoices.buyerTaxNumber = orderInfo.buyerTaxNumber;
@@ -6,6 +6,7 @@ const crypto = global.yoho.crypto; @@ -6,6 +6,7 @@ const crypto = global.yoho.crypto;
6 6
7 const processInvoiceData = (orderInfo, mobile, addresslist) => { 7 const processInvoiceData = (orderInfo, mobile, addresslist) => {
8 let invoices_title = false; 8 let invoices_title = false;
  9 + let invoices_title_personal = false;
9 let invoices_type = '2'; 10 let invoices_type = '2';
10 let addressId = orderInfo.addressId && 11 let addressId = orderInfo.addressId &&
11 parseInt(crypto.encryption('', orderInfo.addressId), 10) || 0; 12 parseInt(crypto.encryption('', orderInfo.addressId), 10) || 0;
@@ -28,13 +29,15 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => { @@ -28,13 +29,15 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => {
28 invoices_type = orderInfo.invoices_type * 1; 29 invoices_type = orderInfo.invoices_type * 1;
29 } 30 }
30 31
  32 + invoices_title_personal = orderInfo.invoices_title_personal || '个人(可修改)';
  33 +
31 let isCompany = invoices_title && invoices_title !== '个人'; 34 let isCompany = invoices_title && invoices_title !== '个人';
32 35
33 return { 36 return {
34 phone: mobile ? mobile : '', 37 phone: mobile ? mobile : '',
35 completeTel: mobile, 38 completeTel: mobile,
36 isCompany: isCompany, 39 isCompany: isCompany,
37 - companyName: isCompany ? invoices_title : '个人(不可修改)', 40 + companyName: isCompany ? invoices_title : invoices_title_personal,
38 buyerTaxNumber: orderInfo.buyerTaxNumber, 41 buyerTaxNumber: orderInfo.buyerTaxNumber,
39 isPaper: invoices_type === 1, 42 isPaper: invoices_type === 1,
40 invoicesType: [ 43 invoicesType: [
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 </li> 21 </li>
22 <li class="company-area"> 22 <li class="company-area">
23 <span class="title">发票抬头</span> 23 <span class="title">发票抬头</span>
24 - <input type="text" name="company" class="company" value="{{companyName}}" placeholder="请输入单位名称" maxlength="30"{{#unless isCompany}} disabled{{/unless}}></li> 24 + <input type="text" name="company" class="company" value="{{companyName}}" placeholder="请输入个人/单位名称" maxlength="30"></li>
25 <li class="tax-number"{{#unless isCompany}} style="display: none;"{{/unless}}> 25 <li class="tax-number"{{#unless isCompany}} style="display: none;"{{/unless}}>
26 <span class="title">税号</span> 26 <span class="title">税号</span>
27 <input type="text" id="buyerTaxNumber" name="buyerTaxNumber" class="number" value="{{buyerTaxNumber}}" placeholder="请输入正确的纳税人识别号" maxlength="30"> 27 <input type="text" id="buyerTaxNumber" name="buyerTaxNumber" class="number" value="{{buyerTaxNumber}}" placeholder="请输入正确的纳税人识别号" maxlength="30">
@@ -106,11 +106,11 @@ function confirmAction() { @@ -106,11 +106,11 @@ function confirmAction() {
106 tip.show('请输入正确手机号'); 106 tip.show('请输入正确手机号');
107 $tel.focus(); 107 $tel.focus();
108 return false; 108 return false;
109 - } else if (title === '单位' && company.length === 0) { 109 + } else if (company.length === 0) {
110 tip.show('请填写发票抬头'); 110 tip.show('请填写发票抬头');
111 $company.focus(); 111 $company.focus();
112 return false; 112 return false;
113 - } else if (title === '单位' && company.length > 30) { 113 + } else if (company.length > 30) {
114 tip.show('发票抬头不得超过30个汉字'); 114 tip.show('发票抬头不得超过30个汉字');
115 $company.focus(); 115 $company.focus();
116 return false; 116 return false;
@@ -128,6 +128,7 @@ function confirmAction() { @@ -128,6 +128,7 @@ function confirmAction() {
128 }, function() { 128 }, function() {
129 orderInfo('invoices_type', eInvoiceType); 129 orderInfo('invoices_type', eInvoiceType);
130 orderInfo('invoices_title', title === '单位' ? company : ''); 130 orderInfo('invoices_title', title === '单位' ? company : '');
  131 + orderInfo('invoices_title_personal', title === '个人' ? company : '');
131 orderInfo('receiverMobile', tel); 132 orderInfo('receiverMobile', tel);
132 orderInfo('buyerTaxNumber', title === '单位' ? buyerTaxNumber : ''); 133 orderInfo('buyerTaxNumber', title === '单位' ? buyerTaxNumber : '');
133 134
@@ -163,8 +164,7 @@ $('.invoice-top span, .invoice-cont li').not('.invoice-cont .cont-title').on('to @@ -163,8 +164,7 @@ $('.invoice-top span, .invoice-cont li').not('.invoice-cont .cont-title').on('to
163 } 164 }
164 165
165 if ($(this).text() === '个人') { 166 if ($(this).text() === '个人') {
166 - $company.val('个人(不可修改)');  
167 - $company.attr('disabled', 'true'); 167 + $company.val('');
168 $taxNumber.slideUp(); 168 $taxNumber.slideUp();
169 } 169 }
170 switchBtnStatus(); 170 switchBtnStatus();
@@ -106,11 +106,11 @@ function confirmAction() { @@ -106,11 +106,11 @@ function confirmAction() {
106 tip.show('请输入正确手机号'); 106 tip.show('请输入正确手机号');
107 $tel.focus(); 107 $tel.focus();
108 return false; 108 return false;
109 - } else if (title === '单位' && company.length === 0) { 109 + } else if (company.length === 0) {
110 tip.show('请填写发票抬头'); 110 tip.show('请填写发票抬头');
111 $company.focus(); 111 $company.focus();
112 return false; 112 return false;
113 - } else if (title === '单位' && company.length > 30) { 113 + } else if (company.length > 30) {
114 tip.show('发票抬头不得超过30个汉字'); 114 tip.show('发票抬头不得超过30个汉字');
115 $company.focus(); 115 $company.focus();
116 return false; 116 return false;
@@ -128,6 +128,7 @@ function confirmAction() { @@ -128,6 +128,7 @@ function confirmAction() {
128 }, function() { 128 }, function() {
129 orderInfo('invoices_type', eInvoiceType); 129 orderInfo('invoices_type', eInvoiceType);
130 orderInfo('invoices_title', title === '单位' ? company : ''); 130 orderInfo('invoices_title', title === '单位' ? company : '');
  131 + orderInfo('invoices_title_personal', title === '个人' ? company : '');
131 orderInfo('receiverMobile', tel); 132 orderInfo('receiverMobile', tel);
132 orderInfo('buyerTaxNumber', title === '单位' ? buyerTaxNumber : ''); 133 orderInfo('buyerTaxNumber', title === '单位' ? buyerTaxNumber : '');
133 134
@@ -163,8 +164,7 @@ $('.invoice-top span, .invoice-cont li').not('.invoice-cont .cont-title').on('to @@ -163,8 +164,7 @@ $('.invoice-top span, .invoice-cont li').not('.invoice-cont .cont-title').on('to
163 } 164 }
164 165
165 if ($(this).text() === '个人') { 166 if ($(this).text() === '个人') {
166 - $company.val('个人(不可修改)');  
167 - $company.attr('disabled', 'true'); 167 + $company.val('');
168 $taxNumber.slideUp(); 168 $taxNumber.slideUp();
169 } 169 }
170 switchBtnStatus(); 170 switchBtnStatus();
@@ -266,7 +266,8 @@ function tranformPayment(data, orderInfo, cartType, skuList, orderComputeData) { @@ -266,7 +266,8 @@ function tranformPayment(data, orderInfo, cartType, skuList, orderComputeData) {
266 266
267 result.invoiceText = `电子发票(${orderInfo.invoices_title})`; 267 result.invoiceText = `电子发票(${orderInfo.invoices_title})`;
268 } else { 268 } else {
269 - result.invoiceText = '电子发票(个人)'; 269 + result.invoiceText = orderInfo.invoices_title_personal ?
  270 + `电子发票(${orderInfo.invoices_title_personal})` : '电子发票(个人)';
270 } 271 }
271 } 272 }
272 } 273 }