| 
				
			 | 
			
			
				@@ -9,7 +9,7 @@ 
			 | 
		
	
		
			
			| 
				9
			 | 
			
				9
			 | 
			
			
				         <el-input style='width:100px;' placeholder="輸入檔案名稱" prefix-icon="el-icon-document" v-model="filename"></el-input> 
			 | 
		
	
		
			
			| 
				10
			 | 
			
				10
			 | 
			
			
				         <el-button style='margin-bottom:20px;' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">匯出 excel</el-button> 
			 | 
		
	
		
			
			| 
				11
			 | 
			
				11
			 | 
			
			
				       </div> 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				
			 | 
			
			
				-      <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row 
			 | 
		
	
		
			
			| 
				
			 | 
			
				12
			 | 
			
			
				+      <el-table show-summary :summary-method="getSummaries" :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row 
			 | 
		
	
		
			
			| 
				13
			 | 
			
				13
			 | 
			
			
				         style="width: 100%"> 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				14
			 | 
			
			
				         <!-- <el-table-column align="center" label='ID' > 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				15
			 | 
			
			
				           <template slot-scope="scope"> 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -26,17 +26,17 @@ 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				26
			 | 
			
			
				             {{scope.row.feeRatio}} 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				27
			 | 
			
			
				           </template> 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				28
			 | 
			
			
				         </el-table-column>         
			 | 
		
	
		
			
			| 
				29
			 | 
			
				
			 | 
			
			
				-        <el-table-column label="代理商上繳金額" align="center"> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				29
			 | 
			
			
				+        <el-table-column label="代理商上繳金額" prop="all" align="center"> 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				30
			 | 
			
			
				             <template slot-scope="scope"> 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				31
			 | 
			
			
				               <span :style="moneyColor(scope.row.all)">{{scope.row.all}}</span> 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				32
			 | 
			
			
				             </template> 
			 | 
		
	
		
			
			| 
				33
			 | 
			
				33
			 | 
			
			
				         </el-table-column> 
			 | 
		
	
		
			
			| 
				34
			 | 
			
				
			 | 
			
			
				-        <el-table-column label="上繳工作室金額70%" align="center"> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+        <el-table-column label="上繳工作室金額70%" prop="all70" align="center"> 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				35
			 | 
			
			
				           <template slot-scope="scope"> 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				36
			 | 
			
			
				             <span :style="moneyColor(scope.row.all70)">{{scope.row.all70}}</span> 
			 | 
		
	
		
			
			| 
				37
			 | 
			
				37
			 | 
			
			
				           </template> 
			 | 
		
	
		
			
			| 
				38
			 | 
			
				38
			 | 
			
			
				         </el-table-column> 
			 | 
		
	
		
			
			| 
				39
			 | 
			
				
			 | 
			
			
				-        <el-table-column label="總逞罰" align="center"> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				39
			 | 
			
			
				+        <el-table-column label="總逞罰" prop="fredPunishment" align="center"> 
			 | 
		
	
		
			
			| 
				40
			 | 
			
				40
			 | 
			
			
				           <template slot-scope="scope"> 
			 | 
		
	
		
			
			| 
				41
			 | 
			
				41
			 | 
			
			
				             {{scope.row.fredPunishment}} 
			 | 
		
	
		
			
			| 
				42
			 | 
			
				42
			 | 
			
			
				           </template> 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -134,28 +134,32 @@ export default { 
			 | 
		
	
		
			
			| 
				134
			 | 
			
				134
			 | 
			
			
				     ]), 
			 | 
		
	
		
			
			| 
				135
			 | 
			
				135
			 | 
			
			
				     async getList() { 
			 | 
		
	
		
			
			| 
				136
			 | 
			
				136
			 | 
			
			
				       this.listLoading = true 
			 | 
		
	
		
			
			| 
				137
			 | 
			
				
			 | 
			
			
				-      await fetchList(this.listQuery).then(response => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				137
			 | 
			
			
				+      fetchList(this.listQuery).then(async response => { 
			 | 
		
	
		
			
			| 
				138
			 | 
			
				138
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				139
			 | 
			
				
			 | 
			
			
				-        response.data.rows.map(agent => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				139
			 | 
			
			
				+        // response.data.rows.map(agent => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				140
			 | 
			
			
				+          console.log('eeeee', response.data.rows) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				141
			 | 
			
			
				+        for(const agent of response.data.rows) { 
			 | 
		
	
		
			
			| 
				140
			 | 
			
				142
			 | 
			
			
				           let combine = [] 
			 | 
		
	
		
			
			| 
				141
			 | 
			
				143
			 | 
			
			
				           this.list = []    
			 | 
		
	
		
			
			| 
				142
			 | 
			
				
			 | 
			
			
				-          this.visible.firstLayer === true ? fetchGroupAll(agent, this.listQuery).then(response => { 
			 | 
		
	
		
			
			| 
				143
			 | 
			
				
			 | 
			
			
				-            console.log('response' , response.data.all) 
			 | 
		
	
		
			
			| 
				144
			 | 
			
				
			 | 
			
			
				-            this.list.push({ 
			 | 
		
	
		
			
			| 
				145
			 | 
			
				
			 | 
			
			
				-              // id: agent.GambleMember.id, 
			 | 
		
	
		
			
			| 
				146
			 | 
			
				
			 | 
			
			
				-              // GambleMember: { 
			 | 
		
	
		
			
			| 
				147
			 | 
			
				
			 | 
			
			
				-              //   id: agent.GambleMember.id, 
			 | 
		
	
		
			
			| 
				148
			 | 
			
				
			 | 
			
			
				-              //   name: agent.GambleMember.name 
			 | 
		
	
		
			
			| 
				149
			 | 
			
				
			 | 
			
			
				-              // }, 
			 | 
		
	
		
			
			| 
				150
			 | 
			
				
			 | 
			
			
				-              id: agent.GambleMember.id, 
			 | 
		
	
		
			
			| 
				151
			 | 
			
				
			 | 
			
			
				-              name: agent.GambleMember.name.slice(19), 
			 | 
		
	
		
			
			| 
				152
			 | 
			
				
			 | 
			
			
				-              createdAt: agent.GambleMember.createdAt, 
			 | 
		
	
		
			
			| 
				153
			 | 
			
				
			 | 
			
			
				-              feeRatio: response.data.feeRatio, 
			 | 
		
	
		
			
			| 
				154
			 | 
			
				
			 | 
			
			
				-              all: response.data.all, 
			 | 
		
	
		
			
			| 
				155
			 | 
			
				
			 | 
			
			
				-              all70: response.data.all70, 
			 | 
		
	
		
			
			| 
				156
			 | 
			
				
			 | 
			
			
				-              fredPunishment: response.data.fredPunishment 
			 | 
		
	
		
			
			| 
				
			 | 
			
				144
			 | 
			
			
				+          if(this.visible.firstLayer === true) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				145
			 | 
			
			
				+            fetchGroupAll(agent, this.listQuery).then(response => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				146
			 | 
			
			
				+              console.log('response' , response.data.all) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				147
			 | 
			
			
				+              this.list.push({ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				148
			 | 
			
			
				+                // id: agent.GambleMember.id, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				149
			 | 
			
			
				+                // GambleMember: { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				150
			 | 
			
			
				+                //   id: agent.GambleMember.id, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				151
			 | 
			
			
				+                //   name: agent.GambleMember.name 
			 | 
		
	
		
			
			| 
				
			 | 
			
				152
			 | 
			
			
				+                // }, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				153
			 | 
			
			
				+                id: agent.GambleMember.id, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				154
			 | 
			
			
				+                name: agent.GambleMember.name.slice(19), 
			 | 
		
	
		
			
			| 
				
			 | 
			
				155
			 | 
			
			
				+                createdAt: agent.GambleMember.createdAt, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				156
			 | 
			
			
				+                feeRatio: response.data.feeRatio, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				157
			 | 
			
			
				+                all: response.data.all, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				158
			 | 
			
			
				+                all70: response.data.all70, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				159
			 | 
			
			
				+                fredPunishment: response.data.fredPunishment 
			 | 
		
	
		
			
			| 
				
			 | 
			
				160
			 | 
			
			
				+              }) 
			 | 
		
	
		
			
			| 
				157
			 | 
			
				161
			 | 
			
			
				             }) 
			 | 
		
	
		
			
			| 
				158
			 | 
			
				
			 | 
			
			
				-          }) : false 
			 | 
		
	
		
			
			| 
				
			 | 
			
				162
			 | 
			
			
				+          } 
			 | 
		
	
		
			
			| 
				159
			 | 
			
				163
			 | 
			
			
				           // fetchMemberList(agent, this.listQuery).then(response => { 
			 | 
		
	
		
			
			| 
				160
			 | 
			
				164
			 | 
			
			
				           //   response.data.rows.map(member => { 
			 | 
		
	
		
			
			| 
				161
			 | 
			
				165
			 | 
			
			
				           //     let row = { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -222,14 +226,11 @@ export default { 
			 | 
		
	
		
			
			| 
				222
			 | 
			
				226
			 | 
			
			
				              
			 | 
		
	
		
			
			| 
				223
			 | 
			
				227
			 | 
			
			
				           //   this.listLoading = false 
			 | 
		
	
		
			
			| 
				224
			 | 
			
				228
			 | 
			
			
				           // }) 
			 | 
		
	
		
			
			| 
				225
			 | 
			
				
			 | 
			
			
				-        }) 
			 | 
		
	
		
			
			| 
				226
			 | 
			
				
			 | 
			
			
				-        this.list.sort(function compare(a, b) { 
			 | 
		
	
		
			
			| 
				227
			 | 
			
				
			 | 
			
			
				-          const dateA = new Date(a.createdAt); 
			 | 
		
	
		
			
			| 
				228
			 | 
			
				
			 | 
			
			
				-          const dateB = new Date(b.createdAt); 
			 | 
		
	
		
			
			| 
				229
			 | 
			
				
			 | 
			
			
				-          return  dateB - dateA; 
			 | 
		
	
		
			
			| 
				230
			 | 
			
				
			 | 
			
			
				-        }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				229
			 | 
			
			
				+        // }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				230
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				231
			 | 
			
				231
			 | 
			
			
				         // this.total = response.data.count 
			 | 
		
	
		
			
			| 
				232
			 | 
			
				232
			 | 
			
			
				         this.listLoading = false 
			 | 
		
	
		
			
			| 
				
			 | 
			
				233
			 | 
			
			
				+        console.log('list', this.list) 
			 | 
		
	
		
			
			| 
				233
			 | 
			
				234
			 | 
			
			
				       }) 
			 | 
		
	
		
			
			| 
				234
			 | 
			
				235
			 | 
			
			
				     }, 
			 | 
		
	
		
			
			| 
				235
			 | 
			
				236
			 | 
			
			
				     resetCreateData() { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -309,6 +310,41 @@ export default { 
			 | 
		
	
		
			
			| 
				309
			 | 
			
				310
			 | 
			
			
				     moneyColor(money) { 
			 | 
		
	
		
			
			| 
				310
			 | 
			
				311
			 | 
			
			
				       return money >= 0 ? { color: '#67C23A' } : { color: '#FA5555' } 
			 | 
		
	
		
			
			| 
				311
			 | 
			
				312
			 | 
			
			
				     }, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				313
			 | 
			
			
				+    getSummaries(param) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				314
			 | 
			
			
				+        let { columns, data } = param; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				315
			 | 
			
			
				+        let sums = []; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				316
			 | 
			
			
				+        data = data.filter(item => item.name !== '文')         
			 | 
		
	
		
			
			| 
				
			 | 
			
				317
			 | 
			
			
				+        columns.forEach((column, index) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				318
			 | 
			
			
				+          if (index === 0) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				319
			 | 
			
			
				+            sums[index] = '合計'; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				320
			 | 
			
			
				+            return; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				321
			 | 
			
			
				+          } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				322
			 | 
			
			
				+          const values = data.map(item => Number(item[column.property])); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				323
			 | 
			
			
				+          if (!values.every(value => isNaN(value))) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				324
			 | 
			
			
				+            sums[index] = values.reduce((prev, curr) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				325
			 | 
			
			
				+              const value = Number(curr); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				326
			 | 
			
			
				+              if (!isNaN(value)) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				327
			 | 
			
			
				+                return new Decimal(prev).plus(curr); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				328
			 | 
			
			
				+              } else { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				329
			 | 
			
			
				+                return new Decimal(prev); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				330
			 | 
			
			
				+              } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				331
			 | 
			
			
				+            }, 0).valueOf(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				332
			 | 
			
			
				+            sums[index]; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				333
			 | 
			
			
				+          } else { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				334
			 | 
			
			
				+            sums[index] = 'N/A'; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				335
			 | 
			
			
				+          } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				336
			 | 
			
			
				+        }); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				337
			 | 
			
			
				+        // this.allCombine.push({ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				338
			 | 
			
			
				+        //   name: (this.data.secondLayer.GambleMember.name).slice(19), 
			 | 
		
	
		
			
			| 
				
			 | 
			
				339
			 | 
			
			
				+        //   allUp: sums[2], 
			 | 
		
	
		
			
			| 
				
			 | 
			
				340
			 | 
			
			
				+        //   allDown: sums[3], 
			 | 
		
	
		
			
			| 
				
			 | 
			
				341
			 | 
			
			
				+        //   allChips: sums[1], 
			 | 
		
	
		
			
			| 
				
			 | 
			
				342
			 | 
			
			
				+        //   allEarned: sums[6], 
			 | 
		
	
		
			
			| 
				
			 | 
			
				343
			 | 
			
			
				+        //   allServiceFees: sums[13], 
			 | 
		
	
		
			
			| 
				
			 | 
			
				344
			 | 
			
			
				+        // }); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				345
			 | 
			
			
				+        // console.log('ewqewqeqweq', this.sums) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				346
			 | 
			
			
				+        return sums; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				347
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				312
			 | 
			
				348
			 | 
			
			
				   }, 
			 | 
		
	
		
			
			| 
				313
			 | 
			
				349
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				314
			 | 
			
				350
			 | 
			
			
				 </script> 
			 |