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
3fd9f1b4
authored
Jul 10, 2023
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: mall SeckillConfig
parent
b67fabcf
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
11 deletions
+41
-11
src/api/mall/promotion/seckill/seckillConfig.ts
+1
-1
src/views/mall/promotion/seckill/config/SeckillConfigForm.vue
+14
-2
src/views/mall/promotion/seckill/config/index.vue
+20
-5
src/views/mall/promotion/seckill/config/seckillConfig.data.ts
+6
-3
No files found.
src/api/mall/promotion/seckill/seckillConfig.ts
View file @
3fd9f1b4
...
@@ -5,7 +5,7 @@ export interface SeckillConfigVO {
...
@@ -5,7 +5,7 @@ export interface SeckillConfigVO {
name
:
string
name
:
string
startTime
:
string
startTime
:
string
endTime
:
string
endTime
:
string
picUrl
:
string
sliderPicUrls
:
string
[]
status
:
number
status
:
number
}
}
...
...
src/views/mall/promotion/seckill/config/SeckillConfigForm.vue
View file @
3fd9f1b4
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<
script
lang=
"ts"
name=
"SeckillConfigForm"
setup
>
<
script
lang=
"ts"
name=
"SeckillConfigForm"
setup
>
import
*
as
SeckillConfigApi
from
'@/api/mall/promotion/seckill/seckillConfig'
import
*
as
SeckillConfigApi
from
'@/api/mall/promotion/seckill/seckillConfig'
import
{
allSchemas
,
rules
}
from
'./seckillConfig.data'
import
{
allSchemas
,
rules
}
from
'./seckillConfig.data'
import
{
cloneDeep
}
from
'lodash-es'
const
{
t
}
=
useI18n
()
// 国际化
const
{
t
}
=
useI18n
()
// 国际化
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
...
@@ -30,6 +31,9 @@ const open = async (type: string, id?: number) => {
...
@@ -30,6 +31,9 @@ const open = async (type: string, id?: number) => {
formLoading
.
value
=
true
formLoading
.
value
=
true
try
{
try
{
const
data
=
await
SeckillConfigApi
.
getSeckillConfig
(
id
)
const
data
=
await
SeckillConfigApi
.
getSeckillConfig
(
id
)
data
.
sliderPicUrls
=
data
[
'sliderPicUrls'
]?.
map
((
item
)
=>
({
url
:
item
}))
formRef
.
value
.
setValues
(
data
)
formRef
.
value
.
setValues
(
data
)
}
finally
{
}
finally
{
formLoading
.
value
=
false
formLoading
.
value
=
false
...
@@ -48,12 +52,20 @@ const submitForm = async () => {
...
@@ -48,12 +52,20 @@ const submitForm = async () => {
// 提交请求
// 提交请求
formLoading
.
value
=
true
formLoading
.
value
=
true
try
{
try
{
// 处理轮播图列表
const
data
=
formRef
.
value
.
formModel
as
SeckillConfigApi
.
SeckillConfigVO
const
data
=
formRef
.
value
.
formModel
as
SeckillConfigApi
.
SeckillConfigVO
const
cloneData
=
cloneDeep
(
data
)
const
newSliderPicUrls
=
[]
cloneData
.
sliderPicUrls
.
forEach
((
item
)
=>
{
// 如果是前端选的图
typeof
item
===
'object'
?
newSliderPicUrls
.
push
(
item
.
url
)
:
newSliderPicUrls
.
push
(
item
)
})
cloneData
.
sliderPicUrls
=
newSliderPicUrls
if
(
formType
.
value
===
'create'
)
{
if
(
formType
.
value
===
'create'
)
{
await
SeckillConfigApi
.
createSeckillConfig
(
d
ata
)
await
SeckillConfigApi
.
createSeckillConfig
(
cloneD
ata
)
message
.
success
(
t
(
'common.createSuccess'
))
message
.
success
(
t
(
'common.createSuccess'
))
}
else
{
}
else
{
await
SeckillConfigApi
.
updateSeckillConfig
(
d
ata
)
await
SeckillConfigApi
.
updateSeckillConfig
(
cloneD
ata
)
message
.
success
(
t
(
'common.updateSuccess'
))
message
.
success
(
t
(
'common.updateSuccess'
))
}
}
dialogVisible
.
value
=
false
dialogVisible
.
value
=
false
...
...
src/views/mall/promotion/seckill/config/index.vue
View file @
3fd9f1b4
...
@@ -29,8 +29,14 @@
...
@@ -29,8 +29,14 @@
total: tableObject.total
total: tableObject.total
}"
}"
>
>
<
template
#
picUrl=
"{ row }"
>
<
template
#
sliderPicUrls=
"{ row }"
>
<el-image
:src=
"row.picUrl"
class=
"w-30px h-30px"
@
click=
"imagePreview(row.picUrl)"
/>
<el-image
v-for=
"(item, index) in row.sliderPicUrls"
:key=
"index"
:src=
"item"
class=
"w-60px h-60px mr-10px"
@
click=
"imagePreview(row.sliderPicUrls)"
/>
</
template
>
</
template
>
<
template
#
status=
"{ row }"
>
<
template
#
status=
"{ row }"
>
<el-switch
<el-switch
...
@@ -70,6 +76,7 @@ import * as SeckillConfigApi from '@/api/mall/promotion/seckill/seckillConfig'
...
@@ -70,6 +76,7 @@ import * as SeckillConfigApi from '@/api/mall/promotion/seckill/seckillConfig'
import
SeckillConfigForm
from
'./SeckillConfigForm.vue'
import
SeckillConfigForm
from
'./SeckillConfigForm.vue'
import
{
createImageViewer
}
from
'@/components/ImageViewer'
import
{
createImageViewer
}
from
'@/components/ImageViewer'
import
{
CommonStatusEnum
}
from
'@/utils/constants'
import
{
CommonStatusEnum
}
from
'@/utils/constants'
import
{
isArray
}
from
'@/utils/is'
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
// tableObject:表格的属性对象,可获得分页大小、条数等属性
// tableObject:表格的属性对象,可获得分页大小、条数等属性
...
@@ -82,10 +89,18 @@ const { tableObject, tableMethods } = useTable({
...
@@ -82,10 +89,18 @@ const { tableObject, tableMethods } = useTable({
// 获得表格的各种操作
// 获得表格的各种操作
const
{
getList
,
setSearchParams
}
=
tableMethods
const
{
getList
,
setSearchParams
}
=
tableMethods
/** 商品图预览 */
/** 轮播图预览预览 */
const
imagePreview
=
(
imgUrl
:
string
)
=>
{
const
imagePreview
=
(
args
)
=>
{
const
urlList
=
[]
if
(
isArray
(
args
))
{
args
.
forEach
((
item
)
=>
{
urlList
.
push
(
item
)
})
}
else
{
urlList
.
push
(
args
)
}
createImageViewer
({
createImageViewer
({
urlList
:
[
imgUrl
]
urlList
})
})
}
}
...
...
src/views/mall/promotion/seckill/config/seckillConfig.data.ts
View file @
3fd9f1b4
...
@@ -46,11 +46,14 @@ const crudSchemas = reactive<CrudSchema[]>([
...
@@ -46,11 +46,14 @@ const crudSchemas = reactive<CrudSchema[]>([
}
}
},
},
{
{
label
:
'秒杀
主
图'
,
label
:
'秒杀
轮播
图'
,
field
:
'
picUrl
'
,
field
:
'
sliderPicUrls
'
,
isSearch
:
false
,
isSearch
:
false
,
form
:
{
form
:
{
component
:
'UploadImg'
component
:
'UploadImgs'
},
table
:
{
width
:
300
}
}
},
},
{
{
...
...
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