yangfeng
2023-08-25 f417dc0a44d225d4ed19bcb5207250eb1b669455
src/views/client/client/index.vue
@@ -2,13 +2,10 @@
  <div class="custom-manage">
    <div class="tab-view">
      <el-tabs v-model="activeName" @tab-click="tabsClick">
        <el-tab-pane label="全部(含所有公海)" name="first" disabled></el-tab-pane>
        <el-tab-pane label="全部(含公海)" name="second" disabled></el-tab-pane>
        <el-tab-pane label="全部(不含公海)" name="third" disabled></el-tab-pane>
        <el-tab-pane label="公海已分配" name="fourth" disabled></el-tab-pane>
        <el-tab-pane label="公未分配" name="aaa" disabled></el-tab-pane>
        <el-tab-pane label="公海客户" name="first"></el-tab-pane>
        <el-tab-pane label="我的客户" name="second"></el-tab-pane>
      </el-tabs>
      <div class="sel-gonghai">
      <!-- <div class="sel-gonghai">
        <el-select v-model="gonghaiValue" placeholder="请选择" class="query-class-sel" size="mini" disabled>
          <el-option v-for="item in gonghaiOptions" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
@@ -16,7 +13,7 @@
        <div class="query-class-btn">
          <i class="el-icon-setting"></i>
        </div>
      </div>
      </div> -->
    </div>
    <div class="top">
      <SearchCommonView
@@ -28,7 +25,6 @@
      />
      <div class="btn-pager">
        <PublicFunctionBtnView
          :duplicate-check="true"
          :list-button="true"
          :map-button="true"
          :statistics="true"
@@ -49,7 +45,10 @@
      <template slot="tableButton">
        <el-table-column label="操作" width="150">
          <template slot-scope="scope">
            <el-button type="text" size="small" disabled>变更公海</el-button>
            <el-button v-if="activeName === 'first'" type="text" size="small" @click="allocationBtnClick(scope.row)"
              >分配</el-button
            >
            <el-button v-else type="text" size="small" @click="changeHighSeasClick(scope.row)">变更公海</el-button>
            <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
            <el-button @click="followupClick(scope.row)" type="text" size="small">跟进</el-button>
            <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button> -->
@@ -65,6 +64,8 @@
    <DetailContacts v-if="contactsDeail.visible" :contacts-detail="contactsDeail" />
    <!-- 新建/编辑跟进记录 -->
    <AddFollowupRecordsDialog v-if="editFollowupConfig.visible" :edit-contacts-config="editFollowupConfig" />
    <!-- 分配 -->
    <AllocationDialog v-if="allocationConfig.visible" :edit-common-config="allocationConfig" />
  </div>
</template>
@@ -73,6 +74,8 @@
import { getClientList, getDeleteClient } from "@/api/client/client"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import AddFollowupRecordsDialog from "@/views/client/followupRecords/AddFollowupRecordsDialog"
import AllocationDialog from "@/views/client/client/AllocationDialog"
import { getAssign } from "@/api/common/other"
export default {
  name: "CustomManage",
@@ -82,7 +85,8 @@
    AddClientManageDialog,
    DetailContacts: () => import("@/views/client/contacts/DetailContacts"),
    DetailClientManage: () => import("@/views/client/client/DetailClientManage"),
    AddFollowupRecordsDialog
    AddFollowupRecordsDialog,
    AllocationDialog
  },
  computed: {},
  data() {
@@ -130,11 +134,19 @@
        visible: false,
        title: "新建",
        infomation: {}
      }
      },
      allocationConfig: {
        visible: false,
        infomation: {}
      },
      not_admin: 2
    }
  },
  created() {
    this.setTable()
    this.search_map = {
      not_admin: this.not_admin
    }
    this.getData()
  },
  methods: {
@@ -145,11 +157,11 @@
          { label: "客户名称", prop: "name", min: 100, isClientClick: true }, // 客户名称
          { label: "销售负责人", prop: "member_name" }, // 销售负责人
          { label: "重要级别", prop: "client_level" }, // 重要级别
          { label: "下次回访日期", prop: "next_visit_time", isTime: true, min: 90 }, // 下次回访日期
          { label: "下次回访日期", prop: "next_visit_time", min: 90 }, // 下次回访日期
          { label: "详细地址", prop: "detail_address", min: 200 }, // 详细地址
          { label: "客户状态", prop: "client_status" }, // 客户状态
          { label: "联系人姓名", prop: "contact_name", isContactClick: true }, // 联系人姓名
          { label: "手机号码", prop: "contact_phone" } // 手机号码
          { label: "联系人手机号码", prop: "contact_phone" } // 手机号码
        ]
      }
      this.searchOptions = []
@@ -174,11 +186,19 @@
              const list = res.data.list.map((item) => {
                let contact_name = ""
                let contact_phone = ""
                let contact_id = 0
                let contact_wechat = ""
                let contact_email = ""
                let position = ""
                if (item.contacts.length !== 0) {
                  for (let i = 0; i < item.contacts.length; i++) {
                    if (item.contacts[i].is_first) {
                      contact_name = item.contacts[i].name
                      contact_phone = item.contacts[i].phone
                      contact_id = item.contacts[i].id
                      contact_wechat = item.contacts[i].wechat
                      contact_email = item.contacts[i].email
                      position = item.contacts[i].position
                    }
                  }
                }
@@ -187,7 +207,12 @@
                  contact_name: contact_name,
                  contact_phone: contact_phone,
                  client_level: item.client_level.name,
                  client_status: item.client_status.name
                  client_status: item.client_status.name,
                  contact_id: contact_id,
                  member_name: item.member.username,
                  contact_wechat: contact_wechat,
                  contact_email: contact_email,
                  position: position
                }
              })
              this.tableList.tableInfomation = list || []
@@ -206,44 +231,52 @@
          this.loading = false
        })
    },
    tabsClick(tab, event) {
      console.log(tab, event)
    tabsClick(tab) {
      console.log(tab.name)
      if (tab.name === "first") {
        this.not_admin = 2
      } else {
        this.not_admin = 1
      }
      this.resetClick()
    },
    // 搜索
    searchClick(val, content) {
      console.log(val, content)
      this.search_map = {
        not_admin: this.not_admin,
        [val.value]: content
      }
      this.getData()
    },
    resetClick() {
      this.search_map = {}
      this.search_map = {
        not_admin: this.not_admin
      }
      this.getData()
    },
    // 新建
    addBtnClick() {
      this.editConfig.visible = true
      this.editConfig.title = "新建"
      this.editConfig.infomation = {}
      this.editConfig.infomation = {
        city_id: 0,
        client_type_id: 1,
        client_origin_id: 1,
        client_level_id: 1,
        registered_capital_id: 1,
        enterprise_nature_id: 1,
        enterprise_scale_id: 1,
        industry_id: 1
      }
    },
    // 编辑
    handleClick(row) {
      console.log(row)
      this.editConfig.visible = true
      this.editConfig.title = "编辑"
      let contactObj = {}
      if (row.contacts.length > 0) {
        row.contacts.forEach((ele) => {
          if (ele.is_first) {
            contactObj = { ...ele }
          }
        })
      }
      this.editConfig.infomation = {
        ...row,
        contact_wechat: contactObj.length > 0 ? contactObj.wechat : "",
        contact_email: contactObj.length > 0 ? contactObj.email : ""
        ...row
      }
    },
    // 删除
@@ -285,7 +318,6 @@
    },
    // 联系人详情
    selContactsClick(row) {
      console.log(row)
      this.contactsDeail.visible = true
      let contact = {}
      if (row.contacts.length !== 0) {
@@ -295,7 +327,11 @@
          }
        }
      }
      this.contactsDeail.infomation = { ...contact, Client: { name: row.name } }
      this.contactsDeail.infomation = {
        ...contact,
        Client: { name: row.name, client_status_id: row.client_status_id },
        client_name: row.name
      }
    },
    // 跟进
    followupClick(row) {
@@ -308,6 +344,26 @@
        number: "",
        next_follow_time: row.next_visit_time
      }
    },
    // 分配
    allocationBtnClick(row) {
      console.log(row)
      this.allocationConfig.visible = true
      this.allocationConfig.infomation = { member_id: row.member_id, id: row.id }
    },
    // 变更公海
    async changeHighSeasClick(row) {
      await getAssign({
        ids: [row.id],
        member_id: 1,
        type: "client"
      }).then((res) => {
        this.editConfig.visible = false
        if (res.code === 200) {
          this.$message.success("变更成功")
          this.getData()
        }
      })
    }
  }
}