Qukatie vor 1 Jahr
Ursprung
Commit
78fe3d5be1

+ 23 - 7
src/views/boxManagement/leaseIn/detailsPage.vue

@@ -221,7 +221,9 @@ import {
     repealCancel,
     statusUpdate, calculateRent, revokeRent, itemDetails, revokeRentingOut, detList, getList, tradingBoxItemSubmitRent
 } from "@/api/boxManagement/leaseIn/index.js";
-
+import {
+  tradingBoxFeesList,
+} from "@/api/boxManagement";
 import checkSchedule from "@/components/check/checkSchedule";
 import {selectByName} from "@/api/boxManagement";
 import {getToken} from "@/util/auth";
@@ -977,11 +979,25 @@ export default {
           this.formState.rentStartDate = this.selectionList[0].rentEndDate
           this.formState.rentCalculationDate = dateFormat(endDate, "yyyy-MM-dd") + " 23:59:59"
           if (this.selectionList[0].rentEndDate){
-            let curDate = new Date(this.selectionList[0].rentEndDate);
-            let endDateTime = new Date((curDate/1000+86400)*1000)
-            this.formState.rentStartDate = dateFormat(endDateTime, "yyyy-MM-dd") + " 00:00:00"
-            const endDateTwo = new Date(endDateTime.getFullYear(), endDateTime.getMonth() + 1, 0);
-            this.formState.rentCalculationDate = dateFormat(endDateTwo, "yyyy-MM-dd") + " 23:59:59"
+            let endDateTime = 0
+            tradingBoxFeesList({
+              code: this.selectionList[0].code,
+              current: 1,
+              size: 10,
+              pid: this.form.id,
+              feesType: 2
+            }).then(res => {
+              if (res.data.data.records.length>0) {
+                let curDate = new Date(this.selectionList[0].rentEndDate);
+                endDateTime = new Date((curDate / 1000 + 86400) * 1000)
+              } else {
+                let curDate = new Date(this.selectionList[0].leaseCommencementDate ? this.selectionList[0].leaseCommencementDate.slice(0, 10) : this.selectionList[0].leaseCommencementDate);
+                endDateTime = new Date((curDate / 1000) * 1000)
+              }
+              this.formState.rentStartDate = dateFormat(endDateTime, "yyyy-MM-dd") + " 00:00:00"
+              const endDateTwo = new Date(endDateTime.getFullYear(), endDateTime.getMonth() + 1, 0);
+              this.formState.rentCalculationDate = dateFormat(endDateTwo, "yyyy-MM-dd") + " 23:59:59"
+            })
           }
         }else if(type === '撤销租金'){
           return this.$confirm('此操作将撤销租金并删除费用, 是否继续?', '提示', {
@@ -1094,7 +1110,7 @@ export default {
               })
             }else {
               if (this.title === "计算租金"){
-                if (Number(new Date(this.selectionList[0].leaseCommencementDate)) > Number(new Date(this.formState.rentStartDate))) {
+                if (Number(new Date(this.selectionList[0].leaseCommencementDate ? this.selectionList[0].leaseCommencementDate.slice(0, 10) : this.selectionList[0].leaseCommencementDate, this.formState.rentStartDate)) > Number(new Date(this.formState.rentStartDate ? this.formState.rentStartDate.slice(0, 10) : this.formState.rentStartDate))) {
                   return this.$message.error("起始日期不能小于起租日期")
                 }
                 this.disabledVisible = true

+ 24 - 8
src/views/boxManagement/leaseOut/detailsPage.vue

@@ -217,7 +217,9 @@ import {
   repealCancel,
   statusUpdate, calculateRent, revokeRent, itemDetails, revokeRentingOut, detList, tradingBoxItemSubmitRent
 } from "@/api/boxManagement/leaseIn/index.js";
-
+import {
+    tradingBoxFeesList,
+} from "@/api/boxManagement";
 import checkSchedule from "@/components/check/checkSchedule";
 import {selectByName} from "@/api/boxManagement";
 import {getToken} from "@/util/auth";
@@ -944,12 +946,26 @@ export default {
           const endDate = new Date(date.getFullYear(), date.getMonth() + 1, 0);
           this.formState.rentStartDate = this.selectionList[0].rentEndDate
           this.formState.rentCalculationDate = dateFormat(endDate, "yyyy-MM-dd") + " 23:59:59"
-          if (this.selectionList[0].rentEndDate){
-            let curDate = new Date(this.selectionList[0].rentEndDate);
-            let endDateTime = new Date((curDate/1000+86400)*1000)
-            this.formState.rentStartDate = dateFormat(endDateTime, "yyyy-MM-dd") + " 00:00:00"
-            const endDateTwo = new Date(endDateTime.getFullYear(), endDateTime.getMonth() + 1, 0);
-            this.formState.rentCalculationDate = dateFormat(endDateTwo, "yyyy-MM-dd") + " 23:59:59"
+          if (this.selectionList[0].rentEndDate) {
+            let endDateTime = 0
+            tradingBoxFeesList({
+              code: this.selectionList[0].code,
+              current: 1,
+              size: 10,
+              pid: this.form.id,
+              feesType: 1
+            }).then(res => {
+              if (res.data.data.records.length>0) {
+                let curDate = new Date(this.selectionList[0].rentEndDate);
+                endDateTime = new Date((curDate / 1000 + 86400) * 1000)
+              } else {
+                let curDate = new Date(this.selectionList[0].leaseCommencementDate ? this.selectionList[0].leaseCommencementDate.slice(0, 10) : this.selectionList[0].leaseCommencementDate);
+                endDateTime = new Date((curDate / 1000) * 1000)
+              }
+              this.formState.rentStartDate = dateFormat(endDateTime, "yyyy-MM-dd") + " 00:00:00"
+              const endDateTwo = new Date(endDateTime.getFullYear(), endDateTime.getMonth() + 1, 0);
+              this.formState.rentCalculationDate = dateFormat(endDateTwo, "yyyy-MM-dd") + " 23:59:59"
+            })
           }
         }else if(type === '撤销租金'){
           return this.$confirm('此操作将撤销租金并删除费用, 是否继续?', '提示', {
@@ -1061,7 +1077,7 @@ export default {
               })
             }else {
               if (this.title === "计算租金"){
-                if (Number(new Date(this.selectionList[0].leaseCommencementDate)) > Number(new Date(this.formState.rentStartDate))) {
+                if (Number(new Date(this.selectionList[0].leaseCommencementDate?this.selectionList[0].leaseCommencementDate.slice(0, 10):this.selectionList[0].leaseCommencementDate,this.formState.rentStartDate)) > Number(new Date(this.formState.rentStartDate?this.formState.rentStartDate.slice(0, 10):this.formState.rentStartDate))) {
                   return this.$message.error("起始日期不能小于起租日期")
                 }
                 this.disabledVisible = true