feat: 更新医生创建团队的客户限制接口逻辑

This commit is contained in:
Jafeng 2026-02-11 16:48:26 +08:00
parent a6179e0624
commit 17fc85b5fb
2 changed files with 89 additions and 52 deletions

View File

@ -1355,35 +1355,70 @@ const toggleBatchMode = withInfo(() => {
selectedItems.value = []; selectedItems.value = [];
}); });
const handleCreate = withInfo(() => { const handleCreate = withInfo(async () => {
if (checkBatchMode()) return; if (checkBatchMode()) return;
const rawMax = doctorInfo.value?.maxCustomerArchive;
const hasMaxField = rawMax !== undefined && rawMax !== null && String(rawMax).trim() !== '';
const maxCustomerArchive = hasMaxField ? Number(rawMax) : NaN;
// maxCustomerArchive // 沿
// -1 = 沿10/100 // - 10toast
if (hasMaxField && Number.isFinite(maxCustomerArchive)) { // - 10
if (maxCustomerArchive !== -1 && managedArchiveCountAllTeams.value >= maxCustomerArchive) { // - 100
uni.showModal({ //
title: '提示', let total = null;
content: `当前管理档案数已达上限 ${maxCustomerArchive} 个,无法继续新增。如需提升档案管理数,请联系客服处理。`, let limit = null;
cancelText: '知道了', let unlimited = false;
confirmText: '添加客服', try {
const corpId = getCorpId();
const userId = getUserId();
if (corpId && userId) {
const res = await api('doctorCreatedTeamsCustomerLimitation', { corpId, userId }, false);
if (res?.success) {
const count = Number(res?.count ?? res?.data?.count);
if (Number.isFinite(count)) total = count;
const rawLimit = Number(res?.limit ?? res?.data?.limit);
if (Number.isFinite(rawLimit)) {
limit = rawLimit;
unlimited = rawLimit === -1;
}
}
}
} catch {
// ignore
}
if (!Number.isFinite(total)) {
total = Number(managedArchiveCountAllTeams.value || 0) || 0;
}
// 10/100
if (!Number.isFinite(limit)) {
limit = isVerified.value ? 100 : 10;
unlimited = false;
}
//
if (unlimited) {
uni.showActionSheet({
itemList: ['邀请患者建档', '我帮患者建档'],
success: (res) => { success: (res) => {
if (res.confirm) { if (res.tapIndex === 0) {
openAddCustomerServiceEntry(); openInvitePatientEntry();
} else if (res.tapIndex === 1) {
openCreatePatientEntry();
} }
} }
}); });
return; return;
} }
} else {
// 100 -> const limitText = Number.isFinite(limit) ? String(limit) : '';
if (managedArchiveCountAllTeams.value >= 100) {
// ->
if (isVerified.value && total >= limit) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '当前管理档案数已达 100 个,无法继续新增。如需提升档案管理数,请联系客服处理。', content: limitText
? `当前管理档案数已达上限 ${limitText} 个,无法继续新增。如需提升档案管理数,请联系客服处理。`
: '当前管理档案数已达上限,无法继续新增。如需提升档案管理数,请联系客服处理。',
cancelText: '知道了', cancelText: '知道了',
confirmText: '添加客服', confirmText: '添加客服',
success: (res) => { success: (res) => {
@ -1395,15 +1430,17 @@ const handleCreate = withInfo(() => {
return; return;
} }
// + 10 // / -> toast
if (!isVerified.value && managedArchiveCountAllTeams.value >= 10) { if (!isVerified.value && total >= limit) {
if (verifyStatus.value === 'verifying') { if (verifyStatus.value === 'verifying') {
toast('信息认证中,请耐心等待!'); toast('信息认证中,请耐心等待!');
return; return;
} }
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '当前管理档案数已达上限 10 个,完成认证即可升级至 100 个。', content: limitText
? `当前管理档案数已达上限 ${limitText} 个,完成认证可提升档案管理上限。`
: '当前管理档案数已达上限,完成认证可提升档案管理上限。',
cancelText: '暂不认证', cancelText: '暂不认证',
confirmText: '去认证', confirmText: '去认证',
success: (res) => { success: (res) => {
@ -1414,7 +1451,6 @@ const handleCreate = withInfo(() => {
}); });
return; return;
} }
}
// //
uni.showActionSheet({ uni.showActionSheet({

View File

@ -69,6 +69,7 @@ const urlsConfig = {
addCustomer: 'add', addCustomer: 'add',
updateCustomer: 'update', updateCustomer: 'update',
transferCustomers: 'transferCustomers', transferCustomers: 'transferCustomers',
doctorCreatedTeamsCustomerLimitation: 'doctorCreatedTeamsCustomerLimitation',
getGroups: 'getGroups', getGroups: 'getGroups',
createGroup: 'createGroup', createGroup: 'createGroup',
updateGroup: 'updateGroup', updateGroup: 'updateGroup',