From 76c4644b4b9d292643672666fa06363e0c6c8908 Mon Sep 17 00:00:00 2001 From: owen Date: Fri, 1 Sep 2023 23:50:26 +0800 Subject: [PATCH] =?UTF-8?q?mall=EF=BC=9A=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E5=8F=91=E9=80=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/promotion/coupon/couponTemplate.ts | 8 -------- src/utils/constants.ts | 18 ++++++++++++++++++ .../promotion/coupon/components/CouponSend.vue | 13 +++++-------- src/views/mall/promotion/coupon/index.vue | 3 ++- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/api/mall/promotion/coupon/couponTemplate.ts b/src/api/mall/promotion/coupon/couponTemplate.ts index bf294441..ec26ce72 100755 --- a/src/api/mall/promotion/coupon/couponTemplate.ts +++ b/src/api/mall/promotion/coupon/couponTemplate.ts @@ -73,14 +73,6 @@ export function getCouponTemplatePage(params: PageParam) { }) } -// 获得可用于领取的优惠劵模板分页 -export function getCanTakeCouponTemplatePage(params: PageParam) { - return request.get({ - url: '/promotion/coupon-template/can-take-page', - params: params - }) -} - // 导出优惠劵模板 Excel export function exportCouponTemplateExcel(params: PageParam) { return request.get({ diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 03c1f999..e5d8d647 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -209,6 +209,24 @@ export const CouponTemplateValidityTypeEnum = { } } +/** + * 优惠劵模板的领取方式的枚举 + */ +export const CouponTemplateTakeTypeEnum = { + BY_USER: { + type: 1, + name: '直接领取' + }, + BY_ADMIN: { + type: 2, + name: '指定发放' + }, + BY_REGISTER: { + type: 3, + name: '新人券' + } +} + /** * 营销的商品范围枚举 */ diff --git a/src/views/mall/promotion/coupon/components/CouponSend.vue b/src/views/mall/promotion/coupon/components/CouponSend.vue index 7686539b..44e6b13e 100644 --- a/src/views/mall/promotion/coupon/components/CouponSend.vue +++ b/src/views/mall/promotion/coupon/components/CouponSend.vue @@ -90,6 +90,7 @@ import { userPriceFormat, validityTypeFormat } from '@/views/mall/promotion/coupon/formatter' +import { CouponTemplateTakeTypeEnum } from '@/utils/constants' defineOptions({ name: 'PromotionCouponSend' }) @@ -102,7 +103,8 @@ const dialogVisible = ref(false) // 弹窗的是否展示 const queryParams = ref({ pageNo: 1, pageSize: 10, - name: null + name: null, + canTakeTypes: [CouponTemplateTakeTypeEnum.BY_ADMIN.type] }) // 查询参数 const queryFormRef = ref() // 搜索的表单 // 领取人的编号列表 @@ -122,7 +124,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗 const getList = async () => { loading.value = true try { - const data = await CouponTemplateApi.getCanTakeCouponTemplatePage(queryParams.value) + const data = await CouponTemplateApi.getCouponTemplatePage(queryParams.value) list.value = data.list total.value = data.total } finally { @@ -132,7 +134,7 @@ const getList = async () => { /** 搜索按钮操作 */ const handleQuery = () => { - queryParams.pageNo = 1 + queryParams.value.pageNo = 1 getList() } @@ -154,9 +156,4 @@ const handleSendCoupon = async (templateId: number) => { sendLoading.value = false } } - -/** 初始化 **/ -// onMounted(async () => { -// await getList() -// }) diff --git a/src/views/mall/promotion/coupon/index.vue b/src/views/mall/promotion/coupon/index.vue index acfccece..9f81edf2 100755 --- a/src/views/mall/promotion/coupon/index.vue +++ b/src/views/mall/promotion/coupon/index.vue @@ -122,7 +122,8 @@ const queryParams = reactive({ pageNo: 1, pageSize: 10, createTime: [], - status: undefined + status: undefined, + nickname: undefined }) const queryFormRef = ref() // 搜索的表单