瀏覽代碼

Merge branch '20201109_pc_vue_new_branch' of http://git.shengws.com/csx/Vue_New into 20201109_pc_vue_new_branch

csx 3 年之前
父節點
當前提交
b4b61d01b2
共有 2 個文件被更改,包括 27 次插入17 次删除
  1. 26 16
      src/xt_pages/outpatientTool/components/detail.vue
  2. 1 1
      src/xt_pages/outpatientTool/components/gather.vue

+ 26 - 16
src/xt_pages/outpatientTool/components/detail.vue 查看文件

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
521
           console.log(data)
526
           console.log(data)
522
           const values = data.map(item => Number(item[column.property]))
527
           const values = data.map(item => Number(item[column.property]))
523
           if (column.property === 'total') {
528
           if (column.property === 'total') {
524
-            sums[index] = values.reduce((prev, curr) => {
525
-              const value = Number(curr)
526
-              if (!isNaN(value)) {
527
-                return prev + curr
528
-              } else {
529
-                return prev
530
-              }
531
-            }, 0)
532
-            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)
533
           } else {
543
           } else {
534
             sums[index] = ''
544
             sums[index] = ''
535
           }
545
           }
536
         })
546
         })
537
 
547
 
538
         return sums
548
         return sums
539
-      }
549
+      },
540
     },
550
     },
541
     created() {
551
     created() {
542
       this.getSummaryDetailList()
552
       this.getSummaryDetailList()

+ 1 - 1
src/xt_pages/outpatientTool/components/gather.vue 查看文件

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