Browse Source

sync agentManagment all

ethan 6 years ago
parent
commit
45dc2756a6
1 changed files with 13 additions and 7 deletions
  1. 13 7
      src/views/agnetManagement/index.vue

+ 13 - 7
src/views/agnetManagement/index.vue

136
                 totalPunishment: 0,
136
                 totalPunishment: 0,
137
                 bookieEarned: 0,
137
                 bookieEarned: 0,
138
                 memberEarned: 0,
138
                 memberEarned: 0,
139
+                bookieWagerFee: 0,
139
                 bookieServiceFees: 0,
140
                 bookieServiceFees: 0,
140
                 memberServiceFees: 0,
141
                 memberServiceFees: 0,
141
                 totalServiceFees: 0,
142
                 totalServiceFees: 0,
144
             
145
             
145
               let bookie = _.groupBy(member['GambleGame-Bucket-MemberRecords'], 'isBookie')
146
               let bookie = _.groupBy(member['GambleGame-Bucket-MemberRecords'], 'isBookie')
146
               if (bookie.false) {
147
               if (bookie.false) {
147
-                row.memberEarned = _.sumBy(bookie.false, 'earned');
148
+                row.memberEarned = _.sumBy(bookie.false, item => {
149
+                  return Math.abs(item.earned)
150
+                });
148
                 row.memberServiceFees = _.sumBy(bookie.false, 'serviceFees')*agent.feeRatio/100;
151
                 row.memberServiceFees = _.sumBy(bookie.false, 'serviceFees')*agent.feeRatio/100;
149
               }
152
               }
150
               if (bookie.true) {
153
               if (bookie.true) {
151
-                row.bookieEarned = _.sumBy(bookie.true, 'earned');
152
-                row.bookieServiceFees = _.sumBy(bookie.true, (item) => { return item.serviceFees-500; })*agent.feeRatio/100;
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;
153
               }
161
               }
154
-              row.totalServiceFees = new Decimal(row.bookieServiceFees).plus(row.memberServiceFees).valueOf()
155
-
162
+              row.totalServiceFees =  Number(new Decimal(row.bookieServiceFees).plus(row.memberServiceFees).plus(row.bookieWagerFee).valueOf())
156
               let chipsLog = _.groupBy(member.GambleMemberChipsLogs, 'type')
163
               let chipsLog = _.groupBy(member.GambleMemberChipsLogs, 'type')
157
               if (chipsLog['0']) {
164
               if (chipsLog['0']) {
158
                 row.totalUp = _.sumBy(chipsLog['0'], (item) => { 
165
                 row.totalUp = _.sumBy(chipsLog['0'], (item) => { 
177
             let allDown = _.sumBy(combine, 'totalDown')
184
             let allDown = _.sumBy(combine, 'totalDown')
178
             let allChips = _.sumBy(combine, 'chips')
185
             let allChips = _.sumBy(combine, 'chips')
179
             let allEarned = _.sumBy(combine, (item) => {return item.bookieEarned + item.memberEarned})
186
             let allEarned = _.sumBy(combine, (item) => {return item.bookieEarned + item.memberEarned})
180
-            let allServiceFees = _.sumBy(combine, (item) => {return item.bookieServiceFees + item.
181
-            memberServiceFees})
187
+            let allServiceFees = _.sumBy(combine, (item) => {return item.totalServiceFees})
182
             agent.all = (allUp+allDown-allChips-allServiceFees)*(-1)
188
             agent.all = (allUp+allDown-allChips-allServiceFees)*(-1)
183
             this.list.push(agent)
189
             this.list.push(agent)
184
             
190