mall-app-t/peach/api/trade/goods.js

156 lines
3.0 KiB
JavaScript

import request from '@/peach/request'
const GoodsApi = {
// 商品列表
getProductList: (data) => {
return request({
url: '/product/spu/page',
method: 'GET',
params: data,
})
},
// 商品详情 spuIds
getProduct: (data) => {
return request({
url: '/product/spu/get-detail',
method: 'GET',
params: data,
})
},
// 添加商品
addProduct: (data) => {
return request({
url: '/product/spu/create',
method: 'POST',
data,
})
},
// 修改商品
editProduct: (data) => {
return request({
url: '/product/spu/update',
method: 'PUT',
data,
})
},
// 删除商品
delProduct: (data) => {
return request({
url: '/product/spu/delete',
method: 'DELETE',
params: data,
})
},
// 商品分类
getGoodsCategory: (data) => {
return request({
url: '/product/category/list',
method: 'GET',
params: data,
})
},
// 商品品牌
getBrand: (data) => {
return request({
url: '/product/brand/list',
method: 'GET',
params: data,
})
},
// 历史属性
getHistoryProperty: () => {
return request({
url: '/product/property/history-list',
method: 'GET',
})
},
getPropertyList: (data) => {
return request({
url: '/product/property/get',
method: 'GET',
params: data,
})
},
// 创建商品属性项
createProperty: (data) => {
return request({
url: '/product/property/create',
method: 'POST',
data,
custom: {
successMsg: '新增成功',
},
})
},
// 修改商品属性项
editProperty: (data) => {
return request({
url: '/product/property/update',
method: 'PUT',
data,
custom: {
successMsg: '修改成功',
},
})
},
// 删除商品属性项
delProperty: (data) => {
return request({
url: '/product/property/delete',
method: 'DELETE',
params: data,
custom: {
successMsg: '删除成功',
},
})
},
// 创建商品属性值
createPropertyValue: (data) => {
return request({
url: '/product/property/value/create',
method: 'POST',
data,
custom: {
successMsg: '新增成功',
},
})
},
// 删除商品属性值
delPropertyValue: (data) => {
return request({
url: '/product/property/value/delete',
method: 'DELETE',
params: data,
custom: {
successMsg: '删除成功',
},
})
},
// 修改商品属性值
editPropertyValue: (data) => {
return request({
url: '/product/property/value/update',
method: 'PUT',
data,
custom: {
successMsg: '修改成功',
},
})
},
// 更改商品状态
changeProductStatus: (data) => {
return request({
url: '/product/spu/update-status',
method: 'PUT',
data,
custom: {
successMsg: '操作成功',
showSuccess: true,
},
})
},
}
export default GoodsApi