lrf402788946 4 years ago
parent
commit
2354f2f62c
1 changed files with 6 additions and 4 deletions
  1. 6 4
      app/service/order/transport.js

+ 6 - 4
app/service/order/transport.js

@@ -85,7 +85,7 @@ class TransportService extends CrudService {
   async carCalculate({ car_no, start, end }) {
     assert(start, '缺少时间范围-开始时间');
     assert(end, '缺少时间范围-结束时间');
-    let query = {
+    const query = {
       'send_time@start': start,
       'send_time@end': end,
       'supplier.car_no': car_no,
@@ -106,22 +106,24 @@ class TransportService extends CrudService {
     const count = {};
     // 收入采用税后实收
     count.im = _.round(
-      res.inBill.reduce((p, n) => p + (n.sh_ss || 0), 0),
+      res.inBill.reduce((p, n) => _.add(p, (parseFloat(n.sh_ss) || 0)), 0),
       2
     );
+    console.log(res.outBill);
     // 运输支出合计
     count.om = _.round(
-      res.outBill.reduce((p, n) => p + (n.money || 0), 0),
+      res.outBill.reduce((p, n) => _.add(p, (parseFloat(n.money) || 0)), 0),
       2
     );
     // 日常支出
     count.dm = _.round(
-      res.daily.reduce((p, n) => p + (n.money || 0), 0),
+      res.daily.reduce((p, n) => _.add(p, (parseFloat(n.money) || 0)), 0),
       2
     );
     // 总计
     count.total = _.round(count.im - count.om - count.dm, 2);
     res.count = count;
+    console.log(res);
     return res;
   }