Browse Source

feat: 花生平台 - 数据循环统计 - 接口联调

zhengxy 2 years ago
parent
commit
532deb2abb

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

359
   dataBoardHS_adqAccountList: "/api/provisionalStat/adqAccountList", // 花生平台 - adq账号授权列表
359
   dataBoardHS_adqAccountList: "/api/provisionalStat/adqAccountList", // 花生平台 - adq账号授权列表
360
   dataBoardHS_wxAccountList: "/api/provisionalStat/wxAccountList", // 花生平台 - mp账号授权列表
360
   dataBoardHS_wxAccountList: "/api/provisionalStat/wxAccountList", // 花生平台 - mp账号授权列表
361
   dataBoardHS_bindAdq: "/api/provisionalStat/bind", // 花生平台 - 绑定ADQ账号
361
   dataBoardHS_bindAdq: "/api/provisionalStat/bind", // 花生平台 - 绑定ADQ账号
362
+  dataBoardHS_dataCycleList: "/api/statistics/HuaShengDataCycleList", // 花生平台 - 数据循环统计
362
 
363
 
363
 };
364
 };
364
 
365
 

+ 21 - 0
project/src/components/assembly/screen/channel.vue

181
     } else if (this.type == 'platform') { // 平台选项
181
     } else if (this.type == 'platform') { // 平台选项
182
       this.getPlatformList()
182
       this.getPlatformList()
183
       this.placeholderVal = '请选择平台'
183
       this.placeholderVal = '请选择平台'
184
+    } else if (this.type == 'mpAccountHS') { // 花生平台 MP账号
185
+      this.getMpAccountHSList()
186
+      this.placeholderVal = '请选择账号'
184
     } else {
187
     } else {
185
       this.init()
188
       this.init()
186
     }
189
     }
187
 
190
 
188
   },
191
   },
189
   methods: {
192
   methods: {
193
+    getMpAccountHSList() { // 花生平台 MP账号
194
+      this.$axios.get(this.URL.BASEURL + this.URL.dataBoardHS_wxAccountList, {
195
+        params: {
196
+          is_select: 1
197
+        }
198
+      }).then((res) => {
199
+        var res = res.data
200
+        if (res && res.errno == 0) {
201
+          this.options = res.rst
202
+          this.options.forEach((item) => {
203
+            item.val = item.account_name
204
+            item.key = item.wechat_account_id
205
+          });
206
+        } else if (res.errno != 4002) {
207
+        }
208
+      }).catch((err) => {
209
+      });
210
+    },
190
     getPlatformList() { // 平台选项
211
     getPlatformList() { // 平台选项
191
       this.$axios.post(this.URL.BASEURL + this.URL.getPlatformOptions, {}).then((res) => {
212
       this.$axios.post(this.URL.BASEURL + this.URL.getPlatformOptions, {}).then((res) => {
192
         var res = res.data
213
         var res = res.data

+ 1 - 1
project/src/components/assembly/screen/channelMultiple.vue

109
     } else if (this.type == 'paySource') {//充值订单管理-付费来源
109
     } else if (this.type == 'paySource') {//充值订单管理-付费来源
110
       this.options = [
110
       this.options = [
111
         { key: 1, val: '柚子' },
111
         { key: 1, val: '柚子' },
112
-        { key: 2, val: '书' },
112
+        { key: 2, val: '书' },
113
         { key: 3, val: '迈步' },
113
         { key: 3, val: '迈步' },
114
         { key: 4, val: '点众-阳光' },
114
         { key: 4, val: '点众-阳光' },
115
         // { key: 5, val: '中文在线' },
115
         // { key: 5, val: '中文在线' },

+ 69 - 56
project/src/components/dataBoard/regRangeReportHS.vue

13
           <label class="common-screen-label">收益截止日期</label>
13
           <label class="common-screen-label">收益截止日期</label>
14
           <el-date-picker v-model="closing_date" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" size="small" style="width:150px" @change="onChangeClosingDate" />
14
           <el-date-picker v-model="closing_date" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" size="small" style="width:150px" @change="onChangeClosingDate" />
15
         </div>
15
         </div>
16
-        <!-- 花生账户 -->
17
-        <selfChannel :reset="reset" title="账户" type="adqAccount" labelWidth @channelDefine="onChangeAccountHS" />
16
+        <!-- 花生mp账号 -->
17
+        <selfChannel :reset="reset" title="账号" type="mpAccountHS" labelWidth @channelDefine="onChangeAccountHS" />
18
       </div>
18
       </div>
19
     </div>
19
     </div>
20
     <!-- S 新增区间筛选项 -->
20
     <!-- S 新增区间筛选项 -->
110
       paid: ['', ''], // 消耗(范围)
110
       paid: ['', ''], // 消耗(范围)
111
       reset: false,
111
       reset: false,
112
       closing_date: '', // 收益截止日期
112
       closing_date: '', // 收益截止日期
113
-      account_id_hs: '', // 花生账户
113
+      app_id: '', // 花生mp账号
114
       sort_field: 'date', // 排序字段 默认 时间 & 降序
114
       sort_field: 'date', // 排序字段 默认 时间 & 降序
115
       sort_type: 'desc', // 升序/降序
115
       sort_type: 'desc', // 升序/降序
116
       updateTime: '', // 数据更新时间
116
       updateTime: '', // 数据更新时间
123
     this.handleGetUpdateTime()
123
     this.handleGetUpdateTime()
124
   },
124
   },
125
   methods: {
125
   methods: {
126
-    // 获取"数据更新时间"
127
-    async handleGetUpdateTime() {
128
-      console.log('handleGetUpdateTime => ')
129
-      try {
130
-        const params = { type: '' }
131
-
132
-        params.type = 'data_cycle_adq' // mock
133
-
134
-        const { data: res = {} } = await this.$axios.get(`${this.URL.BASEURL}${this.URL.dataBoard_uptime}`, { params })
135
-        if (res && res.errno == 0) {
136
-          this.updateTime = res.rst.uptime
137
-        } else if (res.errno != 4002) {
138
-          this.$message.warning(res.err)
139
-          this.updateTime = ''
140
-        }
141
-      } catch (error) {
142
-        this.updateTime = ''
143
-      }
144
-    },
126
+    // 重置
145
     handleReset() {
127
     handleReset() {
146
       this.reset = !this.reset
128
       this.reset = !this.reset
147
       this.closing_date = ''
129
       this.closing_date = ''
148
-      this.account_id_hs = ''
130
+      this.app_id = ''
149
       this.time = this.default_time
131
       this.time = this.default_time
150
       this.firstDayRoi = ['', ''] // 首日ROI(范围)
132
       this.firstDayRoi = ['', ''] // 首日ROI(范围)
151
       this.firstOrderCost = ['', ''] // 下单成本(范围)
133
       this.firstOrderCost = ['', ''] // 下单成本(范围)
157
       this.init(1)
139
       this.init(1)
158
       this.handleGetUpdateTime()
140
       this.handleGetUpdateTime()
159
     },
141
     },
160
-    changeTime (time) {//筛选时间变化
161
-      if (!time || time && time.length == 0) {
162
-        this.time = []
142
+    // 监听排序变化
143
+    onClickSort(sort_field, sort_type) {
144
+      // sort_type:升序asc、降序desc
145
+      if (this.sort_field === sort_field) {
146
+        if (this.sort_type === sort_type) {
147
+          // 点击的是当前排序字段 && 是当前排序类型 => 重置 取消排序
148
+          this.sort_field = 'date'
149
+          this.sort_type = 'desc'
150
+        } else {
151
+          // 点击的是当前排序字段 && 非当前排序类型 => 设置排序类型
152
+          this.sort_type = sort_type
153
+        }
163
       } else {
154
       } else {
164
-        this.time = time
155
+        // 点击的不是当前排序字段 => 设置排序字段和类型
156
+        this.sort_field = sort_field
157
+        this.sort_type = sort_type
165
       }
158
       }
159
+      // 后端排序 => 获取最新数据
166
       this.init(1)
160
       this.init(1)
167
       this.handleGetUpdateTime()
161
       this.handleGetUpdateTime()
168
     },
162
     },
163
+    // 获取"数据更新时间"
164
+    async handleGetUpdateTime() {
165
+      console.log('handleGetUpdateTime => ')
166
+      try {
167
+        const params = { type: 'data_cycle_nur' }
168
+        const { data: res = {} } = await this.$axios.get(`${this.URL.BASEURL}${this.URL.dataBoard_uptime}`, { params })
169
+        if (res && res.errno == 0) {
170
+          this.updateTime = res.rst.uptime
171
+        } else if (res.errno != 4002) {
172
+          this.$message.warning(res.err)
173
+          this.updateTime = ''
174
+        }
175
+      } catch (error) {
176
+        this.updateTime = ''
177
+      }
178
+    },
179
+    // 获取列表数据
169
     async init(page, type) {
180
     async init(page, type) {
170
       console.log('init => ')
181
       console.log('init => ')
171
       try {
182
       try {
175
           if (this.total == 0) return this.$message.warning('暂无数据可导出')
186
           if (this.total == 0) return this.$message.warning('暂无数据可导出')
176
         }
187
         }
177
         this.loading = true
188
         this.loading = true
178
-        const { data: res = {} } = await this.$axios.get(`${this.URL.BASEURL}${this.URL.dataBoard_dataCycleList}`, {
189
+        const { data: res = {} } = await this.$axios.get(`${this.URL.BASEURL}${this.URL.dataBoardHS_dataCycleList}`, {
179
           params: {
190
           params: {
180
             page: type == 'export' ? 1 : this.page,
191
             page: type == 'export' ? 1 : this.page,
181
             page_size: type == 'export' ? this.$store.state.exportNumber : this.page_size,
192
             page_size: type == 'export' ? this.$store.state.exportNumber : this.page_size,
190
             first_day_roi_min: this.firstDayRoi[0],
201
             first_day_roi_min: this.firstDayRoi[0],
191
             first_day_roi_max: this.firstDayRoi[1],
202
             first_day_roi_max: this.firstDayRoi[1],
192
             closing_date: this.closing_date,
203
             closing_date: this.closing_date,
193
-            account_id_hs: this.account_id_hs,
204
+            app_id: this.app_id,
194
             paid_min: this.paid[0],
205
             paid_min: this.paid[0],
195
             paid_max: this.paid[1],
206
             paid_max: this.paid[1],
196
             sort_field: this.sort_field,
207
             sort_field: this.sort_field,
197
             sort_type: this.sort_type,
208
             sort_type: this.sort_type,
198
-
199
-            order_type: 2, // mock
200
           }
209
           }
201
         })
210
         })
202
 
211
 
206
           } else {
215
           } else {
207
             res.rst.data.list.head[0].fixed = 'left' // 第一列固定左侧
216
             res.rst.data.list.head[0].fixed = 'left' // 第一列固定左侧
208
             res.rst.data.overview.head[0].fixed = 'left' // 第一列固定左侧
217
             res.rst.data.overview.head[0].fixed = 'left' // 第一列固定左侧
218
+
219
+            res.rst.data.list.head.forEach(item => {
220
+              if (item.name && item.name.length > 6) { // 长字符宽度
221
+                item['min_width'] = item.name.length * 21
222
+              }
223
+            })
224
+
225
+            res.rst.data.overview.head.forEach(item => {
226
+              if (item.name && item.name.length > 6) { // 长字符宽度
227
+                item['min_width'] = item.name.length * 20
228
+              }
229
+            })
230
+
209
             this.summaryTableCol = Object.freeze(res.rst.data.overview.head || [])
231
             this.summaryTableCol = Object.freeze(res.rst.data.overview.head || [])
210
             this.detailsTableCol = Object.freeze(res.rst.data.list.head || [])
232
             this.detailsTableCol = Object.freeze(res.rst.data.list.head || [])
211
             await this.$nextTick()
233
             await this.$nextTick()
235
       this.total = 0;
257
       this.total = 0;
236
       this.pages = 0;
258
       this.pages = 0;
237
     },
259
     },
260
+    // 监听分页变化
238
     handleCurrentChange (val) {
261
     handleCurrentChange (val) {
239
       this.init(val)
262
       this.init(val)
240
       this.handleGetUpdateTime()
263
       this.handleGetUpdateTime()
241
     },
264
     },
265
+    // 筛选时间变化
266
+    changeTime(time) {
267
+      if (!time || time && time.length == 0) {
268
+        this.time = []
269
+      } else {
270
+        this.time = time
271
+      }
272
+      this.init(1)
273
+      this.handleGetUpdateTime()
274
+    },
242
     // 监听“收益截止日期”筛选变化
275
     // 监听“收益截止日期”筛选变化
243
     onChangeClosingDate(val) {
276
     onChangeClosingDate(val) {
244
       this.closing_date = val || ''
277
       this.closing_date = val || ''
245
       this.init(1)
278
       this.init(1)
246
       this.handleGetUpdateTime()
279
       this.handleGetUpdateTime()
247
     },
280
     },
248
-    // 监听“花生账户”筛选变化
281
+    // 监听“花生mp账号”筛选变化
249
     onChangeAccountHS(val) {
282
     onChangeAccountHS(val) {
250
-      this.account_id_hs = val || ''
251
-      this.init(1)
252
-      this.handleGetUpdateTime()
253
-    },
254
-    // 监听排序变化
255
-    onClickSort(sort_field, sort_type) {
256
-      // sort_type:升序asc、降序desc
257
-      if (this.sort_field === sort_field) {
258
-        if (this.sort_type === sort_type) {
259
-          // 点击的是当前排序字段 && 是当前排序类型 => 重置 取消排序
260
-          this.sort_field = 'date'
261
-          this.sort_type = 'desc'
262
-        } else {
263
-          // 点击的是当前排序字段 && 非当前排序类型 => 设置排序类型
264
-          this.sort_type = sort_type
265
-        }
266
-      } else {
267
-        // 点击的不是当前排序字段 => 设置排序字段和类型
268
-        this.sort_field = sort_field
269
-        this.sort_type = sort_type
270
-      }
271
-      // 后端排序 => 获取最新数据
283
+      this.app_id = val || ''
272
       this.init(1)
284
       this.init(1)
273
       this.handleGetUpdateTime()
285
       this.handleGetUpdateTime()
274
     },
286
     },
275
-    exportEvent (data) {
287
+    // 导出
288
+    exportEvent(data) {
276
       const tHeader = data.list.head.map(v => v.name)
289
       const tHeader = data.list.head.map(v => v.name)
277
       const filterVal = data.list.head.map(v => v.column)
290
       const filterVal = data.list.head.map(v => v.column)
278
       const tableDatas = [data.overview.list, ...data.list.list]
291
       const tableDatas = [data.overview.list, ...data.list.list]
284
           sheetName: '', // 表一的sheet名字
297
           sheetName: '', // 表一的sheet名字
285
         },
298
         },
286
       ]
299
       ]
287
-      this.$exportOrder({ excelDatas, name: `数据循环统计(导出时间:${this.$getDay(0)})` })
300
+      this.$exportOrder({ excelDatas, name: `花生数据循环统计(导出时间:${this.$getDay(0)})` })
288
     }
301
     }
289
   }
302
   }
290
 }
303
 }