Parcourir la Source

feat: 企微数据 - 账号数据趋势 - mp列表接口联调

zhengxy il y a 2 ans
Parent
commit
ebd53bc2a5

+ 1 - 0
project/src/assets/config/interface_api.js

@@ -257,6 +257,7 @@ var api = {
257 257
 
258 258
   dataBoard_dataCycleList: "/api/statistics/dataCycleList", // 数据循环统计
259 259
   dataBoard_adqAccount: "/api/accountDataTrend/adqAccount", // 账号数据趋势 - adq
260
+  dataBoard_mpAccount: "/api/accountDataTrend/mpAccount", // 账号数据趋势 - mp
260 261
 };
261 262
 
262 263
 export { api };

+ 20 - 13
project/src/components/dataBoard/accountTrends.vue

@@ -78,7 +78,7 @@
78 78
             <div v-if="item.column === 'ref_date'">
79 79
               <span>{{ row['expense_date'] }}</span><span v-if="row['expense_date_end']"> - {{ row['expense_date_end'] }}</span>
80 80
             </div>
81
-            <!-- 日期 -->
81
+            <!-- adq账号 -->
82 82
             <span v-else-if="item.column === 'account_id'">
83 83
               {{ row['account_id'] || '-' }}
84 84
             </span>
@@ -217,8 +217,6 @@ export default {
217 217
     // 获取列表数据
218 218
     async handleGetList() {
219 219
       console.log('handleGetList => ',)
220
-      console.log('filter => ', JSON.parse(JSON.stringify(this.filter)))
221
-      console.log('pagination => ', JSON.parse(JSON.stringify(this.pagination)))
222 220
       try {
223 221
         this.loading = true
224 222
         const params = {
@@ -226,7 +224,6 @@ export default {
226 224
           page_size: this.pagination.page_size,
227 225
           start_date: this.filter.time[0],
228 226
           end_date: this.filter.time[1],
229
-          account_id: this.isADQ ? this.filter.account_id_adq : (this.isMP ? this.filter.account_id : ''),
230 227
           closing_date: this.filter.closing_date,
231 228
           plat_order_type: this.filter.plat_order_type,
232 229
           cost_cover_min: this.filter.costCover[0],
@@ -234,24 +231,34 @@ export default {
234 231
           sort_field: this.filter.sort_field,
235 232
           sort_type: this.filter.sort_type,
236 233
         }
237
-        const { data: res = {} } = await this.$axios.post(`${this.URL.BASEURL}${this.URL.dataBoard_adqAccount}`, params)
234
+        let url = ''
235
+
236
+        if (this.isADQ) { // adq 参数 & api
237
+          params.account_id = this.filter.account_id_adq
238
+          url = `${this.URL.BASEURL}${this.URL.dataBoard_adqAccount}`
239
+        } else if (this.isMP) { // mp 参数 & api
240
+          params.app_id = this.filter.account_id
241
+          url = `${this.URL.BASEURL}${this.URL.dataBoard_mpAccount}`
242
+        }
243
+
244
+        const { data: res = {} } = await this.$axios.post(url, params)
238 245
         this.loading = false
239 246
         if (res && res.errno == 0) {
240 247
           res.rst.extra[0].fixed = 'left' // 前2列固定左侧
241 248
           res.rst.extra[1].fixed = 'left' // 前2列固定左侧
242 249
           const detailsTableCol = []
243 250
           const detailsTableColDays = []
244
-          res.rst.extra.forEach(item => { // 处理列宽问题 给长字符列设置min_width
245
-            if (item.name.includes('DAY')) {
251
+          res.rst.extra.forEach(item => {
252
+            if (item.name.includes('DAY')) { // 收集 DAY1、DAY2...表头
246 253
               detailsTableColDays.push(item)
247
-            } else {
248
-              if (item.name && item.name.length > 6) {
254
+            } else { // 普通表头
255
+              if (item.name && item.name.length > 6) { // 长字符宽度
249 256
                 item['min_width'] = item.name.length * 20
250 257
               }
251
-              if (item.column === 'ref_date' && ((this.isMP && !this.filter.account_id) || (this.isADQ && !this.filter.account_id_adq))) {
258
+              if (item.column === 'ref_date' && ((this.isMP && !this.filter.account_id) || (this.isADQ && !this.filter.account_id_adq))) { // 时间(日期)列宽度
252 259
                 item['min_width'] = 200
253 260
               }
254
-              detailsTableCol.push(item)
261
+              detailsTableCol.push(item) // 收集普通表头
255 262
             }
256 263
           })
257 264
           this.detailsTableCol = Object.freeze(detailsTableCol)
@@ -517,8 +524,8 @@ export default {
517 524
       this.filter.closing_date = '',
518 525
       this.filter.plat_order_type = ''
519 526
       this.filter.costCover = ['', '']
520
-      this.filter.sort_field = ''
521
-      this.filter.sort_type = ''
527
+      this.filter.sort_field = 'expense_date'
528
+      this.filter.sort_type = 'desc'
522 529
       this.pagination.page = 1
523 530
       this.handleGetList()
524 531
     },