see999 3 years ago
parent
commit
7385f7a446

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

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

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

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