优化
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
|
||||
|
||||
export type PriceBookStatus = 'PENDING_CONFIRMATION' | 'ACTIVE' | 'SUPERSEDED' | 'FAILED'
|
||||
export type PriceBookStatus = 'PENDING_CONFIRMATION' | 'ACTIVE' | 'SUPERSEDED' | 'VOIDED' | 'FAILED'
|
||||
export type PriceModel = 'FBA_WAREHOUSE_RATE' | 'REGION_WEIGHT_TIER'
|
||||
export type PricingTaxMode = 'TAX_INCLUDED' | 'TAX_EXCLUDED'
|
||||
export type PricingDestinationType = 'FBA' | 'OVERSEAS'
|
||||
@@ -27,6 +27,9 @@ export interface PlatformPriceBookVersion {
|
||||
publishedBy: string | null
|
||||
publishedAt: string | null
|
||||
supersededAt: string | null
|
||||
voidedBy: string | null
|
||||
voidedAt: string | null
|
||||
voidReason: string | null
|
||||
}
|
||||
|
||||
/** Read-only channel data parsed from the uploaded workbook. */
|
||||
@@ -102,7 +105,7 @@ export interface PlatformPriceBookQuery {
|
||||
}
|
||||
|
||||
interface PriceBookVersionPayload extends Omit<PlatformPriceBookVersion,
|
||||
'id' | 'customerId' | 'versionNo' | 'sourceFileId' | 'channelCount' | 'rateCount' | 'blockingErrorCount' | 'warningCount' | 'createdBy' | 'publishedBy'> {
|
||||
'id' | 'customerId' | 'versionNo' | 'sourceFileId' | 'channelCount' | 'rateCount' | 'blockingErrorCount' | 'warningCount' | 'createdBy' | 'publishedBy' | 'voidedBy'> {
|
||||
id: ApiId
|
||||
customerId: ApiId
|
||||
versionNo: ApiNumber
|
||||
@@ -113,6 +116,7 @@ interface PriceBookVersionPayload extends Omit<PlatformPriceBookVersion,
|
||||
warningCount?: ApiNumber | null
|
||||
createdBy?: ApiId | null
|
||||
publishedBy?: ApiId | null
|
||||
voidedBy?: ApiId | null
|
||||
}
|
||||
|
||||
interface PriceBookParsedChannelPayload extends Omit<PlatformPriceBookParsedChannel,
|
||||
@@ -181,6 +185,9 @@ function normalizeVersion(value: PriceBookVersionPayload): PlatformPriceBookVers
|
||||
publishedBy: nullableId(value.publishedBy),
|
||||
publishedAt: nullableText(value.publishedAt),
|
||||
supersededAt: nullableText(value.supersededAt),
|
||||
voidedBy: nullableId(value.voidedBy),
|
||||
voidedAt: nullableText(value.voidedAt),
|
||||
voidReason: nullableText(value.voidReason),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,6 +278,14 @@ export async function publishPlatformPriceBook(
|
||||
return normalizeDetail(unwrapApiResponse(response))
|
||||
}
|
||||
|
||||
export async function voidPlatformPriceBook(versionId: string, reason: string): Promise<PlatformPriceBookDetail> {
|
||||
const response = await http.post<ApiEnvelope<PriceBookDetailPayload>, ApiEnvelope<PriceBookDetailPayload>>(
|
||||
`${basePath}/${encodeURIComponent(versionId)}/void`,
|
||||
{ reason },
|
||||
)
|
||||
return normalizeDetail(unwrapApiResponse(response))
|
||||
}
|
||||
|
||||
export function downloadPlatformPriceBookSource(versionId: string) {
|
||||
return http.get<Blob, Blob>(`${basePath}/${encodeURIComponent(versionId)}/source`, { responseType: 'blob' })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user