From ed9f0429754083a0d3182fde0e35a93bc36128d2 Mon Sep 17 00:00:00 2001 From: dhb52 Date: Fri, 26 May 2023 18:19:39 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20mall=20=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=20=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 @@ + + + From c5a7d05821d4eae7197cbd0dba66f544ee214ecc Mon Sep 17 00:00:00 2001 From: dhb52 Date: Thu, 1 Jun 2023 18:08:23 +0800 Subject: [PATCH 2/5] =?UTF-8?q?style:=20=E6=B7=BB=E5=8A=A0VO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mall/product/spu.ts | 5 +++ src/api/mall/promotion/coupon.ts | 6 +-- src/api/mall/promotion/couponTemplate.ts | 41 +++++++++++++++---- src/utils/constants.ts | 18 ++++++++ .../mall/promotion/couponTemplate/index.vue | 12 +++--- 5 files changed, 64 insertions(+), 18 deletions(-) diff --git a/src/api/mall/product/spu.ts b/src/api/mall/product/spu.ts index fd55e126..9fd87395 100644 --- a/src/api/mall/product/spu.ts +++ b/src/api/mall/product/spu.ts @@ -90,3 +90,8 @@ export const deleteSpu = (id: number) => { export const exportSpu = async (params) => { return await request.download({ url: '/product/spu/export', params }) } + +// 获得商品 SPU 精简列表 +export const getSpuSimpleList = async () => { + 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 index 99e8a027..ab50c3cc 100755 --- a/src/api/mall/promotion/coupon.ts +++ b/src/api/mall/promotion/coupon.ts @@ -1,16 +1,16 @@ import request from '@/config/axios' // 删除优惠劵 -export function deleteCoupon(id) { +export const deleteCoupon = async (id: number) => { return request.delete({ url: `/promotion/coupon/delete?id=${id}` }) } // 获得优惠劵分页 -export function getCouponPage(query) { +export const getCouponPage = async (params: PageParam) => { return request.get({ url: '/promotion/coupon/page', - params: query + params: params }) } diff --git a/src/api/mall/promotion/couponTemplate.ts b/src/api/mall/promotion/couponTemplate.ts index a861b127..6a58876e 100755 --- a/src/api/mall/promotion/couponTemplate.ts +++ b/src/api/mall/promotion/couponTemplate.ts @@ -1,7 +1,30 @@ import request from '@/config/axios' +export interface CouponTemplateVO { + id: number + name: string + status: number + totalCount: number + takeLimitCount: number + takeType: number + usePrice: number + productScope: number + productSpuIds: string + validityType: number + validStartTime: Date + validEndTime: Date + fixedStartTerm: number + fixedEndTerm: number + discountType: number + discountPercent: number + discountPrice: number + discountLimitPrice: number + takeCount: number + useCount: number +} + // 创建优惠劵模板 -export function createCouponTemplate(data) { +export function createCouponTemplate(data: CouponTemplateVO) { return request.post({ url: '/promotion/coupon-template/create', data: data @@ -9,7 +32,7 @@ export function createCouponTemplate(data) { } // 更新优惠劵模板 -export function updateCouponTemplate(data) { +export function updateCouponTemplate(data: CouponTemplateVO) { return request.put({ url: '/promotion/coupon-template/update', data: data @@ -17,7 +40,7 @@ export function updateCouponTemplate(data) { } // 更新优惠劵模板的状态 -export function updateCouponTemplateStatus(id, status) { +export function updateCouponTemplateStatus(id: number, status: [0, 1]) { const data = { id, status @@ -29,32 +52,32 @@ export function updateCouponTemplateStatus(id, status) { } // 删除优惠劵模板 -export function deleteCouponTemplate(id) { +export function deleteCouponTemplate(id: number) { return request.delete({ url: '/promotion/coupon-template/delete?id=' + id }) } // 获得优惠劵模板 -export function getCouponTemplate(id) { +export function getCouponTemplate(id: number) { return request.get({ url: '/promotion/coupon-template/get?id=' + id }) } // 获得优惠劵模板分页 -export function getCouponTemplatePage(query) { +export function getCouponTemplatePage(params: PageParam) { return request.get({ url: '/promotion/coupon-template/page', - params: query + params: params }) } // 导出优惠劵模板 Excel -export function exportCouponTemplateExcel(query) { +export function exportCouponTemplateExcel(params: PageParam) { return request.get({ url: '/promotion/coupon-template/export-excel', - params: query, + params: params, responseType: 'blob' }) } diff --git a/src/utils/constants.ts b/src/utils/constants.ts index a9d41b90..58b4a931 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -221,6 +221,24 @@ export const PayRefundStatusEnum = { } } +/** + * 商品 SPU 状态 + */ +export const ProductSpuStatusEnum = { + RECYCLE: { + status: -1, + name: '回收站' + }, + DISABLE: { + status: 0, + name: '下架' + }, + ENABLE: { + status: 1, + name: '上架' + } +} + /** * 优惠劵模板的有限期类型的枚举 */ diff --git a/src/views/mall/promotion/couponTemplate/index.vue b/src/views/mall/promotion/couponTemplate/index.vue index a1424413..b63e93e1 100755 --- a/src/views/mall/promotion/couponTemplate/index.vue +++ b/src/views/mall/promotion/couponTemplate/index.vue @@ -491,7 +491,7 @@ const handleAdd = () => { } /** 修改按钮操作 */ -const handleUpdate = async (row) => { +const handleUpdate = async (row: any) => { reset() const id = row.id try { @@ -558,7 +558,7 @@ const submitForm = async () => { } /** 优惠劵模板状态修改 */ -const handleStatusChange = async (row) => { +const handleStatusChange = async (row: any) => { // 此时,row 已经变成目标状态了,所以可以直接提交请求和提示 let text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用' @@ -574,7 +574,7 @@ const handleStatusChange = async (row) => { } /** 删除按钮操作 */ -const handleDelete = async (row) => { +const handleDelete = async (row: any) => { const id = row.id try { await message.confirm('是否确认删除优惠劵编号为"' + id + '"的数据项?') @@ -583,7 +583,7 @@ const handleDelete = async (row) => { } // 格式化【优惠金额/折扣】 -const discountFormat = (row) => { +const discountFormat = (row: any) => { if (row.discountType === PromotionDiscountTypeEnum.PRICE.type) { return `¥${(row.discountPrice / 100.0).toFixed(2)}` } @@ -594,7 +594,7 @@ const discountFormat = (row) => { } // 格式化【领取上限】 -const takeLimitCountFormat = (row) => { +const takeLimitCountFormat = (row: any) => { if (row.takeLimitCount === -1) { return '无领取限制' } @@ -602,7 +602,7 @@ const takeLimitCountFormat = (row) => { } // 格式化【有效期限】 -const validityTypeFormat = (row) => { +const validityTypeFormat = (row: any) => { if (row.validityType === CouponTemplateValidityTypeEnum.DATE.type) { return `${formatDate(row.validStartTime)} 至 ${formatDate(row.validEndTime)}` } From 60c1604d4947df8f2eaaa748780af9db9f75831f Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 3 Jun 2023 19:52:14 +0800 Subject: [PATCH 3/5] =?UTF-8?q?code=20review=EF=BC=9A=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E8=87=AA=E6=8F=90=E3=80=81=E5=BF=AB=E9=80=92=E8=BF=90=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trade/delivery/expressTemplate/index.ts | 5 --- .../expressTemplate/ExpressTemplateForm.vue | 43 ++++++++++++++++--- .../trade/delivery/expressTemplate/index.vue | 1 + .../delivery/pickUpStore/PickUpStoreForm.vue | 23 +++++----- .../mall/trade/delivery/pickUpStore/index.vue | 4 +- 5 files changed, 51 insertions(+), 25 deletions(-) diff --git a/src/api/mall/trade/delivery/expressTemplate/index.ts b/src/api/mall/trade/delivery/expressTemplate/index.ts index 9414c847..be3da96e 100644 --- a/src/api/mall/trade/delivery/expressTemplate/index.ts +++ b/src/api/mall/trade/delivery/expressTemplate/index.ts @@ -47,8 +47,3 @@ export const updateDeliveryExpressTemplate = async (data: DeliveryExpressTemplat export const deleteDeliveryExpressTemplate = async (id: number) => { return await request.delete({ url: '/trade/delivery/express-template/delete?id=' + id }) } - -// 导出快递运费模板 Excel -export const exportDeliveryExpressTemplateApi = async (params) => { - return await request.download({ url: '/trade/delivery/express-template/export-excel', params }) -} diff --git a/src/views/mall/trade/delivery/expressTemplate/ExpressTemplateForm.vue b/src/views/mall/trade/delivery/expressTemplate/ExpressTemplateForm.vue index 5b25422d..6c9ff296 100644 --- a/src/views/mall/trade/delivery/expressTemplate/ExpressTemplateForm.vue +++ b/src/views/mall/trade/delivery/expressTemplate/ExpressTemplateForm.vue @@ -89,7 +89,7 @@