Files
im-admin/src/api/service/product.js
Seven 0e0b856edb refactor: improve code formatting and structure in product index view
- Enhanced readability by adjusting indentation and spacing in the template.
- Consolidated repeated code blocks for better maintainability.
- Added functionality for changing product status (上架/下架) with confirmation prompts.
- Updated the handleDelete function to maintain consistent formatting.
- Ensured all API calls and data handling are properly formatted for clarity.
2026-03-08 02:38:43 +07:00

57 lines
987 B
JavaScript

import request from '@/utils/request'
// 查询商品列表列表
export function listProduct(query) {
return request({
url: '/service/product/list',
method: 'get',
params: query
})
}
// 查询商品列表详细
export function getProduct(id) {
return request({
url: '/service/product/' + id,
method: 'get'
})
}
// 新增商品列表
export function addProduct(data) {
return request({
url: '/service/product',
method: 'post',
data: data
})
}
// 修改商品列表
export function updateProduct(data) {
return request({
url: '/service/product',
method: 'put',
data: data
})
}
// 删除商品列表
export function delProduct(id) {
return request({
url: '/service/product/' + id,
method: 'delete'
})
}
// 上架/下架商品
export function changeProductStatus(id, status) {
const data = {
id,
status
}
return request({
url: '/service/product/status',
method: 'put',
data: data
})
}