浏览代码

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,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
@@ -521,22 +526,27 @@
521 526
           console.log(data)
522 527
           const values = data.map(item => Number(item[column.property]))
523 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 543
           } else {
534 544
             sums[index] = ''
535 545
           }
536 546
         })
537 547
 
538 548
         return sums
539
-      }
549
+      },
540 550
     },
541 551
     created() {
542 552
       this.getSummaryDetailList()

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

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