Files
shanxia2.0/miniprogram/api/bx.js
T
wuzilongandCursor 2ff754d572 feat(miniprogram): migrate advance apply list/form/detail from bx-mobile.
Reuse /advances APIs with bx envelope and Fresh Mint list/form styling.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 23:20:54 +08:00

39 lines
1.5 KiB
JavaScript

import { bxRequest, bxUploadFile } from '@/utils/bxRequest'
export const advanceApi = {
my: (params) => bxRequest({ url: '/advances/my', method: 'GET', params }),
getById: (id) => bxRequest({ url: `/advances/${id}`, method: 'GET' }),
getApprovals: (id) => bxRequest({ url: `/advances/${id}/approvals`, method: 'GET' }),
getApprovalHistory: (id) => bxRequest({ url: `/advances/${id}/approval-history`, method: 'GET' }),
create: (data) => bxRequest({ url: '/advances/', method: 'POST', data }),
update: (id, data) => bxRequest({ url: `/advances/${id}`, method: 'PUT', data }),
submit: (id) => bxRequest({ url: `/advances/${id}/submit`, method: 'POST' }),
delete: (id) => bxRequest({ url: `/advances/${id}`, method: 'DELETE' })
}
/** 附件:Batch2 申请页图片上传所需最小集合 */
export const attachmentApi = {
upload: (filePath, bizType = '', bizId = 0) =>
bxUploadFile(filePath, { bizType, bizId }),
listByBiz: (bizType, bizId) =>
bxRequest({
url: '/attachments/list',
method: 'GET',
params: { biz_type: bizType, biz_id: bizId }
}),
preview: (id) => bxRequest({ url: `/attachments/preview/${id}`, method: 'GET' }),
delete: (id) => bxRequest({ url: `/attachments/${id}`, method: 'DELETE' }),
bindBiz: (ids, bizType, bizId) =>
bxRequest({
url: '/attachments/bind-biz',
method: 'PUT',
params: {
ids: (ids || []).join(','),
biz_type: bizType,
biz_id: bizId
}
})
}
export default { advanceApi, attachmentApi }