Przeglądaj źródła

修改采购入库单bug ---cjh

17767204043 3 lat temu
rodzic
commit
3a35a8a318
1 zmienionych plików z 32 dodań i 2 usunięć
  1. 32 2
      src/views/PurchasingManage/InstockOrder/edit.vue

+ 32 - 2
src/views/PurchasingManage/InstockOrder/edit.vue

@@ -315,6 +315,9 @@
             >{{ row.title }}</span
           >
         </template>
+        <template slot="total_cost" slot-scope="{ row }">
+          <span v-show="row.no_tax_total_price*1+row.transport_price*1>0">{{row.no_tax_total_price*1+row.transport_price*1}}</span>
+        </template>
         <!-- :disabled="row.state==0" -->
         <!-- :disabled="row.state==0" -->
         <template slot="setSlot" slot-scope="{ row, index }">
@@ -1293,7 +1296,7 @@ export default {
         },
         {
           title: "运费",
-          key: "transport_price",
+          key: "transportu_price",
           align: "center",
           minWidth: 120,
           render: (h, params) => {
@@ -1433,6 +1436,13 @@ export default {
           },
         },
         {
+          title: " 合计成本",
+          key: "total_cost",
+          align: "center",
+          minWidth: 120,
+          slot: "total_cost",
+        },
+        {
           title: "参照订单号/到货单号",
           key: "reference_order_no",
           align: "center",
@@ -1729,6 +1739,26 @@ export default {
         }
         this.tableData.splice(index, 1, v);
       });
+      let lastObj = {};
+      lastObj = this.tableData.slice(-1);
+      let last = [];
+      let lastSum = 0;
+      this.tableData.forEach((e) => {
+        last.push(e.transport_price);
+      });
+      //这是全部的和
+      lastSum = eval(last.slice(0, -1).join("+"));
+      lastSum = lastSum - lastObj[0].transport_price * 1;
+      lastSum = this.other_price - lastSum;
+      this.tableData.forEach((e, index) => {
+        console.log(e, index, this.tableData.length - 2);
+        if (index == this.tableData.length - 2) {
+          e.transport_price = lastSum.toFixed(2);
+        }
+      });
+      this.tableData.slice(0, -1).forEach((e) => {
+        e.total_cost = e.transport_price*1 + e.no_tax_total_price*1;
+      });
     },
     sureOtherPrice() {
       const values = this.otherPriceList.map((item) => Number(item.price));
@@ -1969,7 +1999,7 @@ export default {
           key === "num" ||
           key === "no_tax_total_price" ||
           key === "tax_total_price" ||
-          key === "total"
+          key === "total" 
         ) {
           const v = values.reduce((prev, curr) => {
             const value = Number(curr);