Przeglądaj źródła

fix(bpm): 使用lodash的reduce计算总价和折扣总价

liujt 7 miesięcy temu
rodzic
commit
393d15093a

+ 4 - 2
src/views/bpm/handleTask/components/adjustNote/detailDialog.vue

@@ -169,6 +169,7 @@
   import { relationTypeList } from '@/enum/dict.js';
   import inventoryTable from './inventoryTable.vue';
   import inventoryTableDetails from '@/BIZComponents/inventoryTableDetails.vue';
+  import { reduce } from 'lodash';
 
   const defForm = {
     name: '',
@@ -207,10 +208,11 @@
       async getInfo(id) {
         let data = await getPunchSlipOrderInfo(id);
         if (data) {
+          // console.log('data~~~~', reduce(data.originalList, (total, item) => total + item.amount, 0));
           const tempdata = {
             // ...data,
-            totalPrice: data.amount,
-            discountTotalPrice: data.discountAmount,
+            totalPrice: reduce(data.originalList, (total, item) => total + item.totalPrice, 0),
+            discountTotalPrice: reduce(data.originalList, (total, item) => total + item.discountTotalPrice, 0),
             productList: data.originalList
           }
           this.businessId = data.id;