Browse Source

feat: 企微数据 - 粉丝激活趋势 - 默认排序逻辑

zhengxy 2 years ago
parent
commit
08289eb9b7
1 changed files with 19 additions and 4 deletions
  1. 19 4
      project/src/components/dataBoard/fansActiveTrends.vue

+ 19 - 4
project/src/components/dataBoard/fansActiveTrends.vue

@@ -206,7 +206,7 @@ export default {
206 206
         closing_date: '', // 收益截止日期
207 207
         plat_order_type: '', // 推广类型
208 208
         costCover: ['', ''], // 回本率(范围)
209
-        sort_field: 'expense_date', // 排序字段 - 默认值
209
+        sort_field: 'paid', // 排序字段 - 默认值
210 210
         sort_type: 'desc', // 升序/降序
211 211
       },
212 212
     }
@@ -220,6 +220,15 @@ export default {
220 220
     isADQ() {
221 221
       return this.filter.order_type === orderTypeOptions.ADQ
222 222
     },
223
+    // 当前"时间"列是否展示的为"时间段" => 是时间段 默认排序"消耗"、非时间段 默认排序时间
224
+    isShowTimes() {
225
+      // (MP && 选了MP账号 && 选了短剧) || (ADQ && 选了ADQ账号 && 选了短剧)
226
+      if ((this.isMP && this.filter.account_id && this.filter.playlet_id) || (this.isADQ && this.filter.account_id_adq && this.filter.playlet_id)) {
227
+        return false
228
+      } else {
229
+        return true
230
+      }
231
+    },
223 232
   },
224 233
   created () {
225 234
     this.initTableHeight()
@@ -553,7 +562,7 @@ export default {
553 562
     onChangeOrderType() {
554 563
       this.handleGetChart()
555 564
       this.handleGetSummaryList()
556
-      this.filter.sort_field = 'expense_date'
565
+      this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
557 566
       this.filter.sort_type = 'desc'
558 567
       this.pagination.page = 1
559 568
       this.handleGetList()
@@ -571,6 +580,8 @@ export default {
571 580
       this.filter.account_id = val
572 581
       this.handleGetChart()
573 582
       this.handleGetSummaryList()
583
+      this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
584
+      this.filter.sort_type = 'desc'
574 585
       this.pagination.page = 1
575 586
       this.handleGetList()
576 587
     },
@@ -579,6 +590,8 @@ export default {
579 590
       this.filter.account_id_adq = val
580 591
       this.handleGetChart()
581 592
       this.handleGetSummaryList()
593
+      this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
594
+      this.filter.sort_type = 'desc'
582 595
       this.pagination.page = 1
583 596
       this.handleGetList()
584 597
     },
@@ -587,6 +600,8 @@ export default {
587 600
       this.filter.playlet_id = val
588 601
       this.handleGetChart()
589 602
       this.handleGetSummaryList()
603
+      this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
604
+      this.filter.sort_type = 'desc'
590 605
       this.pagination.page = 1
591 606
       this.handleGetList()
592 607
     },
@@ -624,7 +639,7 @@ export default {
624 639
       if (this.filter.sort_field === sort_field) {
625 640
         if (this.filter.sort_type === sort_type) {
626 641
           // 点击的是当前排序字段 && 是当前排序类型 => 重置 取消排序
627
-          this.filter.sort_field = 'expense_date'
642
+          this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
628 643
           this.filter.sort_type = 'desc'
629 644
         } else {
630 645
           // 点击的是当前排序字段 && 非当前排序类型 => 设置排序类型
@@ -650,7 +665,7 @@ export default {
650 665
       this.filter.closing_date = '',
651 666
       this.filter.plat_order_type = ''
652 667
       this.filter.costCover = ['', '']
653
-      this.filter.sort_field = 'expense_date'
668
+      this.filter.sort_field = 'paid'
654 669
       this.filter.sort_type = 'desc'
655 670
       this.pagination.page = 1
656 671
       this.handleGetChart()