File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
src/views/mall/product/spu/form Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 37
37
v-for =" item2 in item.propertyOpts"
38
38
:key =" item2.id"
39
39
:label =" item2.name"
40
- :value =" item2.name "
40
+ :value =" item2.id "
41
41
/>
42
42
</el-select >
43
43
<el-button
57
57
import * as PropertyApi from ' @/api/mall/product/property'
58
58
import { PropertyAndValues } from ' @/views/mall/product/spu/components'
59
59
import { propTypes } from ' @/utils/propTypes'
60
+ import { isNumber } from ' @/utils/is'
60
61
61
62
defineOptions ({ name: ' ProductAttributes' })
62
63
@@ -121,11 +122,13 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
121
122
const handleInputConfirm = async (index : number , propertyId : number ) => {
122
123
if (inputValue .value ) {
123
124
// 重复添加校验
124
- if (attributeList .value [index ].values .find ((item ) => item .name === inputValue .value )) {
125
- message .warning (' 已存在相同属性值,请重试' )
126
- attributeIndex .value = null
127
- inputValue .value = ' '
128
- return
125
+ if (isNumber (inputValue .value )) {
126
+ if (attributeList .value [index ].values ?.some ((item ) => item .id === inputValue .value )) {
127
+ message .warning (' 已存在相同属性值,请重试' )
128
+ attributeIndex .value = null
129
+ inputValue .value = ' '
130
+ return
131
+ }
129
132
}
130
133
// 保存属性值
131
134
try {
You can’t perform that action at this time.
0 commit comments