ソースを参照

检测: 解决苹果浏览器new date字段,不兼容的问题

shenjunjie 7 年 前
コミット
da10a99803
1 ファイル変更31 行追加27 行削除
  1. 31 27
      pages/mobile/center/user/btobarCheck.vue

+ 31 - 27
pages/mobile/center/user/btobarCheck.vue

@@ -191,9 +191,9 @@
                   </div>
                 </div>
                 <div style="padding-top: 0.2rem">
-                  <span class="item inline-block" style="opacity: 0"  v-show="!isShowApcheckList.showApcheck">
-                    <label class="mobile-cart-check"></label>
-                  </span>
+                  <!--<span class="item inline-block" style="opacity: 0"  v-show="!isShowApcheckList.showApcheck">-->
+                    <!--<label class="mobile-cart-check"></label>-->
+                  <!--</span>-->
                   <div class="inline-block" style="margin-left: 0.15rem">
                     <div class="OverHidden">发货数量:<span>{{item.qty}}</span></div>
                     <div class="OverHidden">验收单:<span>{{item.inoutno}}</span></div>
@@ -457,11 +457,7 @@
       resultMonth() {
         this.isShowMonthChoose = false
         if (this.$monthType === 'out') {
-          // let _time2 = new Date(this.$value)
-          // _time2.setDate(1)
-          // _time2.setMonth(_time2.getMonth() + 1)
-          // _time2.setDate(_time2.getDate() - 1)
-          let _time2 = this.computedTime(this.$value)
+          let _time2 = this.computedTime(this.$value + '-01')
           let _d = this.computedTime(new Date())
           if (_time2.getTime() > _d.getTime()) {
             this.setRemindText('所选对账日期不能超过当前时间')
@@ -477,11 +473,7 @@
           this.filterParams.page = 1
           this.setSelect('', '', true)
         } else {
-          // let _time2 = new Date(this.$value)
-          // _time2.setDate(1)
-          // _time2.setMonth(_time2.getMonth() + 1)
-          // _time2.setDate(_time2.getDate() - 1)
-          let _time2 = this.computedTime(this.$value)
+          let _time2 = this.computedTime(this.$value + '-01')
           let _d = this.computedTime(new Date())
           if (_time2.getTime() > _d.getTime()) {
             this.setRemindText('所选对账日期不能超过当前时间')
@@ -769,22 +761,29 @@
             }
             // todo
             if (this.ShowApcheckChooseTime) {
-              let _start = new Date(this.isShowApcheckList.objTime.value.fromDate)
-              let _end = new Date(this.isShowApcheckList.objTime.value.toDate)
+              let _time1 = this.isShowApcheckList.objTime.value.fromDate
+              _time1 = _time1.replace(/-/g, '/')
+              let _start = new Date(_time1)
+              let _time2 = this.isShowApcheckList.objTime.value.fromDate
+              _time2 = _time2.replace(/-/g, '/')
+              let _end = new Date(_time2)
               // 获取筛选时间的开始时间为对账的开始时间
               apCheck.beginDate = _start.getTime()
               // 获取筛选的截止时间为对账的截止时间
               apCheck.endDate = _end.getTime()
             } else {
-              this.isShowApcheckList.startTime = this.outTimeMonth + '-01'
-              let _d = new Date(this.isShowApcheckList.startTime)
-              let _start = _d
+              this.isShowApcheckList.startTime = this.isShowApcheckList.thisMonth + '-01'
+              let _time1 = this.isShowApcheckList.startTime
+              _time1 = _time1.replace(/-/g, '/')
+              let _d = new Date(_time1)
               _d.setDate(1)
               _d.setMonth(_d.getMonth() + 1)
               _d.setDate(_d.getDate() - 1)
 
               // 获取筛选时间的开始时间为对账的开始时间
-              apCheck.beginDate = _start.getTime()
+              let _time2 = this.isShowApcheckList.startTime
+              _time2 = _time2.replace(/-/g, '/')
+              apCheck.beginDate = new Date(_time2).getTime()
               // 获取筛选的截止时间为对账的截止时间
               apCheck.endDate = _d.getTime()
             }
@@ -838,8 +837,12 @@
             this.isShowApcheckList.id = res.data.id
             this.isShowApcheckList.showApcheck = true
             if (this.ShowApcheckChooseTime) {
-              let _start = new Date(this.isShowApcheckList.objTime.value.fromDate)
-              let _end = new Date(this.isShowApcheckList.objTime.value.toDate)
+              let _time1 = this.isShowApcheckList.objTime.value.fromDate
+              _time1 = _time1.replace(/-/g, '/')
+              let _start = new Date(_time1)
+              let _time2 = this.isShowApcheckList.objTime.value.toDate
+              _time2 = _time1.replace(/-/g, '/')
+              let _end = new Date(_time2)
               this.isShowApcheckList.startTime = _start.getFullYear() + '-' + (_start.getMonth() + 1) + '-' + _start.getDate()
               this.isShowApcheckList.endTime = _end.getFullYear() + '-' + (_end.getMonth() + 1) + '-' + _end.getDate()
             } else {
@@ -898,7 +901,7 @@
           let _sp = new Date()
           this.ShowApcheckChooseTime = false
           this.$monthClick = true
-          let _d = this.computedTime(this.isShowApcheckList.thisMonth, val)
+          let _d = this.computedTime(this.isShowApcheckList.thisMonth + '-01', val)
           let _m = Number(_d.getMonth() + 1) < 10 ? '0' + (_d.getMonth() + 1) : (_d.getMonth() + 1)
           this.isShowApcheckList.thisMonth = _d.getFullYear() + '-' + _m
           if (_d.getTime() >= _sp.getTime()) {
@@ -911,7 +914,7 @@
           this.getApcheckDetailsinfo()
         } else {
           let _sp = new Date()
-          let _d = this.computedTime(this[key], val)
+          let _d = this.computedTime(this[key] + '-01', val)
           let _m = Number(_d.getMonth() + 1) < 10 ? '0' + (_d.getMonth() + 1) : (_d.getMonth() + 1)
           this[key] = _d.getFullYear() + '-' + _m
           if (_d.getTime() >= _sp.getTime()) {
@@ -924,6 +927,9 @@
         }
       },
       computedTime(num, val) {
+        if ((typeof num === 'object') && num.constructor === Date) {} else {
+          num = num.replace(/-/g, '/')
+        }
         let _d = new Date(num)
         if (val !== undefined) {
           _d.setMonth(_d.getMonth() + val)
@@ -938,13 +944,11 @@
         let itemL = {}
         if (this.activeType === 'all') {
           let _fromDate = this.outTimeMonth + '-01 00:00:00'
-          // let _d = new Date(_fromDate)
           let _d = this.computedTime(_fromDate)
-          // _d.setDate(1)
-          // _d.setMonth(_d.getMonth() + 1)
-          // _d.setDate(_d.getDate() - 1)
           let _endDate = _d.getFullYear() + '-' + (_d.getMonth() + 1) + '-' + _d.getDate() + ' 00:00:00'
+          _endDate = _endDate.replace(/-/g, '/')
           _endDate = new Date(_endDate).getTime()
+          _fromDate = _fromDate.replace(/-/g, '/')
           _fromDate = new Date(_fromDate).getTime()
            _url = '/sale/arCheck/vendor'
           itemL = {