From 09872a3ace831dda7f573eb32094a0dc7bbe26bf Mon Sep 17 00:00:00 2001 From: sonjinyon <2476687577@qq.com> Date: Wed, 9 Oct 2024 09:17:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E7=BA=A6=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/mall/promotion/point/index.ts | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 yudao-admin-vue3/src/api/mall/promotion/point/index.ts diff --git a/yudao-admin-vue3/src/api/mall/promotion/point/index.ts b/yudao-admin-vue3/src/api/mall/promotion/point/index.ts new file mode 100644 index 0000000..38254c2 --- /dev/null +++ b/yudao-admin-vue3/src/api/mall/promotion/point/index.ts @@ -0,0 +1,91 @@ +import request from '@/config/axios' +import { Sku, Spu } from '@/api/mall/product/spu' // 积分商城活动 VO + +// 积分商城活动 VO +export interface PointActivityVO { + id: number // 积分商城活动编号 + spuId: number // 积分商城活动商品 + status: number // 活动状态 + stock: number // 积分商城活动库存 + totalStock: number // 积分商城活动总库存 + remark?: string // 备注 + sort: number // 排序 + createTime: string // 创建时间 + products: PointProductVO[] // 积分商城商品 + + // ========== 商品字段 ========== + spuName: string // 商品名称 + picUrl: string // 商品主图 + marketPrice: number // 商品市场价,单位:分 + + //======================= 显示所需兑换积分最少的 sku 信息 ======================= + point: number // 兑换积分 + price: number // 兑换金额,单位:分 +} + +// 秒杀活动所需属性 +export interface PointProductVO { + id?: number // 积分商城商品编号 + activityId?: number // 积分商城活动 id + spuId?: number // 商品 SPU 编号 + skuId: number // 商品 SKU 编号 + count: number // 可兑换数量 + point: number // 兑换积分 + price: number // 兑换金额,单位:分 + stock: number // 积分商城商品库存 + activityStatus?: number // 积分商城商品状态 +} + +// 扩展 Sku 配置 +export type SkuExtension = Sku & { + productConfig: PointProductVO +} + +export interface SpuExtension extends Spu { + skus: SkuExtension[] // 重写类型 +} + +export interface SpuExtension0 extends Spu { + pointStock: number // 积分商城活动库存 + pointTotalStock: number // 积分商城活动总库存 + point: number // 兑换积分 + pointPrice: number // 兑换金额,单位:分 +} + +// 积分商城活动 API +export const PointActivityApi = { + // 查询积分商城活动分页 + getPointActivityPage: async (params: any) => { + return await request.get({ url: `/promotion/point-activity/page`, params }) + }, + + // 查询积分商城活动详情 + getPointActivity: async (id: number) => { + return await request.get({ url: `/promotion/point-activity/get?id=` + id }) + }, + + // 查询积分商城活动列表,基于活动编号数组 + getPointActivityListByIds: async (ids: number[]) => { + return request.get({ url: `/promotion/point-activity/list-by-ids?ids=${ids}` }) + }, + + // 新增积分商城活动 + createPointActivity: async (data: PointActivityVO) => { + return await request.post({ url: `/promotion/point-activity/create`, data }) + }, + + // 修改积分商城活动 + updatePointActivity: async (data: PointActivityVO) => { + return await request.put({ url: `/promotion/point-activity/update`, data }) + }, + + // 删除积分商城活动 + deletePointActivity: async (id: number) => { + return await request.delete({ url: `/promotion/point-activity/delete?id=` + id }) + }, + + // 关闭秒杀活动 + closePointActivity: async (id: number) => { + return await request.put({ url: '/promotion/point-activity/close?id=' + id }) + } +}