diff --git a/src/api/mall/promotion/combination/combinationactivity.ts b/src/api/mall/promotion/combination/combinationactivity.ts index bc946773..8ecf85bd 100644 --- a/src/api/mall/promotion/combination/combinationactivity.ts +++ b/src/api/mall/promotion/combination/combinationactivity.ts @@ -1,20 +1,38 @@ import request from '@/config/axios' +import { Sku, Spu } from '@/api/mall/product/spu' export interface CombinationActivityVO { - id: number - name: string + id?: number + name?: string + spuIds?: 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 - totalLimitCount: number - singleLimitCount: number - startTime: Date - endTime: Date - userSize: number - totalNum: number - successNum: number - orderUserCount: number - virtualGroup: number - status: number - limitDuration: number + skuId: number + activePrice: number // 拼团价格 +} + +// 扩展 Sku 配置 +type SkuExtension = Sku & { + productConfig: CombinationProductVO +} + +export interface SpuExtension extends Spu { + skus: SkuExtension[] // 重写类型 } // 查询拼团活动列表 diff --git a/src/utils/formatTime.ts b/src/utils/formatTime.ts index c7caabdd..8b798cfe 100644 --- a/src/utils/formatTime.ts +++ b/src/utils/formatTime.ts @@ -74,7 +74,7 @@ export function parseTime(time: any, pattern?: string) { * 获取当前的日期+时间 */ export function getNowDateTime() { - return dayjs().format('YYYY-MM-DD HH:mm:ss') + return dayjs() } /** diff --git a/src/views/mall/product/spu/components/SkuList.vue b/src/views/mall/product/spu/components/SkuList.vue index a4cd5d24..ed1a356d 100644 --- a/src/views/mall/product/spu/components/SkuList.vue +++ b/src/views/mall/product/spu/components/SkuList.vue @@ -2,7 +2,7 @@ {} }, propertyList: { - type: Array as PropType, + type: Array as PropType, default: () => [] }, ruleConfig: { @@ -482,7 +482,7 @@ const build = (propertyValuesList: Property[][]) => { /** 监听属性列表,生成相关参数和表头 */ watch( () => props.propertyList, - (propertyList: Properties[]) => { + (propertyList: PropertyAndValues[]) => { // 如果不是多规格则结束 if (!formData.value!.specType) { return diff --git a/src/views/mall/product/spu/components/index.ts b/src/views/mall/product/spu/components/index.ts index ca61ff6b..1160dbd1 100644 --- a/src/views/mall/product/spu/components/index.ts +++ b/src/views/mall/product/spu/components/index.ts @@ -7,11 +7,11 @@ import SkuList from './SkuList.vue' import { Spu } from '@/api/mall/product/spu' -// TODO @puhui999:Properties 改成 Property 更合适? -interface Properties { +// TODO @puhui999:Properties 改成 Property 更合适?Property 在 Spu 中已存在避免冲突 PropertyAndValues +interface PropertyAndValues { id: number name: string - values?: Properties[] + values?: PropertyAndValues[] } interface RuleConfig { @@ -23,7 +23,7 @@ interface RuleConfig { // 例:需要校验价格必须大于0.01 // { // name:'price', - // rule:(arg) => arg > 0.01 + // rule:(arg: number) => arg > 0.01 // } rule: (arg: any) => boolean // 校验不通过时的消息提示 @@ -34,11 +34,11 @@ interface RuleConfig { * 获得商品的规格列表 * * @param spu - * @return Property 规格列表 + * @return PropertyAndValues 规格列表 */ -const getPropertyList = (spu: Spu): Properties[] => { +const getPropertyList = (spu: Spu): PropertyAndValues[] => { // 直接拿返回的 skus 属性逆向生成出 propertyList - const properties: Properties[] = [] + const properties: PropertyAndValues[] = [] // 只有是多规格才处理 if (spu.specType) { spu.skus?.forEach((sku) => { @@ -66,6 +66,6 @@ export { ProductPropertyAddForm, SkuList, getPropertyList, - Properties, + PropertyAndValues, RuleConfig } diff --git a/src/views/mall/promotion/combination/activity/CombinationActivityForm.vue b/src/views/mall/promotion/combination/activity/CombinationActivityForm.vue index f0c22be5..cfbe107f 100644 --- a/src/views/mall/promotion/combination/activity/CombinationActivityForm.vue +++ b/src/views/mall/promotion/combination/activity/CombinationActivityForm.vue @@ -1,21 +1,49 @@ diff --git a/src/views/mall/promotion/seckill/activity/seckillActivity.data.ts b/src/views/mall/promotion/seckill/activity/seckillActivity.data.ts index 12126fe8..bdfc8f38 100644 --- a/src/views/mall/promotion/seckill/activity/seckillActivity.data.ts +++ b/src/views/mall/promotion/seckill/activity/seckillActivity.data.ts @@ -186,7 +186,7 @@ const crudSchemas = reactive([ { label: '秒杀活动商品', field: 'spuId', - isTable: false, + isTable: true, isSearch: false, form: { colProps: {