| 
					
				 | 
			
			
				@@ -78,7 +78,15 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </el-form> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <el-row :gutter="10" class="mb8"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <el-col :span="3"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <el-button 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        type="primary" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        icon="el-icon-user" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        size="mini" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        @click="handleChangeCompanyUser" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        :disabled="multiple" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      >更换会员归属</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-col :span="1.5"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <el-button 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           type="warning" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -140,6 +148,14 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-table-column label="可提现佣金" align="center" prop="registerCode" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-table-column label="冻结佣金" align="center" prop="source" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-table-column label="已提现佣金" align="center" prop="remark" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <el-table-column label="看课数量" align="center" prop="watchCourseCount" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <el-table-column label="参与营期数" align="center" prop="partCourseCount" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <el-table-column label="所属销售" align="center" prop="companyUserNickName" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <el-table-column label="最后看课时间" align="center" prop="lastWatchDate" width="160"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <template slot-scope="scope"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <span>{{ parseTime(scope.row.lastWatchDate) }}</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      </el-table-column> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-table-column label="操作" align="center" fixed="right" width="150px" class-name="small-padding fixed-width"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <template slot-scope="scope"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-button 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -263,11 +279,41 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          <store-user-details ref="storeUserDetails"></store-user-details> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </el-drawer> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!-- 更换会员归属对话框 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <el-dialog title="更换会员归属" :visible.sync="changeCompanyUserOpen" width="500px" append-to-body> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <el-form ref="changeCompanyUserForm" :model="changeCompanyUserForm" :rules="changeCompanyUserRules" label-width="100px"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-form-item label="选择公司" prop="companyId"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-select v-model="changeCompanyUserForm.companyId" placeholder="请选择公司" style="width: 100%" @change="handleCompanyChange"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-option 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              v-for="item in companyOptions" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :key="item.companyId" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :label="item.companyName" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :value="item.companyId" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          </el-select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-form-item label="选择销售" prop="companyUserId"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-select v-model="changeCompanyUserForm.companyUserId" placeholder="请选择销售" style="width: 100%" @change="handleCompanyUserChange"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-option 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              v-for="item in companyUserOptions" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :key="item.userId" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :label="item.nickName + '_' + item.userName" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :value="item.userId" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          </el-select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      </el-form> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <div slot="footer" class="dialog-footer"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-button type="primary" @click="submitChangeCompanyUserForm">确 定</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-button @click="cancelChangeCompanyUser">取 消</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </el-dialog> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { listUser, getUser, delUser, addUser, updateUser, exportUser } from "@/api/store/user"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { getCompanyUserList, changeCompanyUser, getCompanyList } from '@/api/company/companyUser'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import storeUserDetails from './components/storeUserDetails.vue'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   components: { storeUserDetails }, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -341,7 +387,27 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           { required: true, message: "等级不能为空", trigger: "blur" } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 更换会员归属对话框 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      changeCompanyUserOpen: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 更换会员归属表单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      changeCompanyUserForm: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        companyId: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        companyUserId: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        userIds: [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 更换会员归属表单校验 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      changeCompanyUserRules: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        companyId: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          { required: true, message: '请选择公司', trigger: 'change' } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        companyUserId: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          { required: true, message: '请选择销售', trigger: 'change' } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 销售选项 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      companyUserOptions: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      companyOptions: [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   created() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -505,6 +571,93 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           that.$refs.storeUserDetails.getDetails(row.userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 200); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 更换会员归属按钮操作 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    handleChangeCompanyUser() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 获取公司下拉列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      getCompanyList().then(response => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (response.code === 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.companyOptions = response.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          // 重置表单和销售列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.resetCompanyUserForm(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.companyUserOptions = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.changeCompanyUserOpen = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.$message.error(response.msg || '获取公司列表失败'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }).catch(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.$message.error('获取公司列表失败'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 销售选择变化 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    handleCompanyUserChange(userId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (!this.changeCompanyUserForm.companyId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.$message.warning('请先选择公司'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.changeCompanyUserForm.companyUserId = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 重置更换会员归属表单 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    resetCompanyUserForm() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.changeCompanyUserForm = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        companyId: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        companyUserId: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        userIds: [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.resetForm("changeCompanyUserForm"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    handleCompanyChange(companyId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 清空已选择的销售 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.changeCompanyUserForm.companyUserId = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 根据公司ID获取对应的销售列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (companyId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        getCompanyUserList({ companyId: companyId }).then(response => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (response.code === 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.companyUserOptions = response.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.$message.error(response.msg || '获取销售列表失败'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.companyUserOptions = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }).catch(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.$message.error('获取销售列表失败'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.companyUserOptions = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.companyUserOptions = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 取消更换会员归属 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    cancelChangeCompanyUser() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.changeCompanyUserOpen = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.resetCompanyUserForm(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 提交更换会员归属 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    submitChangeCompanyUserForm() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.$refs["changeCompanyUserForm"].validate(valid => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (valid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          // 调用更换会员归属接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          // 检查companyId是否已设置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (!this.changeCompanyUserForm.companyId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.$message.error('请选择公司'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          changeCompanyUser(this.ids, { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            companyUserId: this.changeCompanyUserForm.companyUserId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            companyId: this.changeCompanyUserForm.companyId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }).then(response => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (response.code === 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.msgSuccess("操作成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.changeCompanyUserOpen = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.getList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.$message.error(response.msg || '操作失败'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }).catch(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.$message.error('操作失败'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </script> 
			 |