Encore лет назад: 6
Родитель
Сommit
5f48ee5866

+ 27 - 0
src/api/agnetManagement.js

@@ -53,3 +53,30 @@ export function fetchAllMemberList(query) {
53 53
   })
54 54
 }
55 55
 
56
+export function fetchGroupDetail(data, query) {
57
+  return request({
58
+    url: `/agents/${data.GambleMember.id}/groupDetail`,
59
+    method: 'get',
60
+    params: {
61
+      startAt: query.startAt,
62
+      endAt: query.endAt
63
+      // name: query.name
64
+    //   chipsSort: query.chipsSort,
65
+    //   updatedSort: query.updatedSort
66
+    }
67
+  })
68
+}
69
+
70
+export function fetchGroupAll(data, query) {
71
+  return request({
72
+    url: `/agents/${data.GambleMember.id}/all`,
73
+    method: 'get',
74
+    params: {
75
+      startAt: query.startAt,
76
+      endAt: query.endAt
77
+      // name: query.name
78
+    //   chipsSort: query.chipsSort,
79
+    //   updatedSort: query.updatedSort
80
+    }
81
+  })
82
+}

+ 1 - 1
src/router/index.js

@@ -167,7 +167,7 @@ export const constantRouterMap = [
167 167
         meta: {
168 168
           title: '代理商管理',
169 169
           icon: 'table',
170
-          noCache: true
170
+          noCache: false
171 171
           // role: ['dd']
172 172
         },
173 173
         children: [

+ 1 - 1
src/utils/request.js

@@ -6,7 +6,7 @@ import { getToken } from '@/utils/auth'
6 6
 // 创建axios实例
7 7
 const service = axios.create({
8 8
   baseURL: process.env.BASE_API, // api的base_url
9
-  timeout: 20000 // 请求超时时间
9
+  timeout: 600000 // 请求超时时间
10 10
 })
11 11
 
12 12
 // request拦截器

+ 112 - 97
src/views/agnetManagement/gambleMemberManagement/index.vue

@@ -17,10 +17,10 @@
17 17
           </div>
18 18
       </div>
19 19
       <el-table :data="allCombine" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row>
20
-          <el-table-column label="代理商名稱" align="center">
21
-            <template slot-scope="scope">
20
+          <el-table-column label="代理商名稱" prop="data.secondLayer.GambleMember.name).slice(19)" align="center">
21
+            <!-- <template slot-scope="scope">
22 22
               <span>{{scope.row.name}}</span>
23
-            </template>
23
+            </template> -->
24 24
           </el-table-column>
25 25
           <el-table-column label="總上分額" align="center">
26 26
             <template slot-scope="scope">
@@ -106,7 +106,7 @@
106 106
 <script>
107 107
 
108 108
 import { mapActions, mapGetters } from 'vuex'
109
-import { fetchMemberList } from '@/api/agnetManagement'
109
+import { fetchMemberList, fetchGroupDetail } from '@/api/agnetManagement'
110 110
 import waves from '@/directive/waves' // 水波纹指令
111 111
 import moment from 'moment-timezone'
112 112
 import config from '../../../../config' 
@@ -152,6 +152,7 @@ export default {
152 152
         }]
153 153
       },
154 154
       date: null,
155
+      sum: [],      
155 156
       dialogFormVisible: false
156 157
 
157 158
     }
@@ -176,103 +177,110 @@ export default {
176 177
       this.listLoading = true
177 178
       this.allCombine = []
178 179
       this.combine = []
179
-       let combine = []
180
-      await fetchMemberList(this.data.secondLayer, this.listQuery).then(response => {
181
-       console.log('response', response.data.rows)
182
-        response.data.rows.map(member => {
183
-          let row = {
184
-            id: member.id,
185
-            name: member.name,
186
-            chips: member.chips,
187
-            totalUp: 0,
188
-            totalDown: 0,
189
-            totalReward: 0,
190
-            totalPunishment: 0,
191
-            effectiveTotal: 0,
192
-            bookieEarned: 0,
193
-            memberEarned: 0,
194
-            bookieWagerFee: 0,
195
-            bookieWagerFeeRatio: 0,
196
-            bookieServiceFees: 0,
197
-            bookieServiceFeesRatio: 0,
198
-            memberServiceFees: 0,
199
-            memberServiceFeesRatio: 0,
200
-            totalServiceFees: 0,
201
-            memberCheckOut: 0,
202
-            feeRatio: new Decimal(this.data.secondLayer.feeRatio/100),
203
-          }
204
-          let bookie = _.groupBy(member['GambleGame-Bucket-MemberRecords'], 'isBookie')
205
-          if (bookie.false) {
206
-            row.memberEarned = _.sumBy(bookie.false, item => {
207
-              return Math.abs(item.earned)
208
-            });
209
-            // console.log('membeEarned', row.memberEarned)
210
-            row.memberServiceFees = _.sumBy(bookie.false, 'serviceFees');
211
-            row.memberServiceFeesRatio = row.feeRatio.times(row.memberServiceFees).valueOf()
180
+      //  let combine = []
181
+       await fetchGroupDetail(this.data.secondLayer, this.listQuery).then(response => {
182
+
183
+         console.log('combine', response.data)
184
+         
185
+         this.combine = response.data
186
+         
187
+       });
188
+      // await fetchMemberList(this.data.secondLayer, this.listQuery).then(response => {
189
+      //  console.log('response', response.data.rows)
190
+      //   response.data.rows.map(member => {
191
+      //     let row = {
192
+      //       id: member.id,
193
+      //       name: member.name,
194
+      //       chips: member.chips,
195
+      //       totalUp: 0,
196
+      //       totalDown: 0,
197
+      //       totalReward: 0,
198
+      //       totalPunishment: 0,
199
+      //       effectiveTotal: 0,
200
+      //       bookieEarned: 0,
201
+      //       memberEarned: 0,
202
+      //       bookieWagerFee: 0,
203
+      //       bookieWagerFeeRatio: 0,
204
+      //       bookieServiceFees: 0,
205
+      //       bookieServiceFeesRatio: 0,
206
+      //       memberServiceFees: 0,
207
+      //       memberServiceFeesRatio: 0,
208
+      //       totalServiceFees: 0,
209
+      //       memberCheckOut: 0,
210
+      //       feeRatio: new Decimal(this.data.secondLayer.feeRatio/100),
211
+      //     }
212
+      //     let bookie = _.groupBy(member['GambleGame-Bucket-MemberRecords'], 'isBookie')
213
+      //     if (bookie.false) {
214
+      //       row.memberEarned = _.sumBy(bookie.false, item => {
215
+      //         return Math.abs(item.earned)
216
+      //       });
217
+      //       // console.log('membeEarned', row.memberEarned)
218
+      //       row.memberServiceFees = _.sumBy(bookie.false, 'serviceFees');
219
+      //       row.memberServiceFeesRatio = row.feeRatio.times(row.memberServiceFees).valueOf()
212 220
             
213
-          }
214
-          if (bookie.true) {
215
-            row.bookieWagerFee = _.sumBy(bookie.true, (item) => {
216
-              return item.wagerServiceFees
217
-            });
218
-            row.bookieWagerFeeRatio = row.feeRatio.times(row.bookieWagerFee).valueOf()
219
-            // console.log('eeee', bookie.true)
220
-            row.bookieEarned = _.sumBy(bookie.true, item => {
221
-              return Math.abs(item.earned)
222
-            });
223
-            // console.log('bookieEarned' , row.bookieEarned)
224
-            row.bookieServiceFees = _.sumBy(bookie.true, (item) => { return item.serviceFees});
225
-            row.bookieServiceFeesRatio = row.feeRatio.times(row.bookieServiceFees).valueOf()
226
-          }
221
+      //     }
222
+      //     if (bookie.true) {
223
+      //       row.bookieWagerFee = _.sumBy(bookie.true, (item) => {
224
+      //         return item.wagerServiceFees
225
+      //       });
226
+      //       row.bookieWagerFeeRatio = row.feeRatio.times(row.bookieWagerFee).valueOf()
227
+      //       // console.log('eeee', bookie.true)
228
+      //       row.bookieEarned = _.sumBy(bookie.true, item => {
229
+      //         return Math.abs(item.earned)
230
+      //       });
231
+      //       // console.log('bookieEarned' , row.bookieEarned)
232
+      //       row.bookieServiceFees = _.sumBy(bookie.true, (item) => { return item.serviceFees});
233
+      //       row.bookieServiceFeesRatio = row.feeRatio.times(row.bookieServiceFees).valueOf()
234
+      //     }
227 235
 
228
-          row.effectiveTotal = _.sumBy(member['GambleGame-Bucket-RoundRecords'], item => {
229
-              return item.used_quota
230
-            }) + row.memberEarned
236
+      //     row.effectiveTotal = _.sumBy(member['GambleGame-Bucket-RoundRecords'], item => {
237
+      //         return item.used_quota
238
+      //       }) + row.memberEarned
231 239
 
232
-          row.totalServiceFees = Number(new Decimal(row.bookieServiceFees).plus(row.memberServiceFees).plus(row.bookieWagerFee).times(row.feeRatio).valueOf())
233
-          let chipsLog = _.groupBy(member.GambleMemberChipsLogs, 'type')
234
-          console.log('type', chipsLog)
235
-          if (chipsLog['0'] || chipsLog['2']) {
236
-            row.totalUp = _.sumBy(chipsLog['0'], (item) => { 
237
-              return item.chips > 0 ? item.chips : 0
238
-            })
239
-            row.totalDown = _.sumBy(chipsLog['0'], (item) => { 
240
-              return item.chips < 0 ? item.chips : 0
241
-            }) + _.sumBy(chipsLog['2'], (item) => { 
242
-              return item.chips < 0 ? item.chips : 0
243
-            })
240
+      //     row.totalServiceFees = Number(new Decimal(row.bookieServiceFees).plus(row.memberServiceFees).plus(row.bookieWagerFee).times(row.feeRatio).valueOf())
241
+      //     let chipsLog = _.groupBy(member.GambleMemberChipsLogs, 'type')
242
+      //     console.log('type', chipsLog)
243
+      //     if (chipsLog['0'] || chipsLog['2']) {
244
+      //       row.totalUp = _.sumBy(chipsLog['0'], (item) => { 
245
+      //         return item.chips > 0 ? item.chips : 0
246
+      //       })
247
+      //       row.totalDown = _.sumBy(chipsLog['0'], (item) => { 
248
+      //         return item.chips < 0 ? item.chips : 0
249
+      //       }) + _.sumBy(chipsLog['2'], (item) => { 
250
+      //         return item.chips < 0 ? item.chips : 0
251
+      //       })
244 252
 
245
-          }
246
-          row.memberCheckOut = (row.totalUp + row.totalDown - row.chips)*(-1)
247
-          // TODO CHECK 是否需要
248
-          let punishment =  _.sumBy(member['GambleGame-Bucket-PunishmentRecords'], item => {
249
-              return (item.chips)*(-1)
250
-          })
251
-          if(chipsLog['1']) {
252
-            row.totalReward = _.sumBy(chipsLog['1'], (item) => { 
253
-              return item.chips > 0 ? item.chips : 0
254
-            })
255
-            row.totalPunishment = _.sumBy(chipsLog['1'], (item) => { 
256
-              return item.chips < 0 ? item.chips : 0
257
-            });
258
-          }
259
-          row.totalPunishment += punishment
260
-          // console.log('www',row)
253
+      //     }
254
+      //     row.memberCheckOut = (row.totalUp + row.totalDown - row.chips)*(-1)
255
+      //     // TODO CHECK 是否需要
256
+      //     let punishment =  _.sumBy(member['GambleGame-Bucket-PunishmentRecords'], item => {
257
+      //         return (item.chips)*(-1)
258
+      //     })
259
+      //     if(chipsLog['1']) {
260
+      //       row.totalReward = _.sumBy(chipsLog['1'], (item) => { 
261
+      //         return item.chips > 0 ? item.chips : 0
262
+      //       })
263
+      //       row.totalPunishment = _.sumBy(chipsLog['1'], (item) => { 
264
+      //         return item.chips < 0 ? item.chips : 0
265
+      //       });
266
+      //     }
267
+      //     row.totalPunishment += punishment
268
+      //     // console.log('www',row)
261 269
 
262
-          combine.push(row)
263
-        })
264
-        // console.log('cimbine' , this.combine)
265
-        this.allCombine.push({
266
-          name: (this.data.secondLayer.GambleMember.name).slice(19),
267
-          allUp: _.sumBy(combine, 'totalUp'),
268
-          allDown: _.sumBy(combine, 'totalDown'),
269
-          allChips: _.sumBy(combine, 'chips'),
270
-          allEarned: _.sumBy(combine, (item) => {return item.bookieEarned + item.memberEarned}),
271
-          allServiceFees: _.sumBy(combine, (item) => {return item.totalServiceFees }).toFixed(2),
272
-        })
273
-        this.combine = combine
270
+      //     combine.push(row)
271
+      //   })
272
+      //   // console.log('cimbine' , this.combine)
273
+      //   this.allCombine.push({
274
+      //     name: (this.data.secondLayer.GambleMember.name).slice(19),
275
+      //     allUp: _.sumBy(combine, 'totalUp'),
276
+      //     allDown: _.sumBy(combine, 'totalDown'),
277
+      //     allChips: _.sumBy(combine, 'chips'),
278
+      //     allEarned: _.sumBy(combine, (item) => {return item.bookieEarned + item.memberEarned}),
279
+      //     allServiceFees: _.sumBy(combine, (item) => {return item.totalServiceFees }).toFixed(2),
280
+      //   })
281
+      //   this.combine = combine
274 282
         this.listLoading = false
275
-      })
283
+      // })
276 284
       
277 285
     },
278 286
     handlePersonDetail(row) {
@@ -329,7 +337,7 @@ export default {
329 337
     },
330 338
     getSummaries(param) {
331 339
         const { columns, data } = param;
332
-        const sums = [];
340
+        let sums = [];
333 341
         columns.forEach((column, index) => {
334 342
           if (index === 0) {
335 343
             sums[index] = '合計';
@@ -350,7 +358,14 @@ export default {
350 358
             sums[index] = 'N/A';
351 359
           }
352 360
         });
353
-
361
+        // this.allCombine.push({
362
+        //   name: (this.data.secondLayer.GambleMember.name).slice(19),
363
+        //   allUp: sums[2],
364
+        //   allDown: sums[3],
365
+        //   allChips: sums[1],
366
+        //   allEarned: sums[6],
367
+        //   allServiceFees: sums[13],
368
+        // });
354 369
         return sums;
355 370
       }
356 371
   },

+ 78 - 66
src/views/agnetManagement/index.vue

@@ -66,7 +66,7 @@
66 66
 <script>
67 67
 
68 68
 import { mapGetters, mapActions } from 'vuex'
69
-import { fetchList, createAgent, fetchMemberList } from '@/api/agnetManagement'
69
+import { fetchList, createAgent, fetchMemberList,fetchGroupAll } from '@/api/agnetManagement'
70 70
 import waves from '@/directive/waves' // 水波纹指令
71 71
 import moment from 'moment-timezone'
72 72
 import _ from 'lodash'
@@ -123,73 +123,85 @@ export default {
123 123
 
124 124
         response.data.rows.map(agent => {
125 125
           let combine = []
126
-          this.list = []          
127
-          fetchMemberList(agent, this.listQuery).then(response => {
128
-            response.data.rows.map(member => {
129
-              let row = {
130
-                id: member.id,
131
-                name: member.name,
132
-                chips: member.chips,
133
-                totalUp: 0,
134
-                totalDown: 0,
135
-                totalReward: 0,
136
-                totalPunishment: 0,
137
-                bookieEarned: 0,
138
-                memberEarned: 0,
139
-                bookieWagerFee: 0,
140
-                bookieServiceFees: 0,
141
-                memberServiceFees: 0,
142
-                totalServiceFees: 0,
143
-                memberCheckOut: 0,
144
-              }
145
-            
146
-              let bookie = _.groupBy(member['GambleGame-Bucket-MemberRecords'], 'isBookie')
147
-              if (bookie.false) {
148
-                row.memberEarned = _.sumBy(bookie.false, item => {
149
-                  return Math.abs(item.earned)
150
-                });
151
-                row.memberServiceFees = _.sumBy(bookie.false, 'serviceFees')*agent.feeRatio/100;
152
-              }
153
-              if (bookie.true) {
154
-                row.bookieWagerFee = _.sumBy(bookie.true, (item) => {
155
-                  return item.wagerServiceFees
156
-                }) * agent.feeRatio/100;
157
-                row.bookieEarned = _.sumBy(bookie.true, item => {
158
-                  return Math.abs(item.earned)
159
-                });
160
-                row.bookieServiceFees = _.sumBy(bookie.true, (item) => { return item.serviceFees })*agent.feeRatio/100;
161
-              }
162
-              row.totalServiceFees =  Number(new Decimal(row.bookieServiceFees).plus(row.memberServiceFees).plus(row.bookieWagerFee).valueOf())
163
-              let chipsLog = _.groupBy(member.GambleMemberChipsLogs, 'type')
164
-              if (chipsLog['0']) {
165
-                row.totalUp = _.sumBy(chipsLog['0'], (item) => { 
166
-                  return item.chips > 0 ? item.chips : 0
167
-                })
168
-                row.totalDown = _.sumBy(chipsLog['0'], (item) => { 
169
-                  return item.chips < 0 ? item.chips : 0
170
-                })
171
-              }
172
-              row.memberCheckOut = row.totalUp + row.totalDown - row.chips
173
-              if(chipsLog['1']) {
174
-                row.totalReward = _.sumBy(chipsLog['1'], (item) => { 
175
-                  return item.chips > 0 ? item.chips : 0
176
-                })
177
-                row.totalPunishment = _.sumBy(chipsLog['1'], (item) => { 
178
-                  return item.chips < 0 ? item.chips : 0
179
-                })
180
-              }
181
-              combine.push(row)
126
+          this.list = []   
127
+          this.visible.firstLayer === true ?  fetchGroupAll(agent, this.listQuery).then(response => {
128
+            console.log('response' , response.data.all)
129
+            this.list.push({
130
+              // id: agent.GambleMember.id,
131
+              GambleMember: {
132
+                id: agent.GambleMember.id,
133
+                name: agent.GambleMember.name
134
+              },
135
+              feeRatio: response.data.feeRatio,
136
+              all: response.data.all
182 137
             })
183
-            let allUp = _.sumBy(combine, 'totalUp')
184
-            let allDown = _.sumBy(combine, 'totalDown')
185
-            let allChips = _.sumBy(combine, 'chips')
186
-            let allEarned = _.sumBy(combine, (item) => {return item.bookieEarned + item.memberEarned})
187
-            let allServiceFees = _.sumBy(combine, (item) => {return item.totalServiceFees}).toFixed(2)
188
-            agent.all = (allUp+allDown-allChips-allServiceFees)*(-1)
189
-            this.list.push(agent)
138
+          }) : false
139
+          // fetchMemberList(agent, this.listQuery).then(response => {
140
+          //   response.data.rows.map(member => {
141
+          //     let row = {
142
+          //       id: member.id,
143
+          //       name: member.name,
144
+          //       chips: member.chips,
145
+          //       totalUp: 0,
146
+          //       totalDown: 0,
147
+          //       totalReward: 0,
148
+          //       totalPunishment: 0,
149
+          //       bookieEarned: 0,
150
+          //       memberEarned: 0,
151
+          //       bookieWagerFee: 0,
152
+          //       bookieServiceFees: 0,
153
+          //       memberServiceFees: 0,
154
+          //       totalServiceFees: 0,
155
+          //       memberCheckOut: 0,
156
+          //     }
190 157
             
191
-            this.listLoading = false
192
-          })
158
+          //     let bookie = _.groupBy(member['GambleGame-Bucket-MemberRecords'], 'isBookie')
159
+          //     if (bookie.false) {
160
+          //       row.memberEarned = _.sumBy(bookie.false, item => {
161
+          //         return Math.abs(item.earned)
162
+          //       });
163
+          //       row.memberServiceFees = _.sumBy(bookie.false, 'serviceFees')*agent.feeRatio/100;
164
+          //     }
165
+          //     if (bookie.true) {
166
+          //       row.bookieWagerFee = _.sumBy(bookie.true, (item) => {
167
+          //         return item.wagerServiceFees
168
+          //       }) * agent.feeRatio/100;
169
+          //       row.bookieEarned = _.sumBy(bookie.true, item => {
170
+          //         return Math.abs(item.earned)
171
+          //       });
172
+          //       row.bookieServiceFees = _.sumBy(bookie.true, (item) => { return item.serviceFees })*agent.feeRatio/100;
173
+          //     }
174
+          //     row.totalServiceFees =  Number(new Decimal(row.bookieServiceFees).plus(row.memberServiceFees).plus(row.bookieWagerFee).valueOf())
175
+          //     let chipsLog = _.groupBy(member.GambleMemberChipsLogs, 'type')
176
+          //     if (chipsLog['0']) {
177
+          //       row.totalUp = _.sumBy(chipsLog['0'], (item) => { 
178
+          //         return item.chips > 0 ? item.chips : 0
179
+          //       })
180
+          //       row.totalDown = _.sumBy(chipsLog['0'], (item) => { 
181
+          //         return item.chips < 0 ? item.chips : 0
182
+          //       })
183
+          //     }
184
+          //     row.memberCheckOut = row.totalUp + row.totalDown - row.chips
185
+          //     if(chipsLog['1']) {
186
+          //       row.totalReward = _.sumBy(chipsLog['1'], (item) => { 
187
+          //         return item.chips > 0 ? item.chips : 0
188
+          //       })
189
+          //       row.totalPunishment = _.sumBy(chipsLog['1'], (item) => { 
190
+          //         return item.chips < 0 ? item.chips : 0
191
+          //       })
192
+          //     }
193
+          //     combine.push(row)
194
+          //   })
195
+          //   let allUp = _.sumBy(combine, 'totalUp')
196
+          //   let allDown = _.sumBy(combine, 'totalDown')
197
+          //   let allChips = _.sumBy(combine, 'chips')
198
+          //   let allEarned = _.sumBy(combine, (item) => {return item.bookieEarned + item.memberEarned})
199
+          //   let allServiceFees = _.sumBy(combine, (item) => {return item.totalServiceFees}).toFixed(2)
200
+          //   agent.all = (allUp+allDown-allChips-allServiceFees)*(-1)
201
+          //   this.list.push(agent)
202
+            
203
+          //   this.listLoading = false
204
+          // })
193 205
         })
194 206
         this.total = response.data.count
195 207
         this.listLoading = false