|
@@ -124,7 +124,7 @@
|
|
|
@pagination="getList"
|
|
@pagination="getList"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
- <!-- ========== 新增/编辑/详情 弹窗(保持不变,但已移除认领逻辑) ========== -->
|
|
|
|
|
|
|
+ <!-- ========== 新增/编辑/详情 弹窗 ========== -->
|
|
|
<el-dialog :title="title" :visible.sync="open" width="1100px" append-to-body :close-on-click-modal="false">
|
|
<el-dialog :title="title" :visible.sync="open" width="1100px" append-to-body :close-on-click-modal="false">
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px" size="small">
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px" size="small">
|
|
|
<!-- 第一行:客户姓名、性别、年龄、电话 -->
|
|
<!-- 第一行:客户姓名、性别、年龄、电话 -->
|
|
@@ -250,7 +250,7 @@
|
|
|
<!-- 信息采集弹窗 -->
|
|
<!-- 信息采集弹窗 -->
|
|
|
<collection-info-dialog :visible.sync="collectionVisible" :id="currentId"/>
|
|
<collection-info-dialog :visible.sync="collectionVisible" :id="currentId"/>
|
|
|
|
|
|
|
|
- <!-- ========== 新增:独立的认领确认弹窗 ========== -->
|
|
|
|
|
|
|
+ <!-- ========== 独立的认领确认弹窗 ========== -->
|
|
|
<el-dialog title="认领客户" :visible.sync="claimDialogVisible" width="400px" append-to-body
|
|
<el-dialog title="认领客户" :visible.sync="claimDialogVisible" width="400px" append-to-body
|
|
|
:close-on-click-modal="false">
|
|
:close-on-click-modal="false">
|
|
|
<div>
|
|
<div>
|
|
@@ -371,7 +371,7 @@ export default {
|
|
|
collectionVisible: false,
|
|
collectionVisible: false,
|
|
|
// 详情弹窗只读模式
|
|
// 详情弹窗只读模式
|
|
|
isDetail: false,
|
|
isDetail: false,
|
|
|
- // 新增:独立认领弹窗相关
|
|
|
|
|
|
|
+ // 独立认领弹窗相关
|
|
|
claimDialogVisible: false,
|
|
claimDialogVisible: false,
|
|
|
claimSubmitLoading: false,
|
|
claimSubmitLoading: false,
|
|
|
currentClaimRow: null,
|
|
currentClaimRow: null,
|
|
@@ -424,23 +424,19 @@ export default {
|
|
|
this.handleQuery();
|
|
this.handleQuery();
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
- * 修改后的认领客户逻辑:打开独立的确认弹窗(不打开编辑弹窗)
|
|
|
|
|
- * 先校验客户是否已被认领,再校验当前用户是否有绑定的医生信息
|
|
|
|
|
|
|
+ * 认领客户:打开独立确认弹窗
|
|
|
*/
|
|
*/
|
|
|
handleClaim(row) {
|
|
handleClaim(row) {
|
|
|
- // 二次确认(虽然按钮已控制显示,但防止脚本调用)
|
|
|
|
|
if (row.companyUserId) {
|
|
if (row.companyUserId) {
|
|
|
this.$message.warning('该客户已被认领,无法重复认领');
|
|
this.$message.warning('该客户已被认领,无法重复认领');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- // 预检:当前用户是否绑定了医生(避免点击确认后才发现无法认领)
|
|
|
|
|
getCompanyUserAndDoctor().then(res => {
|
|
getCompanyUserAndDoctor().then(res => {
|
|
|
const userData = res.data;
|
|
const userData = res.data;
|
|
|
if (!userData || !userData.doctorId) {
|
|
if (!userData || !userData.doctorId) {
|
|
|
this.$modal.msgError("未找到绑定医生!请先绑定医生后再操作!");
|
|
this.$modal.msgError("未找到绑定医生!请先绑定医生后再操作!");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- // 通过预检,打开独立弹窗
|
|
|
|
|
this.currentClaimRow = row;
|
|
this.currentClaimRow = row;
|
|
|
this.claimDialogVisible = true;
|
|
this.claimDialogVisible = true;
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
@@ -448,16 +444,17 @@ export default {
|
|
|
this.$message.error("获取用户信息失败,无法认领");
|
|
this.$message.error("获取用户信息失败,无法认领");
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- /** 执行认领提交(独立弹窗的确认按钮) */
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 执行认领提交:成功后自动打开编辑弹窗(修改模式)
|
|
|
|
|
+ */
|
|
|
submitClaim() {
|
|
submitClaim() {
|
|
|
if (!this.currentClaimRow || !this.currentClaimRow.id) {
|
|
if (!this.currentClaimRow || !this.currentClaimRow.id) {
|
|
|
this.$message.error("客户信息异常,请刷新后重试");
|
|
this.$message.error("客户信息异常,请刷新后重试");
|
|
|
this.claimDialogVisible = false;
|
|
this.claimDialogVisible = false;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- // 避免重复提交
|
|
|
|
|
this.claimSubmitLoading = true;
|
|
this.claimSubmitLoading = true;
|
|
|
- // 重新获取最新的客服和医生信息(确保认领时数据准确)
|
|
|
|
|
|
|
+ // 获取最新的客服和医生信息
|
|
|
getCompanyUserAndDoctor().then(res => {
|
|
getCompanyUserAndDoctor().then(res => {
|
|
|
const userData = res.data;
|
|
const userData = res.data;
|
|
|
if (!userData || !userData.doctorId) {
|
|
if (!userData || !userData.doctorId) {
|
|
@@ -466,7 +463,6 @@ export default {
|
|
|
this.claimDialogVisible = false;
|
|
this.claimDialogVisible = false;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- // 构造认领参数:只需要客户ID、客服ID/姓名、医生ID/姓名
|
|
|
|
|
const claimParams = {
|
|
const claimParams = {
|
|
|
id: this.currentClaimRow.id,
|
|
id: this.currentClaimRow.id,
|
|
|
companyUserId: userData.companyUserId,
|
|
companyUserId: userData.companyUserId,
|
|
@@ -477,12 +473,24 @@ export default {
|
|
|
claimCustomer(claimParams).then(() => {
|
|
claimCustomer(claimParams).then(() => {
|
|
|
this.$message.success("认领成功");
|
|
this.$message.success("认领成功");
|
|
|
this.claimDialogVisible = false;
|
|
this.claimDialogVisible = false;
|
|
|
- // 刷新表格,显示最新认领状态
|
|
|
|
|
|
|
+ // 刷新列表(让表格显示最新状态)
|
|
|
this.getList();
|
|
this.getList();
|
|
|
|
|
+ // 打开编辑弹窗,让用户继续完善信息
|
|
|
|
|
+ return getCustomer(this.currentClaimRow.id);
|
|
|
|
|
+ }).then(response => {
|
|
|
|
|
+ // 重置表单状态(确保不是只读模式)
|
|
|
|
|
+ this.reset();
|
|
|
|
|
+ this.form = response.data;
|
|
|
|
|
+ if (this.form.sex !== undefined && this.form.sex !== null) {
|
|
|
|
|
+ this.form.sex = String(this.form.sex);
|
|
|
|
|
+ }
|
|
|
|
|
+ this.open = true;
|
|
|
|
|
+ this.title = "修改客户信息";
|
|
|
|
|
+ this.isDetail = false;
|
|
|
}).catch(error => {
|
|
}).catch(error => {
|
|
|
- console.error("认领失败", error);
|
|
|
|
|
- const msg = error?.message || error?.msg || "认领失败,请重试";
|
|
|
|
|
- this.$message.error(msg);
|
|
|
|
|
|
|
+ // 如果打开编辑弹窗失败(例如获取详情接口报错),仅提示,不影响认领成功的消息
|
|
|
|
|
+ console.error("获取客户详情失败", error);
|
|
|
|
|
+ this.$message.error("获取客户详情失败,请手动刷新后编辑");
|
|
|
}).finally(() => {
|
|
}).finally(() => {
|
|
|
this.claimSubmitLoading = false;
|
|
this.claimSubmitLoading = false;
|
|
|
});
|
|
});
|
|
@@ -500,19 +508,14 @@ export default {
|
|
|
this.open = false;
|
|
this.open = false;
|
|
|
this.reset();
|
|
this.reset();
|
|
|
},
|
|
},
|
|
|
- /**
|
|
|
|
|
- * 处理详情按钮点击
|
|
|
|
|
- */
|
|
|
|
|
handleDetail(row) {
|
|
handleDetail(row) {
|
|
|
this.reset();
|
|
this.reset();
|
|
|
const id = row.id;
|
|
const id = row.id;
|
|
|
getCustomer(id).then(response => {
|
|
getCustomer(id).then(response => {
|
|
|
this.form = response.data;
|
|
this.form = response.data;
|
|
|
- // 将数字类型的 sex 转换为字符串,以匹配 el-select 的 value
|
|
|
|
|
if (this.form.sex !== undefined && this.form.sex !== null) {
|
|
if (this.form.sex !== undefined && this.form.sex !== null) {
|
|
|
this.form.sex = String(this.form.sex);
|
|
this.form.sex = String(this.form.sex);
|
|
|
}
|
|
}
|
|
|
- // 设置为详情模式,开启只读
|
|
|
|
|
this.isDetail = true;
|
|
this.isDetail = true;
|
|
|
this.open = true;
|
|
this.open = true;
|
|
|
this.title = "客户详情";
|
|
this.title = "客户详情";
|
|
@@ -539,7 +542,6 @@ export default {
|
|
|
allergyHistory: null
|
|
allergyHistory: null
|
|
|
};
|
|
};
|
|
|
this.resetForm("form");
|
|
this.resetForm("form");
|
|
|
- // 重置详情模式(注意:不再包含 isClaim)
|
|
|
|
|
this.isDetail = false;
|
|
this.isDetail = false;
|
|
|
},
|
|
},
|
|
|
handleQuery() {
|
|
handleQuery() {
|
|
@@ -588,7 +590,6 @@ export default {
|
|
|
const valid = await this.$refs["form"].validate();
|
|
const valid = await this.$refs["form"].validate();
|
|
|
if (!valid) return;
|
|
if (!valid) return;
|
|
|
|
|
|
|
|
- // 普通新增或修改(不再包含认领分支)
|
|
|
|
|
if (this.form.id != null) {
|
|
if (this.form.id != null) {
|
|
|
await updateCustomer(this.form);
|
|
await updateCustomer(this.form);
|
|
|
this.$message.success("修改成功");
|
|
this.$message.success("修改成功");
|
|
@@ -642,7 +643,6 @@ export default {
|
|
|
}
|
|
}
|
|
|
return params;
|
|
return params;
|
|
|
},
|
|
},
|
|
|
- /** 打开处方弹窗 */
|
|
|
|
|
handlePrescribe(row) {
|
|
handlePrescribe(row) {
|
|
|
if (!row.phone) {
|
|
if (!row.phone) {
|
|
|
this.$message.warning('该客户未登记手机号,无法查询处方');
|
|
this.$message.warning('该客户未登记手机号,无法查询处方');
|
|
@@ -653,7 +653,6 @@ export default {
|
|
|
this.prescribeOpen = true;
|
|
this.prescribeOpen = true;
|
|
|
this.getPrescribeList();
|
|
this.getPrescribeList();
|
|
|
},
|
|
},
|
|
|
- /** 查询处方列表 */
|
|
|
|
|
getPrescribeList() {
|
|
getPrescribeList() {
|
|
|
this.prescribeLoading = true;
|
|
this.prescribeLoading = true;
|
|
|
const params = {
|
|
const params = {
|
|
@@ -669,7 +668,6 @@ export default {
|
|
|
this.prescribeLoading = false;
|
|
this.prescribeLoading = false;
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- /** 打开信息采集弹窗 */
|
|
|
|
|
handleCollection(row) {
|
|
handleCollection(row) {
|
|
|
if (!row.phone) {
|
|
if (!row.phone) {
|
|
|
this.$message.warning('该客户未登记手机号,无法查看信息采集表')
|
|
this.$message.warning('该客户未登记手机号,无法查看信息采集表')
|