Skip to content

Commit 4906cec

Browse files
committed
feat: 新增商品属性api
1 parent d6f2eaf commit 4906cec

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

src/api/mall/product/property.ts

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import request from '@/config/axios'
2+
3+
/**
4+
* 商品属性
5+
*/
6+
export interface PropertyVO {
7+
id?: number
8+
/** 名称 */
9+
name: string
10+
/** 备注 */
11+
remark?: string
12+
}
13+
14+
/**
15+
* 属性值
16+
*/
17+
export interface PropertyValueVO {
18+
id?: number
19+
/** 属性项的编号 */
20+
propertyId?: number
21+
/** 名称 */
22+
name: string
23+
/** 备注 */
24+
remark?: string
25+
}
26+
27+
/**
28+
* 商品属性值的明细
29+
*/
30+
export interface PropertyValueDetailVO {
31+
/** 属性项的编号 */
32+
propertyId: number // 属性的编号
33+
/** 属性的名称 */
34+
propertyName: string
35+
/** 属性值的编号 */
36+
valueId: number
37+
/** 属性值的名称 */
38+
valueName: string
39+
}
40+
41+
// ------------------------ 属性项 -------------------
42+
43+
// 创建属性项
44+
export const createProperty = (data: PropertyVO) => {
45+
return request.post({ url: '/product/property/create', data })
46+
}
47+
48+
// 更新属性项
49+
export const updateProperty = (data: PropertyVO) => {
50+
return request.put({ url: '/product/property/update', data })
51+
}
52+
53+
// 删除属性项
54+
export const deleteProperty = (id: number) => {
55+
return request.delete({ url: `/product/property/delete?id=${id}` })
56+
}
57+
58+
// 获得属性项
59+
export const getProperty = (id: number): Promise<PropertyVO> => {
60+
return request.get({ url: `/product/property/get?id=${id}` })
61+
}
62+
63+
// 获得属性项分页
64+
export const getPropertyPage = (params: PageParam & any) => {
65+
return request.get({ url: '/product/property/page', params })
66+
}
67+
68+
// 获得属性项列表
69+
export const getPropertyList = (params: any) => {
70+
return request.get({ url: '/product/property/list', params })
71+
}
72+
73+
// 获得属性项列表
74+
export const getPropertyListAndValue = (params: any) => {
75+
return request.get({ url: '/product/property/get-value-list', params })
76+
}
77+
78+
// ------------------------ 属性值 -------------------
79+
80+
// 获得属性值分页
81+
export const getPropertyValuePage = (params: PageParam & any) => {
82+
return request.get({ url: '/product/property/value/page', params })
83+
}
84+
85+
// 获得属性值
86+
export const getPropertyValue = (id: number): Promise<PropertyValueVO> => {
87+
return request.get({ url: `/product/property/value/get?id=${id}` })
88+
}
89+
90+
// 创建属性值
91+
export const createPropertyValue = (data: PropertyValueVO) => {
92+
return request.post({ url: '/product/property/value/create', data })
93+
}
94+
95+
// 更新属性值
96+
export const updatePropertyValue = (data: PropertyValueVO) => {
97+
return request.put({ url: '/product/property/value/update', data })
98+
}
99+
100+
// 删除属性值
101+
export const deletePropertyValue = (id: number) => {
102+
return request.delete({ url: `/product/property/value/delete?id=${id}` })
103+
}

0 commit comments

Comments
 (0)