Browse Source

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

zhengxy 2 years ago
parent
commit
66b3480395
1 changed files with 17 additions and 4 deletions
  1. 17 4
      project/src/components/dataBoard/accountTrends.vue

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

@@ -204,7 +204,7 @@ export default {
204 204
         closing_date: '', // 收益截止日期
205 205
         plat_order_type: '', // 推广类型
206 206
         costCover: ['', ''], // 回本率(范围)
207
-        sort_field: 'expense_date', // 排序字段 - 默认值
207
+        sort_field: 'paid', // 排序字段 - 默认值
208 208
         sort_type: 'desc', // 升序/降序
209 209
       },
210 210
     }
@@ -218,6 +218,15 @@ export default {
218 218
     isADQ() {
219 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 231
   created () {
223 232
     this.initTableHeight()
@@ -544,7 +553,7 @@ export default {
544 553
     onChangeOrderType() {
545 554
       this.handleGetChart()
546 555
       this.handleGetSummaryList()
547
-      this.filter.sort_field = 'expense_date'
556
+      this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
548 557
       this.filter.sort_type = 'desc'
549 558
       this.pagination.page = 1
550 559
       this.handleGetList()
@@ -562,6 +571,8 @@ export default {
562 571
       this.filter.account_id = val
563 572
       this.handleGetChart()
564 573
       this.handleGetSummaryList()
574
+      this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
575
+      this.filter.sort_type = 'desc'
565 576
       this.pagination.page = 1
566 577
       this.handleGetList()
567 578
     },
@@ -570,6 +581,8 @@ export default {
570 581
       this.filter.account_id_adq = val
571 582
       this.handleGetChart()
572 583
       this.handleGetSummaryList()
584
+      this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
585
+      this.filter.sort_type = 'desc'
573 586
       this.pagination.page = 1
574 587
       this.handleGetList()
575 588
     },
@@ -607,7 +620,7 @@ export default {
607 620
       if (this.filter.sort_field === sort_field) {
608 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 624
           this.filter.sort_type = 'desc'
612 625
         } else {
613 626
           // 点击的是当前排序字段 && 非当前排序类型 => 设置排序类型
@@ -632,7 +645,7 @@ export default {
632 645
       this.filter.closing_date = '',
633 646
       this.filter.plat_order_type = ''
634 647
       this.filter.costCover = ['', '']
635
-      this.filter.sort_field = 'expense_date'
648
+      this.filter.sort_field = 'paid'
636 649
       this.filter.sort_type = 'desc'
637 650
       this.pagination.page = 1
638 651
       this.handleGetChart()