cz 1 рік тому
батько
коміт
22af07580c

+ 2 - 0
src/store/modules/mail.js

@@ -1,6 +1,8 @@
 const useMailStore = defineStore(
   'mail', {
     state: () => ({
+      customerSource: [], //客户来源
+      customerStatus: [], //客户类型
       userMailList: [],
       selectMail: {}, //当前选中的邮箱
       currentMenu: {}, //当前选中的邮箱菜单数据

+ 14 - 0
src/views/connect/E-mail/mail/com/left.vue

@@ -827,6 +827,20 @@ const handleCustomerTreeClick = (data, node, type) => {
   }
 };
 
+const getDict = () => {
+  proxy.getDictOne(["customer_source", "customer_status"]).then((res) => {
+    mailStore.customerSource = res["customer_source"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    mailStore.customerStatus = res["customer_status"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
+getDict();
+
 onMounted(() => {
   getMialList();
   getCustomerList();

+ 25 - 104
src/views/connect/E-mail/mail/com/mailDetail.vue

@@ -1,43 +1,27 @@
 <template>
   <div v-loading="loading" class="box">
-    <div
-      style="
+    <div style="
         margin-bottom: 10px;
         display: flex;
         align-items: center;
         flex-wrap: wrap;
-      "
-    >
-      <el-button
-        :disabled="currentMailIndex === 0"
-        @click="handleChangeEail('10')"
-        >上一封</el-button
-      >
-      <el-button
-        :disabled="currentMailIndex === allLength - 1"
-        @click="handleChangeEail('20')"
-        >下一封</el-button
-      >
+      ">
+      <el-button :disabled="currentMailIndex === 0" @click="handleChangeEail('10')">上一封</el-button>
+      <el-button :disabled="currentMailIndex === allLength - 1" @click="handleChangeEail('20')">下一封</el-button>
       <el-button type="primary" @click="handleReply('10')">回复</el-button>
       <el-button type="primary" @click="handleReply('30')">全部回复</el-button>
       <el-button type="warning" @click="handleReply('20')">转发</el-button>
       <el-button @click="handleReply('40')">再次编辑</el-button>
       <el-button @click="handleMove">移动</el-button>
       <el-button @click="handleRemove">删除</el-button>
-      <div
-        style="
+      <div style="
           background-color: #eff6ff;
           padding: 6px;
           margin-left: 10px;
           cursor: pointer;
           border-radius: 2px 2px 2px 2px;
-        "
-        @click="handleAddTag"
-      >
-        <span
-          class="iconfont icon-icon_biaoqian2"
-          style="color: #0084ff; font-size: 20px"
-        ></span>
+        " @click="handleAddTag">
+        <span class="iconfont icon-icon_biaoqian2" style="color: #0084ff; font-size: 20px"></span>
       </div>
       <!-- <el-tag
         style="margin-left: 8px; cursor: pointer"
@@ -54,27 +38,15 @@
         </div>
       </div>
       <div class="top-row" v-if="mailTagList && mailTagList.length > 0">
-        <el-tag
-          style="margin-left: 8px"
-          type="success"
-          closable
-          v-for="(tag, index) in mailTagList"
-          :key="index"
-          @close="tagClose(tag)"
-        >
+        <el-tag style="margin-left: 8px" type="success" closable v-for="(tag, index) in mailTagList" :key="index" @close="tagClose(tag)">
           {{ tag.name }}
         </el-tag>
       </div>
       <div class="top-row">
         <div class="label">发 件 人:</div>
         <div class="value">
-          <span
-            v-for="item in replyTo"
-            :key="item.id"
-            style="margin-right: 10px"
-          >
-            {{ item.email || item.personalName }}</span
-          >
+          <span v-for="item in replyTo" :key="item.id" style="margin-right: 10px">
+            {{ item.email || item.personalName }}</span>
         </div>
       </div>
       <div class="top-row">
@@ -89,16 +61,14 @@
         <div class="label">抄 送 人:</div>
         <div class="value">
           <span v-for="item in cc" :key="item.id" style="margin-right: 10px">
-            {{ item.email || item.personalName }}</span
-          >
+            {{ item.email || item.personalName }}</span>
         </div>
       </div>
       <div class="top-row" v-if="bcc && bcc.length > 0">
         <div class="label">密 送 人:</div>
         <div class="value">
           <span v-for="item in bcc" :key="item.id" style="margin-right: 10px">
-            {{ item.email || item.personalName }}</span
-          >
+            {{ item.email || item.personalName }}</span>
         </div>
       </div>
       <div class="top-row">
@@ -110,94 +80,45 @@
       <div class="top-row" v-if="fileList && fileList.length > 0">
         <div class="label">附 件:</div>
         <div class="value">
-          <div
-            v-for="(item, index) in fileList"
-            style="margin-right: 20px; display: flex; align-items: center"
-            :key="index"
-          >
+          <div v-for="(item, index) in fileList" style="margin-right: 20px; display: flex; align-items: center" :key="index">
             <span style="cursor: pointer" @click="handleClickFile(item)">{{
               item.name
             }}</span>
-            <span
-              style="margin-left: 8px; cursor: pointer"
-              @click="handleClickDownload(item)"
-              ><el-icon color="#0084FF"><Download /></el-icon
-            ></span>
+            <span style="margin-left: 8px; cursor: pointer" @click="handleClickDownload(item)"><el-icon color="#0084FF">
+                <Download />
+              </el-icon></span>
           </div>
         </div>
       </div>
     </div>
 
     <div class="body">
-      <iframe
-        frameborder="0"
-        allowTransparency="true"
-        style="
+      <iframe frameborder="0" allowTransparency="true" style="
           width: 99% !important;
           overflow-x: scroll;
           padding-top: 10px;
           height: 500px;
-        "
-        :srcdoc="showBodyText(detailsData.data.content)"
-        :ref="'iframeText_' + mailStore.currentId"
-        :id="'iframeText_' + mailStore.currentId"
-      >
+        " :srcdoc="showBodyText(detailsData.data.content)" :ref="'iframeText_' + mailStore.currentId" :id="'iframeText_' + mailStore.currentId">
       </iframe>
     </div>
 
-    <el-dialog
-      title="移动邮件"
-      v-model="myFolderDialog"
-      width="300px"
-      destroy-on-close
-      v-loading="submitLoading"
-    >
-      <byForm
-        :formConfig="myFolderFormConfig"
-        :formOption="formOption"
-        v-model="formData.myFolderData"
-        :rules="rules"
-        ref="myFolderForm"
-      >
+    <el-dialog title="移动邮件" v-model="myFolderDialog" width="300px" destroy-on-close v-loading="submitLoading">
+      <byForm :formConfig="myFolderFormConfig" :formOption="formOption" v-model="formData.myFolderData" :rules="rules" ref="myFolderForm">
       </byForm>
       <template #footer>
-        <el-button @click="myFolderDialog = false" size="large"
-          >取 消</el-button
-        >
-        <el-button
-          type="primary"
-          @click="submitMyFolderForm()"
-          size="large"
-          :loading="submitLoading"
-        >
+        <el-button @click="myFolderDialog = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitMyFolderForm()" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>
     </el-dialog>
 
-    <el-dialog
-      title="添加标签"
-      v-model="tagDialog"
-      width="300px"
-      destroy-on-close
-      v-loading="submitLoading"
-    >
-      <byForm
-        :formConfig="tagFormConfig"
-        :formOption="formOption"
-        v-model="formData.tagData"
-        :rules="rules"
-        ref="tagForm"
-      >
+    <el-dialog title="添加标签" v-model="tagDialog" width="300px" destroy-on-close v-loading="submitLoading">
+      <byForm :formConfig="tagFormConfig" :formOption="formOption" v-model="formData.tagData" :rules="rules" ref="tagForm">
       </byForm>
       <template #footer>
         <el-button @click="tagDialog = false" size="large">取 消</el-button>
-        <el-button
-          type="primary"
-          @click="submitTagForm()"
-          size="large"
-          :loading="submitLoading"
-        >
+        <el-button type="primary" @click="submitTagForm()" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>

+ 147 - 41
src/views/connect/E-mail/mail/com/mailList.vue

@@ -63,40 +63,43 @@
               <span style="margin-left:5px;cursor: pointer;">
                 <el-popover placement="top-start" :width="300" trigger="hover">
                   <template #default>
-                    <div v-if="row.flags" style="font-size:12px">
+                    <div v-if="row.customerId &&row.customerInfo" style="font-size:12px">
                       <div style="display:flex;align-items:center">
                         <el-icon size="26" :color="'#409eff'" style="vertical-align:middle">
                           <UserFilled />
                         </el-icon>
-                        <span style="margin:0 20px" class="public-color">客户名称</span>
-                        <span class="public-color">1279230601@qq.com</span>
+                        <span style="margin:0 20px" class="public-color"
+                              v-if="row.customerInfo.customerUserList &&row.customerInfo.customerUserList.length>0">{{row.customerInfo.customerUserList[0].name}}</span>
+                        <span class="public-color"
+                              v-if="row.customerInfo.customerUserList &&row.customerInfo.customerUserList.length>0">{{row.customerInfo.customerUserList[0].email}}</span>
                       </div>
                       <div style="border-top:1px solid #eee;border-bottom:1px solid #eee;margin-top:20px;padding-bottom:10px">
                         <div style="margin-top:10px">
-                          国家:
+                          国家:{{row.customerInfo.countryName}}
                         </div>
                         <div style="margin-top:10px">
-                          公司:
+                          公司:{{row.customerInfo.name}}
                         </div>
                         <div style="margin-top:10px">
-                          职位:
+                          电话:{{row.phoneNumber}}
                         </div>
                         <div style="margin-top:10px">
-                          电话:
+                          类型:{{dictValueLabel(row.customerInfo.status, customerStatus)}}
                         </div>
                         <div style="margin-top:10px">
-                          来源:
+                          来源:{{dictValueLabel(row.customerInfo.source, customerSource)}}
                         </div>
                       </div>
                       <div style="display:flex;align-items:center;margin-top:10px;justify-content:space-between">
-                        <span class="cursor-class" @click="addCustomer('edit')">
+                        <span class="cursor-class" @click="addCustomer('edit',row.customerId)">
                           <el-icon :size="16" color="#409eff" class="icon-class">
                             <Edit />
                           </el-icon><span class="public-color">编辑客户</span></span>
-                        <span class="cursor-class"><el-icon :size="16" color="#409eff" class="icon-class">
+                        <!-- <span class="cursor-class" @click="handleReply('10')"><el-icon :size="16" color="#409eff" class="icon-class">
                             <ChatRound />
-                          </el-icon><span class="public-color">回复</span></span>
-                        <span class="cursor-class"><el-icon :size="16" color="#409eff" class="icon-class">
+                          </el-icon><span class="public-color">回复</span></span> -->
+                        <span class="cursor-class" @click="handleGoWrite({email:row.fromEmail},'0')"><el-icon :size="16" color="#409eff"
+                                   class="icon-class">
                             <EditPen />
                           </el-icon><span class="public-color">写信</span></span>
                       </div>
@@ -106,8 +109,8 @@
                         <el-icon size="26" style="vertical-align:middle">
                           <UserFilled />
                         </el-icon>
-                        <span style="margin:0 20px">客户名称</span>
-                        <span>1279230601@qq.com</span>
+                        <span style="margin:0 20px">{{row.fromEmail}}</span>
+                        <!-- <span>1279230601@qq.com</span> -->
                       </div>
                       <div
                            style="border-top:1px solid #eee;margin-top:20px;display:flex;align-items:center;justify-content:space-between;padding-top:10px">
@@ -115,25 +118,26 @@
                           <el-icon :size="16" color="#409eff" class="icon-class">
                             <Plus />
                           </el-icon><span class="public-color">添加为客户</span></span>
-                        <span class="cursor-class"><el-icon :size="16" color="#409eff" class="icon-class">
+                        <!-- <span class="cursor-class"><el-icon :size="16" color="#409eff" class="icon-class">
                             <ChatRound />
-                          </el-icon><span class="public-color">回复</span></span>
-                        <span class="cursor-class"><el-icon :size="16" color="#409eff" class="icon-class">
+                          </el-icon><span class="public-color">回复</span></span> -->
+                        <span class="cursor-class" @click="handleGoWrite({email:row.fromEmail},'0')"><el-icon :size="16" color="#409eff"
+                                   class="icon-class">
                             <EditPen />
                           </el-icon><span class="public-color">写信</span></span>
                       </div>
                     </div>
                   </template>
                   <template #reference>
-                    <el-icon size="18" :color="row.flags?'#409eff':''" style="vertical-align:middle">
+                    <el-icon size="18" :color="row.customerId?'#409eff':''" style="vertical-align:middle">
                       <UserFilled />
                     </el-icon>
                   </template>
                 </el-popover>
 
               </span>
-              <span style="margin-left:5px;cursor: pointer;">
-                <el-icon size="18" :color="row.isAttachments?'#409eff':''" style="vertical-align:middle">
+              <span style="margin-left:5px;cursor: pointer;" v-if="row.isAttachments">
+                <el-icon size="18" :color="'#409eff'" style="vertical-align:middle">
                   <Paperclip />
                 </el-icon>
               </span>
@@ -238,6 +242,8 @@ const tableData = reactive({
 });
 const mailKeyword = ref("");
 const unReadCount = computed(() => mailStore.currentMenu.unReadCount);
+const customerSource = computed(() => mailStore.customerSource);
+const customerStatus = computed(() => mailStore.customerStatus);
 const config = computed(() => {
   return [
     {
@@ -284,11 +290,30 @@ const getList = () => {
         keyword: mailKeyword.value,
       })
       .then((res) => {
-        tableData.data = res.rows.map((x) => ({ ...x, isCheck: false }));
-        mailStore.mailDataList = res.rows.map((x) => ({
-          ...x,
-          isCheck: false,
-        }));
+        for (let i = 0; i < res.rows.length; i++) {
+          const row = res.rows[i];
+          row.isCheck = false;
+          if (
+            row.customerId &&
+            row.customerInfo &&
+            row.customerInfo.customerUserList &&
+            row.customerInfo.customerUserList.length > 0
+          ) {
+            if (row.customerInfo.customerUserList[0].contactJson) {
+              row.customerInfo.customerUserList[0].contactJson = JSON.parse(
+                row.customerInfo.customerUserList[0].contactJson
+              );
+              let arr = row.customerInfo.customerUserList[0].contactJson.filter(
+                (x) => x.type == "mobile"
+              );
+              if (arr && arr.length > 0) {
+                row.phoneNumber = arr[0].contactNo;
+              }
+            }
+          }
+        }
+        tableData.data = res.rows;
+        mailStore.mailDataList = tableData.data;
         tableData.pagination.total = res.total;
         loading.value = false;
       });
@@ -302,14 +327,30 @@ const getList = () => {
         keyword: mailKeyword.value,
       })
       .then((res) => {
-        tableData.data = res.rows.map((x) => ({
-          ...x,
-          isCheck: false,
-        }));
-        mailStore.mailDataList = res.rows.map((x) => ({
-          ...x,
-          isCheck: false,
-        }));
+        for (let i = 0; i < res.rows.length; i++) {
+          const row = res.rows[i];
+          row.isCheck = false;
+          if (
+            row.customerId &&
+            row.customerInfo &&
+            row.customerInfo.customerUserList &&
+            row.customerInfo.customerUserList.length > 0
+          ) {
+            if (row.customerInfo.customerUserList[0].contactJson) {
+              row.customerInfo.customerUserList[0].contactJson = JSON.parse(
+                row.customerInfo.customerUserList[0].contactJson
+              );
+              let arr = row.customerInfo.customerUserList[0].contactJson.filter(
+                (x) => x.type == "mobile"
+              );
+              if (arr && arr.length > 0) {
+                row.phoneNumber = arr[0].contactNo;
+              }
+            }
+          }
+        }
+        tableData.data = res.rows;
+        mailStore.mailDataList = tableData.data;
         tableData.pagination.total = res.total;
         loading.value = false;
       });
@@ -323,14 +364,30 @@ const getList = () => {
         keyword: mailKeyword.value,
       })
       .then((res) => {
-        tableData.data = res.rows.map((x) => ({
-          ...x,
-          isCheck: false,
-        }));
-        mailStore.mailDataList = res.rows.map((x) => ({
-          ...x,
-          isCheck: false,
-        }));
+        for (let i = 0; i < res.rows.length; i++) {
+          const row = res.rows[i];
+          row.isCheck = false;
+          if (
+            row.customerId &&
+            row.customerInfo &&
+            row.customerInfo.customerUserList &&
+            row.customerInfo.customerUserList.length > 0
+          ) {
+            if (row.customerInfo.customerUserList[0].contactJson) {
+              row.customerInfo.customerUserList[0].contactJson = JSON.parse(
+                row.customerInfo.customerUserList[0].contactJson
+              );
+              let arr = row.customerInfo.customerUserList[0].contactJson.filter(
+                (x) => x.type == "mobile"
+              );
+              if (arr && arr.length > 0) {
+                row.phoneNumber = arr[0].contactNo;
+              }
+            }
+          }
+        }
+        tableData.data = res.rows;
+        mailStore.mailDataList = tableData.data;
         tableData.pagination.total = res.total;
         loading.value = false;
       });
@@ -618,6 +675,55 @@ const addCustomer = (type, id = "") => {
   modalType.value = type;
   addCustomerDialog.value = true;
 };
+const handleReply = (pageType) => {
+  // pageType 10为回复  20为转发 30为全部回复 40为再次编辑  0为写信
+  let title = "";
+  if (pageType === "10") {
+    title = "回复";
+  } else if (pageType === "20") {
+    title = "转发";
+  } else if (pageType === "30") {
+    title = "全部回复";
+  } else if (pageType === "40") {
+    title = "再次编辑";
+  }
+  const menu = {
+    title: title,
+    type: mailStore.selectMail.type,
+    id: "write",
+    pageType: pageType,
+    details: {},
+  };
+  const index = mailStore.mailMenuList.findIndex((x) => x.id === menu.id);
+  if (index >= 0) {
+    mailStore.mailMenuList[index] = menu;
+  } else {
+    mailStore.mailMenuList.push(menu);
+  }
+  mailStore.currentMenu = menu;
+  mailStore.currentId = menu.id;
+};
+
+const handleGoWrite = (mail = {}, pageType = "0") => {
+  const menu = {
+    title: "写信",
+    type: mailStore.selectMail.type,
+    id: "write",
+    pageType,
+  };
+  if (mail) {
+    menu.reMail = mail;
+  }
+  const index = mailStore.mailMenuList.findIndex((x) => x.id === menu.id);
+  if (index >= 0) {
+    mailStore.mailMenuList[index] = menu;
+  } else {
+    mailStore.mailMenuList.push(menu);
+  }
+  mailStore.currentMenu = menu;
+  mailStore.currentId = menu.id;
+};
+
 defineExpose({
   initFn: init,
 });

+ 11 - 1
src/views/connect/E-mail/mail/com/mailWrite.vue

@@ -440,6 +440,7 @@ const pushTo = () => {
 };
 const handleReplyInit = (allData, pageType) => {
   let data = allData.details;
+  console.log(data, "asd");
   // 回复功能:则发件人是回复的收件人
   if (pageType === "10") {
     if (data.messageAddressList && data.messageAddressList.length > 0) {
@@ -500,7 +501,16 @@ const handleReplyInit = (allData, pageType) => {
     pushTo();
   }
   if (pageType !== "50") {
-    contentEditor.value.changeHtml(`<p><br></p><p><br></p>${data.content}`);
+    contentEditor.value.changeHtml(`
+    <div style="background:#eee;padding:10px;font-size:12px">
+      <div><span style="color:#000;font-weight:700">发件人:</span><span>${data.fromEmail}</span></div>
+      <div><span style="color:#000;font-weight:700;margin-top:5px">发送时间:</span><span>${data.fromEmail}</span></div>
+      <div><span style="color:#000;font-weight:700;margin-top:5px">收件人:</span><span>${data.fromEmail}</span></div>
+      <div><span style="color:#000;font-weight:700;margin-top:5px">主题:</span><span>${data.subject}</span></div>
+    </div>
+    <p><br></p>
+    ${data.content}`);
+    // <p><br></p><p><br></p>
     // nextTick(() => {
     //   contentEditor.value.getFocus();
     // });

+ 37 - 4
src/views/customer/addCustomer.vue

@@ -1,6 +1,11 @@
 <template>
   <div>
     <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit" v-loading="loading">
+      <template #name>
+        <div style="width: 100%">
+          <el-autocomplete v-model="formData.data.name" :fetch-suggestions="querySearch" clearable placeholder="请输入" style="width:100%" />
+        </div>
+      </template>
       <template #allAddress>
         <el-row style="width: 100%">
           <el-col :span="8">
@@ -260,13 +265,19 @@ const formOption = reactive({
 });
 const formConfig = computed(() => {
   return [
+    // {
+    //   type: "input",
+    //   prop: "name",
+    //   label: "客户名称",
+    //   required: true,
+    //   itemWidth: 100,
+    //   itemType: "text",
+    // },
     {
-      type: "input",
+      type: "slot",
+      slotName: "name",
       prop: "name",
       label: "客户名称",
-      required: true,
-      itemWidth: 100,
-      itemType: "text",
     },
     {
       type: "slot",
@@ -474,6 +485,28 @@ const handleSubmit = () => {
     }
   });
 };
+const querySearch = (queryString, callback) => {
+  proxy
+    .post("/customer/page", {
+      pageNum: 1,
+      pageSize: 20,
+      name: queryString,
+    })
+    .then((res) => {
+      if (res.rows && res.rows.length > 0) {
+        res.rows = res.rows.map((item) => {
+          return {
+            ...item,
+            value: item.name,
+          };
+        });
+        callback(res.rows);
+      } else {
+        callback([]);
+      }
+    });
+};
+
 defineExpose({
   handleSubmit,
 });