Authored by yyq

option

@@ -367,15 +367,24 @@ module.exports = class extends global.yoho.BaseModel { @@ -367,15 +367,24 @@ module.exports = class extends global.yoho.BaseModel {
367 newOrder.time = _.get(order, 'create_time'); 367 newOrder.time = _.get(order, 'create_time');
368 newOrder.payType = _.get(order, 'payment_type'); 368 newOrder.payType = _.get(order, 'payment_type');
369 newOrder.title = _.get(order, 'order_title'); 369 newOrder.title = _.get(order, 'order_title');
370 - newOrder.invoiceType = '';  
371 370
372 - let issueType = +_.get(order, 'invoice.issueType'); 371 + // 补开发票订单
  372 + if (type === 8) {
  373 + let iop = _.get(order, 'links', []);
  374 + let issueType = +_.get(order, 'invoice.issueType');
373 375
374 - newOrder.issueType = issueType === 2;  
375 - newOrder.invoiceSupplying = issueType === 1; 376 + newOrder.invoiceType = '';
  377 + newOrder.issueType = issueType === 2;
  378 + newOrder.invoiceOperation = _.zipObject(iop, iop);
376 379
377 - if (newOrder.issueType) {  
378 - newOrder.invoiceType = _.get(order, 'invoice.type', 0) === 2 ? '电子发票' : '纸质发票'; 380 + if (!newOrder.invoiceOperation || (!newOrder.invoiceOperation.invoiceDetail &&
  381 + !newOrder.invoiceOperation.supplyInvoice)) {
  382 + _.set(newOrder, 'invoiceOperation.invoiceSupplying', issueType === 1);
  383 + }
  384 +
  385 + if (newOrder.issueType) {
  386 + newOrder.invoiceType = _.get(order, 'invoice.type', 0) === 2 ? '电子发票' : '纸质发票';
  387 + }
379 } 388 }
380 389
381 if (order.is_cancel === 'Y' || order.status === 6) { 390 if (order.is_cancel === 'Y' || order.status === 6) {
@@ -94,15 +94,19 @@ @@ -94,15 +94,19 @@
94 <span class="no-pay">{{#if issueType}}已开票{{^}}未开票{{/if}}</span> 94 <span class="no-pay">{{#if issueType}}已开票{{^}}未开票{{/if}}</span>
95 </div> 95 </div>
96 <div class="operation"> 96 <div class="operation">
97 - {{#if issueType}}  
98 - <span class="op-item view-invoice" data-id="{{orderNum}}">查看发票</span>  
99 - {{^}} 97 + {{# invoiceOperation}}
  98 + {{#if invoiceDetail}}
  99 + <span class="op-item view-invoice" data-id="{{../orderNum}}">查看发票</span>
  100 + {{/if}}
  101 +
100 {{#if invoiceSupplying}} 102 {{#if invoiceSupplying}}
101 - <span class="op-item on-invoice" data-id="{{orderNum}}">开票中</span>  
102 - {{^}}  
103 - <span class="op-item supply-invoice" data-id="{{orderNum}}">申请补开</span> 103 + <span class="op-item on-invoice" data-id="{{../orderNum}}">开票中</span>
  104 + {{/if}}
  105 +
  106 + {{#if supplyInvoice}}
  107 + <span class="op-item supply-invoice" data-id="{{../orderNum}}">申请补开</span>
104 {{/if}} 108 {{/if}}
105 - {{/if}} 109 + {{/ invoiceOperation}}
106 </div> 110 </div>
107 </div> 111 </div>
108 </div> 112 </div>