diff --git a/src/api/mall/product/property.ts b/src/api/mall/product/property.ts index 44dc663f..a191d82e 100644 --- a/src/api/mall/product/property.ts +++ b/src/api/mall/product/property.ts @@ -24,20 +24,6 @@ export interface PropertyValueVO { remark?: string } -/** - * 商品属性值的明细 - */ -export interface PropertyValueDetailVO { - /** 属性项的编号 */ - propertyId: number // 属性的编号 - /** 属性的名称 */ - propertyName: string - /** 属性值的编号 */ - valueId: number - /** 属性值的名称 */ - valueName: string -} - // ------------------------ 属性项 ------------------- // 创建属性项 @@ -65,6 +51,11 @@ export const getPropertyPage = (params: PageParam) => { return request.get({ url: '/product/property/page', params }) } +// 获得属性项精简列表 +export const getPropertySimpleList = (): Promise => { + return request.get({ url: '/product/property/simple-list' }) +} + // ------------------------ 属性值 ------------------- // 获得属性值分页 @@ -91,3 +82,8 @@ export const updatePropertyValue = (data: PropertyValueVO) => { export const deletePropertyValue = (id: number) => { return request.delete({ url: `/product/property/value/delete?id=${id}` }) } + +// 获得属性值精简列表 +export const getPropertyValueSimpleList = (propertyId: number): Promise => { + return request.get({ url: '/product/property/value/simple-list', params: { propertyId } }) +} diff --git a/src/components/DictTag/src/DictTag.vue b/src/components/DictTag/src/DictTag.vue index e7f911d3..8835774f 100644 --- a/src/components/DictTag/src/DictTag.vue +++ b/src/components/DictTag/src/DictTag.vue @@ -3,7 +3,7 @@ import { defineComponent, PropType, computed } from 'vue' import { isHexColor } from '@/utils/color' import { ElTag } from 'element-plus' import { DictDataType, getDictOptions } from '@/utils/dict' -import { isArray, isString, isNumber } from '@/utils/is' +import { isArray, isString, isNumber, isBoolean } from '@/utils/is' export default defineComponent({ name: 'DictTag', @@ -29,15 +29,15 @@ export default defineComponent({ }, setup(props) { const valueArr: any = computed(() => { - // 1.是Number类型的情况 - if (isNumber(props.value)) { + // 1. 是 Number 类型和 Boolean 类型的情况 + if (isNumber(props.value) || isBoolean(props.value)) { return [String(props.value)] } - // 2.是字符串(进一步判断是否有包含分隔符号 -> props.sepSymbol ) + // 2. 是字符串(进一步判断是否有包含分隔符号 -> props.sepSymbol ) else if (isString(props.value)) { return props.value.split(props.separator) } - // 3.数组 + // 3. 数组 else if (isArray(props.value)) { return props.value.map(String) } @@ -57,7 +57,7 @@ export default defineComponent({
@@ -168,7 +168,7 @@ > @@ -248,7 +248,7 @@ > diff --git a/src/views/mall/product/spu/form/ProductAttributes.vue b/src/views/mall/product/spu/form/ProductAttributes.vue index ffe7397d..7b4fc37c 100644 --- a/src/views/mall/product/spu/form/ProductAttributes.vue +++ b/src/views/mall/product/spu/form/ProductAttributes.vue @@ -18,16 +18,28 @@ > {{ value.name }} - + @change="handleInputConfirm(index, item.id)" + > + + diff --git a/src/views/mall/product/spu/form/ProductPropertyAddForm.vue b/src/views/mall/product/spu/form/ProductPropertyAddForm.vue index 15c5a8d5..3c07cd74 100644 --- a/src/views/mall/product/spu/form/ProductPropertyAddForm.vue +++ b/src/views/mall/product/spu/form/ProductPropertyAddForm.vue @@ -10,7 +10,22 @@ @keydown.enter.prevent="submitForm" > - + + +