Files
xk-doctor-wx/api/salesperson.js
2026-08-12 08:57:35 +08:00

56 lines
2.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { req } from '@/common/js/index.js';
import { salespersonApi } from '@/api/businessApi.js';
import { unwrapClinicRes } from '@/api/clinicAdmin.js';
export const getSalespersonMyInfo = salespersonApi.getMyInfo.bind(salespersonApi);
export const getSalespersonInputStats = salespersonApi.getInputStats.bind(salespersonApi);
/**
* 业务员工作台专属请求助手(带 _salesperson 头 + 统一 { res, data, ok } 返回)
* 单独封装(不进 createBusinessApidashboard 系列接口仅业务员端有此路由
*/
function salespersonDashboardRequest(options) {
return req.request({
...options,
header: { ...(options.header || {}), _salesperson: '1' },
}).then((res) => {
const data = unwrapClinicRes(res);
const ok = !!(res && Number(res.code) === 0);
return { res, data, ok };
});
}
/**
* 业务员工作台功能入口下发(后台按角色分配的宫格入口,替代前端硬编码)
* xk-api GET /salesperson-dashboard/entries
*/
export function getSalespersonWorkbenchEntries() {
return salespersonDashboardRequest({ url: '/newApi/salesperson-dashboard/entries', method: 'GET' });
}
/**
* 功能页用户数据:我的常用 + 最近使用
* xk-api GET /salesperson-dashboard/entry-user-data
*/
export function getSalespersonEntryUserData() {
return salespersonDashboardRequest({ url: '/newApi/salesperson-dashboard/entry-user-data', method: 'GET' });
}
/**
* 收藏/取消收藏功能入口(功能页长按触发),返回 { is_favorite }
* xk-api POST /salesperson-dashboard/toggle-favorite-entry
*/
export function toggleSalespersonFavoriteEntry(code) {
return salespersonDashboardRequest({ url: '/newApi/salesperson-dashboard/toggle-favorite-entry', method: 'POST', data: { code } });
}
/**
* 上报功能入口使用(点击跳转时静默调用,调用方无需处理失败)
* xk-api POST /salesperson-dashboard/report-entry-usage
*/
export function reportSalespersonEntryUsage(code) {
return salespersonDashboardRequest({ url: '/newApi/salesperson-dashboard/report-entry-usage', method: 'POST', data: { code } });
}
export default salespersonApi;