From ed9f0429754083a0d3182fde0e35a93bc36128d2 Mon Sep 17 00:00:00 2001 From: dhb52 Date: Fri, 26 May 2023 18:19:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20mall=20=E4=BC=98=E6=83=A0=E5=88=B8=20?= =?UTF-8?q?=E5=88=9D=E7=A8=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mall/product/spu.ts | 46 ++ src/api/mall/promotion/coupon.ts | 16 + src/api/mall/promotion/couponTemplate.ts | 60 ++ src/utils/constants.ts | 78 +++ src/utils/dict.ts | 11 +- src/views/mall/promotion/coupon/index.vue | 200 ++++++ .../mall/promotion/couponTemplate/index.vue | 614 ++++++++++++++++++ 7 files changed, 1024 insertions(+), 1 deletion(-) create mode 100644 src/api/mall/product/spu.ts create mode 100755 src/api/mall/promotion/coupon.ts create mode 100755 src/api/mall/promotion/couponTemplate.ts create mode 100755 src/views/mall/promotion/coupon/index.vue create mode 100755 src/views/mall/promotion/couponTemplate/index.vue diff --git a/src/api/mall/product/spu.ts b/src/api/mall/product/spu.ts new file mode 100644 index 00000000..2cfe722c --- /dev/null +++ b/src/api/mall/product/spu.ts @@ -0,0 +1,46 @@ +import request from '@/config/axios' + +// 创建商品 SPU +export function createSpu(data) { + return request.post({ + url: '/product/spu/create', + data: data + }) +} + +// 更新商品 SPU +export function updateSpu(data) { + return request.put({ + url: '/product/spu/update', + data: data + }) +} + +// 删除商品 SPU +export function deleteSpu(id) { + return request.delete({ + url: `/product/spu/delete?id=${id}` + }) +} + +// 获得商品 SPU 详情 +export function getSpuDetail(id) { + return request.get({ + url: `/product/spu/get-detail?id=${id}` + }) +} + +// 获得商品 SPU 分页 +export function getSpuPage(query) { + return request.get({ + url: '/product/spu/page', + params: query + }) +} + +// 获得商品 SPU 精简列表 +export function getSpuSimpleList() { + return request.get({ + url: '/product/spu/get-simple-list' + }) +} diff --git a/src/api/mall/promotion/coupon.ts b/src/api/mall/promotion/coupon.ts new file mode 100755 index 00000000..99e8a027 --- /dev/null +++ b/src/api/mall/promotion/coupon.ts @@ -0,0 +1,16 @@ +import request from '@/config/axios' + +// 删除优惠劵 +export function deleteCoupon(id) { + return request.delete({ + url: `/promotion/coupon/delete?id=${id}` + }) +} + +// 获得优惠劵分页 +export function getCouponPage(query) { + return request.get({ + url: '/promotion/coupon/page', + params: query + }) +} diff --git a/src/api/mall/promotion/couponTemplate.ts b/src/api/mall/promotion/couponTemplate.ts new file mode 100755 index 00000000..a861b127 --- /dev/null +++ b/src/api/mall/promotion/couponTemplate.ts @@ -0,0 +1,60 @@ +import request from '@/config/axios' + +// 创建优惠劵模板 +export function createCouponTemplate(data) { + return request.post({ + url: '/promotion/coupon-template/create', + data: data + }) +} + +// 更新优惠劵模板 +export function updateCouponTemplate(data) { + return request.put({ + url: '/promotion/coupon-template/update', + data: data + }) +} + +// 更新优惠劵模板的状态 +export function updateCouponTemplateStatus(id, status) { + const data = { + id, + status + } + return request.put({ + url: '/promotion/coupon-template/update-status', + data: data + }) +} + +// 删除优惠劵模板 +export function deleteCouponTemplate(id) { + return request.delete({ + url: '/promotion/coupon-template/delete?id=' + id + }) +} + +// 获得优惠劵模板 +export function getCouponTemplate(id) { + return request.get({ + url: '/promotion/coupon-template/get?id=' + id + }) +} + +// 获得优惠劵模板分页 +export function getCouponTemplatePage(query) { + return request.get({ + url: '/promotion/coupon-template/page', + params: query + }) +} + +// 导出优惠劵模板 Excel +export function exportCouponTemplateExcel(query) { + return request.get({ + url: '/promotion/coupon-template/export-excel', + params: query, + responseType: 'blob' + }) +} diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 5cda391f..a9d41b90 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -220,3 +220,81 @@ export const PayRefundStatusEnum = { name: '退款关闭' } } + +/** + * 优惠劵模板的有限期类型的枚举 + */ +export const CouponTemplateValidityTypeEnum = { + DATE: { + type: 1, + name: '固定日期可用' + }, + TERM: { + type: 2, + name: '领取之后可用' + } +} + +/** + * 营销的商品范围枚举 + */ +export const PromotionProductScopeEnum = { + ALL: { + scope: 1, + name: '全部商品参与' + }, + SPU: { + scope: 2, + name: '指定商品参与' + } +} + +/** + * 营销的条件类型枚举 + */ +export const PromotionConditionTypeEnum = { + PRICE: { + type: 10, + name: '满 N 元' + }, + COUNT: { + type: 20, + name: '满 N 件' + } +} + +/** + * 促销活动的状态枚举 + */ +export const PromotionActivityStatusEnum = { + WAIT: { + type: 10, + name: '未开始' + }, + RUN: { + type: 20, + name: '进行中' + }, + END: { + type: 30, + name: '已结束' + }, + CLOSE: { + type: 40, + name: '已关闭' + } +} + +/** + * 优惠类型枚举 + */ +export const PromotionDiscountTypeEnum = { + PRICE: { + type: 1, + name: '满减' + }, + PERCENT: { + type: 2, + name: '折扣' + } +} diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 03e17e75..73913b91 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -144,5 +144,14 @@ export enum DICT_TYPE { // ========== MP 模块 ========== MP_AUTO_REPLY_REQUEST_MATCH = 'mp_auto_reply_request_match', // 自动回复请求匹配类型 - MP_MESSAGE_TYPE = 'mp_message_type' // 消息类型 + MP_MESSAGE_TYPE = 'mp_message_type', // 消息类型 + + // ========== MALL - PROMOTION 模块 ========== + PROMOTION_DISCOUNT_TYPE = 'promotion_discount_type', // 优惠类型 + PROMOTION_PRODUCT_SCOPE = 'promotion_product_scope', // 营销的商品范围 + PROMOTION_COUPON_TEMPLATE_VALIDITY_TYPE = 'promotion_coupon_template_validity_type', // 优惠劵模板的有限期类型 + PROMOTION_COUPON_STATUS = 'promotion_coupon_status', // 优惠劵的状态 + PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式 + PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态 + PROMOTION_CONDITION_TYPE = 'promotion_condition_type' // 营销的条件类型枚举 } diff --git a/src/views/mall/promotion/coupon/index.vue b/src/views/mall/promotion/coupon/index.vue new file mode 100755 index 00000000..9fe8f0d4 --- /dev/null +++ b/src/views/mall/promotion/coupon/index.vue @@ -0,0 +1,200 @@ + + + diff --git a/src/views/mall/promotion/couponTemplate/index.vue b/src/views/mall/promotion/couponTemplate/index.vue new file mode 100755 index 00000000..a1424413 --- /dev/null +++ b/src/views/mall/promotion/couponTemplate/index.vue @@ -0,0 +1,614 @@ + + +