Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3e7945e4
authored
Sep 01, 2023
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修正合并差异
parent
5035fc77
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
33 deletions
+1
-33
src/views/mall/product/spu/form/BasicInfoForm.vue
+1
-33
No files found.
src/views/mall/product/spu/form/BasicInfoForm.vue
View file @
3e7945e4
...
...
@@ -185,11 +185,7 @@ import { propTypes } from '@/utils/propTypes'
import
{
checkSelectedNode
,
defaultProps
,
handleTree
,
treeToString
}
from
'@/utils/tree'
import
{
createImageViewer
}
from
'@/components/ImageViewer'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
PropertyAndValues
,
RuleConfig
,
SkuList
}
from
'@/views/mall/product/spu/components/index.ts'
import
{
getPropertyList
,
RuleConfig
,
SkuList
}
from
'@/views/mall/product/spu/components/index.ts'
import
ProductAttributes
from
'./ProductAttributes.vue'
import
ProductPropertyAddForm
from
'./ProductPropertyAddForm.vue'
import
{
basicInfoSchema
}
from
'./spu.data'
...
...
@@ -241,34 +237,6 @@ const imagePreview = (args) => {
})
}
/**
* 获得商品的规格列表
*
* @param spu
* @return PropertyAndValues 规格列表
*/
const
getPropertyList
=
(
spu
:
Spu
):
PropertyAndValues
[]
=>
{
// 直接拿返回的 skus 属性逆向生成出 propertyList
const
properties
:
PropertyAndValues
[]
=
[]
// 只有是多规格才处理
if
(
spu
.
specType
)
{
spu
.
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
!
})
}
})
})
}
return
properties
}
// ====== end ======
const
message
=
useMessage
()
// 消息弹窗
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment