Parcourir la Source

feat: 企微数据 - 账号数据趋势 - 默认排序逻辑

zhengxy il y a 2 ans
Parent
commit
66b3480395
1 fichiers modifiés avec 17 ajouts et 4 suppressions
  1. 17 4
      project/src/components/dataBoard/accountTrends.vue

+ 17 - 4
project/src/components/dataBoard/accountTrends.vue

204
         closing_date: '', // 收益截止日期
204
         closing_date: '', // 收益截止日期
205
         plat_order_type: '', // 推广类型
205
         plat_order_type: '', // 推广类型
206
         costCover: ['', ''], // 回本率(范围)
206
         costCover: ['', ''], // 回本率(范围)
207
-        sort_field: 'expense_date', // 排序字段 - 默认值
207
+        sort_field: 'paid', // 排序字段 - 默认值
208
         sort_type: 'desc', // 升序/降序
208
         sort_type: 'desc', // 升序/降序
209
       },
209
       },
210
     }
210
     }
218
     isADQ() {
218
     isADQ() {
219
       return this.filter.order_type === orderTypeOptions.ADQ
219
       return this.filter.order_type === orderTypeOptions.ADQ
220
     },
220
     },
221
+    // 当前"时间"列是否展示的为"时间段" => 是时间段 默认排序"消耗"、非时间段 默认排序时间
222
+    isShowTimes() {
223
+      // (MP && 选了MP账号) || (ADQ && 选了ADQ账号)
224
+      if ((this.isMP && this.filter.account_id) || (this.isADQ && this.filter.account_id_adq)) {
225
+        return false
226
+      } else {
227
+        return true
228
+      }
229
+    },
221
   },
230
   },
222
   created () {
231
   created () {
223
     this.initTableHeight()
232
     this.initTableHeight()
544
     onChangeOrderType() {
553
     onChangeOrderType() {
545
       this.handleGetChart()
554
       this.handleGetChart()
546
       this.handleGetSummaryList()
555
       this.handleGetSummaryList()
547
-      this.filter.sort_field = 'expense_date'
556
+      this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
548
       this.filter.sort_type = 'desc'
557
       this.filter.sort_type = 'desc'
549
       this.pagination.page = 1
558
       this.pagination.page = 1
550
       this.handleGetList()
559
       this.handleGetList()
562
       this.filter.account_id = val
571
       this.filter.account_id = val
563
       this.handleGetChart()
572
       this.handleGetChart()
564
       this.handleGetSummaryList()
573
       this.handleGetSummaryList()
574
+      this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
575
+      this.filter.sort_type = 'desc'
565
       this.pagination.page = 1
576
       this.pagination.page = 1
566
       this.handleGetList()
577
       this.handleGetList()
567
     },
578
     },
570
       this.filter.account_id_adq = val
581
       this.filter.account_id_adq = val
571
       this.handleGetChart()
582
       this.handleGetChart()
572
       this.handleGetSummaryList()
583
       this.handleGetSummaryList()
584
+      this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
585
+      this.filter.sort_type = 'desc'
573
       this.pagination.page = 1
586
       this.pagination.page = 1
574
       this.handleGetList()
587
       this.handleGetList()
575
     },
588
     },
607
       if (this.filter.sort_field === sort_field) {
620
       if (this.filter.sort_field === sort_field) {
608
         if (this.filter.sort_type === sort_type) {
621
         if (this.filter.sort_type === sort_type) {
609
           // 点击的是当前排序字段 && 是当前排序类型 => 重置 取消排序
622
           // 点击的是当前排序字段 && 是当前排序类型 => 重置 取消排序
610
-          this.filter.sort_field = 'expense_date'
623
+          this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
611
           this.filter.sort_type = 'desc'
624
           this.filter.sort_type = 'desc'
612
         } else {
625
         } else {
613
           // 点击的是当前排序字段 && 非当前排序类型 => 设置排序类型
626
           // 点击的是当前排序字段 && 非当前排序类型 => 设置排序类型
632
       this.filter.closing_date = '',
645
       this.filter.closing_date = '',
633
       this.filter.plat_order_type = ''
646
       this.filter.plat_order_type = ''
634
       this.filter.costCover = ['', '']
647
       this.filter.costCover = ['', '']
635
-      this.filter.sort_field = 'expense_date'
648
+      this.filter.sort_field = 'paid'
636
       this.filter.sort_type = 'desc'
649
       this.filter.sort_type = 'desc'
637
       this.pagination.page = 1
650
       this.pagination.page = 1
638
       this.handleGetChart()
651
       this.handleGetChart()