更新商品风险处理
This commit is contained in:
12
frontend-vue/product-risk.html
Normal file
12
frontend-vue/product-risk.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>商品风险解决 - 数富AI</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/product-risk-main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
1487
frontend-vue/src/pages/brand/components/BrandProductRiskTab.vue
Normal file
1487
frontend-vue/src/pages/brand/components/BrandProductRiskTab.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -38,7 +38,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
active: 'brand' | 'dedupe' | 'convert' | 'split' | 'delete-brand'
|
||||
active: 'brand' | 'dedupe' | 'convert' | 'split' | 'delete-brand' | 'product-risk'
|
||||
}>()
|
||||
|
||||
const active = props.active
|
||||
@@ -57,6 +57,7 @@ const navGroups = [
|
||||
label: '运营工具',
|
||||
items: [
|
||||
{ key: 'delete-brand', label: '删除指定ASIN和品牌', href: '/new_web_source/delete-brand.html' },
|
||||
{ key: 'product-risk', label: '商品风险解决', href: '/new_web_source/product-risk.html' },
|
||||
],
|
||||
},
|
||||
] as const
|
||||
|
||||
7
frontend-vue/src/product-risk-main.ts
Normal file
7
frontend-vue/src/product-risk-main.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { createApp } from 'vue'
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import '@/styles/main.css'
|
||||
import BrandProductRiskTab from '@/pages/brand/components/BrandProductRiskTab.vue'
|
||||
|
||||
createApp(BrandProductRiskTab).use(ElementPlus).mount('#app')
|
||||
@@ -1,4 +1,4 @@
|
||||
import { del, get, http, post, type JavaApiResponse, unwrapJavaResponse } from '@/shared/api/http'
|
||||
import { del, get, http, post, put, type JavaApiResponse, unwrapJavaResponse } from '@/shared/api/http'
|
||||
|
||||
const JAVA_API_PREFIX = '/newApi/api'
|
||||
|
||||
@@ -398,6 +398,206 @@ export function submitDeleteBrandResult(taskId: number, request: DeleteBrandSubm
|
||||
return unwrapJavaResponse(post<JavaApiResponse<null>, DeleteBrandSubmitResultRequest>(`${JAVA_API_PREFIX}/delete-brand/tasks/${taskId}/result`, request))
|
||||
}
|
||||
|
||||
/** 商品风险解决:备选店铺与匹配(推队列由前端 pywebview 完成) */
|
||||
export interface ProductRiskCandidateVo {
|
||||
id: number
|
||||
shop_name: string
|
||||
created_at?: string
|
||||
}
|
||||
|
||||
export interface ProductRiskShopQueueItem {
|
||||
shopName: string
|
||||
matched: boolean
|
||||
shopId?: string
|
||||
platform?: string
|
||||
companyName?: string
|
||||
openStoreUrl?: string
|
||||
matchedUserId?: number
|
||||
matchStatus?: string
|
||||
matchMessage?: string
|
||||
}
|
||||
|
||||
export interface ProductRiskMatchShopsVo {
|
||||
items: ProductRiskShopQueueItem[]
|
||||
}
|
||||
|
||||
export function listProductRiskCandidates() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<ProductRiskCandidateVo[]>>(`${JAVA_API_PREFIX}/product-risk-resolve/candidates`, {
|
||||
params: { user_id: getCurrentUserId() },
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
export function addProductRiskCandidate(shopName: string) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<ProductRiskCandidateVo>, { user_id: number; shop_name: string }>(
|
||||
`${JAVA_API_PREFIX}/product-risk-resolve/candidates`,
|
||||
{ user_id: getCurrentUserId(), shop_name: shopName },
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
export function deleteProductRiskCandidate(id: number) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/product-risk-resolve/candidates/${id}`, {
|
||||
params: { user_id: getCurrentUserId() },
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
export interface ProductRiskCountryPreferenceVo {
|
||||
country_codes: string[]
|
||||
}
|
||||
|
||||
export function getProductRiskCountryPreference() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<ProductRiskCountryPreferenceVo>>(`${JAVA_API_PREFIX}/product-risk-resolve/country-preference`, {
|
||||
params: { user_id: getCurrentUserId() },
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
export function putProductRiskCountryPreference(countryCodes: string[]) {
|
||||
return unwrapJavaResponse(
|
||||
put<
|
||||
JavaApiResponse<ProductRiskCountryPreferenceVo>,
|
||||
{ user_id: number; country_codes: string[] }
|
||||
>(`${JAVA_API_PREFIX}/product-risk-resolve/country-preference`, {
|
||||
user_id: getCurrentUserId(),
|
||||
country_codes: countryCodes,
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
export function matchProductRiskShops(shopNames: string[]) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<ProductRiskMatchShopsVo>, { user_id: number; shop_names: string[] }>(
|
||||
`${JAVA_API_PREFIX}/product-risk-resolve/match-shops`,
|
||||
{ user_id: getCurrentUserId(), shop_names: shopNames },
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
export interface ProductRiskDashboardVo {
|
||||
candidateCount: number
|
||||
processedTaskCount: number
|
||||
successTaskCount: number
|
||||
failedTaskCount: number
|
||||
}
|
||||
|
||||
export interface ProductRiskHistoryItem {
|
||||
resultId?: number
|
||||
taskId?: number
|
||||
shopName?: string
|
||||
shopId?: string
|
||||
platform?: string
|
||||
companyName?: string
|
||||
matched?: boolean
|
||||
matchStatus?: string
|
||||
matchMessage?: string
|
||||
taskStatus?: string
|
||||
success?: boolean
|
||||
error?: string
|
||||
outputFilename?: string
|
||||
downloadUrl?: string
|
||||
}
|
||||
|
||||
export interface ProductRiskHistoryVo {
|
||||
items: ProductRiskHistoryItem[]
|
||||
}
|
||||
|
||||
export interface ProductRiskTaskSummary {
|
||||
id?: number
|
||||
taskNo?: string
|
||||
status?: string
|
||||
errorMessage?: string
|
||||
createdAt?: string
|
||||
updatedAt?: string
|
||||
finishedAt?: string
|
||||
}
|
||||
|
||||
export interface ProductRiskTaskDetailVo {
|
||||
task?: ProductRiskTaskSummary
|
||||
items?: ProductRiskHistoryItem[]
|
||||
}
|
||||
|
||||
export interface ProductRiskTaskBatchVo {
|
||||
items: ProductRiskTaskDetailVo[]
|
||||
missingTaskIds?: number[]
|
||||
}
|
||||
|
||||
export interface ProductRiskPendingDeleteVo {
|
||||
removed: boolean
|
||||
}
|
||||
|
||||
export interface ProductRiskCreateTaskVo {
|
||||
taskId: number
|
||||
items: ProductRiskHistoryItem[]
|
||||
}
|
||||
|
||||
export function getProductRiskDashboard() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<ProductRiskDashboardVo>>(`${JAVA_API_PREFIX}/product-risk-resolve/dashboard`, {
|
||||
params: { user_id: getCurrentUserId() },
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
export function getProductRiskHistory() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<ProductRiskHistoryVo>>(`${JAVA_API_PREFIX}/product-risk-resolve/history`, {
|
||||
params: { user_id: getCurrentUserId() },
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
export function deleteProductRiskHistory(resultId: number) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/product-risk-resolve/history/${resultId}`, {
|
||||
params: { user_id: getCurrentUserId() },
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
export function createProductRiskTask(items: ProductRiskShopQueueItem[]) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<ProductRiskCreateTaskVo>, { user_id: number; items: ProductRiskShopQueueItem[] }>(
|
||||
`${JAVA_API_PREFIX}/product-risk-resolve/tasks`,
|
||||
{ user_id: getCurrentUserId(), items },
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
export function deleteProductRiskTask(taskId: number) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/product-risk-resolve/tasks/${taskId}`, {
|
||||
params: { user_id: getCurrentUserId() },
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
export function deletePendingProductRiskShopResult(shopName: string) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<ProductRiskPendingDeleteVo>>(`${JAVA_API_PREFIX}/product-risk-resolve/pending-shop-result`, {
|
||||
params: { user_id: getCurrentUserId(), shop_name: shopName },
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
export function getProductRiskTasksBatch(taskIds: number[]) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<ProductRiskTaskBatchVo>, { taskIds: number[] }>(
|
||||
`${JAVA_API_PREFIX}/product-risk-resolve/tasks/batch`,
|
||||
{ taskIds },
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
export function getProductRiskResultDownloadUrl(resultId: number) {
|
||||
return getJavaDownloadUrl(`/product-risk-resolve/results/${resultId}/download`)
|
||||
}
|
||||
|
||||
export function getJavaDownloadUrl(path: string) {
|
||||
let raw = path.startsWith('http://') || path.startsWith('https://') ? path : `${JAVA_API_PREFIX}${path}`
|
||||
// 核心修复:pywebview 的 save_file_from_url 需要完整带 schema 的 URL
|
||||
|
||||
@@ -46,6 +46,7 @@ export default defineConfig({
|
||||
convert: resolve(__dirname, 'convert.html'),
|
||||
split: resolve(__dirname, 'split.html'),
|
||||
'delete-brand': resolve(__dirname, 'delete-brand.html'),
|
||||
'product-risk': resolve(__dirname, 'product-risk.html'),
|
||||
},
|
||||
output: {
|
||||
entryFileNames: 'assets/[name].js',
|
||||
|
||||
Reference in New Issue
Block a user