Browse Source

客户画像调整

lxf 1 year ago
parent
commit
4aef9d274a

+ 56 - 217
src/views/customer/portrait/com/CustomerInfo.vue

@@ -1,17 +1,11 @@
 <template>
   <div class="content" v-loading="loading">
-    <!-- <div class="company">
-      <i class="el-icon-office-building icon"> </i>
-      <span class="company-name"> {{ detailsData.corporateName }} </span>
-    </div> -->
     <div class="line">
-      <span class="title_">客户代码:</span
-      ><span>{{ detailsData.customerCode }}</span>
-      <span class="title_" style="margin: 0 6px">|</span>
-      <span class="title_"> 客户类型:</span
-      ><span>{{ dictValueLabel(detailsData.status, customerStatus) }}</span>
+      <span class="title_" v-if="detailsData.customerCode">客户代码:{{ detailsData.customerCode }}</span>
+      <span class="title_" v-if="detailsData.customerCode && detailsData.status" style="margin: 0 6px">|</span>
+      <span class="title_" v-if="detailsData.status">客户类型:{{ dictValueLabel(detailsData.status, customerStatus) }}</span>
     </div>
-    <div class="line">
+    <div class="line" v-if="detailsData.source">
       <span class="title_">客户来源:</span>
       <span>{{ dictValueLabel(detailsData.source, customerSource) }}</span>
     </div>
@@ -26,90 +20,46 @@
     <div class="contacts" v-if="detailsData.customerUserList.length > 0">
       <div style="display: flex; justify-content: space-between">
         <span> 相关联系人: </span>
-        <el-button
-          type="primary"
-          icon="Plus"
-          circle
-          style="margin-top: -15px"
-          @click="handleAddUserList(detailsData)"
-        />
+        <el-button type="primary" size="small" style="padding: 0px" text @click="handleAddUserList(detailsData)">添加</el-button>
       </div>
       <div>
-        <div
-          v-for="(item, index) in detailsData.customerUserList"
-          :key="index"
-          class="item"
-          v-show="!(index > 1)"
-        >
+        <div v-for="(item, index) in detailsData.customerUserList" :key="index" class="item" v-show="!(index > 1)">
           <div class="img">
-            <i
-              class="iconfont icon-iconm_kehd"
-              style="font-size: 26px; color: #cccccc; margin-top: 2px"
-            ></i>
+            <i class="iconfont icon-iconm_kehd" style="font-size: 26px; color: #cccccc; margin-top: 2px"></i>
           </div>
           <div class="details">
             <div>
               <span> {{ item.name }} </span>
-              <!-- <span> {{ item.position }} </span> -->
             </div>
             <div class="information">
-              <div class="first">
-                <span class="val">Tel:</span>{{ getPhone(item) }}
-              </div>
-              <div style="display: flex; justify-content: space-between">
+              <div class="first"><span class="val">Tel:</span>{{ getPhone(item) }}</div>
+              <div style="display: flex; justify-content: space-between; height: 18px; line-height: 18px">
                 <span class="val" style="flex: 1">Email:</span>{{ item.email }}
                 <img
                   src="@/assets/images/portrait/icon_email.png"
                   alt=""
-                  style="cursor: pointer; margin-left: 10px"
+                  style="cursor: pointer; margin-left: 10px; transform: translateY(-1px)"
                   @click="handleSendEmail(item)"
-                  v-show="item.email"
-                />
+                  v-show="item.email" />
               </div>
             </div>
           </div>
         </div>
-        <div
-          style="float: right"
-          v-if="
-            detailsData.customerUserList &&
-            detailsData.customerUserList.length > 1
-          "
-        >
+        <div style="float: right" v-if="detailsData.customerUserList && detailsData.customerUserList.length > 1">
           <el-button type="primary" link size="small">更多联系人</el-button>
         </div>
       </div>
     </div>
 
-    <el-dialog
-      :title="'添加联系人'"
-      v-if="dialogVisible"
-      v-model="dialogVisible"
-      width="800"
-      v-loading="loadingOperation"
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="submit"
-      >
+    <el-dialog :title="'添加联系人'" v-if="dialogVisible" v-model="dialogVisible" width="800" v-loading="loadingOperation">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
         <template #person>
           <div style="width: 100%">
-            <!-- <el-button type="primary" @click="clickAddPerson">添 加</el-button> -->
-            <el-table
-              :data="formData.data.customerUserList"
-              style="width: 100%; margin-top: 16px"
-            >
+            <el-table :data="formData.data.customerUserList" style="width: 100%; margin-top: 16px">
               <el-table-column label="联系人" width="160">
                 <template #default="{ row, $index }">
                   <div style="width: 100%">
-                    <el-form-item
-                      :prop="'customerUserList.' + $index + '.name'"
-                      :rules="rules.name2"
-                      :inline-message="true"
-                    >
+                    <el-form-item :prop="'customerUserList.' + $index + '.name'" :rules="rules.name2" :inline-message="true">
                       <el-input v-model="row.name" placeholder="请输入联系人" />
                     </el-form-item>
                   </div>
@@ -118,35 +68,15 @@
               <el-table-column label="电子邮箱">
                 <template #default="{ row, $index }">
                   <div style="width: 100%">
-                    <el-form-item
-                      :prop="'customerUserList.' + $index + '.email'"
-                      :rules="rules.email"
-                      :inline-message="true"
-                    >
-                      <el-input
-                        v-model="row.email"
-                        placeholder="请输入电子邮箱"
-                      />
+                    <el-form-item :prop="'customerUserList.' + $index + '.email'" :rules="rules.email" :inline-message="true">
+                      <el-input v-model="row.email" placeholder="请输入电子邮箱" />
                     </el-form-item>
                   </div>
                 </template>
               </el-table-column>
-              <el-table-column
-                align="center"
-                label="操作"
-                width="120"
-                fixed="right"
-              >
+              <el-table-column align="center" label="操作" width="120" fixed="right">
                 <template #default="{ row, $index }">
-                  <el-button
-                    type="primary"
-                    link
-                    @click="clickInformationMore(row, $index)"
-                    >更多</el-button
-                  >
-                  <!-- <el-button type="primary" link @click="clickDelete($index)"
-                    >删除</el-button
-                  > -->
+                  <el-button type="primary" link @click="clickInformationMore(row, $index)">更多</el-button>
                 </template>
               </el-table-column>
             </el-table>
@@ -155,28 +85,12 @@
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button
-          type="primary"
-          @click="submitForm()"
-          size="large"
-          :loading="submitLoading"
-          >确 定</el-button
-        >
+        <el-button type="primary" @click="submitForm()" size="large" :loading="submitLoading">确 定</el-button>
       </template>
     </el-dialog>
 
-    <el-dialog
-      title="更多联系方式"
-      v-if="openPerson"
-      v-model="openPerson"
-      width="700"
-    >
-      <el-form
-        :label-position="'top'"
-        :model="formPerson.data"
-        :rules="rulesPerson"
-        ref="person"
-      >
+    <el-dialog title="更多联系方式" v-if="openPerson" v-model="openPerson" width="700">
+      <el-form :label-position="'top'" :model="formPerson.data" :rules="rulesPerson" ref="person">
         <el-form-item label="联系人" prop="name">
           <el-input v-model="formPerson.data.name" />
         </el-form-item>
@@ -185,32 +99,14 @@
         </el-form-item>
         <el-form-item label="更多联系方式">
           <div style="width: 100%">
-            <el-button type="primary" @click="clickAddMoreInformation"
-              >添 加</el-button
-            >
-            <el-table
-              :data="formPerson.data.contact"
-              style="width: 100%; margin-top: 16px"
-            >
+            <el-button type="primary" @click="clickAddMoreInformation">添 加</el-button>
+            <el-table :data="formPerson.data.contact" style="width: 100%; margin-top: 16px">
               <el-table-column label="类型" width="180">
                 <template #default="{ row, $index }">
                   <div style="width: 100%">
-                    <el-form-item
-                      :prop="'contact.' + $index + '.type'"
-                      :rules="rulesPerson.type"
-                      :inline-message="true"
-                    >
-                      <el-select
-                        v-model="row.type"
-                        placeholder="请选择类型"
-                        style="width: 100%"
-                      >
-                        <el-option
-                          v-for="item in contactType"
-                          :key="item.value"
-                          :label="item.label"
-                          :value="item.value"
-                        />
+                    <el-form-item :prop="'contact.' + $index + '.type'" :rules="rulesPerson.type" :inline-message="true">
+                      <el-select v-model="row.type" placeholder="请选择类型" style="width: 100%">
+                        <el-option v-for="item in contactType" :key="item.value" :label="item.label" :value="item.value" />
                       </el-select>
                     </el-form-item>
                   </div>
@@ -219,32 +115,15 @@
               <el-table-column label="联系号码">
                 <template #default="{ row, $index }">
                   <div style="width: 100%">
-                    <el-form-item
-                      :prop="'contact.' + $index + '.contactNo'"
-                      :rules="rulesPerson.contactNo"
-                      :inline-message="true"
-                    >
-                      <el-input
-                        v-model="row.contactNo"
-                        placeholder="请输入联系号码"
-                      />
+                    <el-form-item :prop="'contact.' + $index + '.contactNo'" :rules="rulesPerson.contactNo" :inline-message="true">
+                      <el-input v-model="row.contactNo" placeholder="请输入联系号码" />
                     </el-form-item>
                   </div>
                 </template>
               </el-table-column>
-              <el-table-column
-                align="center"
-                label="操作"
-                width="120"
-                fixed="right"
-              >
+              <el-table-column align="center" label="操作" width="120" fixed="right">
                 <template #default="{ $index }">
-                  <el-button
-                    type="primary"
-                    link
-                    @click="clickInformationDelete($index)"
-                    >删除</el-button
-                  >
+                  <el-button type="primary" link @click="clickInformationDelete($index)">删除</el-button>
                 </template>
               </el-table-column>
             </el-table>
@@ -253,17 +132,14 @@
       </el-form>
       <template #footer>
         <el-button @click="openPerson = false" size="large">取 消</el-button>
-        <el-button type="primary" @click="submitPerson()" size="large"
-          >确 定</el-button
-        >
+        <el-button type="primary" @click="submitPerson()" size="large">确 定</el-button>
       </template>
     </el-dialog>
   </div>
 </template>
-  
+
 <script setup>
-import { ElMessage, ElMessageBox } from "element-plus";
-import useUserStore from "@/store/modules/user";
+import { ElMessage } from "element-plus";
 import byForm from "@/components/byForm/index";
 const props = defineProps({
   customerId: {
@@ -328,31 +204,20 @@ const customerSource = ref([]);
 const customerStatus = ref([]);
 const contactType = ref([]);
 const getDict = () => {
-  proxy
-    .getDictOne([
-      "customer_tag",
-      "customer_source",
-      "customer_status",
-      "contact_type",
-    ])
-    .then((res) => {
-      // customerTag.value = res["customer_tag"].map((x) => ({
-      //   label: x.dictValue,
-      //   value: x.dictKey,
-      // }));
-      customerSource.value = res["customer_source"].map((x) => ({
-        label: x.dictValue,
-        value: x.dictKey,
-      }));
-      customerStatus.value = res["customer_status"].map((x) => ({
-        label: x.dictValue,
-        value: x.dictKey,
-      }));
-      contactType.value = res["contact_type"].map((x) => ({
-        label: x.dictValue,
-        value: x.dictKey,
-      }));
-    });
+  proxy.getDictOne(["customer_source", "customer_status", "contact_type"]).then((res) => {
+    customerSource.value = res["customer_source"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    customerStatus.value = res["customer_status"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    contactType.value = res["contact_type"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
 };
 getDict();
 onMounted(() => {
@@ -378,25 +243,6 @@ const handleAddUserList = (res) => {
   ];
   dialogVisible.value = true;
 };
-
-const clickAddPerson = () => {
-  if (
-    formData.data.customerUserList &&
-    formData.data.customerUserList.length > 0
-  ) {
-    formData.data.customerUserList.push({
-      name: "",
-      email: "",
-    });
-  } else {
-    formData.data.customerUserList = [
-      {
-        name: "",
-        email: "",
-      },
-    ];
-  }
-};
 const moreIndex = ref(-1);
 const clickInformationMore = (item, index) => {
   moreIndex.value = index;
@@ -408,11 +254,6 @@ const clickInformationMore = (item, index) => {
   formPerson.data = proxy.deepClone(item);
   openPerson.value = true;
 };
-
-const clickDelete = (index) => {
-  formData.data.customerUserList.splice(index, 1);
-};
-
 const clickAddMoreInformation = () => {
   if (formPerson.data.contact && formPerson.data.contact.length > 0) {
     formPerson.data.contact.push({
@@ -433,7 +274,6 @@ const clickInformationDelete = (index) => {
 };
 const person = ref(null);
 const submit = ref(null);
-
 const submitPerson = () => {
   person.value.validate((valid) => {
     if (valid) {
@@ -443,13 +283,9 @@ const submitPerson = () => {
     }
   });
 };
-
 const submitForm = () => {
   submit.value.handleSubmit(() => {
-    if (
-      formData.data.customerUserList &&
-      formData.data.customerUserList.length > 0
-    ) {
+    if (formData.data.customerUserList && formData.data.customerUserList.length > 0) {
       submitLoading.value = true;
       const data = {
         customerId: detailsData.value.id,
@@ -473,7 +309,6 @@ const submitForm = () => {
     }
   });
 };
-
 const getPhone = (res) => {
   if (res.contactJson) {
     let contactJson = JSON.parse(res.contactJson);
@@ -483,7 +318,7 @@ const getPhone = (res) => {
   }
 };
 </script>
-  
+
 <style lang="scss" scoped>
 .content {
   font-size: 12px;
@@ -522,9 +357,10 @@ const getPhone = (res) => {
           display: flex;
           align-items: center;
           flex-wrap: wrap;
-          // overflow: auto;
           .first {
             margin-right: 10px;
+            height: 18px;
+            line-height: 18px;
           }
           .val {
             color: #999999;
@@ -549,4 +385,7 @@ const getPhone = (res) => {
   // object-fit: contain;
   cursor: pointer;
 }
+::v-deep(.el-button--small) {
+  --el-button-size: 20px;
+}
 </style>

+ 45 - 27
src/views/customer/portrait/com/LatestProgress.vue

@@ -1,19 +1,25 @@
 <template>
   <div v-loading="loading" class="progress">
     <el-timeline reverse>
-      <el-timeline-item
-        v-for="(item, index) in progressList"
-        :key="index"
-        color="#0084FF"
-        placement="top"
-        hide-timestamp
-      >
-        <div class="details">
+      <el-timeline-item v-for="(item, index) in progressList" :key="index" color="#0084FF" placement="top" hide-timestamp>
+        <div class="details" :style="getColor(item.type)">
           <div class="t">{{ getTitle(item.type) }}</div>
-          <div class="content11">
-            <span class="gray"> 跟进摘要: </span>
+          <div class="content11" v-if="item.type != 30">
+            <span class="gray">跟进摘要: </span>
             <span class="val"> {{ getContent(item) }} </span>
           </div>
+          <div class="content11" v-else>
+            <span class="gray">跟进记录: </span>
+            <span class="val"> {{ item.remark }} </span>
+          </div>
+          <div style="margin: 8px 0; display: flex" v-if="item.fileList && item.fileList.length > 0">
+            <div style="width: 36px; color: #999999">附件:</div>
+            <div style="width: calc(100% - 36px)">
+              <div v-for="(file, index) in item.fileList" :key="index">
+                <a style="color: #409eff; cursor: pointer" @click="openFile(file.fileUrl)">{{ file.fileName }}</a>
+              </div>
+            </div>
+          </div>
           <div class="gray">{{ item.createTime }}</div>
         </div>
       </el-timeline-item>
@@ -32,15 +38,17 @@ const loading = ref(false);
 const progressList = ref([]);
 const getData = () => {
   loading.value = true;
-  proxy
-    .post("/saleQuotation/latestFollowUp", { id: props.customerId })
-    .then((res) => {
-      console.log(res, "adas");
-      progressList.value = res.rows;
-      setTimeout(() => {
-        loading.value = false;
-      }, 200);
+  proxy.post("/saleQuotation/latestFollowUp", { id: props.customerId }).then((res) => {
+    progressList.value = res.rows;
+    proxy.post("/fileInfo/getList", { businessIdList: res.rows.map((rows) => rows.id) }).then((fileObj) => {
+      for (let i = 0; i < res.rows.length; i++) {
+        progressList.value[i].fileList = fileObj[progressList.value[i].id] || [];
+      }
     });
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
 };
 onMounted(() => {
   if (props.customerId) {
@@ -54,6 +62,8 @@ const getTitle = (type) => {
       return "报价单";
     case 20:
       return "合同";
+    case 30:
+      return "手动跟进";
     default:
       return "";
   }
@@ -62,16 +72,25 @@ const getContent = (item) => {
   if (item.type === 10) {
     return "报价单总金额 " + proxy.moneyFormat(item.amount, 2);
   } else if (item.type === 20) {
-    return (
-      "合同总金额 " +
-      proxy.moneyFormat(item.amount, 2) +
-      ` (${item.contractCode}) `
-    );
+    return "合同总金额 " + proxy.moneyFormat(item.amount, 2) + ` (${item.contractCode}) `;
   }
 };
+const openFile = (path) => {
+  window.open(path, "_blank");
+};
+const getColor = (type) => {
+  const obj = {
+    0: "#EAE8FB",
+    10: "#FCF1E4",
+    20: "#E2FBE8",
+    30: "#D9EDFF",
+    40: "#E4F9F9",
+  };
+  return "background-color: " + obj[type];
+};
 </script>
 
-<style lang="scss" scoped >
+<style lang="scss" scoped>
 :deep(.el-timeline-item) {
   padding-bottom: 10px;
 }
@@ -83,7 +102,7 @@ const getContent = (item) => {
 }
 .details {
   padding: 10px;
-  background-color: #d9edff;
+  // background-color: #d9edff;
   border-radius: 5px;
   font-size: 12px;
   .t {
@@ -105,10 +124,9 @@ const getContent = (item) => {
   }
 }
 </style>
-<style >
+<style>
 ul {
   margin: 0px;
   padding: 0px;
 }
 </style>
-