Skip to content

Commit 190c6e3

Browse files
YunaiVgitee-org
authored andcommitted
!225 优惠券
Merge pull request !225 from 疯狂的世界/owen_dev
2 parents 0743e49 + 27219e1 commit 190c6e3

File tree

10 files changed

+591
-161
lines changed

10 files changed

+591
-161
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,11 @@ export const getCouponPage = async (params: PageParam) => {
1616
params: params
1717
})
1818
}
19+
20+
// 发送优惠券
21+
export const sendCoupon = async (data: any) => {
22+
return request.post({
23+
url: '/promotion/coupon/send',
24+
data: data
25+
})
26+
}

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface CouponTemplateVO {
99
takeType: number
1010
usePrice: number
1111
productScope: number
12-
productSpuIds: string
12+
productSpuIds: number[]
1313
validityType: number
1414
validStartTime: Date
1515
validEndTime: Date
@@ -73,6 +73,14 @@ 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+
7684
// 导出优惠劵模板 Excel
7785
export function exportCouponTemplateExcel(params: PageParam) {
7886
return request.get({

src/utils/constants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ export const PromotionProductScopeEnum = {
220220
SPU: {
221221
scope: 2,
222222
name: '指定商品参与'
223+
},
224+
CATEGORY: {
225+
scope: 3,
226+
name: '指定品类参与'
223227
}
224228
}
225229

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<template>
2+
<el-tree-select
3+
v-model="selectCategoryId"
4+
:data="categoryList"
5+
:props="defaultProps"
6+
:multiple="multiple"
7+
:show-checkbox="multiple"
8+
class="w-1/1"
9+
node-key="id"
10+
placeholder="请选择商品分类"
11+
/>
12+
</template>
13+
<script lang="ts" setup>
14+
import { defaultProps, handleTree } from '@/utils/tree'
15+
import * as ProductCategoryApi from '@/api/mall/product/category'
16+
import { oneOf } from 'vue-types'
17+
import { propTypes } from '@/utils/propTypes'
18+
19+
/** 商品分类选择组件 */
20+
defineOptions({ name: 'ProductCategorySelect' })
21+
22+
const props = defineProps({
23+
value: oneOf([propTypes.number, propTypes.array.def([])]).isRequired, // 选中的ID
24+
multiple: propTypes.bool.def(false) // 是否多选
25+
})
26+
27+
/** 选中的分类ID */
28+
const selectCategoryId = computed({
29+
get: () => {
30+
return props.value
31+
},
32+
set: (val: number | number[]) => {
33+
emit('update:modelValue', val)
34+
}
35+
})
36+
37+
/** 分类选择 */
38+
const emit = defineEmits(['update:modelValue'])
39+
40+
const categoryList = ref([]) // 分类树
41+
42+
onMounted(async () => {
43+
// 获得分类树
44+
const data = await ProductCategoryApi.getCategoryList({})
45+
categoryList.value = handleTree(data, 'id', 'parentId')
46+
})
47+
</script>

0 commit comments

Comments
 (0)