see999 3 anni fa
parent
commit
7385f7a446

+ 26 - 19
src/xt_pages/outpatientTool/components/detail.vue Vedi File

@@ -311,9 +311,12 @@
311 311
               }
312 312
               tempPatientsTwo[i]['total'] = total
313 313
             }
314
-
314
+            console.log('tempPatientsTwo',tempPatientsTwo)
315 315
             for (let i = 0; i < tempPatientsTwo.length; i++) {
316
-              console.log(tempPatientsTwo[i].total)
316
+              // console.log(111,tempPatientsTwo[i].total)
317
+              if(tempPatientsTwo[i].new_order_info.length > 0){
318
+
319
+              
317 320
               for (let b = 0; b < tempPatientsTwo[i].new_order_info.length; b++) {
318 321
                 let new_name = tempPatientsTwo[i].new_order_info[b].item_name
319 322
                 new_name=new_name.replace("( ","");
@@ -330,15 +333,17 @@
330 333
                     count: tempPatientsTwo[i].new_order_info[b].count,
331 334
 
332 335
                   }
333
-                  if(b == 0){
336
+
337
+                  // if(b == 0){
334 338
                     obj['total'] =  tempPatientsTwo[i].total
335
-                  }else{
336
-                    obj['total'] = 0
337
-                  }
339
+                  // }else{
340
+                  //   obj['total'] = 0
341
+                  // }
338 342
                   this.tableData.push(obj)
339 343
                 }
340 344
 
341 345
               }
346
+              }
342 347
             }
343 348
             this.handleSpanTempArr()
344 349
             // this.tableData = tempPatientsTwo
@@ -473,7 +478,6 @@
473 478
             colspan: _col
474 479
           }
475 480
         }
476
-<<<<<<< HEAD
477 481
       }, export_detail() {
478 482
 
479 483
         let list = []
@@ -511,7 +515,6 @@
511 515
 
512 516
       }, formatJson(filterVal, jsonData) {
513 517
         return jsonData.map(v => filterVal.map(j => v[j]))
514
-=======
515 518
       }, getTotal(param) {
516 519
         const { columns, data } = param
517 520
         const sums = []
@@ -523,23 +526,27 @@
523 526
           console.log(data)
524 527
           const values = data.map(item => Number(item[column.property]))
525 528
           if (column.property === 'total') {
526
-            sums[index] = values.reduce((prev, curr) => {
527
-              const value = Number(curr)
528
-              if (!isNaN(value)) {
529
-                return prev + curr
530
-              } else {
531
-                return prev
532
-              }
533
-            }, 0)
534
-            sums[index] = sums[index].toFixed(2)
529
+            // sums[index] = values.reduce((prev, curr) => {
530
+            //   const value = Number(curr)
531
+            //   if (!isNaN(value)) {
532
+            //     return prev + curr
533
+            //   } else {
534
+            //     return prev
535
+            //   }
536
+            // }, 0)
537
+            // sums[index] = sums[index].toFixed(2)
538
+            let num = 0
539
+            data.map(item => {
540
+              num += item.price.toFixed(2)*item.count
541
+            })
542
+            sums[index] = num.toFixed(2)
535 543
           } else {
536 544
             sums[index] = ''
537 545
           }
538 546
         })
539 547
 
540 548
         return sums
541
->>>>>>> 217aeb893378e63b858282bbb055562ea21ad31b
542
-      }
549
+      },
543 550
     },
544 551
     created() {
545 552
       this.getSummaryDetailList()

+ 1 - 1
src/xt_pages/outpatientTool/components/gather.vue Vedi File

@@ -455,7 +455,7 @@
455 455
           }
456 456
           console.log(data)
457 457
           const values = data.map(item => Number(item[column.property]))
458
-          if (column.property === 'total') {
458
+          if (column.property === 'sum') {
459 459
             sums[index] = values.reduce((prev, curr) => {
460 460
               const value = Number(curr)
461 461
               if (!isNaN(value)) {