提交
This commit is contained in:
1 parent
c87732fcd5
commit
058811ae77
107 files changed
+16983
-12758
No files matched your search
+171
-422
@@ -1,8 +1,87 @@
|
||||
import request from '@/utils/http'
|
||||
import type { AppRouteRecord } from '@/types/router'
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 后端菜单 / 角色(与 router 后端模式、用户弹窗对齐)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/** 后端菜单模式:拉取动态路由 */
|
||||
export async function fetchGetMenuList() {
|
||||
const res = await request.get<AppRouteRecord[] | { menuList?: AppRouteRecord[] }>({
|
||||
url: '/web/menu/list'
|
||||
})
|
||||
if (Array.isArray(res)) return res
|
||||
return res?.menuList || []
|
||||
}
|
||||
|
||||
/** 用户表单等:角色下拉 */
|
||||
export function fetchGetRoleList() {
|
||||
return request.get<Array<{ label: string; value: string }>>({
|
||||
url: '/web/admin/roles'
|
||||
})
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 租户(系统管理)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function fetchTenantList(params?: { page?: number; pageSize?: number; keyword?: string }) {
|
||||
return request.get<{
|
||||
list: Api.Tenant.TenantItem[]
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
totalPages: number
|
||||
}>({
|
||||
url: '/web/admin/tenants',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchCreateTenant(data: {
|
||||
tenantNo: string
|
||||
tenantName: string
|
||||
contactName?: string
|
||||
contactPhone?: string
|
||||
orderNum?: number
|
||||
remark?: string
|
||||
}) {
|
||||
return request.post<Api.Tenant.TenantItem>({
|
||||
url: '/web/admin/tenants',
|
||||
data,
|
||||
showSuccessMessage: true
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchUpdateTenant(
|
||||
id: string,
|
||||
data: Partial<{
|
||||
tenantNo: string
|
||||
tenantName: string
|
||||
contactName: string
|
||||
contactPhone: string
|
||||
orderNum: number
|
||||
remark: string
|
||||
}>
|
||||
) {
|
||||
return request.put<Api.Tenant.TenantItem>({
|
||||
url: `/web/admin/tenants/${id}`,
|
||||
data,
|
||||
showSuccessMessage: true
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchDeleteTenant(id: string) {
|
||||
return request.del({
|
||||
url: `/web/admin/tenants/${id}`,
|
||||
showSuccessMessage: true
|
||||
})
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 用户
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
export function fetchUserList(params: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
@@ -24,18 +103,12 @@ export function fetchUserList(params: {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户详情
|
||||
*/
|
||||
export function fetchUserDetail(id: string) {
|
||||
return request.get<Api.User.UserDetail>({
|
||||
url: `/web/admin/users/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
*/
|
||||
export function fetchCreateUser(data: {
|
||||
username: string
|
||||
password: string
|
||||
@@ -52,27 +125,24 @@ export function fetchCreateUser(data: {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
*/
|
||||
export function fetchUpdateUser(id: string, data: Partial<{
|
||||
realName: string
|
||||
phone?: string
|
||||
role: string
|
||||
regionId?: string
|
||||
regionIds?: string[]
|
||||
isActive: boolean
|
||||
avatarUrl?: string | null
|
||||
}>) {
|
||||
export function fetchUpdateUser(
|
||||
id: string,
|
||||
data: Partial<{
|
||||
realName: string
|
||||
phone?: string
|
||||
role: string
|
||||
regionId?: string
|
||||
regionIds?: string[]
|
||||
isActive: boolean
|
||||
avatarUrl?: string | null
|
||||
}>
|
||||
) {
|
||||
return request.put({
|
||||
url: `/web/admin/users/${id}`,
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 可授权菜单 code 列表
|
||||
*/
|
||||
export function fetchAssignableMenuCodes() {
|
||||
return request.get<{
|
||||
list: Array<{
|
||||
@@ -87,9 +157,6 @@ export function fetchAssignableMenuCodes() {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户菜单授权
|
||||
*/
|
||||
export function fetchUserMenuScopes(userId: string) {
|
||||
return request.get<{
|
||||
userId: string
|
||||
@@ -99,9 +166,6 @@ export function fetchUserMenuScopes(userId: string) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户菜单授权(全量覆盖)
|
||||
*/
|
||||
export function fetchUpdateUserMenuScopes(userId: string, menuCodes: string[]) {
|
||||
return request.post({
|
||||
url: `/web/admin/users/${userId}/menu-scopes`,
|
||||
@@ -109,41 +173,31 @@ export function fetchUpdateUserMenuScopes(userId: string, menuCodes: string[]) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
export function fetchDeleteUser(id: string) {
|
||||
return request.del({
|
||||
url: `/web/admin/users/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*/
|
||||
export function fetchResetPassword(id: string) {
|
||||
return request.post({
|
||||
url: `/web/admin/users/${id}/reset-password`
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户密码
|
||||
*/
|
||||
export function fetchChangePassword(data: {
|
||||
oldPassword: string
|
||||
newPassword: string
|
||||
}) {
|
||||
return request.post({
|
||||
url: '/web/admin/users/change-password',
|
||||
params: data
|
||||
/** 上传用户头像,返回存储后的 URL,供写入 avatarUrl */
|
||||
export function fetchUploadUserAvatar(data: FormData) {
|
||||
return request.post<{ url: string }>({
|
||||
url: '/web/admin/users/upload-avatar',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取区域列表
|
||||
*/
|
||||
export function fetchRegionList(params?: {
|
||||
// ---------------------------------------------------------------------------
|
||||
// 区域(仅列表分页供 fetchNotDeletedRegions 使用 + 启用列表)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function fetchRegionList(params?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
keyword?: string
|
||||
@@ -161,36 +215,29 @@ export function fetchRegionList(params?: {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取启用的区域列表
|
||||
*/
|
||||
export function fetchActiveRegions() {
|
||||
// 简单缓存:区域列表变化频率低,避免页面间重复请求导致“区域加载慢”
|
||||
// 5 分钟 TTL;需要实时刷新时可在调用方自行绕过(后续可升级为 Pinia store)
|
||||
const now = Date.now()
|
||||
const anyFn = fetchActiveRegions as any
|
||||
const cache = anyFn.__cache as undefined | { ts: number; data: Api.Region.RegionItem[] }
|
||||
if (cache && now - cache.ts < 5 * 60 * 1000) return Promise.resolve(cache.data)
|
||||
|
||||
return request.get<Api.Region.RegionItem[]>({
|
||||
url: '/web/admin/regions/active'
|
||||
}).then((data) => {
|
||||
anyFn.__cache = { ts: now, data: data || [] }
|
||||
return data
|
||||
})
|
||||
return request
|
||||
.get<Api.Region.RegionItem[]>({
|
||||
url: '/web/admin/regions/active'
|
||||
})
|
||||
.then((data) => {
|
||||
anyFn.__cache = { ts: now, data: data || [] }
|
||||
return data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有未删除的区域(包含禁用态 isActive=0)
|
||||
* 用于后台各模块“区域 tab”展示全量范围。
|
||||
*/
|
||||
/** 未删除的全量区域(含禁用),供各页区域 Tab */
|
||||
export async function fetchNotDeletedRegions() {
|
||||
const now = Date.now()
|
||||
const anyFn = fetchNotDeletedRegions as any
|
||||
const cache = anyFn.__cache as undefined | { ts: number; data: Api.Region.RegionItem[] }
|
||||
if (cache && now - cache.ts < 5 * 60 * 1000) return cache.data
|
||||
|
||||
// 注意:后端 `GET /web/admin/regions` 的 pageSize 有上限(<=100),不能一次性拉太大。
|
||||
const pageSize = 100
|
||||
const all: Api.Region.RegionItem[] = []
|
||||
let page = 1
|
||||
@@ -201,7 +248,6 @@ export async function fetchNotDeletedRegions() {
|
||||
all.push(...list)
|
||||
|
||||
const total = Number(res?.total ?? 0)
|
||||
// 没有更多数据:直接退出(避免死循环)
|
||||
if (!total || all.length >= total || list.length < pageSize) break
|
||||
page++
|
||||
}
|
||||
@@ -210,64 +256,10 @@ export async function fetchNotDeletedRegions() {
|
||||
return all
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取区域详情
|
||||
*/
|
||||
export function fetchRegionDetail(id: string) {
|
||||
return request.get<Api.Region.RegionDetail>({
|
||||
url: `/web/admin/regions/${id}`
|
||||
})
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
// 商品分类
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 创建区域
|
||||
*/
|
||||
export function fetchCreateRegion(data: {
|
||||
name: string
|
||||
code: string
|
||||
description?: string
|
||||
sortOrder?: number
|
||||
/** 预计配送时长(分钟) */
|
||||
expectedDeliveryMinutes?: number | null
|
||||
/** 计划到货前未送达时预警提前时间(分钟) */
|
||||
deliveryWarnAdvanceMinutes?: number | null
|
||||
}) {
|
||||
return request.post({
|
||||
url: '/web/admin/regions',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新区域
|
||||
*/
|
||||
export function fetchUpdateRegion(id: string, data: Partial<{
|
||||
name: string
|
||||
code: string
|
||||
description?: string
|
||||
sortOrder?: number
|
||||
isActive?: boolean
|
||||
expectedDeliveryMinutes?: number | null
|
||||
deliveryWarnAdvanceMinutes?: number | null
|
||||
}>) {
|
||||
return request.put({
|
||||
url: `/web/admin/regions/${id}`,
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除区域
|
||||
*/
|
||||
export function fetchDeleteRegion(id: string) {
|
||||
return request.del({
|
||||
url: `/web/admin/regions/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品分类列表
|
||||
*/
|
||||
export function fetchCategoryList(params?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
@@ -286,24 +278,11 @@ export function fetchCategoryList(params?: {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品分类树
|
||||
*/
|
||||
export function fetchCategoryTree() {
|
||||
return request.get<any[]>({
|
||||
url: '/web/admin/categories/tree'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建商品分类
|
||||
*/
|
||||
export function fetchCreateCategory(data: {
|
||||
name: string
|
||||
parentId?: string
|
||||
sortOrder?: number
|
||||
imageUrl?: string
|
||||
/** 价格系数,百分比点数(如 5 表示 5%) */
|
||||
priceCoefficient?: number
|
||||
}) {
|
||||
return request.post({
|
||||
@@ -312,35 +291,29 @@ export function fetchCreateCategory(data: {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品分类
|
||||
*/
|
||||
export function fetchUpdateCategory(id: string, data: Partial<{
|
||||
name: string
|
||||
parentId?: string
|
||||
sortOrder?: number
|
||||
isActive?: boolean
|
||||
imageUrl?: string
|
||||
priceCoefficient?: number
|
||||
}>) {
|
||||
export function fetchUpdateCategory(
|
||||
id: string,
|
||||
data: Partial<{
|
||||
name: string
|
||||
parentId?: string
|
||||
sortOrder?: number
|
||||
isActive?: boolean
|
||||
imageUrl?: string
|
||||
priceCoefficient?: number
|
||||
}>
|
||||
) {
|
||||
return request.put({
|
||||
url: `/web/admin/categories/${id}`,
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品分类
|
||||
*/
|
||||
export function fetchDeleteCategory(id: string) {
|
||||
return request.del({
|
||||
url: `/web/admin/categories/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传商品分类图片(MinIO)并返回图片URL
|
||||
*/
|
||||
export function fetchUploadCategoryImage(data: FormData) {
|
||||
return request.post({
|
||||
url: '/web/admin/categories/upload-image',
|
||||
@@ -348,17 +321,10 @@ export function fetchUploadCategoryImage(data: FormData) {
|
||||
})
|
||||
}
|
||||
|
||||
/** 上传用户头像,返回 MinIO 等存储后的 URL,供写入 avatarUrl */
|
||||
export function fetchUploadUserAvatar(data: FormData) {
|
||||
return request.post<{ url: string }>({
|
||||
url: '/web/admin/users/upload-avatar',
|
||||
data
|
||||
})
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
// 商品单位
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 获取商品单位列表
|
||||
*/
|
||||
export function fetchUnitList(params?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
@@ -377,45 +343,37 @@ export function fetchUnitList(params?: {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建商品单位
|
||||
*/
|
||||
export function fetchCreateUnit(data: {
|
||||
name: string
|
||||
code: string
|
||||
}) {
|
||||
export function fetchCreateUnit(data: { name: string; code: string }) {
|
||||
return request.post({
|
||||
url: '/web/admin/units',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品单位
|
||||
*/
|
||||
export function fetchUpdateUnit(id: string, data: Partial<{
|
||||
name: string
|
||||
code: string
|
||||
isActive?: boolean
|
||||
}>) {
|
||||
export function fetchUpdateUnit(
|
||||
id: string,
|
||||
data: Partial<{
|
||||
name: string
|
||||
code: string
|
||||
isActive?: boolean
|
||||
}>
|
||||
) {
|
||||
return request.put({
|
||||
url: `/web/admin/units/${id}`,
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品单位
|
||||
*/
|
||||
export function fetchDeleteUnit(id: string) {
|
||||
return request.del({
|
||||
url: `/web/admin/units/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品列表
|
||||
*/
|
||||
// ---------------------------------------------------------------------------
|
||||
// 商品
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function fetchProductList(params?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
@@ -435,18 +393,12 @@ export function fetchProductList(params?: {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品详情
|
||||
*/
|
||||
export function fetchProductDetail(id: string) {
|
||||
return request.get<Api.Product.ProductDetail>({
|
||||
url: `/web/admin/products/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品在各启用区域的当前生效价(来自该区域生效中的价格清单)
|
||||
*/
|
||||
export function fetchProductRegionPrices(productId: string) {
|
||||
return request.get<{
|
||||
list: Array<{
|
||||
@@ -461,9 +413,6 @@ export function fetchProductRegionPrices(productId: string) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建商品
|
||||
*/
|
||||
export function fetchCreateProduct(data: {
|
||||
name: string
|
||||
skuCode?: string
|
||||
@@ -472,7 +421,6 @@ export function fetchCreateProduct(data: {
|
||||
measureValue?: number | null
|
||||
description?: string
|
||||
imageUrl?: string
|
||||
/** 调价系数(%):百分比点数,5 表示 5% */
|
||||
priceCoefficient?: number
|
||||
isActive?: boolean
|
||||
detailContent?: string
|
||||
@@ -483,41 +431,35 @@ export function fetchCreateProduct(data: {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品
|
||||
*/
|
||||
export function fetchUpdateProduct(id: string, data: Partial<{
|
||||
name: string
|
||||
skuCode?: string
|
||||
categoryId?: string
|
||||
unitId?: string
|
||||
measureValue?: number | null
|
||||
description?: string
|
||||
imageUrl?: string
|
||||
priceCoefficient?: number
|
||||
isActive?: boolean
|
||||
detailContent?: string
|
||||
}>) {
|
||||
export function fetchUpdateProduct(
|
||||
id: string,
|
||||
data: Partial<{
|
||||
name: string
|
||||
skuCode?: string
|
||||
categoryId?: string
|
||||
unitId?: string
|
||||
measureValue?: number | null
|
||||
description?: string
|
||||
imageUrl?: string
|
||||
priceCoefficient?: number
|
||||
isActive?: boolean
|
||||
detailContent?: string
|
||||
}>
|
||||
) {
|
||||
return request.put({
|
||||
url: `/web/admin/products/${id}`,
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
*/
|
||||
export function fetchDeleteProduct(id: string) {
|
||||
return request.del({
|
||||
url: `/web/admin/products/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
// ========== 商品轮播图 ==========
|
||||
// --- 轮播图 ---
|
||||
|
||||
/**
|
||||
* 获取商品轮播图列表
|
||||
*/
|
||||
export function fetchProductBannerList(productId: string) {
|
||||
return request.get<{
|
||||
list: Api.Product.ProductBanner[]
|
||||
@@ -527,9 +469,6 @@ export function fetchProductBannerList(productId: string) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加商品轮播图
|
||||
*/
|
||||
export function fetchCreateProductBanners(productId: string, items: Api.Product.ProductBannerCreate[]) {
|
||||
return request.post({
|
||||
url: `/web/admin/product-banners/product/${productId}`,
|
||||
@@ -537,19 +476,6 @@ export function fetchCreateProductBanners(productId: string, items: Api.Product.
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新轮播图
|
||||
*/
|
||||
export function fetchUpdateProductBanner(id: string, data: Partial<Api.Product.ProductBannerUpdate>) {
|
||||
return request.put({
|
||||
url: `/web/admin/product-banners/${id}`,
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新轮播图排序
|
||||
*/
|
||||
export function fetchUpdateProductBannerSort(productId: string, items: { id: string; sortOrder: number }[]) {
|
||||
return request.put({
|
||||
url: `/web/admin/product-banners/product/${productId}/sort`,
|
||||
@@ -557,20 +483,14 @@ export function fetchUpdateProductBannerSort(productId: string, items: { id: str
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除轮播图
|
||||
*/
|
||||
export function fetchDeleteProductBanner(id: string) {
|
||||
return request.del({
|
||||
url: `/web/admin/product-banners/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
// ========== 商品详情媒体 ==========
|
||||
// --- 详情媒体 ---
|
||||
|
||||
/**
|
||||
* 获取商品详情媒体列表
|
||||
*/
|
||||
export function fetchProductDetailMediaList(productId: string) {
|
||||
return request.get<{
|
||||
list: Api.Product.ProductDetailMedia[]
|
||||
@@ -580,29 +500,16 @@ export function fetchProductDetailMediaList(productId: string) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加商品详情媒体
|
||||
*/
|
||||
export function fetchCreateProductDetailMedia(productId: string, items: Api.Product.ProductDetailMediaCreate[]) {
|
||||
export function fetchCreateProductDetailMedia(
|
||||
productId: string,
|
||||
items: Api.Product.ProductDetailMediaCreate[]
|
||||
) {
|
||||
return request.post({
|
||||
url: `/web/admin/product-detail-media/product/${productId}`,
|
||||
params: items
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新详情媒体
|
||||
*/
|
||||
export function fetchUpdateProductDetailMedia(id: string, data: Partial<Api.Product.ProductDetailMediaUpdate>) {
|
||||
return request.put({
|
||||
url: `/web/admin/product-detail-media/${id}`,
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新详情媒体排序
|
||||
*/
|
||||
export function fetchUpdateProductDetailMediaSort(productId: string, items: { id: string; sortOrder: number }[]) {
|
||||
return request.put({
|
||||
url: `/web/admin/product-detail-media/product/${productId}/sort`,
|
||||
@@ -610,40 +517,14 @@ export function fetchUpdateProductDetailMediaSort(productId: string, items: { id
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除详情媒体
|
||||
*/
|
||||
export function fetchDeleteProductDetailMedia(id: string) {
|
||||
return request.del({
|
||||
url: `/web/admin/product-detail-media/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
// ========== 商品参数模板 ==========
|
||||
// --- 参数模板(简洁列表供分类/商品选择) ---
|
||||
|
||||
/**
|
||||
* 获取参数模板列表
|
||||
*/
|
||||
export function fetchProductParameterList(params?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
keyword?: string
|
||||
isActive?: number
|
||||
}) {
|
||||
return request.get<{
|
||||
list: Api.Product.ProductParameter[]
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
}>({
|
||||
url: '/web/admin/product-parameters',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参数模板简洁列表
|
||||
*/
|
||||
export function fetchProductParameterSimple() {
|
||||
return request.get<{
|
||||
list: Api.Product.ProductParameterSimple[]
|
||||
@@ -653,49 +534,8 @@ export function fetchProductParameterSimple() {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参数模板详情
|
||||
*/
|
||||
export function fetchProductParameterDetail(id: string) {
|
||||
return request.get<Api.Product.ProductParameter>({
|
||||
url: `/web/admin/product-parameters/${id}`
|
||||
})
|
||||
}
|
||||
// --- 分类关联参数 ---
|
||||
|
||||
/**
|
||||
* 创建参数模板
|
||||
*/
|
||||
export function fetchCreateProductParameter(data: Api.Product.ProductParameterCreate) {
|
||||
return request.post({
|
||||
url: '/web/admin/product-parameters',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新参数模板
|
||||
*/
|
||||
export function fetchUpdateProductParameter(id: string, data: Partial<Api.Product.ProductParameterUpdate>) {
|
||||
return request.put({
|
||||
url: `/web/admin/product-parameters/${id}`,
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数模板
|
||||
*/
|
||||
export function fetchDeleteProductParameter(id: string) {
|
||||
return request.del({
|
||||
url: `/web/admin/product-parameters/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
// ========== 分类参数关联 ==========
|
||||
|
||||
/**
|
||||
* 获取分类关联的参数列表
|
||||
*/
|
||||
export function fetchCategoryParameters(categoryId: string) {
|
||||
return request.get<{
|
||||
list: Api.Product.CategoryParameter[]
|
||||
@@ -705,9 +545,6 @@ export function fetchCategoryParameters(categoryId: string) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新分类关联的参数
|
||||
*/
|
||||
export function fetchUpdateCategoryParameters(categoryId: string, items: Api.Product.CategoryParameterCreate[]) {
|
||||
return request.put({
|
||||
url: `/web/admin/categories/${categoryId}/parameters`,
|
||||
@@ -715,11 +552,8 @@ export function fetchUpdateCategoryParameters(categoryId: string, items: Api.Pro
|
||||
})
|
||||
}
|
||||
|
||||
// ========== 商品参数值 ==========
|
||||
// --- 商品参数值 ---
|
||||
|
||||
/**
|
||||
* 获取商品参数值列表
|
||||
*/
|
||||
export function fetchProductParameterValues(productId: string) {
|
||||
return request.get<{
|
||||
list: Api.Product.ProductParameterValue[]
|
||||
@@ -729,97 +563,12 @@ export function fetchProductParameterValues(productId: string) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存商品参数值
|
||||
*/
|
||||
export function fetchSaveProductParameterValues(productId: string, values: Api.Product.ProductParameterValueCreate[]) {
|
||||
export function fetchSaveProductParameterValues(
|
||||
productId: string,
|
||||
values: Api.Product.ProductParameterValueCreate[]
|
||||
) {
|
||||
return request.post({
|
||||
url: `/web/admin/product-parameter-values/product/${productId}`,
|
||||
params: { productId, values }
|
||||
})
|
||||
}
|
||||
|
||||
// ========== 售后评价 ==========
|
||||
|
||||
/**
|
||||
* 获取评价列表
|
||||
*/
|
||||
export function fetchReviewList(params?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
productId?: string
|
||||
productName?: string
|
||||
userName?: string
|
||||
status?: string
|
||||
rating?: number
|
||||
startDate?: string
|
||||
endDate?: string
|
||||
}) {
|
||||
return request.get<{
|
||||
list: Api.Product.ProductReview[]
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
}>({
|
||||
url: '/web/admin/reviews',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评价统计
|
||||
*/
|
||||
export function fetchReviewStatistics(productId?: string) {
|
||||
return request.get<Api.Product.ProductReviewStatistics>({
|
||||
url: '/web/admin/reviews/statistics',
|
||||
params: { productId }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评价详情
|
||||
*/
|
||||
export function fetchReviewDetail(id: string) {
|
||||
return request.get<Api.Product.ProductReview>({
|
||||
url: `/web/admin/reviews/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核通过评价
|
||||
*/
|
||||
export function fetchApproveReview(id: string) {
|
||||
return request.put({
|
||||
url: `/web/admin/reviews/${id}/approve`
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝评价
|
||||
*/
|
||||
export function fetchRejectReview(id: string, rejectReason: string) {
|
||||
return request.put({
|
||||
url: `/web/admin/reviews/${id}/reject`,
|
||||
params: { rejectReason }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 回复评价
|
||||
*/
|
||||
export function fetchReplyReview(id: string, replyContent: string) {
|
||||
return request.put({
|
||||
url: `/web/admin/reviews/${id}/reply`,
|
||||
params: { replyContent }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 置顶/取消置顶评价
|
||||
*/
|
||||
export function fetchToggleReviewTop(id: string, isTop: number) {
|
||||
return request.put({
|
||||
url: `/web/admin/reviews/${id}/top`,
|
||||
params: { isTop }
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user