Skip to content

Commit c486dfd

Browse files
committed
【功能优化】重构拼团装修(仍需优化)
1 parent 18880c7 commit c486dfd

File tree

7 files changed

+877
-230
lines changed

7 files changed

+877
-230
lines changed
Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,74 @@
11
import request from '@/config/axios'
2-
import { Sku, Spu } from '@/api/mall/product/spu'
2+
import {Sku, Spu} from '@/api/mall/product/spu'
33

44
export interface CombinationActivityVO {
5-
id?: number
6-
name?: string
7-
spuId?: number
8-
totalLimitCount?: number
9-
singleLimitCount?: number
10-
startTime?: Date
11-
endTime?: Date
12-
userSize?: number
13-
totalCount?: number
14-
successCount?: number
15-
orderUserCount?: number
16-
virtualGroup?: number
17-
status?: number
18-
limitDuration?: number
19-
products: CombinationProductVO[]
5+
id?: number
6+
name?: string
7+
spuId?: number
8+
totalLimitCount?: number
9+
singleLimitCount?: number
10+
startTime?: Date
11+
endTime?: Date
12+
userSize?: number
13+
totalCount?: number
14+
successCount?: number
15+
orderUserCount?: number
16+
virtualGroup?: number
17+
status?: number
18+
limitDuration?: number
19+
products: CombinationProductVO[]
20+
spuName?: string
21+
picUrl?: string
22+
marketPrice?: number
2023
}
2124

2225
// 拼团活动所需属性
2326
export interface CombinationProductVO {
24-
spuId: number
25-
skuId: number
26-
combinationPrice: number // 拼团价格
27+
spuId: number
28+
skuId: number
29+
combinationPrice: number // 拼团价格
2730
}
2831

2932
// 扩展 Sku 配置
3033
export type SkuExtension = Sku & {
31-
productConfig: CombinationProductVO
34+
productConfig: CombinationProductVO
3235
}
3336

3437
export interface SpuExtension extends Spu {
35-
skus: SkuExtension[] // 重写类型
38+
skus: SkuExtension[] // 重写类型
3639
}
3740

3841
// 查询拼团活动列表
3942
export const getCombinationActivityPage = async (params) => {
40-
return await request.get({ url: '/promotion/combination-activity/page', params })
43+
return await request.get({url: '/promotion/combination-activity/page', params})
4144
}
4245

4346
// 查询拼团活动详情
4447
export const getCombinationActivity = async (id: number) => {
45-
return await request.get({ url: '/promotion/combination-activity/get?id=' + id })
48+
return await request.get({url: '/promotion/combination-activity/get?id=' + id})
49+
}
50+
51+
// 查询拼团活动详情列表
52+
export const getCombinationActivityDetailList = (ids: number[]) => {
53+
return request.get({url: `/promotion/combination-activity/list?combinationActivityIds=${ids}`})
4654
}
4755

4856
// 新增拼团活动
4957
export const createCombinationActivity = async (data: CombinationActivityVO) => {
50-
return await request.post({ url: '/promotion/combination-activity/create', data })
58+
return await request.post({url: '/promotion/combination-activity/create', data})
5159
}
5260

5361
// 修改拼团活动
5462
export const updateCombinationActivity = async (data: CombinationActivityVO) => {
55-
return await request.put({ url: '/promotion/combination-activity/update', data })
63+
return await request.put({url: '/promotion/combination-activity/update', data})
5664
}
5765

5866
// 关闭拼团活动
5967
export const closeCombinationActivity = async (id: number) => {
60-
return await request.put({ url: '/promotion/combination-activity/close?id=' + id })
68+
return await request.put({url: '/promotion/combination-activity/close?id=' + id})
6169
}
6270

6371
// 删除拼团活动
6472
export const deleteCombinationActivity = async (id: number) => {
65-
return await request.delete({ url: '/promotion/combination-activity/delete?id=' + id })
73+
return await request.delete({url: '/promotion/combination-activity/delete?id=' + id})
6674
}

src/components/DiyEditor/components/ComponentContainer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
...style
66
}"
77
>
8-
<component :is="component.id" :property="component.property" />
8+
<component :is="component.id" :property="component.property" :component="component" />
99
</div>
1010
<div class="component-wrap">
1111
<!-- 左侧:组件名(悬浮的小贴条) -->
Lines changed: 84 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,96 @@
1-
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
1+
import {ComponentStyle, DiyComponent} from '@/components/DiyEditor/util'
22

33
/** 拼团属性 */
44
export interface PromotionCombinationProperty {
5-
// 布局类型:单列 | 三列
6-
layoutType: 'oneCol' | 'threeCol'
7-
// 商品字段
8-
fields: {
9-
// 商品名称
10-
name: PromotionCombinationFieldProperty
11-
// 商品价格
12-
price: PromotionCombinationFieldProperty
13-
}
14-
// 角标
15-
badge: {
16-
// 是否显示
17-
show: boolean
18-
// 角标图片
19-
imgUrl: string
20-
}
21-
// 上圆角
22-
borderRadiusTop: number
23-
// 下圆角
24-
borderRadiusBottom: number
25-
// 间距
26-
space: number
27-
// 拼团活动编号
28-
activityId: number
29-
// 组件样式
30-
style: ComponentStyle
5+
// 布局类型:单列 | 三列
6+
layoutType: 'oneColBigImg' | 'oneColSmallImg' | 'twoCol';
7+
// 商品字段
8+
fields: {
9+
// 商品名称
10+
name: PromotionCombinationFieldProperty
11+
// 商品简介
12+
introduction: PromotionCombinationFieldProperty
13+
// 商品价格
14+
price: PromotionCombinationFieldProperty
15+
// 市场价
16+
marketPrice: PromotionCombinationFieldProperty
17+
// 商品销量
18+
salesCount: PromotionCombinationFieldProperty
19+
// 商品库存
20+
stock: PromotionCombinationFieldProperty
21+
}
22+
// 角标
23+
badge: {
24+
// 是否显示
25+
show: boolean
26+
// 角标图片
27+
imgUrl: string
28+
}
29+
// 按钮
30+
btnBuy: {
31+
// 类型:文字 | 图片
32+
type: 'text' | 'img'
33+
// 文字
34+
text: string
35+
// 文字按钮:背景渐变起始颜色
36+
bgBeginColor: string
37+
// 文字按钮:背景渐变结束颜色
38+
bgEndColor: string
39+
// 图片按钮:图片地址
40+
imgUrl: string
41+
}
42+
// 上圆角
43+
borderRadiusTop: number
44+
// 下圆角
45+
borderRadiusBottom: number
46+
// 间距
47+
space: number
48+
// 拼团活动编号
49+
activityIds: number[]
50+
// 组件样式
51+
style: ComponentStyle
3152
}
3253

3354
// 商品字段
3455
export interface PromotionCombinationFieldProperty {
35-
// 是否显示
36-
show: boolean
37-
// 颜色
38-
color: string
56+
// 是否显示
57+
show: boolean
58+
// 颜色
59+
color: string
3960
}
4061

4162
// 定义组件
4263
export const component = {
43-
id: 'PromotionCombination',
44-
name: '拼团',
45-
icon: 'mdi:account-group',
46-
property: {
47-
layoutType: 'oneCol',
48-
fields: {
49-
name: { show: true, color: '#000' },
50-
price: { show: true, color: '#ff3000' }
51-
},
52-
badge: { show: false, imgUrl: '' },
53-
borderRadiusTop: 8,
54-
borderRadiusBottom: 8,
55-
space: 8,
56-
style: {
57-
bgType: 'color',
58-
bgColor: '',
59-
marginLeft: 8,
60-
marginRight: 8,
61-
marginBottom: 8
62-
} as ComponentStyle
63-
}
64+
id: 'PromotionCombination',
65+
name: '拼团',
66+
icon: 'mdi:account-group',
67+
property: {
68+
layoutType: 'oneColSmallImg',
69+
fields: {
70+
name: {show: true, color: '#000'},
71+
introduction: {show: true, color: '#999'},
72+
price: {show: true, color: '#ff3000'},
73+
marketPrice: {show: true, color: '#c4c4c4'},
74+
salesCount: {show: true, color: '#c4c4c4'},
75+
stock: {show: false, color: '#c4c4c4'}
76+
},
77+
badge: {show: false, imgUrl: ''},
78+
btnBuy: {
79+
type: 'text',
80+
text: '去拼团',
81+
bgBeginColor: '#FF6000',
82+
bgEndColor: '#FE832A',
83+
imgUrl: ''
84+
},
85+
borderRadiusTop: 8,
86+
borderRadiusBottom: 8,
87+
space: 8,
88+
style: {
89+
bgType: 'color',
90+
bgColor: '',
91+
marginLeft: 8,
92+
marginRight: 8,
93+
marginBottom: 8
94+
} as ComponentStyle
95+
}
6496
} as DiyComponent<PromotionCombinationProperty>

0 commit comments

Comments
 (0)