Skip to content

Commit 76c4644

Browse files
committed
mall:优惠券发送优化
1 parent 190c6e3 commit 76c4644

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

src/api/mall/promotion/coupon/couponTemplate.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,6 @@ export function getCouponTemplatePage(params: PageParam) {
7373
})
7474
}
7575

76-
// 获得可用于领取的优惠劵模板分页
77-
export function getCanTakeCouponTemplatePage(params: PageParam) {
78-
return request.get({
79-
url: '/promotion/coupon-template/can-take-page',
80-
params: params
81-
})
82-
}
83-
8476
// 导出优惠劵模板 Excel
8577
export function exportCouponTemplateExcel(params: PageParam) {
8678
return request.get({

src/utils/constants.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,24 @@ export const CouponTemplateValidityTypeEnum = {
209209
}
210210
}
211211

212+
/**
213+
* 优惠劵模板的领取方式的枚举
214+
*/
215+
export const CouponTemplateTakeTypeEnum = {
216+
BY_USER: {
217+
type: 1,
218+
name: '直接领取'
219+
},
220+
BY_ADMIN: {
221+
type: 2,
222+
name: '指定发放'
223+
},
224+
BY_REGISTER: {
225+
type: 3,
226+
name: '新人券'
227+
}
228+
}
229+
212230
/**
213231
* 营销的商品范围枚举
214232
*/

src/views/mall/promotion/coupon/components/CouponSend.vue

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ import {
9090
userPriceFormat,
9191
validityTypeFormat
9292
} from '@/views/mall/promotion/coupon/formatter'
93+
import { CouponTemplateTakeTypeEnum } from '@/utils/constants'
9394
9495
defineOptions({ name: 'PromotionCouponSend' })
9596
@@ -102,7 +103,8 @@ const dialogVisible = ref(false) // 弹窗的是否展示
102103
const queryParams = ref({
103104
pageNo: 1,
104105
pageSize: 10,
105-
name: null
106+
name: null,
107+
canTakeTypes: [CouponTemplateTakeTypeEnum.BY_ADMIN.type]
106108
}) // 查询参数
107109
const queryFormRef = ref() // 搜索的表单
108110
// 领取人的编号列表
@@ -122,7 +124,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
122124
const getList = async () => {
123125
loading.value = true
124126
try {
125-
const data = await CouponTemplateApi.getCanTakeCouponTemplatePage(queryParams.value)
127+
const data = await CouponTemplateApi.getCouponTemplatePage(queryParams.value)
126128
list.value = data.list
127129
total.value = data.total
128130
} finally {
@@ -132,7 +134,7 @@ const getList = async () => {
132134
133135
/** 搜索按钮操作 */
134136
const handleQuery = () => {
135-
queryParams.pageNo = 1
137+
queryParams.value.pageNo = 1
136138
getList()
137139
}
138140
@@ -154,9 +156,4 @@ const handleSendCoupon = async (templateId: number) => {
154156
sendLoading.value = false
155157
}
156158
}
157-
158-
/** 初始化 **/
159-
// onMounted(async () => {
160-
// await getList()
161-
// })
162159
</script>

src/views/mall/promotion/coupon/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ const queryParams = reactive({
122122
pageNo: 1,
123123
pageSize: 10,
124124
createTime: [],
125-
status: undefined
125+
status: undefined,
126+
nickname: undefined
126127
})
127128
const queryFormRef = ref() // 搜索的表单
128129

0 commit comments

Comments
 (0)