Jelajahi Sumber

新增字段“合计成本” ---cjh

17767204043 3 tahun lalu
induk
melakukan
3a2608f0da

+ 2 - 1
src/views/PurchasingManage/InstockOrder/detail.vue

@@ -112,6 +112,7 @@ export default {
                {title:'税额',align:'center',key:'tax_total_price',minWidth:120},
                {title:'运费',align:'center',key:'transport_price',minWidth:120},
                {title:'价格合计',align:'center',key:'total',minWidth:120},
+               {title:'合计成本',align:'center',key:'total_cost',minWidth:120},
                {title:'参照订单号/到货单号',align:'center',key:'reference_order_no',minWidth:120,render:(h,params)=>{
                    const {row}=params;
                    return row.refer?h('a',{on:{'click':()=>{
@@ -251,7 +252,7 @@ export default {
                         return;
                     }
                     const values = data.map(item => Number(item[key]));
-                    if (key === 'num'||key==='no_tax_total_price'||key==='tax_total_price'||key==='total'||key==='transport_price') {
+                    if (key === 'num'||key==='no_tax_total_price'||key==='tax_total_price'||key==='total'||key==='transport_price' || key === "total_cost") {
                         const v = values.reduce((prev, curr) => {
                             const value = Number(curr);
                             if (!isNaN(value)) {

+ 39 - 8
src/views/PurchasingManage/InstockOrder/edit.vue

@@ -333,9 +333,14 @@
             >{{ 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).toFixed(2)}}</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).toFixed(2)
+            }}</span
+          >
+        </template>
         <!-- :disabled="row.state==0" -->
         <!-- :disabled="row.state==0" -->
         <template slot="setSlot" slot-scope="{ row, index }">
@@ -1481,6 +1486,23 @@ export default {
           key: "total_cost",
           align: "center",
           minWidth: 120,
+          render: (h, params) => {
+            const { row, index } = params;
+            const currentRow = JSON.parse(
+              JSON.stringify(this.tableData[index])
+            );
+            return currentRow.no_tax_total_price * 1 +
+              currentRow.transport_price * 1 >
+              0
+              ? h(
+                  "span",
+                  (
+                    currentRow.no_tax_total_price * 1 +
+                    currentRow.transport_price * 1
+                  ).toFixed(2)
+                )
+              : "";
+          },
           // slot: "total_cost",
         },
         {
@@ -2293,6 +2315,13 @@ export default {
           this.searchData.type = 0;
         }
       });
+      this.tableData.forEach((e) => {
+        let total_cost_value = (
+          e.no_tax_total_price * 1 +
+          e.transport_price * 1
+        ).toFixed(2);
+        this.$set(e, "total_cost",total_cost_value);
+      });
       let obj = JSON.parse(JSON.stringify(this.searchData));
       obj.order_time =
         parseInt(new Date(obj.order_time).getTime() / 1000) || "";
@@ -2301,10 +2330,12 @@ export default {
         if (v.title == "选择物料") {
           children.splice(index, 1);
         }
-        this.otherPriceList = [{
-          name:"",
-          price:this.other_price
-        }]
+        this.otherPriceList = [
+          {
+            name: "",
+            price: this.other_price,
+          },
+        ];
       });
       if (this.$route.query.order_in_no == "" || this.$route.query.type == 6) {
         // console.log(...obj, "obj");
@@ -2323,7 +2354,7 @@ export default {
           },
         })
           .then((res) => {
-            debugger
+            debugger;
             if (res.code == 200) {
               this.$Message.success(res.msg);
               this.goBack();