import { get, post } from '../utils/request' import type { Product, Category, DetailParameterConfig, SpecData } from '../types' /** 获取商品列表 */ export const getProducts = (params?: { categoryId?: number; page?: number; pageSize?: number }) => get<{ list: Product[]; total: number }>('/api/products', params as Record) /** 获取商品详情 */ export const getProductDetail = (id: number) => get(`/api/products/${id}`) /** 获取商品详细参数选项 */ export const getProductSpecs = (id: number) => get(`/api/products/${id}/specs`) /** 根据参数组合获取规格数据列表 */ export const getSpecDataList = (id: number, params: { fineness: string; mainStone: string; ringSize: string }) => post(`/api/products/${id}/spec-data`, params as unknown as Record) /** 获取商品分类列表 */ export const getCategories = () => get('/api/categories')