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
7908160e
authored
Jun 17, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-to-dev' of
https://gitee.com/puhui999/yudao-ui-admin-vue3
into dev
Conflicts: src/utils/dict.ts
parents
5eaf0546
d31ade7a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
22 additions
and
24 deletions
+22
-24
src/router/modules/remaining.ts
+5
-5
src/views/mall/product/spu/addForm.vue
+1
-1
src/views/mall/product/spu/components/BasicInfoForm.vue
+9
-11
src/views/mall/product/spu/components/ProductPropertyAddForm.vue
+1
-1
src/views/mall/product/spu/components/SkuList.vue
+0
-1
src/views/mall/product/spu/components/index.ts
+2
-2
src/views/mall/product/spu/components/spu.data.ts
+1
-0
src/views/mall/product/spu/index.vue
+3
-3
No files found.
src/router/modules/remaining.ts
View file @
7908160e
...
...
@@ -355,7 +355,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
},
children
:
[
{
path
:
'
productSpuAdd'
,
// TODO @puhui999:最好拆成 add 和 edit 两个路由;添加商品;修改商品 fix
path
:
'
spu/add'
,
component
:
()
=>
import
(
'@/views/mall/product/spu/addForm.vue'
),
name
:
'ProductSpuAdd'
,
meta
:
{
...
...
@@ -368,9 +368,9 @@ const remainingRouter: AppRouteRecordRaw[] = [
}
},
{
path
:
'
productSpuE
dit/:spuId(\\d+)'
,
path
:
'
spu/e
dit/:spuId(\\d+)'
,
component
:
()
=>
import
(
'@/views/mall/product/spu/addForm.vue'
),
name
:
'
p
roductSpuEdit'
,
name
:
'
P
roductSpuEdit'
,
meta
:
{
noCache
:
true
,
hidden
:
true
,
...
...
@@ -381,9 +381,9 @@ const remainingRouter: AppRouteRecordRaw[] = [
}
},
{
path
:
'
productSpuD
etail/:spuId(\\d+)'
,
path
:
'
spu/d
etail/:spuId(\\d+)'
,
component
:
()
=>
import
(
'@/views/mall/product/spu/addForm.vue'
),
name
:
'
p
roductSpuDetail'
,
name
:
'
P
roductSpuDetail'
,
meta
:
{
noCache
:
true
,
hidden
:
true
,
...
...
src/views/mall/product/spu/addForm.vue
View file @
7908160e
...
...
@@ -104,7 +104,7 @@ const getDetail = async () => {
formLoading
.
value
=
true
try
{
const
res
=
(
await
ProductSpuApi
.
getSpu
(
id
))
as
ProductSpuApi
.
Spu
res
.
skus
!
.
forEach
((
item
)
=>
{
res
.
skus
?
.
forEach
((
item
)
=>
{
// 回显价格分转元
item
.
price
=
formatToFraction
(
item
.
price
)
item
.
marketPrice
=
formatToFraction
(
item
.
marketPrice
)
...
...
src/views/mall/product/spu/components/BasicInfoForm.vue
View file @
7908160e
...
...
@@ -14,7 +14,6 @@
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<!-- TODO @puhui999:只能选根节点 fix: 已完善-->
<el-form-item
label=
"商品分类"
prop=
"categoryId"
>
<el-tree-select
v-model=
"formData.categoryId"
...
...
@@ -166,8 +165,7 @@
</Descriptions>
<!-- 商品属性添加 Form 表单 -->
<!-- TODO @puhui999: ProductPropertyAddForm 是不是更合适呀 -->
<ProductAttributesAddForm
ref=
"attributesAddFormRef"
:propertyList=
"propertyList"
/>
<ProductPropertyAddForm
ref=
"attributesAddFormRef"
:propertyList=
"propertyList"
/>
</template>
<
script
lang=
"ts"
name=
"ProductSpuBasicInfoForm"
setup
>
import
{
PropType
}
from
'vue'
...
...
@@ -178,7 +176,7 @@ import { checkSelectedNode, defaultProps, handleTree, treeToString } from '@/uti
import
{
createImageViewer
}
from
'@/components/ImageViewer'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
UploadImg
,
UploadImgs
}
from
'@/components/UploadFile'
import
{
ProductAttributes
,
Product
Attributes
AddForm
,
SkuList
}
from
'./index'
import
{
ProductAttributes
,
Product
Property
AddForm
,
SkuList
}
from
'./index'
import
{
basicInfoSchema
}
from
'./spu.data'
import
type
{
Spu
}
from
'@/api/mall/product/spu'
import
*
as
ProductCategoryApi
from
'@/api/mall/product/category'
...
...
@@ -258,7 +256,7 @@ watch(
return
}
copyValueToTarget
(
formData
,
data
)
formData
.
sliderPicUrls
=
data
[
'sliderPicUrls'
].
map
((
item
)
=>
({
formData
.
sliderPicUrls
=
data
[
'sliderPicUrls'
]
?
.
map
((
item
)
=>
({
url
:
item
}))
// 只有是多规格才处理
...
...
@@ -267,16 +265,16 @@ watch(
}
// 直接拿返回的 skus 属性逆向生成出 propertyList
const
properties
=
[]
formData
.
skus
.
forEach
((
sku
)
=>
{
sku
.
properties
.
forEach
(({
propertyId
,
propertyName
,
valueId
,
valueName
})
=>
{
formData
.
skus
?
.
forEach
((
sku
)
=>
{
sku
.
properties
?
.
forEach
(({
propertyId
,
propertyName
,
valueId
,
valueName
})
=>
{
// 添加属性
if
(
!
properties
.
some
((
item
)
=>
item
.
id
===
propertyId
))
{
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
})
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
})
}
})
})
...
...
src/views/mall/product/spu/components/Product
Attributes
AddForm.vue
→
src/views/mall/product/spu/components/Product
Property
AddForm.vue
View file @
7908160e
...
...
@@ -17,7 +17,7 @@
</
template
>
</Dialog>
</template>
<
script
lang=
"ts"
name=
"ProductPropertyForm"
setup
>
<
script
lang=
"ts"
name=
"ProductProperty
Add
Form"
setup
>
import
*
as
PropertyApi
from
'@/api/mall/product/property'
const
{
t
}
=
useI18n
()
// 国际化
...
...
src/views/mall/product/spu/components/SkuList.vue
View file @
7908160e
...
...
@@ -23,7 +23,6 @@
min-width=
"120"
>
<template
#
default=
"
{ row }">
<!-- TODO puhui999:展示成蓝色,有点区分度哈 fix-->
<span
style=
"font-weight: bold; color: #40aaff"
>
{{
row
.
properties
[
index
]?.
valueName
}}
</span>
...
...
src/views/mall/product/spu/components/index.ts
View file @
7908160e
...
...
@@ -2,7 +2,7 @@ import BasicInfoForm from './BasicInfoForm.vue'
import
DescriptionForm
from
'./DescriptionForm.vue'
import
OtherSettingsForm
from
'./OtherSettingsForm.vue'
import
ProductAttributes
from
'./ProductAttributes.vue'
import
Product
AttributesAddForm
from
'./ProductAttributes
AddForm.vue'
import
Product
PropertyAddForm
from
'./ProductProperty
AddForm.vue'
import
SkuList
from
'./SkuList.vue'
export
{
...
...
@@ -10,6 +10,6 @@ export {
DescriptionForm
,
OtherSettingsForm
,
ProductAttributes
,
Product
Attributes
AddForm
,
Product
Property
AddForm
,
SkuList
}
src/views/mall/product/spu/components/spu.data.ts
View file @
7908160e
import
{
CrudSchema
}
from
'@/hooks/web/useCrudSchemas'
// TODO @puhui999:如果只要 detail,可以不用 CrudSchema,只要描述的 Schema
// fix: useCrudSchemas 中没有单独处理的情况且只要 detail 的情况只要 spu 这里有使用 如果改动得添加/修改代码
export
const
basicInfoSchema
=
reactive
<
CrudSchema
[]
>
([
{
label
:
'商品名称'
,
...
...
src/views/mall/product/spu/index.vue
View file @
7908160e
...
...
@@ -396,18 +396,18 @@ const resetQuery = () => {
const
openForm
=
(
id
?:
number
)
=>
{
// 修改
if
(
typeof
id
===
'number'
)
{
push
(
'/product/
productSpuE
dit/'
+
id
)
push
(
'/product/
spu/e
dit/'
+
id
)
return
}
// 新增
push
(
'/product/productSpuAdd'
)
push
(
{
name
:
'ProductSpuAdd'
}
)
}
/**
* 查看商品详情
*/
const
openDetail
=
(
id
?:
number
)
=>
{
push
(
'/product/
productSpuD
etail/'
+
id
)
push
(
'/product/
spu/d
etail/'
+
id
)
}
/** 导出按钮操作 */
...
...
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