Authored by 郭成尧

Merge branch 'featrue/invoice' into release/6.0.2

@@ -210,14 +210,24 @@ exports.submit = (req, res, next) => { @@ -210,14 +210,24 @@ exports.submit = (req, res, next) => {
210 }; 210 };
211 211
212 if (req.body.invoice === 'true') { 212 if (req.body.invoice === 'true') {
  213 + let invoicesTitlePersonal = req.body.invoices_title_personal ? req.body.invoices_title_personal : '个人';
  214 + let invoicePayableType = _.parseInt(req.body.invoice_payable_type);
  215 +
213 _.assign(options, { 216 _.assign(options, {
214 - invoices_title: req.body.invoices_title || '个人',  
215 invoices_type: 2, 217 invoices_type: 2,
216 invoices_type_id: 12, 218 invoices_type_id: 12,
217 - invoice_payable_type: req.body.invoice_payable_type || 1, 219 + invoice_payable_type: invoicePayableType,
218 receiverMobile: req.body.receiverMobile || '', 220 receiverMobile: req.body.receiverMobile || '',
219 - buyerTaxNumber: req.body.buyerTaxNumber || ''  
220 }); 221 });
  222 +
  223 + if (invoicePayableType === 1) {
  224 + // 开个人发票
  225 + options.invoices_title = invoicesTitlePersonal;
  226 + } else {
  227 + // 开公司发票
  228 + options.invoices_title = req.body.invoices_title;
  229 + options.buyerTaxNumber = req.body.buyerTaxNumber;
  230 + }
221 } 231 }
222 232
223 return seckillModel.submit(options) 233 return seckillModel.submit(options)
@@ -231,9 +231,16 @@ function submitOrder() { @@ -231,9 +231,16 @@ function submitOrder() {
231 invoice: orderInfo('invoice'), 231 invoice: orderInfo('invoice'),
232 invoices_title: orderInfo('invoices_title'), // 发票抬头 232 invoices_title: orderInfo('invoices_title'), // 发票抬头
233 invoices_type: orderInfo('invoices_type'), // 发票类型 1 纸质 2 电子 233 invoices_type: orderInfo('invoices_type'), // 发票类型 1 纸质 2 电子
  234 + invoice_payable_type: orderInfo('invoice_payable_type'), // 发票抬头类型 1:个人,2:企业
234 receiverMobile: orderInfo('receiverMobile'), // 接收人电话 235 receiverMobile: orderInfo('receiverMobile'), // 接收人电话
235 buyerTaxNumber: orderInfo('buyerTaxNumber') // 购买方纳税人识别号,需要开具 236 buyerTaxNumber: orderInfo('buyerTaxNumber') // 购买方纳税人识别号,需要开具
236 }); 237 });
  238 +
  239 + if (orderInfo('invoices_title_personal')) {
  240 + Object.assign(postData, {
  241 + invoices_title_personal: orderInfo('invoices_title_personal')
  242 + });
  243 + }
237 } 244 }
238 245
239 $.ajax({ 246 $.ajax({