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
1116fb27
authored
May 02, 2023
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品管理: 调整相关组件优化逻辑
parent
6478d295
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
36 deletions
+43
-36
src/api/mall/product/management/spu.ts
+3
-3
src/utils/dict.ts
+2
-1
src/views/mall/product/management/components/BasicInfoForm.vue
+3
-1
src/views/mall/product/management/components/DescriptionForm.vue
+3
-1
src/views/mall/product/management/components/OtherSettingsForm.vue
+3
-1
src/views/mall/product/management/components/SkuList.vue
+9
-9
src/views/mall/product/management/index.vue
+20
-20
No files found.
src/api/mall/product/management/spu.ts
View file @
1116fb27
import
request
from
'@/config/axios'
import
type
{
SpuType
}
from
'./type/spuType'
// 获得s
k
u列表
export
const
getS
k
uList
=
(
params
:
any
)
=>
{
return
request
.
get
({
url
:
'/product/s
ku/list
'
,
params
})
// 获得s
p
u列表
export
const
getS
p
uList
=
(
params
:
any
)
=>
{
return
request
.
get
({
url
:
'/product/s
pu/page
'
,
params
})
}
// 创建商品spu
export
const
createSpu
=
(
data
:
SpuType
)
=>
{
...
...
src/utils/dict.ts
View file @
1116fb27
...
...
@@ -147,5 +147,6 @@ export enum DICT_TYPE {
MP_MESSAGE_TYPE
=
'mp_message_type'
,
// 消息类型
// ========== MALL 模块 ==========
PRODUCT_UNIT
=
'product_unit'
// 商品单位
PRODUCT_UNIT
=
'product_unit'
,
// 商品单位
PRODUCT_SPU_STATUS
=
'product_spu_status'
//商品状态
}
src/views/mall/product/management/components/BasicInfoForm.vue
View file @
1116fb27
...
...
@@ -116,13 +116,15 @@ import { copyValueToTarget } from '@/utils/object'
import
{
ProductAttributes
,
ProductAttributesAddForm
,
SkuList
}
from
'./index'
// 业务Api
import
*
as
ProductCategoryApi
from
'@/api/mall/product/category'
import
{
propTypes
}
from
'@/utils/propTypes'
const
message
=
useMessage
()
// 消息弹窗
const
props
=
defineProps
({
propFormData
:
{
type
:
Object
as
PropType
<
SpuType
>
,
default
:
()
=>
{}
}
},
activeName
:
propTypes
.
string
.
def
(
''
)
})
const
AttributesAddFormRef
=
ref
()
// 添加商品属性表单
const
ProductManagementBasicInfoRef
=
ref
()
// 表单Ref
...
...
src/views/mall/product/management/components/DescriptionForm.vue
View file @
1116fb27
...
...
@@ -11,13 +11,15 @@ import type { SpuType } from '@/api/mall/product/management/type/spuType'
import
{
Editor
}
from
'@/components/Editor'
import
{
PropType
}
from
'vue'
import
{
copyValueToTarget
}
from
'@/utils/object'
import
{
propTypes
}
from
'@/utils/propTypes'
const
message
=
useMessage
()
// 消息弹窗
const
props
=
defineProps
({
propFormData
:
{
type
:
Object
as
PropType
<
SpuType
>
,
default
:
()
=>
{}
}
},
activeName
:
propTypes
.
string
.
def
(
''
)
})
const
DescriptionFormRef
=
ref
()
// 表单Ref
const
formData
=
ref
<
SpuType
>
({
...
...
src/views/mall/product/management/components/OtherSettingsForm.vue
View file @
1116fb27
...
...
@@ -53,13 +53,15 @@
import
type
{
SpuType
}
from
'@/api/mall/product/management/type/spuType'
import
{
PropType
}
from
'vue'
import
{
copyValueToTarget
}
from
'@/utils/object'
import
{
propTypes
}
from
'@/utils/propTypes'
const
message
=
useMessage
()
// 消息弹窗
const
props
=
defineProps
({
propFormData
:
{
type
:
Object
as
PropType
<
SpuType
>
,
default
:
()
=>
{}
}
},
activeName
:
propTypes
.
string
.
def
(
''
)
})
// 商品推荐选项
const
recommend
=
[
...
...
src/views/mall/product/management/components/SkuList.vue
View file @
1116fb27
...
...
@@ -19,17 +19,17 @@
</
template
>
</el-table-column>
</template>
<el-table-column
align=
"center"
label=
"商品条码"
min-width=
"1
20
"
>
<el-table-column
align=
"center"
label=
"商品条码"
min-width=
"1
68
"
>
<
template
#
default=
"{ row }"
>
<el-input
v-model=
"row.barCode"
class=
"w-100%"
/>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"销售价(分)"
min-width=
"1
20
"
>
<el-table-column
align=
"center"
label=
"销售价(分)"
min-width=
"1
68
"
>
<
template
#
default=
"{ row }"
>
<el-input-number
v-model=
"row.price"
:min=
"0"
class=
"w-100%"
controls-position=
"right"
/>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"市场价(分)"
min-width=
"1
20
"
>
<el-table-column
align=
"center"
label=
"市场价(分)"
min-width=
"1
68
"
>
<
template
#
default=
"{ row }"
>
<el-input-number
v-model=
"row.marketPrice"
...
...
@@ -39,7 +39,7 @@
/>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"成本价(分)"
min-width=
"1
20
"
>
<el-table-column
align=
"center"
label=
"成本价(分)"
min-width=
"1
68
"
>
<
template
#
default=
"{ row }"
>
<el-input-number
v-model=
"row.costPrice"
...
...
@@ -49,23 +49,23 @@
/>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"库存"
min-width=
"1
20
"
>
<el-table-column
align=
"center"
label=
"库存"
min-width=
"1
68
"
>
<
template
#
default=
"{ row }"
>
<el-input-number
v-model=
"row.stock"
:min=
"0"
class=
"w-100%"
controls-position=
"right"
/>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"重量(kg)"
min-width=
"1
20
"
>
<el-table-column
align=
"center"
label=
"重量(kg)"
min-width=
"1
68
"
>
<
template
#
default=
"{ row }"
>
<el-input-number
v-model=
"row.weight"
:min=
"0"
class=
"w-100%"
controls-position=
"right"
/>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"体积(m^3)"
min-width=
"1
20
"
>
<el-table-column
align=
"center"
label=
"体积(m^3)"
min-width=
"1
68
"
>
<
template
#
default=
"{ row }"
>
<el-input-number
v-model=
"row.volume"
:min=
"0"
class=
"w-100%"
controls-position=
"right"
/>
</
template
>
</el-table-column>
<
template
v-if=
"formData.subCommissionType"
>
<el-table-column
align=
"center"
label=
"一级返佣(分)"
min-width=
"1
20
"
>
<el-table-column
align=
"center"
label=
"一级返佣(分)"
min-width=
"1
68
"
>
<template
#
default=
"
{ row }">
<el-input-number
v-model=
"row.subCommissionFirstPrice"
...
...
@@ -75,7 +75,7 @@
/>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"二级返佣(分)"
min-width=
"1
20
"
>
<el-table-column
align=
"center"
label=
"二级返佣(分)"
min-width=
"1
68
"
>
<
template
#
default=
"{ row }"
>
<el-input-number
v-model=
"row.subCommissionSecondPrice"
...
...
src/views/mall/product/management/index.vue
View file @
1116fb27
...
...
@@ -68,7 +68,7 @@
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table-column
type=
"expand"
>
<template
#
default=
"
{ row }">
<el-form
class=
"demo-table-expand"
inline
label-position=
"left"
>
<el-form
inline
label-position=
"left"
>
<el-form-item
label=
"市场价:"
>
<span>
{{
row
.
marketPrice
}}
</span>
</el-form-item>
...
...
@@ -83,23 +83,18 @@
</el-table-column>
<el-table-column
label=
"商品图"
min-width=
"80"
>
<
template
#
default=
"{ row }"
>
<div
class=
"demo-image__preview"
>
<div
class=
"demo-image__preview
z-100
"
>
<el-image
:preview-src-list=
"[row.image]"
:src=
"row.image"
:src=
"row.picUrl"
style=
"width: 36px; height: 36px"
@
click=
"imgViewVisible = true"
/>
</div>
</
template
>
</el-table-column>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"商品名称"
min-width=
"300"
prop=
"storeName"
/>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"商品名称"
min-width=
"300"
prop=
"name"
/>
<el-table-column
align=
"center"
label=
"商品售价"
min-width=
"90"
prop=
"price"
/>
<el-table-column
align=
"center"
label=
"销量"
min-width=
"90"
prop=
"sales"
/>
<el-table-column
align=
"center"
label=
"销量"
min-width=
"90"
prop=
"sales
Count
"
/>
<el-table-column
align=
"center"
label=
"库存"
min-width=
"90"
prop=
"stock"
/>
<el-table-column
align=
"center"
label=
"排序"
min-width=
"70"
prop=
"sort"
/>
<el-table-column
...
...
@@ -112,7 +107,7 @@
<el-table-column
fixed=
"right"
label=
"状态"
min-width=
"80"
>
<
template
#
default=
"{ row }"
>
<!--TODO 暂时用COMMON_STATUS占位一下使其不报错 -->
<dict-tag
:type=
"DICT_TYPE.
COMMON
_STATUS"
:value=
"row.status"
/>
<dict-tag
:type=
"DICT_TYPE.
PRODUCT_SPU
_STATUS"
:value=
"row.status"
/>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
fixed=
"right"
label=
"操作"
min-width=
"150"
/>
...
...
@@ -125,11 +120,19 @@
@
pagination=
"getList"
/>
</ContentWrap>
<!-- 必须在表格外面展示。不然单元格会遮挡图层 -->
<el-image-viewer
v-if=
"imgViewVisible"
:url-list=
"[
'http://127.0.0.1:48080/admin-api/infra/file/4/get/6ffdf8f5dfc03f7ceec1ff1ebc138adb8b721a057d505ccfb0e61a8783af1371.png'
]"
@
close=
"imgViewVisible = false"
/>
</template>
<
script
lang=
"ts"
name=
"ProductManagement"
setup
>
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
// 业务api
import
*
as
managementApi
from
'@/api/mall/product/management/spu'
// const message = useMessage() // 消息弹窗
import
*
as
managementApi
from
'@/api/mall/product/management/spu'
// const message = useMessage() // 消息弹窗
// const { t } = useI18n() // 国际化
const
{
push
}
=
useRouter
()
// 路由跳转
...
...
@@ -163,13 +166,10 @@ const headerNum = ref([
type
:
5
}
])
const
imgViewVisible
=
ref
(
false
)
const
queryParams
=
reactive
({
pageNo
:
1
,
pageSize
:
10
,
name
:
undefined
,
status
:
undefined
,
createTime
:
[],
type
:
'1'
pageSize
:
10
})
const
queryFormRef
=
ref
()
// 搜索的表单
...
...
@@ -177,7 +177,7 @@ const queryFormRef = ref() // 搜索的表单
const
getList
=
async
()
=>
{
loading
.
value
=
true
try
{
const
data
=
await
managementApi
.
getS
k
uList
(
queryParams
)
const
data
=
await
managementApi
.
getS
p
uList
(
queryParams
)
list
.
value
=
data
.
list
total
.
value
=
data
.
total
}
finally
{
...
...
@@ -218,6 +218,6 @@ const openForm = (id?: number) => {
/** 初始化 **/
onMounted
(()
=>
{
//
getList()
getList
()
})
</
script
>
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