Browse Source

1、修改移动端--卖家中心--应收对账,对账确认页进行取消操作后单据没有返回未对账TAB中
2、移动端--卖家中心--应收对账,使用月份选择器切换月份后没有显示对应月份的应收单据

shenjunjie 7 years ago
parent
commit
794c2c9b65
1 changed files with 57 additions and 34 deletions
  1. 57 34
      pages/mobile/center/vendor/btobapCheck.vue

+ 57 - 34
pages/mobile/center/vendor/btobapCheck.vue

@@ -457,16 +457,17 @@
       resultMonth() {
         this.isShowMonthChoose = false
         if (this.$monthType === 'out') {
-          let _time2 = new Date(this.$value)
-          let _d = new Date()
+          // 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 _d = this.computedTime(new Date())
           if (_time2.getTime() > _d.getTime()) {
             this.setRemindText('所选对账日期不能超过当前时间')
             return
           }
           let _sp = new Date()
-          _time2.setDate(1)
-          _time2.setMonth(_time2.getMonth() + 1)
-          _time2.setDate(_time2.getDate() - 1)
           if (_time2.getTime() >= _sp.getTime()) {
             this.MouthOutShow = false
           } else {
@@ -476,21 +477,23 @@
           this.filterParams.page = 1
           this.setSelect('', '', true)
         } else {
-          let _time2 = new Date(this.$value)
-          let _d = new Date()
+          // 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 _d = this.computedTime(new Date())
           if (_time2.getTime() > _d.getTime()) {
             this.setRemindText('所选对账日期不能超过当前时间')
             return
           }
           let _sp = new Date()
-          _time2.setDate(1)
-          _time2.setMonth(_time2.getMonth() + 1)
-          _time2.setDate(_time2.getDate() - 1)
-          if (_time2.getTime() >= _sp.getTime()) {
+          if (_time2.getTime() > _sp.getTime()) {
             this.MouthinShow = false
           } else {
             this.MouthinShow = true
           }
+          this.$monthClick = true
           this.isShowApcheckList.thisMonth = this.$value
           this.ShowApcheckChooseTime = false
           this.$refs.baseFilter[0].setSelect(1)
@@ -584,8 +587,9 @@
         this.getApcheckDetailsinfo(selectObj.key, selectObj.value)
       },
       ApcheckonValueAction(selectObj) {
-        this.isShowApcheckList.objTime = selectObj
-        this.getApcheckDetailsinfo(selectObj.key, selectObj.value)
+        // if (this.$monthClick) return
+        // this.isShowApcheckList.objTime = selectObj
+        // this.getApcheckDetailsinfo(selectObj.key, selectObj.value)
       },
       // B2B未对账
       // NotapCheck () {
@@ -599,13 +603,17 @@
       },
       // 未对账详情获取数据
       getApcheckDetailsinfo (...objTime) {
+        if (!this.isShowApcheckList.show) return
         let _params = {
           params: {
             checkDate: this.isShowApcheckList.thisMonth,
             suuorname: this.isShowApcheckList.enName
           }
         }
+        // 是否打开自定义时间选项 且
         if (this.ShowApcheckChooseTime && !this.$monthClick) {
+          // let _fromDate = new Date(this.outTimeMonth + '-01 00:00:00').getTime()
+          // let _d = this.computedTime(this.isShowApcheckList.thisMonth).getTime()
           _params = {
             params: {
               fromDate: objTime[1].fromDate,
@@ -766,6 +774,7 @@
               _d.setDate(1)
               _d.setMonth(_d.getMonth() + 1)
               _d.setDate(_d.getDate() - 1)
+
               // 获取筛选时间的开始时间为对账的开始时间
               apCheck.beginDate = _start.getTime()
               // 获取筛选的截止时间为对账的截止时间
@@ -827,10 +836,7 @@
               this.isShowApcheckList.endTime = _end.getFullYear() + '-' + (_end.getMonth() + 1) + '-' + _end.getDate()
             } else {
               this.isShowApcheckList.startTime = this.outTimeMonth + '-01'
-              let _d = new Date(this.isShowApcheckList.startTime)
-              _d.setDate(1)
-              _d.setMonth(_d.getMonth() + 1)
-              _d.setDate(_d.getDate() - 1)
+              let _d = this.computedTime(this.isShowApcheckList.startTime)
               this.isShowApcheckList.endTime = _d.getFullYear() + '-' + (_d.getMonth() + 1) + '-' + _d.getDate()
             }
             this.ShowApcheckChooseTime = false
@@ -856,10 +862,24 @@
           this.isShowApcheckList.id = ''
           return
         }
-        this.$http.post('/sale/apCheck/operation/deleteApCheck?id=' + this.isShowApcheckList.id).then(res => {
+        this.$http.post('/sale/apCheck/operation/deleteApCheck?id=' + this.isShowApcheckList.id, {}).then(res => {
           this.isShowApcheckList.showApcheck = false
           this.isShowApcheckList.show = false
           this.isShowApcheckList.id = ''
+
+          let sourceInfos = []
+          this.isShowApcheckList.list.forEach(item => {
+            let sourceInfo = {
+              sourceId: '',
+              sourceTable: '',
+              newYCheckQty: ''
+            }
+            sourceInfo.sourceId = item.sourceid
+            sourceInfo.sourceTable = item.sourcetable
+            sourceInfo.newYCheckQty = item.oldYCheckQty
+            sourceInfos.push(sourceInfo)
+          })
+          this.$http.post('/sale/apCheck/update', sourceInfos).then(res => {})
         }, err => {
           this.setRemindText(err.response.data)
         })
@@ -870,11 +890,7 @@
           let _sp = new Date()
           this.ShowApcheckChooseTime = false
           this.$monthClick = true
-          let _d = new Date(this.isShowApcheckList.thisMonth)
-          _d.setMonth(_d.getMonth() + val)
-          _d.setDate(1)
-          _d.setMonth(_d.getMonth() + 1)
-          _d.setDate(_d.getDate() - 1)
+          let _d = this.computedTime(this.isShowApcheckList.thisMonth, 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()) {
@@ -886,11 +902,7 @@
           this.showApcheckList()
         } else {
           let _sp = new Date()
-          let _d = new Date(this[key])
-          _d.setMonth(_d.getMonth() + val)
-          _d.setDate(1)
-          _d.setMonth(_d.getMonth() + 1)
-          _d.setDate(_d.getDate() - 1)
+          let _d = this.computedTime(this[key], 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()) {
@@ -902,15 +914,26 @@
           this.setSelect('', '', true)
         }
       },
+      computedTime(num, val) {
+        let _d = new Date(num)
+        if (val !== undefined) {
+          _d.setMonth(_d.getMonth() + val)
+        }
+        _d.setDate(1)
+        _d.setMonth(_d.getMonth() + 1)
+        _d.setDate(_d.getDate() - 1)
+        return _d
+      },
       async setSelect(...val) {
         let _url = '/sale/apCheck/info/search'
         let itemL = {}
         if (this.activeType === 'all') {
           let _fromDate = this.outTimeMonth + '-01 00:00:00'
-          let _d = new Date(_fromDate)
-          _d.setDate(1)
-          _d.setMonth(_d.getMonth() + 1)
-          _d.setDate(_d.getDate() - 1)
+          // 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 = new Date(_endDate).getTime()
           _fromDate = new Date(_fromDate).getTime()
@@ -979,11 +1002,11 @@
       ShowMonthChoose(tp, key) {
         this.$monthType = tp
         if (tp === 'inside') {
-          let _m = Number(this.isShowApcheckList.thisMonth.split('-')[1]) < 10 ? '0' + this.isShowApcheckList.thisMonth.split('-')[1] : this.isShowApcheckList.thisMonth.split('-')[1]
+          let _m = this.isShowApcheckList.thisMonth.split('-')[1].length < 2 ? '0' + this.isShowApcheckList.thisMonth.split('-')[1] : this.isShowApcheckList.thisMonth.split('-')[1]
           this.$picker.setSlotValue(0, this.isShowApcheckList.thisMonth.split('-')[0] + '年')
           this.$picker.setSlotValue(1, _m + '月')
         } else {
-          let _m = Number(this[key].split('-')[1]) < 10 ? '0' + this[key].split('-')[1] : this[key].split('-')[1]
+          let _m = this[key].split('-')[1].length < 2 ? '0' + this[key].split('-')[1] : this[key].split('-')[1]
           this.$picker.setSlotValue(0, this[key].split('-')[0] + '年')
           this.$picker.setSlotValue(1, _m + '月')
         }