Jelajahi Sumber

前端结算单修改

gjy 2 tahun lalu
induk
melakukan
fe5feee0ca
1 mengubah file dengan 32 tambahan dan 35 penghapusan
  1. 32 35
      src/views/profitable/contractprofitsdetails.vue

+ 32 - 35
src/views/profitable/contractprofitsdetails.vue

@@ -232,13 +232,14 @@
             judgesettlement(this.datalist).toPromise().then(response => {
                          var weightprice=0
                   for (let i = 0; i < data.length; i++) {
-                      weightprice+=(data[i].weight*data[i].settlementPrice)
-                  }
-                  if(row.agreementType=='收购合同'||row.agreementType=='采购合同'){
-                    row.profit=weightprice-(row.actualWeight*row.settlementPrice)
-                  }else if(row.agreementType=='销售合同'){
-                    row.profit=(row.actualWeight*row.settlementPrice)-weightprice
+                      // weightprice+=(data[i].weight*data[i].settlementPrice)
+                      if(row.agreementType=='收购合同'||row.agreementType=='采购合同'){
+                      weightprice+=(data[i].weight*(data[i].settlementPrice-row.settlementPrice))
+                    }else if(row.agreementType=='销售合同'){
+                      weightprice+=(data[i].weight*(row.settlementPrice-data[i].settlementPrice))
+                    }
                   }
+                    row.profit=weightprice
         this.$confirm('结算后当前合同和相关合同不可再进行费用相关操作', '提示', {
             confirmButtonText: '确定',
             cancelButtonText: '取消',
@@ -268,11 +269,19 @@
         this.tableData.buyer=row.buyer
         this.tableData.seller=row.seller
         this.tableData.settlementPrice=row.settlementPrice
-        this.tableData.profit=row.profit
+        this.tableData.profit=row.profit*10000
         getrelationcontract({
           agreementType:row.agreementType,contractNo:row.contractNo,compId:this.compId})
           .toPromise()
           .then(response => {
+            for (let q = 0; q < response.length; q++) {
+              if(row.agreementType=='收购合同'||row.agreementType=='采购合同'){
+                response[q].profit=response[q].weight*(response[q].settlementPrice-row.settlementPrice)
+              }else if(row.agreementType=='销售合同'){
+                response[q].profit=response[q].weight*(row.settlementPrice-response[q].settlementPrice)
+              }
+              
+            }
             this.tableData.contractList=response
             this.show=true
           })
@@ -290,20 +299,6 @@
         this.$router.push({name:'contractcost',query:{contractNo:row.contractNo,contractType:row.contractType,buyer:row.buyer,seller:row.seller}})
       },
       getPassYearFormatDate () {
-        // getcontractdetails({
-        //     // warehouseType: 1,
-        //     agreementType: this.agreementType,
-        //     startDate:this.startDate,
-        //     endDate:this.endDate,
-        //     currentPage: 1,
-        //     pageSize:9999 ,
-        //     searchType:this.searchType,
-        //     searchContractType:this.searchContractType,
-        //     searchTypeCon:this.searchTypeCon
-        //   })
-        //   .toPromise()
-        //   .then(response => {
-        //     this.tableData = response.records
              var _date = new Date()
             var year1 = _date.getFullYear()
             var month1 = _date.getMonth() + 1
@@ -314,14 +309,14 @@
             if (strDate1 >= 0 && strDate1 <= 9) {
               strDate1 = '0' + strDate1
             }
-            this.startDate = year1 + '-' + month1 +'-' + strDate1
+            this.startDate = year1 + '-' + (month1-1) +'-' + strDate1
             this.endDate = year1 + '-' + month1 +'-' + strDate1
             this.value=[this.startDate,this.endDate]
             this.getList()
           // })
         },
       async getList() {
-         getcontractdetails({
+         var response=await getcontractdetails({
             // warehouseType: 1,
             agreementType: this.agreementType,
             startDate:this.startDate,
@@ -334,24 +329,27 @@
             searchTypeCon:this.searchTypeCon
           })
           .toPromise()
-          .then(response => {
-            if(response.records.length){
+          
+          if(response.records.length){
               for (let i = 0; i < response.records.length; i++) {
                 if(response.records[i].status=='已结算'){
-                  var data=getrelationcontract({
+                  var data=await getrelationcontract({
                   agreementType:response.records[i].agreementType,contractNo:response.records[i].contractNo,compId:this.compId})
                   .toPromise()
                   var weightprice=0
                   var weightprice1=0
-                  for (let i = 0; i < data.length; i++) {
-                    weightprice+=(data[i].weight*data[i].settlementPrice)
-                    // weightprice1-=(data[i].weight*data[i].settlementPrice)
-                  }
-                  if(response.records[i].agreementType=='收购合同'||response.records[i].agreementType=='采购合同'){
-                    response.records[i].profit=weightprice-(response.records[i].actualWeight*response.records[i].settlementPrice)
-                  }else if(response.records[i].agreementType=='销售合同'){
-                    response.records[i].profit=(response.records[i].actualWeight*response.records[i].settlementPrice)-weightprice
+                  console.log(data)
+                  for (let q = 0; q < data.length; q++) {
+                    if(response.records[i].agreementType=='收购合同'||response.records[i].agreementType=='采购合同'){
+                      weightprice+=(data[q].weight*(data[q].settlementPrice-response.records[i].settlementPrice))
+                    }else if(response.records[i].agreementType=='销售合同'){
+                      weightprice+=(data[q].weight*(response.records[i].settlementPrice-data[q].settlementPrice))
+                    }
+                    data[q].profit=data[q].weight*data[q].settlementPrice
+                    console.log(data[q],222222)
                   }
+                    response.records[i].profit=weightprice
+                 
                 }
                 response.records[i].profit=Number(Number(response.records[i].profit/10000).toFixed(3))
                 response.records[i].surplus=Number(Number(response.records[i].surplus).toFixed(3))
@@ -365,7 +363,6 @@
             }
             
            this.deptBudgetTotal = response.total
-          })
       },
 
       changeDate(){