From 360cce10c7099537f8df4aa61f69f363f626bc45 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 22 Sep 2024 23:29:22 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91=E5=95=86?= =?UTF-8?q?=E5=9F=8E:=20=E7=A7=AF=E5=88=86=E5=95=86=E5=9F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mall/promotion/point/index.ts | 78 ++++++ .../point/activity/PointActivityForm.vue | 219 +++++++++++++++++ .../mall/promotion/point/activity/index.vue | 223 ++++++++++++++++++ .../point/activity/pointActivity.data.ts | 55 +++++ 4 files changed, 575 insertions(+) create mode 100644 src/api/mall/promotion/point/index.ts create mode 100644 src/views/mall/promotion/point/activity/PointActivityForm.vue create mode 100644 src/views/mall/promotion/point/activity/index.vue create mode 100644 src/views/mall/promotion/point/activity/pointActivity.data.ts diff --git a/src/api/mall/promotion/point/index.ts b/src/api/mall/promotion/point/index.ts new file mode 100644 index 00000000..f74d104e --- /dev/null +++ b/src/api/mall/promotion/point/index.ts @@ -0,0 +1,78 @@ +import request from '@/config/axios' +import { Sku, Spu } from '@/api/mall/product/spu' + +// 积分商城活动 VO +export interface PointActivityVO { + id: number // 积分商城活动编号 + spuId: number // 积分商城活动商品 + status: number // 活动状态 + remark?: string // 备注 + sort: number // 排序 + createTime: string // 创建时间 + products: PointProductVO[] // 积分商城商品 + + // ========== 商品字段 ========== + spuName: string // 商品名称 + picUrl: string // 商品主图 + marketPrice: number // 商品市场价,单位:分 + + //======================= 显示所需兑换积分最少的 sku 信息 ======================= + maxCount: number // 可兑换数量 + 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[] // 重写类型 +} + +// 积分商城活动 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 }) + }, + + // 新增积分商城活动 + 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 }) + } +} diff --git a/src/views/mall/promotion/point/activity/PointActivityForm.vue b/src/views/mall/promotion/point/activity/PointActivityForm.vue new file mode 100644 index 00000000..28411642 --- /dev/null +++ b/src/views/mall/promotion/point/activity/PointActivityForm.vue @@ -0,0 +1,219 @@ + + diff --git a/src/views/mall/promotion/point/activity/index.vue b/src/views/mall/promotion/point/activity/index.vue new file mode 100644 index 00000000..dc5295b5 --- /dev/null +++ b/src/views/mall/promotion/point/activity/index.vue @@ -0,0 +1,223 @@ + + + diff --git a/src/views/mall/promotion/point/activity/pointActivity.data.ts b/src/views/mall/promotion/point/activity/pointActivity.data.ts new file mode 100644 index 00000000..a3334eac --- /dev/null +++ b/src/views/mall/promotion/point/activity/pointActivity.data.ts @@ -0,0 +1,55 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' + +// 表单校验 +export const rules = reactive({ + spuId: [required], + sort: [required] +}) + +// CrudSchema https://doc.iocoder.cn/vue3/crud-schema/ +const crudSchemas = reactive([ + { + label: '排序', + field: 'sort', + form: { + component: 'InputNumber', + value: 0 + }, + table: { + width: 80 + } + }, + { + label: '积分商城活动商品', + field: 'spuId', + isTable: true, + isSearch: false, + form: { + colProps: { + span: 24 + } + }, + table: { + width: 300 + } + }, + { + label: '备注', + field: 'remark', + isSearch: false, + form: { + component: 'Input', + componentProps: { + type: 'textarea', + rows: 4 + }, + colProps: { + span: 24 + } + }, + table: { + width: 300 + } + } +]) +export const { allSchemas } = useCrudSchemas(crudSchemas)