Showing
6 changed files
with
47 additions
and
43 deletions
@@ -201,19 +201,17 @@ exports.orderSub = (req, res, next) => { | @@ -201,19 +201,17 @@ exports.orderSub = (req, res, next) => { | ||
201 | // 电子发票信息数组 | 201 | // 电子发票信息数组 |
202 | let invoices = {}; | 202 | let invoices = {}; |
203 | 203 | ||
204 | - if (orderInfo) { | 204 | + if (orderInfo && orderInfo.invoice) { |
205 | invoices = { | 205 | invoices = { |
206 | invoices_type_id: 12, // 发票类型写死【明细】 | 206 | invoices_type_id: 12, // 发票类型写死【明细】 |
207 | - invoices_type: orderInfo.invoicesType, // 区分电子发票还是纸质发票 | 207 | + invoices_type: orderInfo.invoices_type, // 区分电子发票还是纸质发票 |
208 | receiverMobile: orderInfo.receiverMobile, // 电话 | 208 | receiverMobile: orderInfo.receiverMobile, // 电话 |
209 | - invoices_title: orderInfo.invoiceText ? orderInfo.invoiceText : '个人' // 发票抬头 | 209 | + invoices_title: orderInfo.invoices_title ? orderInfo.invoices_title : '个人' // 发票抬头,没有是个人 |
210 | }; | 210 | }; |
211 | 211 | ||
212 | // 购买方纳税人识别号 | 212 | // 购买方纳税人识别号 |
213 | if (orderInfo.buyerTaxNumber) { | 213 | if (orderInfo.buyerTaxNumber) { |
214 | - _.assign(invoices, { | ||
215 | - buyerTaxNumber: orderInfo.buyerTaxNumber | ||
216 | - }); | 214 | + invoices.buyerTaxNumber = orderInfo.buyerTaxNumber; |
217 | } | 215 | } |
218 | } | 216 | } |
219 | 217 |
@@ -7,7 +7,6 @@ const crypto = global.yoho.crypto; | @@ -7,7 +7,6 @@ const crypto = global.yoho.crypto; | ||
7 | const processInvoiceData = (orderInfo, mobile, addresslist) => { | 7 | const processInvoiceData = (orderInfo, mobile, addresslist) => { |
8 | let invoices_title = ''; | 8 | let invoices_title = ''; |
9 | let invoices_type = '2'; | 9 | let invoices_type = '2'; |
10 | - let invoice_Top = '个人'; | ||
11 | let addressId = orderInfo.addressId && | 10 | let addressId = orderInfo.addressId && |
12 | parseInt(crypto.encryption('', orderInfo.addressId), 10) || 0; | 11 | parseInt(crypto.encryption('', orderInfo.addressId), 10) || 0; |
13 | 12 | ||
@@ -24,17 +23,17 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => { | @@ -24,17 +23,17 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => { | ||
24 | } | 23 | } |
25 | 24 | ||
26 | // 发票信息处理 | 25 | // 发票信息处理 |
27 | - if (orderInfo.invoiceType && orderInfo.invoiceTitle) { | ||
28 | - invoices_title = orderInfo.invoiceText; | ||
29 | - invoices_type = orderInfo.invoicesType * 1; | ||
30 | - invoice_Top = orderInfo.invoiceTitle; | 26 | + if (orderInfo.invoiceType && orderInfo.invoices_title) { |
27 | + invoices_title = orderInfo.invoices_title; | ||
28 | + invoices_type = orderInfo.invoices_type * 1; | ||
31 | } | 29 | } |
32 | 30 | ||
33 | return { | 31 | return { |
34 | - phone: mobile ? mobile : '', // TODO 字符串替换 **** | 32 | + phone: mobile ? mobile : '', |
35 | completeTel: mobile, | 33 | completeTel: mobile, |
36 | - isCompany: invoice_Top !== '单位', | ||
37 | - companyName: invoices_title, | 34 | + isCompany: invoices_title !== '个人', |
35 | + companyName: invoices_title === '个人' ? '个人(不可修改)' : invoices_title, | ||
36 | + buyerTaxNumber: orderInfo.buyerTaxNumber, | ||
38 | isPaper: invoices_type === 1, | 37 | isPaper: invoices_type === 1, |
39 | invoicesType: [ | 38 | invoicesType: [ |
40 | { | 39 | { |
@@ -45,11 +44,11 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => { | @@ -45,11 +44,11 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => { | ||
45 | invoiceTitle: [ | 44 | invoiceTitle: [ |
46 | { | 45 | { |
47 | type: '个人', | 46 | type: '个人', |
48 | - choosed: invoice_Top === '个人' | 47 | + choosed: invoices_title === '个人' |
49 | }, | 48 | }, |
50 | { | 49 | { |
51 | type: '单位', | 50 | type: '单位', |
52 | - choosed: invoice_Top === '单位' | 51 | + choosed: invoices_title !== '个人' |
53 | } | 52 | } |
54 | ] | 53 | ] |
55 | }; | 54 | }; |
@@ -21,10 +21,10 @@ | @@ -21,10 +21,10 @@ | ||
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="个人(不可修改)" placeholder="请输入单位名称" maxlength="30" disabled></li> | ||
25 | - <li class="tax-number" {{#isCompany}}style="display: none;"{{/isCompany}}> | 24 | + <input type="text" name="company" class="company" value="{{companyName}}" placeholder="请输入单位名称" maxlength="30"{{#unless isCompany}} disabled{{/unless}}></li> |
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="{{taxNumber}}" placeholder="请输入正确的纳税人识别号" maxlength="30"> | 27 | + <input type="text" id="buyerTaxNumber" name="buyerTaxNumber" class="number" value="{{buyerTaxNumber}}" placeholder="请输入正确的纳税人识别号" maxlength="30"> |
28 | </li> | 28 | </li> |
29 | </section> | 29 | </section> |
30 | <header>收票人信息</header> | 30 | <header>收票人信息</header> |
@@ -213,8 +213,7 @@ function orderCompute() { | @@ -213,8 +213,7 @@ function orderCompute() { | ||
213 | } | 213 | } |
214 | 214 | ||
215 | function submitOrder() { | 215 | function submitOrder() { |
216 | - let invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'), | ||
217 | - msg = $('#msg').find('input').val() || orderInfo('msg'); | 216 | + let msg = $('#msg').find('input').val() || orderInfo('msg'); |
218 | 217 | ||
219 | if (isSubmiting) { | 218 | if (isSubmiting) { |
220 | return false; | 219 | return false; |
@@ -228,25 +227,35 @@ function submitOrder() { | @@ -228,25 +227,35 @@ function submitOrder() { | ||
228 | } | 227 | } |
229 | loading.showLoadingMask(); | 228 | loading.showLoadingMask(); |
230 | isSubmiting = true; | 229 | isSubmiting = true; |
230 | + | ||
231 | + let postData = { | ||
232 | + addressId: orderInfo('addressId'), | ||
233 | + cartType: orderInfo('cartType') || 'ordinary', | ||
234 | + deliveryId: orderInfo('deliveryId'), | ||
235 | + deliveryTimeId: orderInfo('deliveryTimeId'), | ||
236 | + msg: msg, | ||
237 | + isPrintPrice: orderInfo('isPrintPrice'), | ||
238 | + paymentTypeId: orderInfo('paymentTypeId'), | ||
239 | + paymentType: orderInfo('paymentType'), // 支付方式 | ||
240 | + couponCode: orderInfo('couponCode'), | ||
241 | + yohoCoin: orderInfo('yohoCoin'), | ||
242 | + skuList: isLimitGood() ? orderInfo('skuList') : void 0 | ||
243 | + }; | ||
244 | + | ||
245 | + if (orderInfo('invoice')) { | ||
246 | + Object.assign(postData, { | ||
247 | + invoice: orderInfo('invoice'), | ||
248 | + invoices_title: orderInfo('invoices_title'), // 发票抬头 | ||
249 | + invoices_type: orderInfo('invoices_type'), // 发票类型 1 纸质 2 电子 | ||
250 | + receiverMobile: orderInfo('receiverMobile'), // 接收人电话 | ||
251 | + buyerTaxNumber: orderInfo('buyerTaxNumber') // 购买方纳税人识别号,需要开具 | ||
252 | + }); | ||
253 | + } | ||
254 | + | ||
231 | $.ajax({ | 255 | $.ajax({ |
232 | method: 'POST', | 256 | method: 'POST', |
233 | url: '/cart/index/new/orderSub', | 257 | url: '/cart/index/new/orderSub', |
234 | - data: { | ||
235 | - addressId: orderInfo('addressId'), | ||
236 | - cartType: orderInfo('cartType') || 'ordinary', | ||
237 | - deliveryId: orderInfo('deliveryId'), | ||
238 | - deliveryTimeId: orderInfo('deliveryTimeId'), | ||
239 | - invoiceText: orderInfo('invoice') ? invoiceText : null, | ||
240 | - invoiceType: orderInfo('invoice') ? ($invoice.find('.invoice-type').val() || | ||
241 | - orderInfo('invoiceType')) : null, | ||
242 | - msg: msg, | ||
243 | - isPrintPrice: orderInfo('isPrintPrice'), | ||
244 | - paymentTypeId: orderInfo('paymentTypeId'), | ||
245 | - paymentType: orderInfo('paymentType'), // 支付方式 | ||
246 | - couponCode: orderInfo('couponCode'), | ||
247 | - yohoCoin: orderInfo('yohoCoin'), | ||
248 | - skuList: isLimitGood() ? orderInfo('skuList') : void 0 | ||
249 | - } | 258 | + data: postData |
250 | }).then(function(res) { | 259 | }).then(function(res) { |
251 | let url; | 260 | let url; |
252 | 261 |
@@ -22,9 +22,8 @@ function init() { | @@ -22,9 +22,8 @@ function init() { | ||
22 | couponCode: null, | 22 | couponCode: null, |
23 | couponName: null, | 23 | couponName: null, |
24 | invoice: null, | 24 | invoice: null, |
25 | - invoiceText: null, | ||
26 | - invoiceType: null, | ||
27 | - invoiceTitle: null, | 25 | + invoices_title: null, |
26 | + invoices_type: null, | ||
28 | receiverMobile: null, | 27 | receiverMobile: null, |
29 | isModifyTel: false, | 28 | isModifyTel: false, |
30 | invoicesType: null, | 29 | invoicesType: null, |
@@ -121,10 +121,9 @@ function confirmAction() { | @@ -121,10 +121,9 @@ function confirmAction() { | ||
121 | rightBtnText: '确定' | 121 | rightBtnText: '确定' |
122 | } | 122 | } |
123 | }, function() { | 123 | }, function() { |
124 | - orderInfo('invoiceText', (title === '单位' ? company : '')); | 124 | + orderInfo('invoices_type', eInvoiceType); |
125 | + orderInfo('invoices_title', company); | ||
125 | orderInfo('receiverMobile', tel); | 126 | orderInfo('receiverMobile', tel); |
126 | - orderInfo('invoicesType', eInvoiceType); | ||
127 | - orderInfo('invoiceTitle', title); | ||
128 | orderInfo('buyerTaxNumber', buyerTaxNumber); | 127 | orderInfo('buyerTaxNumber', buyerTaxNumber); |
129 | 128 | ||
130 | if (isModifyTel && $copyTel !== tel) { | 129 | if (isModifyTel && $copyTel !== tel) { |
-
Please register or login to post a comment