Skip to content

Commit 9475ded

Browse files
committed
fix: 商品属性值添加暂时恢复name同名校验
1 parent 0e9fde1 commit 9475ded

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/views/mall/product/spu/form/ProductAttributes.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
v-for="item2 in item.propertyOpts"
3838
:key="item2.id"
3939
:label="item2.name"
40-
:value="item2.id"
40+
:value="item2.name"
4141
/>
4242
</el-select>
4343
<el-button
@@ -57,7 +57,6 @@
5757
import * as PropertyApi from '@/api/mall/product/property'
5858
import { PropertyAndValues } from '@/views/mall/product/spu/components'
5959
import { propTypes } from '@/utils/propTypes'
60-
import { isNumber } from '@/utils/is'
6160
6261
defineOptions({ name: 'ProductAttributes' })
6362
@@ -123,13 +122,11 @@ const handleInputConfirm = async (index: number, propertyId: number) => {
123122
if (inputValue.value) {
124123
// 重复添加校验
125124
// TODO @芋艿:需要测试下
126-
if (isNumber(inputValue.value)) {
127-
if (attributeList.value[index].values?.some((item) => item.id === inputValue.value)) {
128-
message.warning('已存在相同属性值,请重试')
129-
attributeIndex.value = null
130-
inputValue.value = ''
131-
return
132-
}
125+
if (attributeList.value[index].values.find((item) => item.name === inputValue.value)) {
126+
message.warning('已存在相同属性值,请重试')
127+
attributeIndex.value = null
128+
inputValue.value = ''
129+
return
133130
}
134131
// 保存属性值
135132
try {

0 commit comments

Comments
 (0)