/** * 补货员管理 API(运营平台端) */ import { get, post, put, del } from '@/utils/request'; export interface ReplenisherQuery { page: number; pageSize: number; keyword?: string; status?: number; } export interface ReplenisherForm { id?: string; name: string; phone?: string; employeeId?: string; status?: number; wechatOpenid?: string; } export interface ReplenisherListResponse { list: any[]; total: number; } /** * 分页查询补货员列表 */ export function getReplenisherList(params: ReplenisherQuery): Promise { return get('/replenishers/list', params); } /** * 获取补货员详情 */ export function getReplenisherById(id: string): Promise { return get(`/replenishers/${id}`); } /** * 新增补货员 */ export function createReplenisher(data: ReplenisherForm): Promise { return post('/replenishers', data); } /** * 更新补货员 */ export function updateReplenisher(id: string, data: Partial): Promise { return put(`/replenishers/${id}`, data); } /** * 切换补货员状态 */ export function updateReplenisherStatus(id: string, status: number): Promise { return put(`/replenishers/${id}/status`, { status }); } /** * 删除补货员 */ export function deleteReplenisher(id: string): Promise { return del(`/replenishers/${id}`); } /** * 获取补货员已绑定的设备列表 */ export function getBoundDevices(id: string): Promise { return get(`/replenishers/${id}/devices`); } /** * 绑定设备 */ export function bindDevices(id: string, deviceIds: string[]): Promise { return post(`/replenishers/${id}/devices`, { deviceIds }); } /** * 解绑设备 */ export function unbindDevice(replenisherId: string, deviceId: string): Promise { return del(`/replenishers/${replenisherId}/devices/${deviceId}`); } /** * 生成微信绑定码 */ export function generateBindingCode(id: string): Promise<{ bindingCode: string }> { return post(`/replenishers/${id}/binding-code`); }