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
127e6b20
authored
Aug 13, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商城:
1. 修复拼团活动,修改商品的拼团价格,会存在 *100 的问题
parent
ff8bde20
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
30 deletions
+27
-30
src/api/mall/promotion/combination/combinationActivity.ts
+3
-3
src/views/mall/promotion/combination/activity/CombinationActivityForm.vue
+12
-11
src/views/mall/promotion/combination/activity/combinationActivity.data.ts
+2
-2
src/views/mall/promotion/combination/activity/index.vue
+6
-14
src/views/mall/promotion/combination/record/index.vue
+0
-0
src/views/mall/promotion/seckill/activity/index.vue
+2
-0
src/views/mall/promotion/seckill/config/index.vue
+2
-0
No files found.
src/api/mall/promotion/combination/combinationActivity.ts
View file @
127e6b20
...
@@ -10,8 +10,8 @@ export interface CombinationActivityVO {
...
@@ -10,8 +10,8 @@ export interface CombinationActivityVO {
startTime
?:
Date
startTime
?:
Date
endTime
?:
Date
endTime
?:
Date
userSize
?:
number
userSize
?:
number
total
Num
?:
number
total
Count
?:
number
success
Num
?:
number
success
Count
?:
number
orderUserCount
?:
number
orderUserCount
?:
number
virtualGroup
?:
number
virtualGroup
?:
number
status
?:
number
status
?:
number
...
@@ -23,7 +23,7 @@ export interface CombinationActivityVO {
...
@@ -23,7 +23,7 @@ export interface CombinationActivityVO {
export
interface
CombinationProductVO
{
export
interface
CombinationProductVO
{
spuId
:
number
spuId
:
number
skuId
:
number
skuId
:
number
active
Price
:
number
// 拼团价格
combination
Price
:
number
// 拼团价格
}
}
// 扩展 Sku 配置
// 扩展 Sku 配置
...
...
src/views/mall/promotion/combination/CombinationActivityForm.vue
→
src/views/mall/promotion/combination/
activity/
CombinationActivityForm.vue
View file @
127e6b20
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<el-table-column
align=
"center"
label=
"拼团价格(元)"
min-width=
"168"
>
<el-table-column
align=
"center"
label=
"拼团价格(元)"
min-width=
"168"
>
<template
#
default=
"
{ row: sku }">
<template
#
default=
"
{ row: sku }">
<el-input-number
<el-input-number
v-model=
"sku.productConfig.
active
Price"
v-model=
"sku.productConfig.
combination
Price"
:min=
"0"
:min=
"0"
:precision=
"2"
:precision=
"2"
:step=
"0.1"
:step=
"0.1"
...
@@ -45,6 +45,7 @@ import { SpuAndSkuList, SpuProperty, SpuSelect } from '@/views/mall/promotion/co
...
@@ -45,6 +45,7 @@ import { SpuAndSkuList, SpuProperty, SpuSelect } from '@/views/mall/promotion/co
import
{
getPropertyList
,
RuleConfig
}
from
'@/views/mall/product/spu/components'
import
{
getPropertyList
,
RuleConfig
}
from
'@/views/mall/product/spu/components'
import
*
as
ProductSpuApi
from
'@/api/mall/product/spu'
import
*
as
ProductSpuApi
from
'@/api/mall/product/spu'
import
{
convertToInteger
,
formatToFraction
}
from
'@/utils'
import
{
convertToInteger
,
formatToFraction
}
from
'@/utils'
import
{
cloneDeep
}
from
'lodash-es'
defineOptions
({
name
:
'PromotionCombinationActivityForm'
})
defineOptions
({
name
:
'PromotionCombinationActivityForm'
})
...
@@ -65,8 +66,8 @@ const spuList = ref<CombinationActivityApi.SpuExtension[]>([]) // 选择的 spu
...
@@ -65,8 +66,8 @@ const spuList = ref<CombinationActivityApi.SpuExtension[]>([]) // 选择的 spu
const
spuPropertyList
=
ref
<
SpuProperty
<
CombinationActivityApi
.
SpuExtension
>
[]
>
([])
const
spuPropertyList
=
ref
<
SpuProperty
<
CombinationActivityApi
.
SpuExtension
>
[]
>
([])
const
ruleConfig
:
RuleConfig
[]
=
[
const
ruleConfig
:
RuleConfig
[]
=
[
{
{
name
:
'productConfig.
active
Price'
,
name
:
'productConfig.
combination
Price'
,
rule
:
(
arg
)
=>
arg
>
0.01
,
rule
:
(
arg
)
=>
arg
>
=
0.01
,
message
:
'商品拼团价格不能小于0.01 !!!'
message
:
'商品拼团价格不能小于0.01 !!!'
}
}
]
]
...
@@ -98,13 +99,12 @@ const getSpuDetails = async (
...
@@ -98,13 +99,12 @@ const getSpuDetails = async (
let
config
:
CombinationProductVO
=
{
let
config
:
CombinationProductVO
=
{
spuId
:
spu
.
id
!
,
spuId
:
spu
.
id
!
,
skuId
:
sku
.
id
!
,
skuId
:
sku
.
id
!
,
active
Price
:
0
combination
Price
:
0
}
}
if
(
typeof
products
!==
'undefined'
)
{
if
(
typeof
products
!==
'undefined'
)
{
const
product
=
products
.
find
((
item
)
=>
item
.
skuId
===
sku
.
id
)
const
product
=
products
.
find
((
item
)
=>
item
.
skuId
===
sku
.
id
)
if
(
product
)
{
if
(
product
)
{
// 分转元
product
.
combinationPrice
=
formatToFraction
(
product
.
combinationPrice
)
product
.
activePrice
=
formatToFraction
(
product
.
activePrice
)
}
}
config
=
product
||
config
config
=
product
||
config
}
}
...
@@ -162,13 +162,14 @@ const submitForm = async () => {
...
@@ -162,13 +162,14 @@ const submitForm = async () => {
// 提交请求
// 提交请求
formLoading
.
value
=
true
formLoading
.
value
=
true
try
{
try
{
const
data
=
formRef
.
value
.
formModel
as
CombinationActivityApi
.
CombinationActivityVO
// 获得拼团商品配置
const
products
=
spuAndSkuListRef
.
value
.
getSkuConfigs
(
'productConfig'
)
const
products
=
cloneDeep
(
spuAndSkuListRef
.
value
.
getSkuConfigs
(
'productConfig'
))
products
.
forEach
((
item
:
CombinationProductVO
)
=>
{
products
.
forEach
((
item
:
CombinationActivityApi
.
CombinationProductVO
)
=>
{
// 拼团价格元转分
item
.
combinationPrice
=
convertToInteger
(
item
.
combinationPrice
)
item
.
activePrice
=
convertToInteger
(
item
.
activePrice
)
})
})
const
data
=
formRef
.
value
.
formModel
as
CombinationActivityApi
.
CombinationActivityVO
data
.
products
=
products
data
.
products
=
products
// 真正提交
if
(
formType
.
value
===
'create'
)
{
if
(
formType
.
value
===
'create'
)
{
await
CombinationActivityApi
.
createCombinationActivity
(
data
)
await
CombinationActivityApi
.
createCombinationActivity
(
data
)
message
.
success
(
t
(
'common.createSuccess'
))
message
.
success
(
t
(
'common.createSuccess'
))
...
...
src/views/mall/promotion/combination/combinationActivity.data.ts
→
src/views/mall/promotion/combination/
activity/
combinationActivity.data.ts
View file @
127e6b20
...
@@ -122,13 +122,13 @@ const crudSchemas = reactive<CrudSchema[]>([
...
@@ -122,13 +122,13 @@ const crudSchemas = reactive<CrudSchema[]>([
},
},
{
{
label
:
'开团组数'
,
label
:
'开团组数'
,
field
:
'total
Num
'
,
field
:
'total
Count
'
,
isSearch
:
false
,
isSearch
:
false
,
isForm
:
false
isForm
:
false
},
},
{
{
label
:
'成团组数'
,
label
:
'成团组数'
,
field
:
'success
Num
'
,
field
:
'success
Count
'
,
isSearch
:
false
,
isSearch
:
false
,
isForm
:
false
isForm
:
false
},
},
...
...
src/views/mall/promotion/combination/index.vue
→
src/views/mall/promotion/combination/
activity/
index.vue
View file @
127e6b20
<
template
>
<
template
>
<doc-alert
title=
"功能开启"
url=
"https://doc.iocoder.cn/mall/build/"
/>
<!-- 搜索工作栏 -->
<!-- 搜索工作栏 -->
<ContentWrap>
<ContentWrap>
<Search
:schema=
"allSchemas.searchSchema"
@
reset=
"setSearchParams"
@
search=
"setSearchParams"
>
<Search
:schema=
"allSchemas.searchSchema"
@
reset=
"setSearchParams"
@
search=
"setSearchParams"
>
...
@@ -10,8 +12,7 @@
...
@@ -10,8 +12,7 @@
type=
"primary"
type=
"primary"
@
click=
"openForm('create')"
@
click=
"openForm('create')"
>
>
<Icon
class=
"mr-5px"
icon=
"ep:plus"
/>
<Icon
class=
"mr-5px"
icon=
"ep:plus"
/>
新增
新增
</el-button>
</el-button>
</
template
>
</
template
>
</Search>
</Search>
...
@@ -65,7 +66,7 @@
...
@@ -65,7 +66,7 @@
import
{
allSchemas
}
from
'./combinationActivity.data'
import
{
allSchemas
}
from
'./combinationActivity.data'
import
*
as
CombinationActivityApi
from
'@/api/mall/promotion/combination/combinationActivity'
import
*
as
CombinationActivityApi
from
'@/api/mall/promotion/combination/combinationActivity'
import
CombinationActivityForm
from
'./CombinationActivityForm.vue'
import
CombinationActivityForm
from
'./CombinationActivityForm.vue'
import
{
cloneDeep
}
from
'lodash-e
s'
import
{
sortTableColumns
}
from
'@/hooks/web/useCrudSchema
s'
import
{
createImageViewer
}
from
'@/components/ImageViewer'
import
{
createImageViewer
}
from
'@/components/ImageViewer'
defineOptions
({
name
:
'PromotionCombinationActivity'
})
defineOptions
({
name
:
'PromotionCombinationActivity'
})
...
@@ -100,17 +101,8 @@ const handleDelete = (id: number) => {
...
@@ -100,17 +101,8 @@ const handleDelete = (id: number) => {
/** 初始化 **/
/** 初始化 **/
onMounted
(()
=>
{
onMounted
(()
=>
{
/**
// 获得活动列表
TODO
sortTableColumns
(
allSchemas
.
tableColumns
,
'spuId'
)
后面准备封装成一个函数来操作 tableColumns 重新排列:比如说需求是表单上商品选择是在后面的而列表展示的时候需要调到位置。
封装效果支持批量操作,给出 field 和需要插入的位置,例:[{field:'spuId',index: 1}] 效果为把 field 为 spuId 的 column 移动到第一个位置
*/
// 处理一下表格列让商品往前
const
index
=
allSchemas
.
tableColumns
.
findIndex
((
item
)
=>
item
.
field
===
'spuId'
)
const
column
=
cloneDeep
(
allSchemas
.
tableColumns
[
index
])
allSchemas
.
tableColumns
.
splice
(
index
,
1
)
// 添加到开头
allSchemas
.
tableColumns
.
unshift
(
column
)
getList
()
getList
()
})
})
</
script
>
</
script
>
src/views/mall/promotion/combination/record/index.vue
0 → 100644
View file @
127e6b20
src/views/mall/promotion/seckill/activity/index.vue
View file @
127e6b20
<
template
>
<
template
>
<doc-alert
title=
"功能开启"
url=
"https://doc.iocoder.cn/mall/build/"
/>
<!-- 搜索工作栏 -->
<!-- 搜索工作栏 -->
<ContentWrap>
<ContentWrap>
<Search
:schema=
"allSchemas.searchSchema"
@
reset=
"setSearchParams"
@
search=
"setSearchParams"
>
<Search
:schema=
"allSchemas.searchSchema"
@
reset=
"setSearchParams"
@
search=
"setSearchParams"
>
...
...
src/views/mall/promotion/seckill/config/index.vue
View file @
127e6b20
<
template
>
<
template
>
<doc-alert
title=
"功能开启"
url=
"https://doc.iocoder.cn/mall/build/"
/>
<!-- 搜索工作栏 -->
<!-- 搜索工作栏 -->
<ContentWrap>
<ContentWrap>
<Search
:schema=
"allSchemas.searchSchema"
@
reset=
"setSearchParams"
@
search=
"setSearchParams"
>
<Search
:schema=
"allSchemas.searchSchema"
@
reset=
"setSearchParams"
@
search=
"setSearchParams"
>
...
...
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