feat(admin): 最低价ASIN列表操作列新增整条删除按钮——后端DELETE /skip-price-asins/{id}(权限校验+日志),前端确认弹窗+删空页回退,补单测与对齐测试
This commit is contained in:
@@ -8,7 +8,7 @@ import { createSkipPriceAsin, fetchSkipPriceList } from './skip-price-api.ts'
|
||||
import { skipPriceDisplayRows, type SkipPriceItem } from './skip-price-model.ts'
|
||||
import { asinCountryLabel } from './asin-country.ts'
|
||||
import { createSkipPriceFilterState, toSkipPriceParams, type SkipPriceFilterState } from './skip-price-filter.ts'
|
||||
import { deleteSkipPriceCountry, updateSkipPriceCountry } from './skip-price-detail-api.ts'
|
||||
import { deleteSkipPriceAsin, deleteSkipPriceCountry, updateSkipPriceCountry } from './skip-price-detail-api.ts'
|
||||
import { fetchSkipPriceDeleteImportProgress, fetchSkipPriceImportProgress, startSkipPriceDeleteImport, startSkipPriceImport } from './skip-price-import-api.ts'
|
||||
import { isAllowedExcelImportFile } from './import-progress-model.ts'
|
||||
import { fetchShopNamesByGroup } from './query-asin-api.ts'
|
||||
@@ -204,6 +204,30 @@ async function saveConfig(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 整条删除 ----
|
||||
async function removeRow(item: SkipPriceItem): Promise<void> {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定删除「${item.shopName}」${item.groupName ? `(${item.groupName})` : ''}全部站点的最低价 ASIN 配置吗?`,
|
||||
'删除确认',
|
||||
{ type: 'warning', confirmButtonText: '删除', cancelButtonText: '取消' },
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await deleteSkipPriceAsin(item.id)
|
||||
ElMessage.success('删除成功')
|
||||
// 删除后当前页若已空且非首页,回退一页避免展示空页。
|
||||
if (rows.value.length === 1 && page.value > 1) {
|
||||
page.value -= 1
|
||||
}
|
||||
await load()
|
||||
} catch (error) {
|
||||
ElMessage.error(error instanceof Error ? error.message : '删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 导入添加 / 删除导入(group_id 必填) ----
|
||||
type ImportMode = 'add' | 'delete'
|
||||
const importVisible = ref(false)
|
||||
@@ -433,6 +457,7 @@ onMounted(() => {
|
||||
<template v-if="row.isFirst">
|
||||
<td :rowspan="row.rowspan" class="asin-col-actions">
|
||||
<button class="btn btn-sm" type="button" @click="openConfig(row.item as SkipPriceItem)">配置</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" @click="removeRow(row.item as SkipPriceItem)">删除</button>
|
||||
</td>
|
||||
</template>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user