Skip to content

Commit ed0f3a3

Browse files
YunaiVgitee-org
authored andcommitted
!293 完善 banner 管理。商品 spu 剔除优惠卷相关逻辑
Merge pull request !293 from puhui999/dev-to-dev
2 parents 6c6c2cb + 95d7d1e commit ed0f3a3

File tree

14 files changed

+234
-161
lines changed

14 files changed

+234
-161
lines changed

src/api/mall/market/banner/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,32 @@ export interface BannerVO {
66
picUrl: string
77
status: number
88
url: string
9+
position: number
910
sort: number
1011
memo: string
1112
}
1213

1314
// 查询Banner管理列表
1415
export const getBannerPage = async (params) => {
15-
return await request.get({ url: `/market/banner/page`, params })
16+
return await request.get({ url: `/promotion/banner/page`, params })
1617
}
1718

1819
// 查询Banner管理详情
1920
export const getBanner = async (id: number) => {
20-
return await request.get({ url: `/market/banner/get?id=` + id })
21+
return await request.get({ url: `/promotion/banner/get?id=` + id })
2122
}
2223

2324
// 新增Banner管理
2425
export const createBanner = async (data: BannerVO) => {
25-
return await request.post({ url: `/market/banner/create`, data })
26+
return await request.post({ url: `/promotion/banner/create`, data })
2627
}
2728

2829
// 修改Banner管理
2930
export const updateBanner = async (data: BannerVO) => {
30-
return await request.put({ url: `/market/banner/update`, data })
31+
return await request.put({ url: `/promotion/banner/update`, data })
3132
}
3233

3334
// 删除Banner管理
3435
export const deleteBanner = async (id: number) => {
35-
return await request.delete({ url: `/market/banner/delete?id=` + id })
36+
return await request.delete({ url: `/promotion/banner/delete?id=` + id })
3637
}

src/api/mall/product/spu.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ export interface Spu {
6161
createTime?: Date // 商品创建时间
6262
status?: number // 商品状态
6363
activityOrders: number[] // 活动排序
64-
giveCouponTemplates: GiveCouponTemplate[] // 优惠卷
6564
}
6665

6766
// 获得 Spu 列表

src/utils/dict.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ export enum DICT_TYPE {
184184
PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举
185185
PROMOTION_BARGAIN_RECORD_STATUS = 'promotion_bargain_record_status', // 砍价记录的状态
186186
PROMOTION_COMBINATION_RECORD_STATUS = 'promotion_combination_record_status', // 拼团记录的状态
187+
BANNER_POSITION = 'banner_position', // banner 定位
187188

188189
// ========== CRM - 客户管理模块 ==========
189190
CRM_RECEIVABLE_CHECK_STATUS = 'crm_receivable_check_status',

src/views/mall/product/spu/form/ActivityOrdersSort.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ const initSortable = () => {
5454
}
5555
onMounted(async () => {
5656
await nextTick()
57+
// 如果活动排序为空也就是新增的时候加入活动
58+
if (props.activityOrders && props.activityOrders.length === 0) {
59+
emit(
60+
'update:activityOrders',
61+
props.promotionTypes.map((item) => item.value as number)
62+
)
63+
}
5764
initSortable()
5865
})
5966
</script>

src/views/mall/product/spu/form/OtherSettingsForm.vue

Lines changed: 61 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,12 @@
4242
</el-col>
4343
<el-col :span="24">
4444
<el-form-item label="活动优先级">
45-
<!-- TODO @puhui999:这个目前先写死;主要是,这个优惠类型不好用 promotion_type_enum;因为优惠劵、会员折扣都算。 -->
4645
<ActivityOrdersSort
4746
v-model:activity-orders="formData.activityOrders"
4847
:promotion-types="promotionTypes"
4948
/>
5049
</el-form-item>
5150
</el-col>
52-
<el-col :span="24">
53-
<el-form-item label="赠送优惠劵">
54-
<el-tag
55-
v-for="coupon in formData.giveCouponTemplates"
56-
:key="coupon.id as number"
57-
class="mr-[10px]"
58-
>
59-
{{ coupon.name }}
60-
</el-tag>
61-
<el-button @click="openCouponSelect">选择优惠券</el-button>
62-
</el-form-item>
63-
</el-col>
6451
</el-row>
6552
</el-form>
6653

@@ -91,26 +78,15 @@
9178
{{ promotionTypes.find((item) => item.value === activityType)?.label }}
9279
</el-tag>
9380
</template>
94-
<template #giveCouponTemplates="{ row }">
95-
<el-tag
96-
v-for="coupon in row.giveCouponTemplates"
97-
:key="coupon.id as number"
98-
class="mr-[10px]"
99-
>
100-
{{ coupon.name }}
101-
</el-tag>
102-
</template>
10381
</Descriptions>
104-
<CouponSelect ref="couponSelectRef" v-model:multiple-selection="formData.giveCouponTemplates" />
10582
</template>
10683
<script lang="ts" setup>
10784
import type { Spu } from '@/api/mall/product/spu'
10885
import { PropType } from 'vue'
10986
import { propTypes } from '@/utils/propTypes'
11087
import { copyValueToTarget } from '@/utils'
11188
import { otherSettingsSchema } from './spu.data'
112-
import { DICT_TYPE, DictDataType, getIntDictOptions } from '@/utils/dict'
113-
import CouponSelect from './CouponSelect.vue'
89+
import { DICT_TYPE, DictDataType } from '@/utils/dict'
11490
import ActivityOrdersSort from './ActivityOrdersSort.vue'
11591
11692
defineOptions({ name: 'OtherSettingsForm' })
@@ -128,14 +104,66 @@ const props = defineProps({
128104
isDetail: propTypes.bool.def(false) // 是否作为详情组件
129105
})
130106
131-
// 优惠卷
132-
const couponSelectRef = ref() // 优惠卷模版选择 Ref
133-
const openCouponSelect = () => {
134-
couponSelectRef.value?.open()
135-
}
136-
107+
// TODO @puhui999:这个目前先写死;主要是,这个优惠类型不好用 promotion_type_enum;因为优惠劵、会员折扣都算
137108
// 活动优先级处理
138-
const promotionTypes = ref<DictDataType[]>(getIntDictOptions(DICT_TYPE.PROMOTION_TYPE_ENUM))
109+
const promotionTypes = ref<DictDataType[]>([
110+
{
111+
dictType: 'promotionTypes',
112+
label: '秒杀活动',
113+
value: 1,
114+
colorType: 'warning',
115+
cssClass: ''
116+
},
117+
{
118+
dictType: 'promotionTypes',
119+
label: '砍价活动',
120+
value: 2,
121+
colorType: 'warning',
122+
cssClass: ''
123+
},
124+
{
125+
dictType: 'promotionTypes',
126+
label: '拼团活动',
127+
value: 3,
128+
colorType: 'warning',
129+
cssClass: ''
130+
},
131+
{
132+
dictType: 'promotionTypes',
133+
label: '限时折扣',
134+
value: 4,
135+
colorType: 'warning',
136+
cssClass: ''
137+
},
138+
{
139+
dictType: 'promotionTypes',
140+
label: '满减送',
141+
value: 5,
142+
colorType: 'warning',
143+
cssClass: ''
144+
},
145+
{
146+
dictType: 'promotionTypes',
147+
label: '会员折扣',
148+
value: 6,
149+
colorType: 'warning',
150+
cssClass: ''
151+
},
152+
{
153+
dictType: 'promotionTypes',
154+
label: '优惠劵',
155+
value: 7,
156+
colorType: 'warning',
157+
cssClass: ''
158+
},
159+
{
160+
dictType: 'promotionTypes',
161+
label: '积分',
162+
value: 8,
163+
colorType: 'warning',
164+
cssClass: ''
165+
}
166+
])
139167
140168
const otherSettingsFormRef = ref() // 表单Ref
141169
// 表单数据
@@ -148,8 +176,7 @@ const formData = ref<Spu>({
148176
recommendBest: false, // 是否精品
149177
recommendNew: false, // 是否新品
150178
recommendGood: false, // 是否优品
151-
activityOrders: [], // 活动排序
152-
giveCouponTemplates: [] // 赠送的优惠券
179+
activityOrders: [] // 活动排序
153180
})
154181
// 表单规则
155182
const rules = reactive({

src/views/mall/product/spu/form/index.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ const formData = ref<ProductSpuApi.Spu>({
9595
recommendBest: false, // 是否精品
9696
recommendNew: false, // 是否新品
9797
recommendGood: false, // 是否优品
98-
activityOrders: [], // 活动排序
99-
giveCouponTemplates: [] // 赠送的优惠券
98+
activityOrders: [] // 活动排序
10099
})
101100
102101
/** 获得详情 */

src/views/mall/product/spu/form/spu.data.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ export const otherSettingsSchema = reactive<CrudSchema[]>([
9494
label: '是否优品推荐',
9595
field: 'recommendGood'
9696
},
97-
{
98-
label: '赠送的优惠劵',
99-
field: 'giveCouponTemplates'
100-
},
10197
{
10298
label: '活动显示排序',
10399
field: 'activityOrders'

src/views/mall/promotion/banner/BannerForm.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@
4141
</el-radio-group>
4242
</el-form-item>
4343
</el-col>
44+
<el-col :span="24">
45+
<el-form-item label="定位" prop="position">
46+
<el-radio-group v-model="formData.position">
47+
<el-radio
48+
v-for="dict in getIntDictOptions(DICT_TYPE.BANNER_POSITION)"
49+
:key="dict.value"
50+
:label="dict.value"
51+
>
52+
{{ dict.label }}
53+
</el-radio>
54+
</el-radio-group>
55+
</el-form-item>
56+
</el-col>
4457
<el-col :span="24">
4558
<el-form-item label="描述" prop="memo">
4659
<el-input v-model="formData.memo" placeholder="请输入描述" type="textarea" />
@@ -70,6 +83,7 @@ const formData = ref({
7083
title: undefined,
7184
picUrl: undefined,
7285
status: 0,
86+
position: 1,
7387
url: undefined,
7488
sort: 0,
7589
memo: undefined
@@ -133,6 +147,7 @@ const resetForm = () => {
133147
title: undefined,
134148
picUrl: undefined,
135149
status: 0,
150+
position: 1,
136151
url: undefined,
137152
sort: 0,
138153
memo: undefined

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
重置
4949
</el-button>
5050
<el-button
51-
v-hasPermi="['market:banner:create']"
51+
v-hasPermi="['promotion:banner:create']"
5252
plain
5353
type="primary"
5454
@click="openForm('create')"
@@ -74,6 +74,11 @@
7474
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
7575
</template>
7676
</el-table-column>
77+
<el-table-column align="center" label="定位" prop="position">
78+
<template #default="scope">
79+
<dict-tag :type="DICT_TYPE.BANNER_POSITION" :value="scope.row.position" />
80+
</template>
81+
</el-table-column>
7782
<el-table-column align="center" label="跳转地址" prop="url" />
7883
<el-table-column
7984
:formatter="dateFormatter"
@@ -87,15 +92,15 @@
8792
<el-table-column align="center" label="操作">
8893
<template #default="scope">
8994
<el-button
90-
v-hasPermi="['market:banner:update']"
95+
v-hasPermi="['promotion:banner:update']"
9196
link
9297
type="primary"
9398
@click="openForm('update', scope.row.id)"
9499
>
95100
编辑
96101
</el-button>
97102
<el-button
98-
v-hasPermi="['market:banner:delete']"
103+
v-hasPermi="['promotion:banner:delete']"
99104
link
100105
type="danger"
101106
@click="handleDelete(scope.row.id)"

0 commit comments

Comments
 (0)