diff --git a/src/api/mall/product/management/type/spuType.ts b/src/api/mall/product/management/type/spuType.ts
index f51bc526..5d9b65ef 100644
--- a/src/api/mall/product/management/type/spuType.ts
+++ b/src/api/mall/product/management/type/spuType.ts
@@ -9,7 +9,6 @@ export interface SpuType {
sliderPicUrls?: string[] // 商品轮播图
introduction?: string // 商品简介
deliveryTemplateId?: number // 运费模版
- selectRule?: string // 选择规格 TODO 暂时定义
specType?: boolean // 商品规格
subCommissionType?: boolean // 分销类型
skus?: SkuType[] // sku数组
diff --git a/src/views/mall/product/management/components/BasicInfoForm.vue b/src/views/mall/product/management/components/BasicInfoForm.vue
index 90f7c0df..d06a787d 100644
--- a/src/views/mall/product/management/components/BasicInfoForm.vue
+++ b/src/views/mall/product/management/components/BasicInfoForm.vue
@@ -60,7 +60,7 @@
-
+
单规格
多规格
@@ -76,12 +76,17 @@
-
- 添加规格
+
+ 添加规格
+
+
+
+
-
+
@@ -110,14 +115,8 @@ const props = defineProps({
})
const AttributesAddFormRef = ref() // 添加商品属性表单
const ProductManagementBasicInfoRef = ref() // 表单Ref
-// 属性列表
-const attributeList = ref([
- {
- id: 1,
- name: '颜色',
- values: [{ id: 1, name: '白色' }]
- }
-])
+const attributeList = ref([]) // 商品属性列表
+/** 添加商品属性 */
const addAttribute = (property: any) => {
attributeList.value.push(property)
}
@@ -176,10 +175,10 @@ const rules = reactive({
unit: [required],
introduction: [required],
picUrl: [required],
- sliderPicUrls: [required]
+ sliderPicUrls: [required],
// deliveryTemplateId: [required],
- // specType: [required],
- // subCommissionType: [required],
+ specType: [required],
+ subCommissionType: [required]
})
/**
* 将传进来的值赋值给formData
@@ -215,10 +214,7 @@ const validate = async () => {
})
}
defineExpose({ validate })
-// 选择规格
-const changeSpecType = (specType) => {
- console.log(specType)
-}
+
// 分销类型
const changeSubCommissionType = () => {
// 默认为零,类型切换后也要重置为零
@@ -227,10 +223,7 @@ const changeSubCommissionType = () => {
item.subCommissionSecondPrice = 0
}
}
-// 选择属性确认
-// const confirm = () => {}
-// 添加规格
-// const addRule = () => {}
+
const categoryList = ref() // 分类树
onMounted(async () => {
// 获得分类树
diff --git a/src/views/mall/product/management/components/ProductAttributes.vue b/src/views/mall/product/management/components/ProductAttributes.vue
index 120ffd36..ea9b311a 100644
--- a/src/views/mall/product/management/components/ProductAttributes.vue
+++ b/src/views/mall/product/management/components/ProductAttributes.vue
@@ -49,10 +49,10 @@ const inputVisible = computed(() => (index) => {
if (attributeIndex.value === index) return true
})
const InputRef = ref() //标签输入框Ref
-const attributeList = ref([])
+const attributeList = ref([]) // 商品属性列表
const props = defineProps({
attributeData: {
- type: Object,
+ type: Array,
default: () => {}
}
})
diff --git a/src/views/mall/product/management/components/ProductAttributesAddForm.vue b/src/views/mall/product/management/components/ProductAttributesAddForm.vue
index f498b7dd..bd715dde 100644
--- a/src/views/mall/product/management/components/ProductAttributesAddForm.vue
+++ b/src/views/mall/product/management/components/ProductAttributesAddForm.vue
@@ -62,6 +62,9 @@ const submitForm = async () => {
const propertyId = await PropertyApi.createProperty(data)
emit('success', { id: propertyId, ...formData.value, values: [] })
} else {
+ if (res[0].values === null) {
+ res[0].values = []
+ }
emit('success', res[0]) // 因为只用一个
}
message.success(t('common.createSuccess'))
diff --git a/src/views/mall/product/management/components/SkuList/index.vue b/src/views/mall/product/management/components/SkuList/index.vue
index fd148126..a3ecd9dd 100644
--- a/src/views/mall/product/management/components/SkuList/index.vue
+++ b/src/views/mall/product/management/components/SkuList/index.vue
@@ -1,10 +1,21 @@
-
+
+
+
+
+
@@ -40,7 +51,7 @@
-
+
@@ -52,35 +63,133 @@
+
+
+ 批量添加
+ 删除
+
+