feat: edit collaboration remarks across order loading
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
||||
approvePlatformUnifiedOrder,
|
||||
batchApprovePlatformUnifiedOrders,
|
||||
getPlatformUnifiedOrderBatchApprovalPreview,
|
||||
addPlatformUnifiedOrderNote,
|
||||
updatePlatformUnifiedOrderRemarks,
|
||||
getPlatformUnifiedOrder,
|
||||
downloadPlatformProductImage,
|
||||
listPlatformUnifiedOrders,
|
||||
@@ -172,10 +172,11 @@ describe('unified orders API contract', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('writes platform internal notes through the unified order boundary', async () => {
|
||||
vi.mocked(http.post).mockResolvedValue({ data: '91001' })
|
||||
await expect(addPlatformUnifiedOrderNote('208', '90001', '已确认船期')).resolves.toBe('91001')
|
||||
expect(http.post).toHaveBeenCalledWith('/platform/v1/orders/90001/internal-notes', { content: '已确认船期' }, { params: { tenantId: '208' } })
|
||||
it('updates the three editable remarks while keeping customer remark outside the request', async () => {
|
||||
const request = { expectedVersion: 7, internalRemark: '内部', warehouseRemark: '仓库', customerServiceRemark: '客服' }
|
||||
vi.mocked(http.put).mockResolvedValue({ data: { ...request, version: 8, customerRemark: '客户只读' } })
|
||||
await expect(updatePlatformUnifiedOrderRemarks('208', '90001', request)).resolves.toMatchObject({ version: 8 })
|
||||
expect(http.put).toHaveBeenCalledWith('/platform/v1/orders/90001/remarks', request, { params: { tenantId: '208' } })
|
||||
})
|
||||
|
||||
it('updates customer declaration fields through the versioned tenant-scoped contract', async () => {
|
||||
|
||||
@@ -160,6 +160,8 @@ export interface UnifiedOrderResource {
|
||||
customerRemark?: string | null
|
||||
latestInternalNote?: string | null
|
||||
internalRemark?: string | null
|
||||
warehouseRemark?: string | null
|
||||
customerServiceRemark?: string | null
|
||||
createdBy?: string | null
|
||||
}
|
||||
|
||||
@@ -599,10 +601,25 @@ export function batchApprovePlatformUnifiedOrders(tenantId: string, items: Unifi
|
||||
).then(unwrapApiResponse)
|
||||
}
|
||||
|
||||
export function addPlatformUnifiedOrderNote(tenantId: string, orderId: string, content: string) {
|
||||
return http.post<ApiEnvelope<number | string>, ApiEnvelope<number | string>>(
|
||||
`${unifiedOrdersApiPath}/${orderId}/internal-notes`,
|
||||
{ content },
|
||||
export interface UnifiedOrderRemarksUpdateRequest {
|
||||
expectedVersion: number
|
||||
internalRemark: string | null
|
||||
warehouseRemark: string | null
|
||||
customerServiceRemark: string | null
|
||||
}
|
||||
|
||||
export interface UnifiedOrderRemarksUpdateResponse {
|
||||
version: number
|
||||
customerRemark: string | null
|
||||
internalRemark: string | null
|
||||
warehouseRemark: string | null
|
||||
customerServiceRemark: string | null
|
||||
}
|
||||
|
||||
export function updatePlatformUnifiedOrderRemarks(tenantId: string, orderId: string, request: UnifiedOrderRemarksUpdateRequest) {
|
||||
return http.put<ApiEnvelope<UnifiedOrderRemarksUpdateResponse>, ApiEnvelope<UnifiedOrderRemarksUpdateResponse>>(
|
||||
`${unifiedOrdersApiPath}/${orderId}/remarks`,
|
||||
request,
|
||||
{ params: { tenantId } },
|
||||
).then(unwrapApiResponse)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user