فهرست منبع

客户信息表新增认领限制

cgp 2 هفته پیش
والد
کامیت
062a8cf379
3فایلهای تغییر یافته به همراه100 افزوده شده و 41 حذف شده
  1. 8 0
      src/api/qw/companyCustomer.js
  2. 1 1
      src/views/hisStore/components/OrderDoctorAdvice.vue
  3. 91 40
      src/views/qw/companyCustomer/index.vue

+ 8 - 0
src/api/qw/companyCustomer.js

@@ -233,3 +233,11 @@ export function quickClaimAndImprove(data) {
     data: data
   });
 }
+
+// 获取认领限制配置
+export function getCompanyCustomerDynamicConfig() {
+  return request({
+    url: '/qw/companyCustomer/getCompanyCustomerDynamicConfig',
+    method: 'get'
+  });
+}

+ 1 - 1
src/views/hisStore/components/OrderDoctorAdvice.vue

@@ -355,7 +355,7 @@ export default {
 }
 .info-label {
   display: inline-block;
-  width: 100px;
+  width: 115px;
   color: #606266;
   font-weight: 500;
 }

+ 91 - 40
src/views/qw/companyCustomer/index.vue

@@ -1656,6 +1656,7 @@ import {
   createPhoneQRCode,
   canClaimCustomer,
   quickClaimAndImprove,
+  getCompanyCustomerDynamicConfig,
 } from "@/api/qw/companyCustomer";
 import { treeselect } from "@/api/company/companyDept";
 import { parseTime } from "@/utils/common";
@@ -2749,13 +2750,13 @@ export default {
     },
     handleCreateOrder(row) {
       //调用获取详情接口进行回填
-      // getCustomer(row.id).then((res) => {
-      //   if (res.data.noEncryptPhone==null){
-      //     alert("回填号码异常,请手动填写");
-      //   }else {
-      //     this.createOrderForm.phone=res.data.noEncryptPhone;
-      //   }
-      // });
+      getCustomer(row.id).then((res) => {
+        if (res.data.phone==null){
+          this.$message.error('回填号码异常,请手动填写')
+        }else {
+          this.createOrderForm.phone=res.data.phone;
+        }
+      });
       this.createOrderReset();
       this.createOrder.open = true;
       this.createOrder.scrmPrescribeInfo = null; // 清空旧数据
@@ -2843,42 +2844,92 @@ export default {
       this.queryParams.autoAddUser = null; // 重置为未勾选
     },
     handleClaim(row) {
-      canClaimCustomer(row.id).then(response => {
-        const flag = response.data;
-        if (flag === 1) {
-          this.isQuickClaimMode = true;
-          getCustomer(row.id).then(res => {
-            this.form = res.data;
-            if (this.form.sex !== undefined && this.form.sex !== null) {
-              this.form.sex = String(this.form.sex);
+      // ========== 点击时实时请求配置接口 ==========
+      getCompanyCustomerDynamicConfig()
+        .then(res => {
+          const enable = res.data?.enable;
+          // 判断是否满足认领条件
+          if (enable === 1 && row.kdzlMakeStatus !== 1) {
+            this.$message.warning('仅已成交的客户才可以认领!');
+            return;
+          }
+          // ========== 满足条件,继续认领逻辑 ==========
+          canClaimCustomer(row.id).then(response => {
+            const flag = response.data;
+            if (flag === 1) {
+              this.isQuickClaimMode = true;
+              getCustomer(row.id).then(res => {
+                this.form = res.data;
+                if (this.form.sex !== undefined && this.form.sex !== null) {
+                  this.form.sex = String(this.form.sex);
+                }
+                this.open = true;
+                this.title = "认领客户 - 请完善信息";
+              }).catch(() => {
+                this.isQuickClaimMode = false;
+                this.$message.error('获取客户信息失败');
+              });
+            } else {
+              this.isQuickClaimMode = false;
+              this.currentClaimRow = row;
+              this.claimForm = {
+                claimNumber: '',
+                kdzlAddWechatStatus: null,
+                patientMainComplaint: '',
+                presentIllness: '',
+                currentMedication: '',
+                allergyHistory: ''
+              };
+              this.claimDialogVisible = true;
+              this.$nextTick(() => {
+                if (this.$refs.claimForm) this.$refs.claimForm.clearValidate();
+              });
             }
-            this.open = true;
-            this.title = "认领客户 - 请完善信息";
-          }).catch(() => {
+          }).catch(error => {
             this.isQuickClaimMode = false;
-            this.$message.error('获取客户信息失败');
+            this.$message.error(error.msg || '判断快捷认领失败');
           });
-        } else {
-          this.isQuickClaimMode = false;
-          this.currentClaimRow = row;
-          // 重置表单,包括新增字段
-          this.claimForm = {
-            claimNumber: '',
-            kdzlAddWechatStatus: null,
-            patientMainComplaint: '',
-            presentIllness: '',
-            currentMedication: '',
-            allergyHistory: ''
-          };
-          this.claimDialogVisible = true;
-          this.$nextTick(() => {
-            if (this.$refs.claimForm) this.$refs.claimForm.clearValidate();
+        })
+        .catch(() => {
+          // 接口请求失败时,默认允许认领(降级处理)
+          this.$message.warning('获取配置失败,已允许认领');
+          // 继续执行原有认领逻辑
+          canClaimCustomer(row.id).then(response => {
+            const flag = response.data;
+            if (flag === 1) {
+              this.isQuickClaimMode = true;
+              getCustomer(row.id).then(res => {
+                this.form = res.data;
+                if (this.form.sex !== undefined && this.form.sex !== null) {
+                  this.form.sex = String(this.form.sex);
+                }
+                this.open = true;
+                this.title = "认领客户 - 请完善信息";
+              }).catch(() => {
+                this.isQuickClaimMode = false;
+                this.$message.error('获取客户信息失败');
+              });
+            } else {
+              this.isQuickClaimMode = false;
+              this.currentClaimRow = row;
+              this.claimForm = {
+                claimNumber: '',
+                kdzlAddWechatStatus: null,
+                patientMainComplaint: '',
+                presentIllness: '',
+                currentMedication: '',
+                allergyHistory: ''
+              };
+              this.claimDialogVisible = true;
+              this.$nextTick(() => {
+                if (this.$refs.claimForm) this.$refs.claimForm.clearValidate();
+              });
+            }
+          }).catch(error => {
+            this.isQuickClaimMode = false;
+            this.$message.error(error.msg || '判断快捷认领失败');
           });
-        }
-      }).catch(error => {
-        this.isQuickClaimMode = false;
-        this.$message.error(error.msg || '判断快捷认领失败');
-      });
+        });
     },
     submitClaim() {
       this.$refs.claimForm.validate((valid) => {
@@ -3456,7 +3507,7 @@ export default {
     handleDialogClose() {
       this.isQuickClaimMode = false;
       this.reset();
-    }
+    },
   },
 };
 </script>