|
@@ -1,8 +1,188 @@
|
|
-<template>
|
|
|
|
-</template>
|
|
|
|
-
|
|
|
|
-<script>
|
|
|
|
-</script>
|
|
|
|
-
|
|
|
|
-<style>
|
|
|
|
|
|
+<template>
|
|
|
|
+ <div class="hui-flex hui-content">
|
|
|
|
+ <div class="hui-content-title">
|
|
|
|
+ <div class="hui-title-item active">经纪人列表</div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="hui-flex-box hui-flex hui-table">
|
|
|
|
+ <div class="hui-content-insert">
|
|
|
|
+ <el-button type="primary" size="medium" @click="insertAgent">新增经纪人</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="hui-flex-box">
|
|
|
|
+ <el-table :data="tableData" row-key="id" border height="100%">
|
|
|
|
+ <el-table-column label="序号" width="50">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div style="text-align: center;">{{scope.$index + 1}}</div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="经纪人名称" prop="name"></el-table-column>
|
|
|
|
+ <el-table-column label="邀请项目" width="150">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div class="hui-table-operation" v-if="!scope.row.status">
|
|
|
|
+ <span class="table-operation" @click="inviteAgent(scope.row)">发送邀请</span>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="hui-table-operation" v-if="scope.row.status === 3">
|
|
|
|
+ <span class="table-operation" @click="inviteAgent(scope.row)">重新邀请</span>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="邀请状态" width="150">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div v-if="!scope.row.status" class="hui-state">
|
|
|
|
+ <span class="hui-state-bage hui-state-primary"></span>
|
|
|
|
+ <span class="hui-state-label">待邀请</span>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-if="scope.row.status == 1" class="hui-state">
|
|
|
|
+ <span class="hui-state-bage hui-state-info"></span>
|
|
|
|
+ <span class="hui-state-label">邀请中</span>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-if="scope.row.status == 2" class="hui-state">
|
|
|
|
+ <span class="hui-state-bage hui-state-success"></span>
|
|
|
|
+ <span class="hui-state-label">通过邀请</span>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-if="scope.row.status == 3" class="hui-state">
|
|
|
|
+ <span class="hui-state-bage hui-state-error"></span>
|
|
|
|
+ <span class="hui-state-label">拒绝邀请</span>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作" width="200">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div class="hui-table-operation">
|
|
|
|
+ <span class="table-operation" @click="lookAgent(scope.row)">详情</span>
|
|
|
|
+ <span class="table-operation" @click="updateAgent(scope.row)">编辑</span>
|
|
|
|
+ <span class="table-operation" @click="deleteAgent(scope.row)">删除</span>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <template slot="empty">
|
|
|
|
+ <empty description="暂无数据"></empty>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="hui-content-pagination">
|
|
|
|
+ <el-pagination :page-size="pageSize" :pager-count="9" layout="prev, pager, next" :total="totalCount"
|
|
|
|
+ @current-change="currentChange">
|
|
|
|
+ </el-pagination>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <el-dialog :title="isUpdate?'编辑':'新增'" :visible.sync="visible" width="900px" :append-to-body="true">
|
|
|
|
+ <edit v-if="visible" @callback="callback" :isUpdate="isUpdate" :detailId="detailId"></edit>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ <el-drawer title="经纪人详情" :visible.sync="drawer" :size="400" :append-to-body="true">
|
|
|
|
+ <detail v-if="drawer" :detailId="detailId"></detail>
|
|
|
|
+ </el-drawer>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+ import {
|
|
|
|
+ getAgentListByPage,
|
|
|
|
+ deleteAgentById,
|
|
|
|
+ updateAgent
|
|
|
|
+ } from '@/httpApi/crm'
|
|
|
|
+ import {
|
|
|
|
+ testPhone
|
|
|
|
+ } from '@/httpApi/organization'
|
|
|
|
+ import edit from '@/components/work/crm/agent/edit'
|
|
|
|
+ import detail from '@/components/work/crm/agent/detail'
|
|
|
|
+ export default {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ tableData: [],
|
|
|
|
+ currPage: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ totalCount: 0,
|
|
|
|
+ visible: false,
|
|
|
|
+ detailId: '',
|
|
|
|
+ isUpdate: false,
|
|
|
|
+ drawer: false
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ this.init();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ init() {
|
|
|
|
+ getAgentListByPage({
|
|
|
|
+ currPage: this.currPage,
|
|
|
|
+ pageSize: this.pageSize,
|
|
|
|
+ organizationId: this.$store.getters.organization.id,
|
|
|
|
+ userId: this.$store.getters.user.id
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.state) {
|
|
|
|
+ this.tableData = res.data.dataList;
|
|
|
|
+ this.totalCount = res.data.totalCount;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ currentChange(currPage) {
|
|
|
|
+ this.currPage = currPage;
|
|
|
|
+ this.init();
|
|
|
|
+ },
|
|
|
|
+ insertAgent() {
|
|
|
|
+ this.isUpdate = false;
|
|
|
|
+ this.visible = true;
|
|
|
|
+ },
|
|
|
|
+ updateAgent(val) {
|
|
|
|
+ this.detailId = val.id;
|
|
|
|
+ this.isUpdate = true;
|
|
|
|
+ this.visible = true;
|
|
|
|
+ },
|
|
|
|
+ lookAgent(val) {
|
|
|
|
+ this.detailId = val.id;
|
|
|
|
+ this.drawer = true;
|
|
|
|
+ },
|
|
|
|
+ inviteAgent(user) {
|
|
|
|
+ testPhone(user.phone).then(res => {
|
|
|
|
+ if (res.state) {
|
|
|
|
+ this.$confirm('是否邀请该经纪人至当前项目?', () => {
|
|
|
|
+ this.$msg.send({
|
|
|
|
+ dataId: user.id,
|
|
|
|
+ identityId: 2
|
|
|
|
+ }, {
|
|
|
|
+ messageType: 2,
|
|
|
|
+ userIds: res.data.id
|
|
|
|
+ }).then(node => {
|
|
|
|
+ if (node.state) {
|
|
|
|
+ updateAgent({
|
|
|
|
+ id: user.id,
|
|
|
|
+ status: 1
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.state) {
|
|
|
|
+ this.init();
|
|
|
|
+ this.$message.success('邀请成功');
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.warning('用户不存在,无法绑定');
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ deleteAgent(val) {
|
|
|
|
+ this.$confirm('确定要删除该经纪人?', () => {
|
|
|
|
+ deleteAgentById(val.id).then(res => {
|
|
|
|
+ if (res.state) {
|
|
|
|
+ this.init();
|
|
|
|
+ this.$message.success('操作成功');
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ callback(type) {
|
|
|
|
+ if (type === 'init') this.init();
|
|
|
|
+ this.visible = false;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ components: {
|
|
|
|
+ edit,
|
|
|
|
+ detail
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="scss">
|
|
|
|
+
|
|
</style>
|
|
</style>
|