浏览代码

济南发送短信

yuhongqi 2 小时之前
父节点
当前提交
724f1e3903

+ 9 - 0
src/api/qw/externalContact.js

@@ -168,6 +168,15 @@ export function updateExternalContact(data) {
   })
 }
 
+// 修改外部联系人备注手机号码
+export function updateRemarkMobiles(data) {
+  return request({
+    url: '/qw/externalContact/editRemarkMobiles',
+    method: 'put',
+    data: data
+  })
+}
+
 // 修改企业微信客户称呼
 export function updateExternalContactCall(data) {
   return request({

+ 88 - 1
src/views/qw/externalContact/deptIndex.vue

@@ -526,7 +526,7 @@
           >修改客户称呼</el-button>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180px" fixed="right">
         <template slot-scope="scope">
           <!--          <el-button-->
           <!--            size="mini"-->
@@ -538,6 +538,14 @@
           <!--            <span v-else>绑定CRM</span>-->
           <!--          </el-button>-->
 
+          <el-button
+            v-if="showEditRemarkMobileBtn"
+            size="mini"
+            type="text"
+            icon="el-icon-phone-outline"
+            @click="handleEditRemarkMobile(scope.row)"
+          >修改手机号码</el-button>
+
           <el-button
             size="mini"
             type="text"
@@ -833,6 +841,23 @@
       </div>
     </el-dialog>
 
+    <el-dialog title="修改手机号码" :visible.sync="mobileEditOpen" width="500px" append-to-body>
+      <el-form label-width="110px">
+        <el-form-item label="联系手机号码">
+          <el-input
+            v-model="mobileEditInput"
+            type="textarea"
+            :rows="4"
+            placeholder="多个手机号请用英文逗号分隔,例如:177****8524,177****1352"
+          />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitRemarkMobileForm">确 定</el-button>
+        <el-button @click="mobileEditOpen = false">取 消</el-button>
+      </div>
+    </el-dialog>
+
     <!-- 绑定客户   -->
     <el-dialog :title="bindCustomer.title" :visible.sync="bindCustomer.open"  width="1200px" append-to-body>
       <mycustomer ref="mycustomer"  @bindCustomerId="bindCustomerId"></mycustomer>
@@ -970,6 +995,7 @@ import {
   setCustomerCourseSopList,
   unBindUserId,
   updateExternalContact,
+  updateRemarkMobiles,
   getRepeat,
   updateExternalContactCall, myDeptExtList, getRepeatRecordList
 } from '../../../api/qw/externalContact'
@@ -1073,6 +1099,10 @@ export default {
       remarkMobiles: [],
       inputVisible: false,
       inputValue: '',
+      showEditRemarkMobileBtn: false,
+      mobileEditOpen: false,
+      mobileEditForm: {},
+      mobileEditInput: '',
       // 非单个禁用
       single: true,
       tagGroupList: [],
@@ -1274,9 +1304,66 @@ export default {
     this.getDicts("sys_qw_transfer_status").then(response => {
       this.transferStatusOptions = response.data;
     });
+    this.loadExternalContactFuncDict();
 
   },
   methods: {
+    loadExternalContactFuncDict() {
+      this.getDicts("sys_qw_external_contact_func").then(response => {
+        const list = response.data || [];
+        const btnDict = list.find(item => String(item.dictSort) === "1");
+        this.showEditRemarkMobileBtn = !!(btnDict && btnDict.dictValue === "1");
+      });
+    },
+    parseContactMobilesText(contactMobiles) {
+      return contactMobiles ? String(contactMobiles).trim() : "";
+    },
+    validateContactMobileInput(input) {
+      const raw = (input || "").trim();
+      if (!raw) {
+        return { valid: true, value: "" };
+      }
+      if (raw.includes(",")) {
+        return { valid: false, msg: "请使用英文逗号分隔手机号码" };
+      }
+      if (raw.includes(",,") || raw.startsWith(",") || raw.endsWith(",")) {
+        return { valid: false, msg: "手机号码格式不正确,请使用英文逗号分隔" };
+      }
+      const mobiles = raw.split(",").map(item => item.trim());
+      if (mobiles.some(item => !item)) {
+        return { valid: false, msg: "手机号码格式不正确,请使用英文逗号分隔" };
+      }
+      const set = new Set();
+      for (const mobile of mobiles) {
+        if (set.has(mobile)) {
+          return { valid: false, msg: "手机号码重复:" + mobile };
+        }
+        set.add(mobile);
+      }
+      return { valid: true, value: mobiles.join(",") };
+    },
+    handleEditRemarkMobile(row) {
+      getExternalContact(row.id).then(response => {
+        this.mobileEditForm = response.data;
+        this.mobileEditInput = this.parseContactMobilesText(response.data.contactMobiles);
+        this.mobileEditOpen = true;
+      });
+    },
+    submitRemarkMobileForm() {
+      const result = this.validateContactMobileInput(this.mobileEditInput);
+      if (!result.valid) {
+        this.msgError(result.msg);
+        return;
+      }
+      updateRemarkMobiles({
+        id: this.mobileEditForm.id,
+        contactMobiles: result.value
+      }).then(() => {
+        this.msgSuccess("修改成功");
+        this.mobileEditOpen = false;
+        this.getList();
+      });
+    },
     shortenText(text, maxLen = 16) {
       const str = text == null ? '' : String(text);
       if (str.length <= maxLen) return str;

+ 88 - 1
src/views/qw/externalContact/index.vue

@@ -574,7 +574,7 @@
           >修改客户称呼</el-button>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180px" fixed="right">
         <template slot-scope="scope">
 <!--          <el-button-->
 <!--            size="mini"-->
@@ -586,6 +586,14 @@
 <!--            <span v-else>绑定CRM</span>-->
 <!--          </el-button>-->
 
+          <el-button
+            v-if="showEditRemarkMobileBtn"
+            size="mini"
+            type="text"
+            icon="el-icon-phone-outline"
+            @click="handleEditRemarkMobile(scope.row)"
+          >修改手机号码</el-button>
+
           <el-button
             size="mini"
             type="text"
@@ -914,6 +922,23 @@
       </div>
     </el-dialog>
 
+    <el-dialog title="修改手机号码" :visible.sync="mobileEditOpen" width="500px" append-to-body>
+      <el-form label-width="110px">
+        <el-form-item label="联系手机号码">
+          <el-input
+            v-model="mobileEditInput"
+            type="textarea"
+            :rows="4"
+            placeholder="多个手机号请用英文逗号分隔,例如:177****8524,177****1352"
+          />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitRemarkMobileForm">确 定</el-button>
+        <el-button @click="mobileEditOpen = false">取 消</el-button>
+      </div>
+    </el-dialog>
+
     <!-- 绑定客户   -->
     <el-dialog :title="bindCustomer.title" :visible.sync="bindCustomer.open"  width="1200px" append-to-body>
       <mycustomer ref="mycustomer"  @bindCustomerId="bindCustomerId"></mycustomer>
@@ -1085,6 +1110,7 @@ import {
   delExternalContact,
   addExternalContact,
   updateExternalContact,
+  updateRemarkMobiles,
   exportExternalContact,
   editbindCustomer,
   setCustomerCourseSop,
@@ -1215,6 +1241,10 @@ export default {
       remarkMobiles: [],
       inputVisible: false,
       inputValue: '',
+      showEditRemarkMobileBtn: false,
+      mobileEditOpen: false,
+      mobileEditForm: {},
+      mobileEditInput: '',
       // 非单个禁用
       single: true,
       tagGroupList: [],
@@ -1413,9 +1443,66 @@ export default {
     this.getDicts("sys_qw_transfer_status").then(response => {
       this.transferStatusOptions = response.data;
     });
+    this.loadExternalContactFuncDict();
 
   },
   methods: {
+    loadExternalContactFuncDict() {
+      this.getDicts("sys_qw_external_contact_func").then(response => {
+        const list = response.data || [];
+        const btnDict = list.find(item => String(item.dictSort) === "1");
+        this.showEditRemarkMobileBtn = !!(btnDict && btnDict.dictValue === "1");
+      });
+    },
+    parseContactMobilesText(contactMobiles) {
+      return contactMobiles ? String(contactMobiles).trim() : "";
+    },
+    validateContactMobileInput(input) {
+      const raw = (input || "").trim();
+      if (!raw) {
+        return { valid: true, value: "" };
+      }
+      if (raw.includes(",")) {
+        return { valid: false, msg: "请使用英文逗号分隔手机号码" };
+      }
+      if (raw.includes(",,") || raw.startsWith(",") || raw.endsWith(",")) {
+        return { valid: false, msg: "手机号码格式不正确,请使用英文逗号分隔" };
+      }
+      const mobiles = raw.split(",").map(item => item.trim());
+      if (mobiles.some(item => !item)) {
+        return { valid: false, msg: "手机号码格式不正确,请使用英文逗号分隔" };
+      }
+      const set = new Set();
+      for (const mobile of mobiles) {
+        if (set.has(mobile)) {
+          return { valid: false, msg: "手机号码重复:" + mobile };
+        }
+        set.add(mobile);
+      }
+      return { valid: true, value: mobiles.join(",") };
+    },
+    handleEditRemarkMobile(row) {
+      getExternalContact(row.id).then(response => {
+        this.mobileEditForm = response.data;
+        this.mobileEditInput = this.parseContactMobilesText(response.data.contactMobiles);
+        this.mobileEditOpen = true;
+      });
+    },
+    submitRemarkMobileForm() {
+      const result = this.validateContactMobileInput(this.mobileEditInput);
+      if (!result.valid) {
+        this.msgError(result.msg);
+        return;
+      }
+      updateRemarkMobiles({
+        id: this.mobileEditForm.id,
+        contactMobiles: result.value
+      }).then(() => {
+        this.msgSuccess("修改成功");
+        this.mobileEditOpen = false;
+        this.getList();
+      });
+    },
     handleCreateOrder(row) {
       this.$refs.createOder.show(row);
     },

+ 88 - 1
src/views/qw/externalContact/myExternalContact.vue

@@ -559,7 +559,7 @@
           >修改客户称呼</el-button>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180px" fixed="right">
         <template slot-scope="scope">
 <!--          <el-button-->
 <!--            size="mini"-->
@@ -571,6 +571,14 @@
 <!--            <span v-else>绑定CRM</span>-->
 <!--          </el-button>-->
 
+          <el-button
+            v-if="showEditRemarkMobileBtn"
+            size="mini"
+            type="text"
+            icon="el-icon-phone-outline"
+            @click="handleEditRemarkMobile(scope.row)"
+          >修改手机号码</el-button>
+
           <el-button
             size="mini"
             type="text"
@@ -979,6 +987,23 @@
       </div>
     </el-dialog>
 
+    <el-dialog title="修改手机号码" :visible.sync="mobileEditOpen" width="500px" append-to-body>
+      <el-form label-width="110px">
+        <el-form-item label="联系手机号码">
+          <el-input
+            v-model="mobileEditInput"
+            type="textarea"
+            :rows="4"
+            placeholder="多个手机号请用英文逗号分隔,例如:177****8524,177****1352"
+          />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitRemarkMobileForm">确 定</el-button>
+        <el-button @click="mobileEditOpen = false">取 消</el-button>
+      </div>
+    </el-dialog>
+
     <!-- 重粉看课记录   -->
     <el-drawer title="重粉看课历史" :visible.sync="log.open" size="75%" append-to-body>
       <div style="padding: 10px">
@@ -1170,6 +1195,7 @@ import {
   delExternalContact,
   addExternalContact,
   updateExternalContact,
+  updateRemarkMobiles,
   exportExternalContact,
   editbindCustomer,
   syncMyAddExternalContact,
@@ -1303,6 +1329,10 @@ export default {
       remarkMobiles: [],
       inputVisible: false,
       inputValue: '',
+      showEditRemarkMobileBtn: false,
+      mobileEditOpen: false,
+      mobileEditForm: {},
+      mobileEditInput: '',
       // 非单个禁用
       single: true,
       tagGroupList: [],
@@ -1486,10 +1516,67 @@ export default {
     this.getDicts("sys_qw_transfer_status").then(response => {
       this.transferStatusOptions = response.data;
     });
+    this.loadExternalContactFuncDict();
     this.getDocList();
 
   },
   methods: {
+    loadExternalContactFuncDict() {
+      this.getDicts("sys_qw_external_contact_func").then(response => {
+        const list = response.data || [];
+        const btnDict = list.find(item => String(item.dictSort) === "1");
+        this.showEditRemarkMobileBtn = !!(btnDict && btnDict.dictValue === "1");
+      });
+    },
+    parseContactMobilesText(contactMobiles) {
+      return contactMobiles ? String(contactMobiles).trim() : "";
+    },
+    validateContactMobileInput(input) {
+      const raw = (input || "").trim();
+      if (!raw) {
+        return { valid: true, value: "" };
+      }
+      if (raw.includes(",")) {
+        return { valid: false, msg: "请使用英文逗号分隔手机号码" };
+      }
+      if (raw.includes(",,") || raw.startsWith(",") || raw.endsWith(",")) {
+        return { valid: false, msg: "手机号码格式不正确,请使用英文逗号分隔" };
+      }
+      const mobiles = raw.split(",").map(item => item.trim());
+      if (mobiles.some(item => !item)) {
+        return { valid: false, msg: "手机号码格式不正确,请使用英文逗号分隔" };
+      }
+      const set = new Set();
+      for (const mobile of mobiles) {
+        if (set.has(mobile)) {
+          return { valid: false, msg: "手机号码重复:" + mobile };
+        }
+        set.add(mobile);
+      }
+      return { valid: true, value: mobiles.join(",") };
+    },
+    handleEditRemarkMobile(row) {
+      getExternalContact(row.id).then(response => {
+        this.mobileEditForm = response.data;
+        this.mobileEditInput = this.parseContactMobilesText(response.data.contactMobiles);
+        this.mobileEditOpen = true;
+      });
+    },
+    submitRemarkMobileForm() {
+      const result = this.validateContactMobileInput(this.mobileEditInput);
+      if (!result.valid) {
+        this.msgError(result.msg);
+        return;
+      }
+      updateRemarkMobiles({
+        id: this.mobileEditForm.id,
+        contactMobiles: result.value
+      }).then(() => {
+        this.msgSuccess("修改成功");
+        this.mobileEditOpen = false;
+        this.getList();
+      });
+    },
     shortenText(text, maxLen = 16) {
       const str = text == null ? '' : String(text);
       if (str.length <= maxLen) return str;