feat: Enhance pricing and sales API with free goods and discount scheme support
This commit is contained in:
@@ -4,6 +4,7 @@ import type {
|
||||
PriceResolution,
|
||||
SchemeResponse,
|
||||
SchemeRuleType,
|
||||
SchemeSuggestion,
|
||||
} from '@/types/api'
|
||||
|
||||
// ─── Price Lists ──────────────────────────────────────────────────────────────
|
||||
@@ -89,4 +90,17 @@ export const schemes = {
|
||||
|
||||
remove: (id: string) =>
|
||||
api.delete(`/schemes/${id}`),
|
||||
|
||||
setFreeGoodsRule: (id: string, body: { triggerItemId?: string | null; triggerQty?: number | null; freeItemId: string; freeQty: number }) =>
|
||||
api.put<SchemeResponse>(`/schemes/${id}/free-goods-rule`, body).then(r => r.data),
|
||||
|
||||
upsertBundleComponent: (id: string, itemId: string, qty: number) =>
|
||||
api.put<SchemeResponse>(`/schemes/${id}/bundle-components/${itemId}`, { qty }).then(r => r.data),
|
||||
|
||||
removeBundleComponent: (id: string, itemId: string) =>
|
||||
api.delete<SchemeResponse>(`/schemes/${id}/bundle-components/${itemId}`).then(r => r.data),
|
||||
|
||||
/** Schemes the lines of a not-yet-saved Shop PO qualify for (or are close to). */
|
||||
suggest: (body: { storeId: string; items: { itemId: string; quantity: number; unitPrice?: number | null }[] }) =>
|
||||
api.post<SchemeSuggestion[]>('/schemes/suggest', body).then(r => r.data),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user