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
eea285b1
authored
Aug 29, 2023
by
puhui999
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'yudao/dev' into dev-to-dev
parents
ed739aec
8d026f08
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
46 additions
and
61 deletions
+46
-61
src/router/modules/remaining.ts
+3
-3
src/views/mall/product/spu/components/index.ts
+1
-46
src/views/mall/product/spu/form/BasicInfoForm.vue
+39
-8
src/views/mall/product/spu/form/DescriptionForm.vue
+0
-0
src/views/mall/product/spu/form/OtherSettingsForm.vue
+0
-0
src/views/mall/product/spu/form/ProductAttributes.vue
+0
-0
src/views/mall/product/spu/form/ProductPropertyAddForm.vue
+0
-0
src/views/mall/product/spu/form/index.vue
+3
-4
src/views/mall/product/spu/form/spu.data.ts
+0
-0
No files found.
src/router/modules/remaining.ts
View file @
eea285b1
...
@@ -340,7 +340,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
...
@@ -340,7 +340,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
children
:
[
children
:
[
{
{
path
:
'spu/add'
,
path
:
'spu/add'
,
component
:
()
=>
import
(
'@/views/mall/product/spu/
addForm
.vue'
),
component
:
()
=>
import
(
'@/views/mall/product/spu/
form/index
.vue'
),
name
:
'ProductSpuAdd'
,
name
:
'ProductSpuAdd'
,
meta
:
{
meta
:
{
noCache
:
true
,
noCache
:
true
,
...
@@ -353,7 +353,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
...
@@ -353,7 +353,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
},
},
{
{
path
:
'spu/edit/:spuId(\\d+)'
,
path
:
'spu/edit/:spuId(\\d+)'
,
component
:
()
=>
import
(
'@/views/mall/product/spu/
addForm
.vue'
),
component
:
()
=>
import
(
'@/views/mall/product/spu/
form/index
.vue'
),
name
:
'ProductSpuEdit'
,
name
:
'ProductSpuEdit'
,
meta
:
{
meta
:
{
noCache
:
true
,
noCache
:
true
,
...
@@ -366,7 +366,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
...
@@ -366,7 +366,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
},
},
{
{
path
:
'spu/detail/:spuId(\\d+)'
,
path
:
'spu/detail/:spuId(\\d+)'
,
component
:
()
=>
import
(
'@/views/mall/product/spu/
addForm
.vue'
),
component
:
()
=>
import
(
'@/views/mall/product/spu/
form/index
.vue'
),
name
:
'ProductSpuDetail'
,
name
:
'ProductSpuDetail'
,
meta
:
{
meta
:
{
noCache
:
true
,
noCache
:
true
,
...
...
src/views/mall/product/spu/components/index.ts
View file @
eea285b1
import
BasicInfoForm
from
'./BasicInfoForm.vue'
import
DescriptionForm
from
'./DescriptionForm.vue'
import
OtherSettingsForm
from
'./OtherSettingsForm.vue'
import
ProductAttributes
from
'./ProductAttributes.vue'
import
ProductPropertyAddForm
from
'./ProductPropertyAddForm.vue'
import
SkuList
from
'./SkuList.vue'
import
SkuList
from
'./SkuList.vue'
import
{
Spu
}
from
'@/api/mall/product/spu'
interface
PropertyAndValues
{
interface
PropertyAndValues
{
id
:
number
id
:
number
name
:
string
name
:
string
...
@@ -29,42 +22,4 @@ interface RuleConfig {
...
@@ -29,42 +22,4 @@ interface RuleConfig {
message
:
string
message
:
string
}
}
/**
export
{
SkuList
,
PropertyAndValues
,
RuleConfig
}
* 获得商品的规格列表
*
* @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
}
export
{
BasicInfoForm
,
DescriptionForm
,
OtherSettingsForm
,
ProductAttributes
,
ProductPropertyAddForm
,
SkuList
,
getPropertyList
,
PropertyAndValues
,
RuleConfig
}
src/views/mall/product/spu/
components
/BasicInfoForm.vue
→
src/views/mall/product/spu/
form
/BasicInfoForm.vue
View file @
eea285b1
...
@@ -175,13 +175,17 @@ import { propTypes } from '@/utils/propTypes'
...
@@ -175,13 +175,17 @@ import { propTypes } from '@/utils/propTypes'
import
{
checkSelectedNode
,
defaultProps
,
handleTree
,
treeToString
}
from
'@/utils/tree'
import
{
checkSelectedNode
,
defaultProps
,
handleTree
,
treeToString
}
from
'@/utils/tree'
import
{
createImageViewer
}
from
'@/components/ImageViewer'
import
{
createImageViewer
}
from
'@/components/ImageViewer'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
UploadImg
,
UploadImgs
}
from
'@/components/UploadFile'
import
{
PropertyAndValues
,
SkuList
}
from
'@/views/mall/product/spu/components/index.ts'
import
{
getPropertyList
,
ProductAttributes
,
ProductPropertyAddForm
,
SkuList
}
from
'./index'
import
ProductAttributes
from
'./ProductAttributes.vue'
import
ProductPropertyAddForm
from
'./ProductPropertyAddForm.vue'
import
{
basicInfoSchema
}
from
'./spu.data'
import
{
basicInfoSchema
}
from
'./spu.data'
import
type
{
Spu
}
from
'@/api/mall/product/spu'
import
type
{
Spu
}
from
'@/api/mall/product/spu'
import
*
as
ProductCategoryApi
from
'@/api/mall/product/category'
import
*
as
ProductCategoryApi
from
'@/api/mall/product/category'
import
{
getSimpleBrandList
}
from
'@/api/mall/product/brand'
import
*
as
ProductBrandApi
from
'@/api/mall/product/brand'
import
{
getSimpleTemplateList
}
from
'@/api/mall/trade/delivery/expressTemplate/index'
import
*
as
ExpressTemplateApi
from
'@/api/mall/trade/delivery/expressTemplate'
defineOptions
({
name
:
'ProductSpuBasicInfoForm'
})
// ====== 商品详情相关操作 ======
// ====== 商品详情相关操作 ======
const
{
allSchemas
}
=
useCrudSchemas
(
basicInfoSchema
)
const
{
allSchemas
}
=
useCrudSchemas
(
basicInfoSchema
)
/** 商品图预览 */
/** 商品图预览 */
...
@@ -198,9 +202,36 @@ const imagePreview = (args) => {
...
@@ -198,9 +202,36 @@ const imagePreview = (args) => {
urlList
urlList
})
})
}
}
// ====== end ======
defineOptions
({
name
:
'ProductSpuBasicInfoForm'
})
/**
* 获得商品的规格列表
*
* @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
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
...
@@ -346,8 +377,8 @@ onMounted(async () => {
...
@@ -346,8 +377,8 @@ onMounted(async () => {
const
data
=
await
ProductCategoryApi
.
getCategoryList
({})
const
data
=
await
ProductCategoryApi
.
getCategoryList
({})
categoryList
.
value
=
handleTree
(
data
,
'id'
,
'parentId'
)
categoryList
.
value
=
handleTree
(
data
,
'id'
,
'parentId'
)
// 获取商品品牌列表
// 获取商品品牌列表
brandList
.
value
=
await
getSimpleBrandList
()
brandList
.
value
=
await
ProductBrandApi
.
getSimpleBrandList
()
// 获取运费模版
// 获取运费模版
deliveryTemplateList
.
value
=
await
getSimpleTemplateList
()
deliveryTemplateList
.
value
=
await
ExpressTemplateApi
.
getSimpleTemplateList
()
})
})
</
script
>
</
script
>
src/views/mall/product/spu/
components
/DescriptionForm.vue
→
src/views/mall/product/spu/
form
/DescriptionForm.vue
View file @
eea285b1
File moved
src/views/mall/product/spu/
components
/OtherSettingsForm.vue
→
src/views/mall/product/spu/
form
/OtherSettingsForm.vue
View file @
eea285b1
File moved
src/views/mall/product/spu/
components
/ProductAttributes.vue
→
src/views/mall/product/spu/
form
/ProductAttributes.vue
View file @
eea285b1
File moved
src/views/mall/product/spu/
components
/ProductPropertyAddForm.vue
→
src/views/mall/product/spu/
form
/ProductPropertyAddForm.vue
View file @
eea285b1
File moved
src/views/mall/product/spu/
addForm
.vue
→
src/views/mall/product/spu/
form/index
.vue
View file @
eea285b1
...
@@ -39,13 +39,12 @@
...
@@ -39,13 +39,12 @@
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
cloneDeep
}
from
'lodash-es'
import
{
cloneDeep
}
from
'lodash-es'
import
{
useTagsViewStore
}
from
'@/store/modules/tagsView'
import
{
useTagsViewStore
}
from
'@/store/modules/tagsView'
import
{
BasicInfoForm
,
DescriptionForm
,
OtherSettingsForm
}
from
'./components'
// 业务api
import
*
as
ProductSpuApi
from
'@/api/mall/product/spu'
import
*
as
ProductSpuApi
from
'@/api/mall/product/spu'
import
BasicInfoForm
from
'./BasicInfoForm.vue'
import
DescriptionForm
from
'./DescriptionForm.vue'
import
OtherSettingsForm
from
'./OtherSettingsForm.vue'
import
{
convertToInteger
,
floatToFixed2
,
formatToFraction
}
from
'@/utils'
import
{
convertToInteger
,
floatToFixed2
,
formatToFraction
}
from
'@/utils'
// TODO @芋艿:后续稍微调整下;
defineOptions
({
name
:
'ProductSpuForm'
})
defineOptions
({
name
:
'ProductSpuForm'
})
const
{
t
}
=
useI18n
()
// 国际化
const
{
t
}
=
useI18n
()
// 国际化
...
...
src/views/mall/product/spu/
components
/spu.data.ts
→
src/views/mall/product/spu/
form
/spu.data.ts
View file @
eea285b1
File moved
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