Authored by yyq

option

@@ -367,16 +367,25 @@ module.exports = class extends global.yoho.BaseModel { @@ -367,16 +367,25 @@ 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
  371 + // 补开发票订单
  372 + if (type === 8) {
  373 + let iop = _.get(order, 'links', []);
372 let issueType = +_.get(order, 'invoice.issueType'); 374 let issueType = +_.get(order, 'invoice.issueType');
373 375
  376 + newOrder.invoiceType = '';
374 newOrder.issueType = issueType === 2; 377 newOrder.issueType = issueType === 2;
375 - newOrder.invoiceSupplying = issueType === 1; 378 + newOrder.invoiceOperation = _.zipObject(iop, iop);
  379 +
  380 + if (!newOrder.invoiceOperation || (!newOrder.invoiceOperation.invoiceDetail &&
  381 + !newOrder.invoiceOperation.supplyInvoice)) {
  382 + _.set(newOrder, 'invoiceOperation.invoiceSupplying', issueType === 1);
  383 + }
376 384
377 if (newOrder.issueType) { 385 if (newOrder.issueType) {
378 newOrder.invoiceType = _.get(order, 'invoice.type', 0) === 2 ? '电子发票' : '纸质发票'; 386 newOrder.invoiceType = _.get(order, 'invoice.type', 0) === 2 ? '电子发票' : '纸质发票';
379 } 387 }
  388 + }
380 389
381 if (order.is_cancel === 'Y' || order.status === 6) { 390 if (order.is_cancel === 'Y' || order.status === 6) {
382 newOrder.canDelete = true; // 删除订单 391 newOrder.canDelete = true; // 删除订单
@@ -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}} 104 {{/if}}
  105 +
  106 + {{#if supplyInvoice}}
  107 + <span class="op-item supply-invoice" data-id="{{../orderNum}}">申请补开</span>
105 {{/if}} 108 {{/if}}
  109 + {{/ invoiceOperation}}
106 </div> 110 </div>
107 </div> 111 </div>
108 </div> 112 </div>