From 76ccc54a350a6183b6aa89599d3e010b467263b6 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 25 Jun 2023 09:35:20 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20spu=20=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E6=9F=A5=E7=9C=8B=E9=94=99=E8=AF=AF=EF=BC=8C=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=20mall=20seckill=20=E7=BB=84=E4=BB=B6=20name=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mall/product/spu/addForm.vue | 8 +++--- .../product/spu/components/BasicInfoForm.vue | 25 +++---------------- .../seckill/activity/SeckillActivityForm.vue | 4 ++- .../activity/components/SpuAndSkuList.vue | 5 +++- .../components/SpuAndSkuSelectForm.vue | 4 ++- .../mall/promotion/seckill/activity/index.vue | 4 ++- 6 files changed, 20 insertions(+), 30 deletions(-) diff --git a/src/views/mall/product/spu/addForm.vue b/src/views/mall/product/spu/addForm.vue index f016a4c9..f014ee79 100644 --- a/src/views/mall/product/spu/addForm.vue +++ b/src/views/mall/product/spu/addForm.vue @@ -55,9 +55,9 @@ const { delView } = useTagsViewStore() // 视图操作 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const activeName = ref('basicInfo') // Tag 激活的窗口 const isDetail = ref(false) // 是否查看详情 -const basicInfoRef = ref>() // 商品信息Ref -const descriptionRef = ref>() // 商品详情Ref -const otherSettingsRef = ref>() // 其他设置Ref +const basicInfoRef = ref() // 商品信息Ref +const descriptionRef = ref() // 商品详情Ref +const otherSettingsRef = ref() // 其他设置Ref // spu 表单数据 const formData = ref({ name: '', // 商品名称 @@ -98,7 +98,7 @@ const formData = ref({ /** 获得详情 */ const getDetail = async () => { - if ('productSpuDetail' === name) { + if ('ProductSpuDetail' === name) { isDetail.value = true } const id = params.spuId as number diff --git a/src/views/mall/product/spu/components/BasicInfoForm.vue b/src/views/mall/product/spu/components/BasicInfoForm.vue index c86745be..c8cc6f57 100644 --- a/src/views/mall/product/spu/components/BasicInfoForm.vue +++ b/src/views/mall/product/spu/components/BasicInfoForm.vue @@ -176,7 +176,7 @@ import { checkSelectedNode, defaultProps, handleTree, treeToString } from '@/uti import { createImageViewer } from '@/components/ImageViewer' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { UploadImg, UploadImgs } from '@/components/UploadFile' -import { ProductAttributes, ProductPropertyAddForm, SkuList } from './index' +import { getPropertyList, ProductAttributes, ProductPropertyAddForm, SkuList } from './index' import { basicInfoSchema } from './spu.data' import type { Spu } from '@/api/mall/product/spu' import * as ProductCategoryApi from '@/api/mall/product/category' @@ -242,7 +242,7 @@ const rules = reactive({ introduction: [required], picUrl: [required], sliderPicUrls: [required], - // deliveryTemplateId: [required], + deliveryTemplateId: [required], brandId: [required], specType: [required], subCommissionType: [required] @@ -261,26 +261,7 @@ watch( formData.sliderPicUrls = data['sliderPicUrls']?.map((item) => ({ url: item })) - // 只有是多规格才处理 - if (!formData.specType) { - return - } - // 直接拿返回的 skus 属性逆向生成出 propertyList - const properties = [] - formData.skus?.forEach((sku) => { - sku.properties?.forEach(({ propertyId, propertyName, valueId, valueName }) => { - // 添加属性 - if (!properties?.some((item) => item.id === propertyId)) { - properties.push({ id: propertyId, name: propertyName, values: [] }) - } - // 添加属性值 - const index = properties?.findIndex((item) => item.id === propertyId) - if (!properties[index].values?.some((value) => value.id === valueId)) { - properties[index].values?.push({ id: valueId, name: valueName }) - } - }) - }) - propertyList.value = properties + propertyList.value = getPropertyList(data) }, { immediate: true diff --git a/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue b/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue index e3356ec1..184a1b4d 100644 --- a/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue +++ b/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue @@ -22,13 +22,15 @@ - diff --git a/src/views/mall/promotion/seckill/activity/seckillActivity.data.ts b/src/views/mall/promotion/seckill/activity/seckillActivity.data.ts index ce798f1e..127f0d7b 100644 --- a/src/views/mall/promotion/seckill/activity/seckillActivity.data.ts +++ b/src/views/mall/promotion/seckill/activity/seckillActivity.data.ts @@ -40,8 +40,7 @@ const crudSchemas = reactive([ component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD', - type: 'daterange', - defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + type: 'daterange' } }, form: { @@ -52,7 +51,7 @@ const crudSchemas = reactive([ } }, table: { - width: 300 + width: 120 } }, { @@ -64,8 +63,7 @@ const crudSchemas = reactive([ component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD', - type: 'daterange', - defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + type: 'daterange' } }, form: { @@ -76,11 +74,11 @@ const crudSchemas = reactive([ } }, table: { - width: 300 + width: 120 } }, { - label: '秒杀时段', // todo @PUHUI999: 在列表界面,格式化不对 + label: '秒杀时段', field: 'configIds', form: { component: 'Select', @@ -106,7 +104,7 @@ const crudSchemas = reactive([ value: 0 }, table: { - width: 300 + width: 120 } }, { @@ -118,7 +116,7 @@ const crudSchemas = reactive([ value: 0 }, table: { - width: 300 + width: 120 } }, { @@ -130,7 +128,7 @@ const crudSchemas = reactive([ value: 0 }, table: { - width: 300 + width: 120 } }, { @@ -141,7 +139,7 @@ const crudSchemas = reactive([ value: 0 }, table: { - width: 300 + width: 120 } }, { @@ -152,7 +150,7 @@ const crudSchemas = reactive([ value: 0 }, table: { - width: 300 + width: 120 } }, { @@ -164,7 +162,7 @@ const crudSchemas = reactive([ value: 0 }, table: { - width: 300 + width: 120 } }, { @@ -175,12 +173,12 @@ const crudSchemas = reactive([ value: 0 }, table: { - width: 300 + width: 120 } }, { label: '秒杀活动商品', // TODO @puhui999:格式化的商品不对; - field: 'spuId', + field: 'spuIds', form: { colProps: { span: 24 @@ -204,7 +202,7 @@ const crudSchemas = reactive([ }, isForm: false, table: { - width: 300 + width: 120 } }, { @@ -215,7 +213,7 @@ const crudSchemas = reactive([ value: 0 }, table: { - width: 300 + width: 80 } }, { From 341303b014f1d24baf132575763d20a4a08c4b1c Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 25 Jun 2023 17:16:26 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E5=AE=8C=E5=96=84=20mall=20seckillA?= =?UTF-8?q?ctivity=20add?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/seckill/activity/SeckillActivityForm.vue | 5 ++--- src/views/mall/promotion/seckill/activity/index.vue | 8 ++++++++ .../promotion/seckill/activity/seckillActivity.data.ts | 8 +++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue b/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue index f1d34d4f..e1aee4c7 100644 --- a/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue +++ b/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue @@ -10,7 +10,6 @@ - +