commit
b41d8f06ce
@ -0,0 +1,63 @@
|
||||
import request from '@/config/axios'
|
||||
import { Sku, Spu } from '@/api/mall/product/spu'
|
||||
|
||||
// TODO @puhui999: combinationActivity.ts
|
||||
|
||||
export interface CombinationActivityVO {
|
||||
id?: number
|
||||
name?: string
|
||||
spuId?: number
|
||||
totalLimitCount?: number
|
||||
singleLimitCount?: number
|
||||
startTime?: Date
|
||||
endTime?: Date
|
||||
userSize?: number
|
||||
totalNum?: number
|
||||
successNum?: number
|
||||
orderUserCount?: number
|
||||
virtualGroup?: number
|
||||
status?: number
|
||||
limitDuration?: number
|
||||
products: CombinationProductVO[]
|
||||
}
|
||||
|
||||
// 拼团活动所需属性
|
||||
export interface CombinationProductVO {
|
||||
spuId: number
|
||||
skuId: number
|
||||
activePrice: number // 拼团价格
|
||||
}
|
||||
|
||||
// 扩展 Sku 配置
|
||||
export type SkuExtension = Sku & {
|
||||
productConfig: CombinationProductVO
|
||||
}
|
||||
|
||||
export interface SpuExtension extends Spu {
|
||||
skus: SkuExtension[] // 重写类型
|
||||
}
|
||||
|
||||
// 查询拼团活动列表
|
||||
export const getCombinationActivityPage = async (params) => {
|
||||
return await request.get({ url: '/promotion/combination-activity/page', params })
|
||||
}
|
||||
|
||||
// 查询拼团活动详情
|
||||
export const getCombinationActivity = async (id: number) => {
|
||||
return await request.get({ url: '/promotion/combination-activity/get?id=' + id })
|
||||
}
|
||||
|
||||
// 新增拼团活动
|
||||
export const createCombinationActivity = async (data: CombinationActivityVO) => {
|
||||
return await request.post({ url: '/promotion/combination-activity/create', data })
|
||||
}
|
||||
|
||||
// 修改拼团活动
|
||||
export const updateCombinationActivity = async (data: CombinationActivityVO) => {
|
||||
return await request.put({ url: '/promotion/combination-activity/update', data })
|
||||
}
|
||||
|
||||
// 删除拼团活动
|
||||
export const deleteCombinationActivity = async (id: number) => {
|
||||
return await request.delete({ url: '/promotion/combination-activity/delete?id=' + id })
|
||||
}
|
||||
@ -0,0 +1,151 @@
|
||||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
||||
import { dateFormatter, getNowDateTime } from '@/utils/formatTime'
|
||||
|
||||
// 表单校验
|
||||
export const rules = reactive({
|
||||
name: [required],
|
||||
totalLimitCount: [required],
|
||||
singleLimitCount: [required],
|
||||
startTime: [required],
|
||||
endTime: [required],
|
||||
userSize: [required],
|
||||
totalNum: [required],
|
||||
successNum: [required],
|
||||
orderUserCount: [required],
|
||||
virtualGroup: [required],
|
||||
status: [required],
|
||||
limitDuration: [required]
|
||||
})
|
||||
|
||||
// CrudSchema https://doc.iocoder.cn/vue3/crud-schema/
|
||||
const crudSchemas = reactive<CrudSchema[]>([
|
||||
{
|
||||
label: '拼团名称',
|
||||
field: 'name',
|
||||
isSearch: true,
|
||||
isTable: false,
|
||||
form: {
|
||||
colProps: {
|
||||
span: 24
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '活动时间',
|
||||
field: 'activityTime',
|
||||
formatter: dateFormatter,
|
||||
search: {
|
||||
show: true,
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'x',
|
||||
type: 'datetimerange',
|
||||
rangeSeparator: '至'
|
||||
}
|
||||
},
|
||||
form: {
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'x',
|
||||
type: 'datetimerange',
|
||||
rangeSeparator: '至'
|
||||
},
|
||||
value: [getNowDateTime().valueOf(), getNowDateTime().valueOf()],
|
||||
colProps: {
|
||||
span: 24
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '参与人数',
|
||||
field: 'orderUserCount',
|
||||
isSearch: false,
|
||||
form: {
|
||||
component: 'InputNumber',
|
||||
labelMessage: '参与人数不能少于两人',
|
||||
value: 2
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '限制时长',
|
||||
field: 'limitDuration',
|
||||
isSearch: false,
|
||||
isTable: false,
|
||||
form: {
|
||||
component: 'InputNumber',
|
||||
labelMessage: '限制时长(小时)',
|
||||
componentProps: {
|
||||
placeholder: '请输入限制时长(小时)'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '总限购数量',
|
||||
field: 'totalLimitCount',
|
||||
isSearch: false,
|
||||
isTable: false,
|
||||
form: {
|
||||
component: 'InputNumber',
|
||||
value: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '单次限购数量',
|
||||
field: 'singleLimitCount',
|
||||
isSearch: false,
|
||||
isTable: false,
|
||||
form: {
|
||||
component: 'InputNumber',
|
||||
value: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '购买人数',
|
||||
field: 'userSize',
|
||||
isSearch: false,
|
||||
isForm: false
|
||||
},
|
||||
{
|
||||
label: '开团组数',
|
||||
field: 'totalNum',
|
||||
isSearch: false,
|
||||
isForm: false
|
||||
},
|
||||
{
|
||||
label: '成团组数',
|
||||
field: 'successNum',
|
||||
isSearch: false,
|
||||
isForm: false
|
||||
},
|
||||
{
|
||||
label: '虚拟成团',
|
||||
field: 'virtualGroup',
|
||||
isSearch: false,
|
||||
isTable: false,
|
||||
isForm: false
|
||||
},
|
||||
{
|
||||
label: '活动状态',
|
||||
field: 'status',
|
||||
dictType: DICT_TYPE.COMMON_STATUS,
|
||||
dictClass: 'number',
|
||||
isSearch: true,
|
||||
isForm: false
|
||||
},
|
||||
{
|
||||
label: '拼团商品',
|
||||
field: 'spuId',
|
||||
isSearch: false,
|
||||
form: {
|
||||
colProps: {
|
||||
span: 24
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '操作',
|
||||
field: 'action',
|
||||
isForm: false
|
||||
}
|
||||
])
|
||||
export const { allSchemas } = useCrudSchemas(crudSchemas)
|
||||
Loading…
Reference in New Issue