lilei 1 year ago
parent
commit
572e6cc014
1 changed files with 23 additions and 18 deletions
  1. 23 18
      src/views/reportData/promotionSalesOrderReport/list.vue

+ 23 - 18
src/views/reportData/promotionSalesOrderReport/list.vue

@@ -190,7 +190,6 @@ export default {
   components: { STable, VSelect, subarea, dealerSubareaScopeList, reportModal, Area, BizUser, ProductBrand, productTypeAll },
   data () {
     return {
-      moment,
       spinning: false,
       advanced: true, // 高级搜索 展开/关闭
       tableHeight: 0,
@@ -286,19 +285,25 @@ export default {
   },
   methods: {
     // 统计月份  选择月份限制
-    disabledStartDate (startValue) {
-      const endValue = this.endValue ? typeof (this.endValue) === 'string' ? this.moment().endOf('month') : this.endValue : null
-      if (!startValue || !endValue) {
-        return startValue.valueOf() >= this.moment().month(this.moment().month()).valueOf()
+    disabledStartDate (current) {
+      const endValue = this.endValue
+      const md = moment(current).startOf('month').valueOf()
+      const cd = moment().startOf('month').valueOf() // 当前月份
+      if (!current || !endValue) {
+        return md > cd
       }
-      return startValue.valueOf() >= endValue.valueOf()
+      const ed = moment(endValue).startOf('month').valueOf()
+      return md > ed || md > cd
     },
-    disabledEndDate (endValue) {
-      const startValue = this.startValue ? typeof (this.startValue) === 'string' ? this.moment().startOf('month') : this.startValue : null
-      if (!startValue) {
-        return endValue.valueOf() > this.moment().month(this.moment().month()).valueOf()
+    disabledEndDate (current) {
+      const startValue = this.startValue
+      const md = moment(current).startOf('month').valueOf()
+      const cd = moment().startOf('month').valueOf() // 当前月份
+      if (!current || !startValue) {
+        return md > cd
       }
-      return endValue.valueOf() < startValue.valueOf() || endValue.valueOf() > this.moment().month(this.moment().month()).valueOf()
+      const sd = moment(startValue).startOf('month').valueOf()
+      return md < sd || md > cd
     },
     // 开始时间
     handleStartOpenChange (open) {
@@ -308,7 +313,7 @@ export default {
     },
     getStartDate (date, dateString) {
       this.form.monthInfo[0] = dateString
-      this.queryParam.brandTypeBeginDate = date ? this.moment(dateString).startOf('month').format('YYYYMM') : ''
+      this.queryParam.brandTypeBeginDate = date ? moment(dateString).startOf('month').format('YYYYMM') : ''
     },
     // 结束时间
     handleEndOpenChange (open) {
@@ -316,7 +321,7 @@ export default {
     },
     getEndDate (date, dateString) {
       this.form.monthInfo[1] = dateString
-      this.queryParam.brandTypeEndDate = date ? this.moment(dateString).endOf('month').format('YYYYMM') : ''
+      this.queryParam.brandTypeEndDate = date ? moment(dateString).endOf('month').format('YYYYMM') : ''
     },
     //  导出
     handleExport () {
@@ -377,11 +382,11 @@ export default {
     },
     //  重置
     resetSearchForm () {
-      this.form.monthInfo = [this.moment().format('YYYY-MM'), this.moment().format('YYYY-MM')]
-      this.startValue = this.moment().format('YYYY-MM')
-      this.endValue = this.moment().format('YYYY-MM')
-      this.queryParam.brandTypeBeginDate = this.moment().format('YYYYMM')
-      this.queryParam.brandTypeEndDate = this.moment().format('YYYYMM')
+      this.form.monthInfo = [moment().format('YYYY-MM'), moment().format('YYYY-MM')]
+      this.startValue = moment().format('YYYY-MM')
+      this.endValue = moment().format('YYYY-MM')
+      this.queryParam.brandTypeBeginDate = moment().format('YYYYMM')
+      this.queryParam.brandTypeEndDate = moment().format('YYYYMM')
       this.queryParam.dealerSn = undefined
       this.queryParam.provinceSn = undefined
       this.queryParam.subareaArea.subareaSn = undefined