c1d6ce6d20
抽屉副标题/5 国家草稿(ASIN+最低价)与变更差异(清空 ASIN→删除, 仅清价→
update)纯逻辑, 保存走 PUT/DELETE /api/admin/skip-price-asins/{id}/countries/{country},
10 个契约测试。
24 lines
925 B
TypeScript
24 lines
925 B
TypeScript
/** 最低价 ASIN 详情编辑抽屉保存适配(任务 77):PUT/DELETE /api/admin/skip-price-asins/{id}/countries/{country}。 */
|
|
import { http } from '@/api/http'
|
|
|
|
export const SKIP_PRICE_DETAIL_ENDPOINT = '/api/admin/skip-price-asins'
|
|
|
|
function countryUrl(id: number, country: string): string {
|
|
return `${SKIP_PRICE_DETAIL_ENDPOINT}/${id}/countries/${country}`
|
|
}
|
|
|
|
/** 保存某国家 ASIN 与最低价(body { asin, minimumPrice });返回后由列表刷新回读最新行。 */
|
|
export async function updateSkipPriceCountry(
|
|
id: number,
|
|
country: string,
|
|
asin: string,
|
|
minimumPrice: number | null,
|
|
): Promise<void> {
|
|
await http.put<unknown>(countryUrl(id, country), { asin, minimumPrice })
|
|
}
|
|
|
|
/** 删除某国家最低价 ASIN(清空该站点)。 */
|
|
export async function deleteSkipPriceCountry(id: number, country: string): Promise<void> {
|
|
await http.delete<unknown>(countryUrl(id, country))
|
|
}
|