Authored by Aiden Xu

分期订单

@@ -334,13 +334,35 @@ const orderDetail = (req, res, next) => { @@ -334,13 +334,35 @@ const orderDetail = (req, res, next) => {
334 page: 'installment.order-detail', 334 page: 'installment.order-detail',
335 title: '分期详情', 335 title: '分期详情',
336 order: (()=> { 336 order: (()=> {
  337 + let refundStatusCount = 0, completeStatusCount = 0, listCount = 0;
  338 +
337 if (result && result.data && result.data.orderGoods) { 339 if (result && result.data && result.data.orderGoods) {
338 result.data.orderGoods = [ 340 result.data.orderGoods = [
339 result.data.orderGoods[0] 341 result.data.orderGoods[0]
340 ]; 342 ];
341 } 343 }
342 344
343 - return result.data; 345 + if (result && result.data && result.data.packageList) {
  346 + listCount = result.data.packageList.length;
  347 +
  348 + result.data.packageList.forEach((item)=> {
  349 + if (item.status === 2) {
  350 + completeStatusCount++;
  351 + } else if (item.status === 4 || item.status === 5) {
  352 + refundStatusCount++;
  353 + }
  354 + });
  355 + }
  356 +
  357 + return Object.assign({
  358 + status: (()=> {
  359 + if (refundStatusCount === listCount) {
  360 + return 5;
  361 + } else if (completeStatusCount === listCount) {
  362 + return 2;
  363 + }
  364 + })()
  365 + }, result.data);
344 })(), 366 })(),
345 navBtn: false, 367 navBtn: false,
346 currAmtCount: 0, 368 currAmtCount: 0,
@@ -369,7 +391,7 @@ const orderDetail = (req, res, next) => { @@ -369,7 +391,7 @@ const orderDetail = (req, res, next) => {
369 return options.inverse(this); 391 return options.inverse(this);
370 }, 392 },
371 isRepaymentAllCompleted: function(status, options) { 393 isRepaymentAllCompleted: function(status, options) {
372 - if (status === 2) { // 已结清/已取消 394 + if (status === 2) { // 已结清
373 return options.fn(this); 395 return options.fn(this);
374 } 396 }
375 return options.inverse(this); 397 return options.inverse(this);