zyy 4 дней назад
Родитель
Сommit
de12d9cdac

+ 10 - 0
src/api/crm/customer.js

@@ -196,3 +196,13 @@ export function getMyAssistList(query) {
     params: query
   })
 }
+
+export function getMyCustomerPhone(customerId) {
+  return request({
+    url: '/crm/customer/getMyCustomerPhone',
+    method: 'get',
+    params: {
+      customerId
+    }
+  })
+}

+ 6 - 2
src/views/aiSipCall/aiSipCallManualOutbound.vue

@@ -531,7 +531,10 @@ export default {
         workflowInstanceId: {
             type: [Number, String],
             default: null
-        }
+        },customerId: {
+        type: [Number, String],
+        default: null
+      },
     },
     data() {
         return {
@@ -1398,7 +1401,8 @@ export default {
                     companyId: this.companyId,
                     companyUserId: this.companyUserId,
                     workflowInstanceId: this.workflowInstanceId,
-                    roboticId: this.roboticId
+                    roboticId: this.roboticId,
+                    customerId: this.customerId
                 };
 
                 console.log('[syncByUuid] 准备调用后端记录:', {

+ 67 - 2
src/views/crm/customer/my.vue

@@ -168,6 +168,9 @@
           {{scope.row.mobile}}
           <el-button type="text"    size="mini" @click="callNumber(scope.row.customerId,null,null,null)">拨号</el-button>
           <el-button v-hasPermi="['crm:customer:addVisit']"  type="text" size="mini" @click="handleAddVisit(scope.row)">写跟进</el-button>
+          <el-button type="text" size="mini" @click="handleManualCall(scope.row)">
+            开始手动外呼
+          </el-button>
         </template>
       </el-table-column>
       <el-table-column  label="客户来源" align="center" prop="source">
@@ -269,11 +272,30 @@
     <el-dialog :title="addVisitStatus.title" :visible.sync="addVisitStatus.open" width="600px" append-to-body>
         <add-visit-status ref="visitStatus" @close="closeVisitStatus()"></add-visit-status>
     </el-dialog>
+    <!--人工外呼弹窗-->
+    <el-dialog
+      :title="manualCallDialog.title"
+      :visible.sync="manualCallDialog.visible"
+      width="1500px"
+      append-to-body
+      destroy-on-close
+      class="manual-call-dialog"
+      @close="handleManualCallDialogClose"
+    >
+      <call-center-phone-bar
+        :key="manualCallDialog.key"
+        ref="callCenterPhoneBar"
+        :init-phone-number="manualCallDialog.phone"
+        :company-id="manualCallDialog.companyId"
+        :company-user-id="manualCallDialog.companyUserId"
+        :customer-id="manualCallDialog.customerId"
+      />
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { getMyCustomerList,recover,exportCustomer  } from "@/api/crm/customer";
+import { getMyCustomerList,recover,exportCustomer,getMyCustomerPhone } from "@/api/crm/customer";
 import customerDetails from '../components/customerDetails.vue';
 import addVisit from '../components/addVisit.vue';
 import {getCitys} from "@/api/store/city";
@@ -285,9 +307,10 @@ import addTag from '../components/addTag.vue';
 import addRemark from '../components/addRemark.vue';
 import addCustomerType from '../components/addCustomerType.vue';
 import addVisitStatus from '../components/addVisitStatus.vue';
+import CallCenterPhoneBar from '../../aiSipCall/aiSipCallManualOutbound.vue';
 export default {
   name: "Customer",
-  components: {addVisitStatus,addCustomerType,addRemark,addTag,assignUser,addOrEditCustomer,editSource, addBatchSms,customerDetails,addVisit,addVisit },
+  components: {addVisitStatus,addCustomerType,addRemark,addTag,assignUser,addOrEditCustomer,editSource, addBatchSms,customerDetails,addVisit,CallCenterPhoneBar },
   data() {
     return {
       addVisitStatus:{
@@ -424,6 +447,16 @@ export default {
         ],
       },
       loading:null,
+      manualCallDialog: {
+        visible: false,
+        customerId: null,
+        phone: '',
+        title: '人工外呼',
+        record: null,
+        key: 0,
+        companyId: null,
+        companyUserId: null
+      },
     };
   },
   created() {
@@ -693,6 +726,38 @@ export default {
           this.download(response.msg);
         }).catch(function() {});
     },
+
+    async handleManualCall(row) {
+      try {
+        const res = await getMyCustomerPhone(row.customerId);
+        const phone = res.msg || '';
+        if (!phone) {
+          this.$message.warning('当前客户没有可外呼的手机号');
+          return;
+        }
+        this.manualCallDialog.record = row;
+        this.manualCallDialog.phone = phone;
+        this.manualCallDialog.customerId = row.customerId || null;
+        this.manualCallDialog.title = `人工外呼 - ${row.customerName || '未知客户'}`;
+        this.manualCallDialog.companyId = row.companyId || null;
+        this.manualCallDialog.companyUserId = row.companyUserId ||  null;
+        this.manualCallDialog.key += 1;
+        this.manualCallDialog.visible = true;
+
+      } catch (e) {
+        console.error(e);
+        this.$message.error('获取手机号失败');
+      }
+    },
+
+    handleManualCallDialogClose() {
+      this.manualCallDialog.phone = '';
+      this.manualCallDialog.record = null;
+      this.manualCallDialog.roboticId = null;
+      this.manualCallDialog.companyId = null;
+      this.manualCallDialog.companyUserId = null;
+      this.manualCallDialog.workflowInstanceId = null;
+    }
   }
 };
 </script>