diff --git a/src/api/mall/product/spu.ts b/src/api/mall/product/spu.ts index e0d4ec83..b6bec97e 100644 --- a/src/api/mall/product/spu.ts +++ b/src/api/mall/product/spu.ts @@ -88,3 +88,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 new file mode 100755 index 00000000..565b86f7 --- /dev/null +++ b/src/api/mall/promotion/coupon.ts @@ -0,0 +1,18 @@ +import request from '@/config/axios' + +// TODO @dhb52:vo 缺少 + +// 删除优惠劵 +export const deleteCoupon = async (id: number) => { + return request.delete({ + url: `/promotion/coupon/delete?id=${id}` + }) +} + +// 获得优惠劵分页 +export const getCouponPage = async (params: PageParam) => { + return request.get({ + url: '/promotion/coupon/page', + params: params + }) +} diff --git a/src/api/mall/promotion/couponTemplate.ts b/src/api/mall/promotion/couponTemplate.ts new file mode 100755 index 00000000..6a58876e --- /dev/null +++ b/src/api/mall/promotion/couponTemplate.ts @@ -0,0 +1,83 @@ +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: CouponTemplateVO) { + return request.post({ + url: '/promotion/coupon-template/create', + data: data + }) +} + +// 更新优惠劵模板 +export function updateCouponTemplate(data: CouponTemplateVO) { + return request.put({ + url: '/promotion/coupon-template/update', + data: data + }) +} + +// 更新优惠劵模板的状态 +export function updateCouponTemplateStatus(id: number, status: [0, 1]) { + const data = { + id, + status + } + return request.put({ + url: '/promotion/coupon-template/update-status', + data: data + }) +} + +// 删除优惠劵模板 +export function deleteCouponTemplate(id: number) { + return request.delete({ + url: '/promotion/coupon-template/delete?id=' + id + }) +} + +// 获得优惠劵模板 +export function getCouponTemplate(id: number) { + return request.get({ + url: '/promotion/coupon-template/get?id=' + id + }) +} + +// 获得优惠劵模板分页 +export function getCouponTemplatePage(params: PageParam) { + return request.get({ + url: '/promotion/coupon-template/page', + params: params + }) +} + +// 导出优惠劵模板 Excel +export function exportCouponTemplateExcel(params: PageParam) { + return request.get({ + url: '/promotion/coupon-template/export-excel', + params: params, + responseType: 'blob' + }) +} diff --git a/src/api/mall/trade/delivery/expressTemplate/index.ts b/src/api/mall/trade/delivery/expressTemplate/index.ts index 53f2cdeb..9ed23bc1 100644 --- a/src/api/mall/trade/delivery/expressTemplate/index.ts +++ b/src/api/mall/trade/delivery/expressTemplate/index.ts @@ -52,8 +52,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/utils/constants.ts b/src/utils/constants.ts index e37b6abc..b2914f9e 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -222,7 +222,7 @@ export const PayRefundStatusEnum = { } /** - * 商品SPU枚举类 + * 商品 SPU 状态 */ export const ProductSpuStatusEnum = { RECYCLE: { @@ -238,3 +238,59 @@ export const ProductSpuStatusEnum = { 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 PromotionDiscountTypeEnum = { + PRICE: { + type: 1, + name: '满减' + }, + PERCENT: { + type: 2, + name: '折扣' + } +} diff --git a/src/utils/dict.ts b/src/utils/dict.ts index c742274f..73913b91 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -146,9 +146,12 @@ export enum DICT_TYPE { MP_AUTO_REPLY_REQUEST_MATCH = 'mp_auto_reply_request_match', // 自动回复请求匹配类型 MP_MESSAGE_TYPE = 'mp_message_type', // 消息类型 - // ========== MALL 模块 ========== - PRODUCT_UNIT = 'product_unit', // 商品单位 - PRODUCT_SPU_STATUS = 'product_spu_status', //商品状态 - // ========== MALL 交易模块 ========== - EXPRESS_CHARGE_MODE = 'trade_delivery_express_charge_mode' //快递的计费方式 + // ========== 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/utils/tree.ts b/src/utils/tree.ts index 65a9345c..c8503f54 100644 --- a/src/utils/tree.ts +++ b/src/utils/tree.ts @@ -306,11 +306,14 @@ export const handleTree2 = (data, id, parentId, children, rootId) => { }) return treeData !== '' ? treeData : data } + /** + * 校验选中的节点,是否为指定 level * * @param tree 要操作的树结构数据 * @param nodeId 需要判断在什么层级的数据 * @param level 检查的级别, 默认检查到二级 + * @return true 是;false 否 */ export const checkSelectedNode = (tree: any[], nodeId: any, level = 2): boolean => { if (typeof tree === 'undefined' || !Array.isArray(tree) || tree.length === 0) { diff --git a/src/views/mall/product/spu/components/BasicInfoForm.vue b/src/views/mall/product/spu/components/BasicInfoForm.vue index 00a82a87..b8ae405c 100644 --- a/src/views/mall/product/spu/components/BasicInfoForm.vue +++ b/src/views/mall/product/spu/components/BasicInfoForm.vue @@ -1,4 +1,5 @@ diff --git a/src/views/mall/promotion/couponTemplate/index.vue b/src/views/mall/promotion/couponTemplate/index.vue new file mode 100755 index 00000000..b63e93e1 --- /dev/null +++ b/src/views/mall/promotion/couponTemplate/index.vue @@ -0,0 +1,614 @@ + + + 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 @@