@dongkboy 3 лет назад
Родитель
Сommit
5452f15ac4
1 измененных файлов с 15 добавлено и 32 удалено
  1. 15 32
      src/views/Letter/Letter.vue

+ 15 - 32
src/views/Letter/Letter.vue

@@ -2746,9 +2746,9 @@ export default {
       _this.imageUploadShow = true;
     } else {
       this.jqstartDate = this.transformTime1();
-      this.jqendDate = this.oneYearPast(this.jqstartDate);
+      this.jqendDate = this.oneYearPast1(this.jqstartDate);
       this.systartDate = this.transformTime1();
-      this.syendDate = this.oneYearPast(this.systartDate);
+      this.syendDate = this.oneYearPast1(this.systartDate);
     }
   },
   mounted() {
@@ -2968,11 +2968,11 @@ export default {
     },
     //较强起保日期事件
     jqChange(e) {
-      this.jqendDate = this.oneYearPast(e);
+      this.jqendDate = this.oneYearPast1(e);
     },
     //商业起保日期事件
     syChange(e) {
-      this.syendDate = this.oneYearPast(e);
+      this.syendDate = this.oneYearPast1(e);
     },
     //查看更多
     selectMore(leg) {
@@ -3072,7 +3072,7 @@ export default {
     jqcheckedChange(e) {
       if (e) {
         this.jqstartDate = this.transformTime1();
-        this.jqendDate = this.oneYearPast(this.jqstartDate);
+        this.jqendDate = this.oneYearPast1(this.jqstartDate);
       } else {
         this.jqstartDate = "";
         this.jqendDate = "";
@@ -3081,7 +3081,7 @@ export default {
     sycheckedChange(e) {
       if (e) {
         this.systartDate = this.transformTime1();
-        this.syendDate = this.oneYearPast(this.systartDate);
+        this.syendDate = this.oneYearPast1(this.systartDate);
       } else {
         this.systartDate = "";
         this.syendDate = "";
@@ -4415,30 +4415,9 @@ export default {
       var datetime = strYear + "-" + strMonth + "-" + strDay;
       return datetime;
     },
-    //入参一年后的前一天
-    oneYearPast(time) {
-      var date = new Date(time);
-      date.setFullYear(date.getFullYear() + 1); //一年后
-      date.setTime(date.getTime() - 24 * 60 * 60 * 1000); //一年后的前一天
-      var strYear = date.getFullYear();
-      var strDay = date.getDate();
-      var strMonth = date.getMonth() + 1;
-      var hh = date.getHours();
-      if (hh < 10) {
-        hh = "0" + hh;
-      }
-      if (strMonth < 10) {
-        strMonth = "0" + strMonth;
-      }
-      if (strDay < 10) {
-        strDay = "0" + strDay;
-      }
-      var datastr =
-        strYear + "-" + strMonth + "-" + strDay + " " + hh + ":00:00";
-      return datastr;
-    },
-    oneYearPast1(time) {
+    oneYearPast1(time) {//明年减一秒
       var date = new Date(time);
+      date.setSeconds(date.getSeconds() - 1);
       date.setFullYear(date.getFullYear() + 1); //一年后
       date.setTime(date.getTime()); //一年后的前一天
       var strYear = date.getFullYear();
@@ -4446,12 +4425,16 @@ export default {
       var strMonth = date.getMonth() + 1;
       var hh = date.getHours();
       var minutes = date.getMinutes(); // 分
+      var Seconds=date.getSeconds();
       if (hh < 10) {
         hh = "0" + hh;
       }
       if (minutes < 10) {
         minutes = "0" + minutes;
       }
+      if (Seconds < 10) {
+        Seconds = "0" + Seconds;
+      }
       if (strMonth < 10) {
         strMonth = "0" + strMonth;
       }
@@ -4459,7 +4442,7 @@ export default {
         strDay = "0" + strDay;
       }
       var datastr =
-        strYear + "-" + strMonth + "-" + strDay + " " + hh + ":" + minutes + ":00";
+        strYear + "-" + strMonth + "-" + strDay + " " + hh + ":" + minutes + ":"+Seconds;
       return datastr;
     },
     tbczcarShowChange() {
@@ -5039,9 +5022,9 @@ export default {
       this.orderno = "";
       this.quoteno = "";
       this.jqstartDate = this.transformTime1();
-      this.jqendDate = this.oneYearPast(this.jqstartDate);
+      this.jqendDate = this.oneYearPast1(this.jqstartDate);
       this.systartDate = this.transformTime1();
-      this.syendDate = this.oneYearPast(this.jqstartDate);
+      this.syendDate = this.oneYearPast1(this.jqstartDate);
       this.commpanyList(); // 获取保险公司
     },
     toChinesNum(num) {