branch_wz
wangzhuo 7 months ago
parent 5450926f5c
commit e81e35e6e9

@ -1,7 +1,27 @@
// 导入封装好的请求工具用于发起HTTP请求
import request from '@/utils/request'
/**
* fetchList - 获取公司地址列表数据的函数
*
* 该函数通过发送一个 GET 请求到指定的后端接口
* 以获取公司地址列表数据数据返回后可以用于前端页面渲染
*
* @returns {Promise} - 返回一个Promise对象包含接口返回的数据
*
* 用法示例
* fetchList().then(response => {
* console.log(response); // 处理接口返回的数据
* }).catch(error => {
* console.error(error); // 处理错误
* });
*/
export function fetchList() {
return request({
// 接口的URL路径指向公司地址列表的后端接口
url: '/companyAddress/list',
// 请求方法:使用 HTTP GET 方法获取数据
method: 'get'
})
}

@ -1,38 +1,106 @@
// 导入封装的 HTTP 请求工具,用于与后端接口通信
import request from '@/utils/request'
/**
* fetchList - 获取优惠券列表
*
* 该函数通过 GET 请求获取优惠券列表并支持通过参数进行查询筛选
*
* @param {Object} params - 查询参数例如分页筛选条件等
* @returns {Promise} - 返回一个Promise对象包含接口返回的数据
*
* 用法示例
* fetchList({ pageNum: 1, pageSize: 10 }).then(response => {
* console.log(response);
* });
*/
export function fetchList(params) {
return request({
url:'/coupon/list',
method:'get',
params:params
url: '/coupon/list', // 接口URL路径获取优惠券列表
method: 'get', // 请求方法GET
params: params // 查询参数通过URL参数传递
})
}
/**
* createCoupon - 创建新的优惠券
*
* 该函数通过 POST 请求向后端提交新优惠券的数据
*
* @param {Object} data - 优惠券的详细数据包含名称折扣等字段
* @returns {Promise} - 返回一个Promise对象包含接口返回的数据
*
* 用法示例
* createCoupon({ name: 'Spring Sale', discount: 20 }).then(response => {
* console.log(response);
* });
*/
export function createCoupon(data) {
return request({
url:'/coupon/create',
method:'post',
data:data
url: '/coupon/create', // 接口URL路径创建优惠券
method: 'post', // 请求方法POST
data: data // 请求体,包含优惠券数据
})
}
/**
* getCoupon - 获取单个优惠券的详情
*
* 该函数通过 GET 请求获取指定ID的优惠券详细信息
*
* @param {number|string} id - 优惠券的唯一标识ID
* @returns {Promise} - 返回一个Promise对象包含优惠券的详细数据
*
* 用法示例
* getCoupon(1).then(response => {
* console.log(response);
* });
*/
export function getCoupon(id) {
return request({
url:'/coupon/'+id,
method:'get',
url: '/coupon/' + id, // 接口URL路径根据ID获取优惠券详情
method: 'get' // 请求方法GET
})
}
/**
* updateCoupon - 更新指定优惠券的信息
*
* 该函数通过 POST 请求提交修改后的优惠券数据更新指定ID的优惠券
*
* @param {number|string} id - 优惠券的唯一标识ID
* @param {Object} data - 修改后的优惠券数据
* @returns {Promise} - 返回一个Promise对象包含操作结果
*
* 用法示例
* updateCoupon(1, { name: 'Updated Sale', discount: 25 }).then(response => {
* console.log(response);
* });
*/
export function updateCoupon(id, data) {
return request({
url:'/coupon/update/'+id,
method:'post',
data:data
url: '/coupon/update/' + id, // 接口URL路径更新指定ID的优惠券
method: 'post', // 请求方法POST
data: data // 请求体,包含修改后的数据
})
}
/**
* deleteCoupon - 删除指定优惠券
*
* 该函数通过 POST 请求删除指定ID的优惠券
*
* @param {number|string} id - 优惠券的唯一标识ID
* @returns {Promise} - 返回一个Promise对象包含操作结果
*
* 用法示例
* deleteCoupon(1).then(response => {
* console.log(response);
* });
*/
export function deleteCoupon(id) {
return request({
url:'/coupon/delete/'+id,
method:'post',
url: '/coupon/delete/' + id, // 接口URL路径删除指定ID的优惠券
method: 'post' // 请求方法POST
})
}

@ -1,8 +1,27 @@
// 导入封装的 HTTP 请求工具,用于发送 HTTP 请求
import request from '@/utils/request'
/**
* fetchList - 获取优惠券历史记录列表
*
* 该函数通过 GET 请求获取优惠券使用历史的记录列表
* 可以通过传入查询参数如分页筛选条件等来筛选数据
*
* @param {Object} params - 查询参数包括分页信息筛选条件等
* 示例参数{ pageNum: 1, pageSize: 10, couponId: 1001 }
* @returns {Promise} - 返回一个 Promise 对象包含接口返回的数据
*
* 用法示例
* fetchList({ pageNum: 1, pageSize: 10 }).then(response => {
* console.log(response); // 处理接口返回的数据
* }).catch(error => {
* console.error('获取数据失败:', error); // 处理请求错误
* });
*/
export function fetchList(params) {
return request({
url:'/couponHistory/list',
method:'get',
params:params
url: '/couponHistory/list', // 接口URL路径获取优惠券历史记录列表
method: 'get', // 请求方法GET
params: params // 查询参数,通过 URL 参数传递
})
}

@ -1,35 +1,109 @@
// 导入封装的 HTTP 请求工具,用于发送 HTTP 请求
import request from '@/utils/request'
/**
* fetchList - 获取限时购活动列表
*
* 该函数通过 GET 请求获取限时购活动的列表数据并支持通过参数进行查询筛选
*
* @param {Object} params - 查询参数例如分页筛选条件等
* 示例{ pageNum: 1, pageSize: 10 }
* @returns {Promise} - 返回一个 Promise 对象包含接口返回的数据
*
* 用法示例
* fetchList({ pageNum: 1, pageSize: 10 }).then(response => {
* console.log(response);
* });
*/
export function fetchList(params) {
return request({
url:'/flash/list',
method:'get',
params:params
url: '/flash/list', // 接口URL获取限时购活动列表
method: 'get', // 请求方法GET
params: params // 查询参数,通过 URL 查询字符串传递
})
}
/**
* updateStatus - 更新限时购活动状态
*
* 该函数通过 POST 请求更新指定限时购活动的状态
*
* @param {number|string} id - 限时购活动的唯一标识ID
* @param {Object} params - 状态更新参数例如 { status: 1 }
* @returns {Promise} - 返回一个 Promise 对象包含操作结果
*
* 用法示例
* updateStatus(1, { status: 1 }).then(response => {
* console.log(response);
* });
*/
export function updateStatus(id, params) {
return request({
url:'/flash/update/status/'+id,
method:'post',
params:params
url: '/flash/update/status/' + id, // 接口URL更新指定活动状态
method: 'post', // 请求方法POST
params: params // 状态参数,通过 URL 查询字符串传递
})
}
/**
* deleteFlash - 删除指定的限时购活动
*
* 该函数通过 POST 请求删除指定ID的限时购活动
*
* @param {number|string} id - 限时购活动的唯一标识ID
* @returns {Promise} - 返回一个 Promise 对象包含操作结果
*
* 用法示例
* deleteFlash(1).then(response => {
* console.log(response);
* });
*/
export function deleteFlash(id) {
return request({
url:'/flash/delete/'+id,
method:'post'
url: '/flash/delete/' + id, // 接口URL删除指定活动
method: 'post' // 请求方法POST
})
}
/**
* createFlash - 创建新的限时购活动
*
* 该函数通过 POST 请求向后端提交新的限时购活动数据
*
* @param {Object} data - 活动的详细数据例如 { name: 'Flash Sale', startTime: '2024-06-01' }
* @returns {Promise} - 返回一个 Promise 对象包含创建结果
*
* 用法示例
* createFlash({ name: 'Summer Flash Sale', startTime: '2024-06-01' }).then(response => {
* console.log(response);
* });
*/
export function createFlash(data) {
return request({
url:'/flash/create',
method:'post',
data:data
url: '/flash/create', // 接口URL创建限时购活动
method: 'post', // 请求方法POST
data: data // 请求体,包含活动的详细数据
})
}
/**
* updateFlash - 更新指定的限时购活动
*
* 该函数通过 POST 请求提交更新后的活动数据更新指定ID的限时购活动
*
* @param {number|string} id - 限时购活动的唯一标识ID
* @param {Object} data - 更新后的活动数据
* @returns {Promise} - 返回一个 Promise 对象包含操作结果
*
* 用法示例
* updateFlash(1, { name: 'Updated Flash Sale', startTime: '2024-06-15' }).then(response => {
* console.log(response);
* });
*/
export function updateFlash(id, data) {
return request({
url:'/flash/update/'+id,
method:'post',
data:data
url: '/flash/update/' + id, // 接口URL更新指定ID的活动
method: 'post', // 请求方法POST
data: data // 请求体,包含更新后的活动数据
})
}

@ -1,28 +1,88 @@
// 导入封装的 HTTP 请求工具,用于与后端 API 进行通信
import request from '@/utils/request'
/**
* fetchList - 获取限时购商品关联列表
*
* 该函数通过 GET 请求获取限时购活动与商品的关联列表
* 支持通过查询参数进行筛选和分页
*
* @param {Object} params - 查询参数例如分页和过滤条件
* 示例{ flashId: 1, pageNum: 1, pageSize: 10 }
* @returns {Promise} - 返回一个 Promise 对象包含接口返回的数据
*
* 用法示例
* fetchList({ flashId: 1, pageNum: 1, pageSize: 10 }).then(response => {
* console.log(response);
* });
*/
export function fetchList(params) {
return request({
url:'/flashProductRelation/list',
method:'get',
params:params
url: '/flashProductRelation/list', // 接口URL获取关联列表
method: 'get', // 请求方法GET
params: params // 查询参数,通过 URL 传递
})
}
/**
* createFlashProductRelation - 创建新的限时购商品关联
*
* 该函数通过 POST 请求提交限时购活动与商品的关联数据
*
* @param {Object} data - 关联数据例如 { flashId: 1, productId: 100, sort: 1 }
* @returns {Promise} - 返回一个 Promise 对象包含操作结果
*
* 用法示例
* createFlashProductRelation({ flashId: 1, productId: 100, sort: 1 }).then(response => {
* console.log(response);
* });
*/
export function createFlashProductRelation(data) {
return request({
url:'/flashProductRelation/create',
method:'post',
data:data
url: '/flashProductRelation/create', // 接口URL创建关联
method: 'post', // 请求方法POST
data: data // 请求体,包含关联数据
})
}
/**
* deleteFlashProductRelation - 删除指定的限时购商品关联
*
* 该函数通过 POST 请求删除指定 ID 的限时购商品关联数据
*
* @param {number|string} id - 限时购商品关联的唯一标识 ID
* @returns {Promise} - 返回一个 Promise 对象包含操作结果
*
* 用法示例
* deleteFlashProductRelation(1).then(response => {
* console.log(response);
* });
*/
export function deleteFlashProductRelation(id) {
return request({
url:'/flashProductRelation/delete/'+id,
method:'post'
url: '/flashProductRelation/delete/' + id, // 接口URL删除关联
method: 'post' // 请求方法POST
})
}
/**
* updateFlashProductRelation - 更新指定的限时购商品关联数据
*
* 该函数通过 POST 请求提交更新后的限时购商品关联数据
*
* @param {number|string} id - 限时购商品关联的唯一标识 ID
* @param {Object} data - 更新后的关联数据例如 { sort: 2 }
* @returns {Promise} - 返回一个 Promise 对象包含操作结果
*
* 用法示例
* updateFlashProductRelation(1, { sort: 2 }).then(response => {
* console.log(response);
* });
*/
export function updateFlashProductRelation(id, data) {
return request({
url:'/flashProductRelation/update/'+id,
method:'post',
data:data
url: '/flashProductRelation/update/' + id, // 接口URL更新关联
method: 'post', // 请求方法POST
data: data // 请求体,包含更新数据
})
}

Loading…
Cancel
Save