Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
3fa54bc6
Commit
3fa54bc6
authored
Jan 15, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 价格策略列表
parent
732de195
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
152 additions
and
88 deletions
+152
-88
commodityRoute.ts
config/routes/commodityRoute.ts
+19
-3
menu.ts
src/locales/zh-CN/menu.ts
+3
-1
PriceSetting.tsx
...ages/priceManage/priceStrategy/component/PriceSetting.tsx
+28
-8
index.tsx
src/pages/priceManage/priceStrategy/index.tsx
+70
-67
setStrategy.tsx
src/pages/priceManage/priceStrategy/setStrategy.tsx
+16
-4
index.tsx
src/pages/priceManage/schema/index.tsx
+16
-5
No files found.
config/routes/commodityRoute.ts
View file @
3fa54bc6
...
...
@@ -262,10 +262,26 @@ const CommodityRoute: RouterChild = {
icon
:
'smile'
,
component
:
'@/pages/commodity/products/fastModifyPrice'
,
},
//
设置商品价格
//
新增价格策略
{
path
:
'/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy'
,
name
:
'setStrategy'
,
path
:
'/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/add'
,
name
:
'addStrategy'
,
icon
:
'smile'
,
component
:
'@/pages/priceManage/priceStrategy/setStrategy'
,
hideInMenu
:
true
,
},
// 编辑价格策略
{
path
:
'/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/edit'
,
name
:
'editStrategy'
,
icon
:
'smile'
,
component
:
'@/pages/priceManage/priceStrategy/setStrategy'
,
hideInMenu
:
true
,
},
// 查看价格策略
{
path
:
'/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/detail'
,
name
:
'previewStrategy'
,
icon
:
'smile'
,
component
:
'@/pages/priceManage/priceStrategy/setStrategy'
,
hideInMenu
:
true
,
...
...
src/locales/zh-CN/menu.ts
View file @
3fa54bc6
...
...
@@ -71,7 +71,9 @@ export default {
'menu.commodityAbility.adjustRepository'
:
'仓位库存调拨'
,
'menu.commodityAbility.priceManage'
:
'价格管理'
,
'menu.commodityAbility.priceManage.priceStrategy'
:
'价格策略'
,
'menu.commodityAbility.priceManage.priceStrategy.setStrategy'
:
'设置商品价格'
,
'menu.commodityAbility.priceManage.priceStrategy.addStrategy'
:
'新建商品价格策略'
,
'menu.commodityAbility.priceManage.priceStrategy.editStrategy'
:
'编辑商品价格策略'
,
'menu.commodityAbility.priceManage.priceStrategy.previewStrategy'
:
'查看商品价格策略'
,
'menu.commodityAbility.priceManage.fastModifyPrice'
:
'快捷修改单价'
,
// 会员能力
'menu.memberAbility'
:
'会员'
,
...
...
src/pages/priceManage/priceStrategy/component/PriceSetting.tsx
View file @
3fa54bc6
...
...
@@ -15,6 +15,7 @@ import ModalTable from '@/components/ModalTable'
import
{
GlobalConfig
}
from
'@/global/config'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
import
SearchSelect
from
'@/components/NiceForm/components/SearchSelect'
import
ModalSearch
from
'@/components/NiceForm/components/Search'
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
import
Submit
from
'@/components/NiceForm/components/Submit'
import
{
SHOP_TYPES
,
MALL_TYPE
}
from
'@/constants'
;
...
...
@@ -148,19 +149,31 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
return
res
.
data
}
// 指定商品
const
fetchProductList
=
async
(
params
)
=>
{
const
shopType
=
addSchemaAction
.
getFieldValue
(
'shopType'
)
const
res
=
await
PublicApi
.
getProductCommodityCommonGetCommodityListByStock
({
let
shopInfo
:
any
=
GlobalConfig
.
web
.
shopInfo
.
filter
(
item
=>
item
.
id
===
shopType
)
console
.
log
(
shopInfo
,
'skhopIndo0'
)
const
res
=
await
PublicApi
.
getProductCommodityCommonGetCommodityListBySeller
({
...
params
,
shopType
,
environment
:
1
,
// 根据商城类型手动传输定价类型
priceTypeList
:
priceTypeMaps
[
shopType
]
?
priceTypeMaps
[
shopType
]
:
undefined
environment
:
shopInfo
[
0
].
environment
,
priceTypeList
:
[
1
,
2
],
})
return
res
.
data
// const shopType = addSchemaAction.getFieldValue('shopType')
// let shopInfo: any = GlobalConfig.web.shopInfo.filter(item => item.id === shopType)
// console.log(shopInfo, 'skhopIndo0')
// const res = await PublicApi.getProductCommodityCommonGetCommodityListBySeller({
// shopType,
// environment: shopInfo[0].environment,
// priceTypeList: [1, 2],
// })
// return res.data
}
// 指定规格商品列表
const
fetchProductUnitList
=
async
(
params
)
=>
{
const
productId
=
addSchemaAction
.
getFieldValue
(
'productId'
)
const
res
=
await
PublicApi
.
getProductChannelCommodityGetCommodityUnitPrice
({
...
...
@@ -335,7 +348,6 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
return
res
.
data
}
const
handleCancelAddProduct
=
()
=>
{
setVisibleChannelRroduct
(
false
)
}
...
...
@@ -464,7 +476,12 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
{
ctx
:
{
schema
:
formSearch
,
components
:
{
ModalSearch
:
Search
,
SearchSelect
,
Submit
,
Select
}
,
components
:
{
ModalSearch
,
SearchSelect
,
Submit
,
Select
},
effects
:
(
$
,
actions
)
=>
{
actions
.
reset
()
useStateFilterSearchLinkageEffect
(
...
...
@@ -497,7 +514,10 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
{
ctx
:
{
schema
:
formProduct
,
components
:
{
ModalSearch
:
Search
,
SearchSelect
,
Submit
}
,
components
:
{
ModalSearch
,
SearchSelect
,
Submit
},
effects
:
(
$
,
actions
)
=>
{
actions
.
reset
()
useStateFilterSearchLinkageEffect
(
...
...
src/pages/priceManage/priceStrategy/index.tsx
View file @
3fa54bc6
import
React
,
{
useState
,
useEffect
,
useRef
,
ReactNode
}
from
'react'
import
{
Button
,
Form
,
Card
,
}
from
'antd'
import
{
Button
,
Form
,
Card
,
Space
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
StandardTable
}
from
'god'
import
{
ColumnType
}
from
'antd/lib/table/interface'
...
...
@@ -13,44 +13,55 @@ import { searchCustomerCategoryOptionEffect, searchBrandOptionEffect } from '../
import
{
schema
}
from
'../schema'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
import
{
history
}
from
'umi'
import
StatusSwitch
from
'@/components/StatusSwitch'
import
{
PlusOutlined
}
from
'@ant-design/icons'
const
formActions
=
createFormActions
();
const
PriceManage
:
React
.
FC
<
{}
>
=
()
=>
{
const
ref
=
useRef
<
any
>
({})
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'
商品
ID'
,
title
:
'
价格策略
ID'
,
dataIndex
:
'id'
,
key
:
'id'
,
},
{
title
:
'
商品
名称'
,
title
:
'
价格策略
名称'
,
dataIndex
:
'name'
,
key
:
'name'
,
className
:
'commonPickColor'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
EyePreview
url=
{
`/memberCenter/commodityAbility/
commodity/products/detail?id=${record.commodityId}
`
}
url=
{
`/memberCenter/commodityAbility/
priceManage/priceStrategy/setStrategy/detail?id=${record.id}&preview=1
`
}
>
{
text
}
</
EyePreview
>
},
{
title
:
'商品品类'
,
dataIndex
:
'customerCategoryName'
,
key
:
'customerCategoryName'
,
title
:
'商品ID'
,
dataIndex
:
'id'
,
key
:
'id'
,
},
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
key
:
'name'
,
},
{
title
:
'商品品牌'
,
dataIndex
:
'brandName'
,
key
:
'brandName'
,
title
:
'品类'
,
dataIndex
:
[
"commodity"
,
"customerCategory"
,
"name"
],
key
:
'commodity'
,
},
{
title
:
'品牌'
,
dataIndex
:
[
"commodity"
,
"brand"
,
"name"
],
key
:
'commodity'
,
},
{
title
:
'单位'
,
dataIndex
:
'unitName'
,
key
:
'
unitName
'
,
dataIndex
:
[
"commodity"
,
"unitName"
]
,
key
:
'
commodity
'
,
},
{
title
:
'商品定价'
,
...
...
@@ -87,58 +98,27 @@ const PriceManage: React.FC<{}> = () => {
}
},
{
title
:
'申请审核时间'
,
dataIndex
:
'applyTime'
,
key
:
'applyTime'
,
render
:
(
text
:
any
,
record
:
any
)
=>
text
&&
moment
(
text
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
},
{
title
:
'状态'
,
dataIndex
:
'status'
,
key
:
'status'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
let
component
:
ReactNode
=
null
if
(
record
.
status
===
1
)
component
=
(<><
span
className=
"commonStatusStop"
></
span
>
待提交审核
</>)
else
if
(
record
.
status
===
2
)
component
=
(<><
span
className=
"commonStatusModify"
></
span
>
待审核
</>)
else
if
(
record
.
status
===
3
)
component
=
(<><
span
className=
"commonStatusInvalid"
></
span
>
审核不通过
</>)
else
if
(
record
.
status
===
4
)
component
=
(<><
span
className=
"commonStatusValid"
></
span
>
审核通过
</>)
else
if
(
record
.
status
===
5
)
component
=
(<
span
style=
{
{
color
:
'#00B37A'
,
padding
:
'2px 5px'
,
background
:
'rgba(235,247,242,1)'
,
borderRadius
:
'4px'
}
}
>
已上架
</
span
>)
else
if
(
record
.
status
===
6
)
component
=
(<
span
style=
{
{
padding
:
'2px 5px'
,
background
:
'rgba(244,245,247,1)'
,
borderRadius
:
'4px'
}
}
>
已下架
</
span
>)
return
component
},
// filters: [
// {
// text: '待提交审核',
// value: 1,
// },
// {
// text: '待审核',
// value: 2,
// },
// {
// text: '审核通过',
// value: 3,
// },
// {
// text: '审核不通过',
// value: 4,
// },
// {
// text: '已上架',
// value: 5,
// },
// {
// text: '已下架',
// value: 6,
// }
// ],
// onFilter: (value, record) => record.status === value,
dataIndex
:
'isEnable'
,
key
:
'isEnable'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(
<
StatusSwitch
handleConfirm=
{
()
=>
handleUpdateState
(
record
)
}
record=
{
record
}
fieldNames=
"isEnable"
/>
),
filters
:
[
{
text
:
'有效'
,
value
:
true
,
},
{
text
:
'无效'
,
value
:
false
,
}
],
onFilter
:
(
value
,
record
)
=>
record
.
isEnable
===
value
,
},
{
title
:
'操作'
,
...
...
@@ -147,7 +127,8 @@ const PriceManage: React.FC<{}> = () => {
render
:
(
text
:
any
,
record
:
any
)
=>
{
return
(
<>
<
Button
type=
'link'
className=
"padLeft0"
onClick=
{
()
=>
handleModify
(
record
)
}
>
设置商品价格
</
Button
>
<
Button
type=
'link'
className=
"padLeft0"
onClick=
{
()
=>
handleModify
(
record
)
}
>
修改
</
Button
>
<
Button
type=
'link'
className=
"padLeft0"
onClick=
{
()
=>
handleDelete
(
record
)
}
>
删除
</
Button
>
</>
)
}
...
...
@@ -156,17 +137,36 @@ const PriceManage: React.FC<{}> = () => {
const
fetchData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getProductCommodityGet
CommodityDetailList
({
...
params
,
environment
:
1
}
).
then
(
res
=>
{
PublicApi
.
getProductCommodityGet
UnitPriceStrategyList
(
params
).
then
(
res
=>
{
const
{
data
}
=
res
resolve
(
data
)
})
})
}
const
handleUpdateState
=
(
record
:
any
)
=>
{
PublicApi
.
postProductCommodityUpdateUnitPriceStrategyStatus
({
id
:
record
.
id
,
isEnable
:
!
record
.
isEnable
})
}
const
handleModify
=
(
record
:
any
)
=>
{
history
.
push
(
"/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy"
)
history
.
push
(
`/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/edit?id=
${
record
.
id
}
`
)
}
const
handleDelete
=
(
record
:
any
)
=>
{
}
const
controllerBtns
=
(
<
Space
>
<
Button
type=
'primary'
onClick=
{
()
=>
history
.
push
(
'/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/add'
)
}
>
<
PlusOutlined
/>
新建
</
Button
>
</
Space
>
)
return
(
<
PageHeaderWrapper
>
<
Card
>
...
...
@@ -179,6 +179,9 @@ const PriceManage: React.FC<{}> = () => {
<
NiceForm
actions=
{
formActions
}
onSubmit=
{
values
=>
ref
.
current
.
reload
(
values
)
}
expressionScope=
{
{
controllerBtns
,
}
}
effects=
{
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
...
...
src/pages/priceManage/priceStrategy/setStrategy.tsx
View file @
3fa54bc6
...
...
@@ -8,13 +8,20 @@ import { createFormActions } from '@formily/antd'
import
{
setPriceSchema
}
from
'../schema'
import
PriceSetting
from
'./component/PriceSetting'
import
'./index.less'
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
const
addSchemaAction
=
createFormActions
()
const
SetStrategy
:
React
.
FC
<
{}
>
=
()
=>
{
const
{
id
,
preview
,
pageStatus
}
=
usePageStatus
()
// 整体表单提交
const
formSubmit
=
async
(
values
)
=>
{
console
.
log
(
values
,
'values'
)
// const params = omit(values, ['NO_SUBMIT3'])
// if (params['applyMember']) {
// params['applyMember'] = params['applyMember']
...
...
@@ -37,11 +44,16 @@ const SetStrategy: React.FC<{}> = () => {
onBack=
{
()
=>
history
.
goBack
()
}
backIcon=
{
<
ReutrnEle
description=
"返回"
/>
}
className=
"setStrategy"
title=
"设置商品价格"
title=
{
pageStatus
===
PageStatus
.
PREVIEW
?
'查看商品价格策略'
:
'新建商品价格策略'
}
extra=
{
(
<
Button
key=
"1"
onClick=
{
()
=>
addSchemaAction
.
submit
()
}
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
>
保存
</
Button
>
pageStatus
!==
PageStatus
.
PREVIEW
?
(
<
Button
key=
"1"
onClick=
{
()
=>
addSchemaAction
.
submit
()
}
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
>
保存
</
Button
>
)
:
null
)
}
>
<
Card
>
...
...
src/pages/priceManage/schema/index.tsx
View file @
3fa54bc6
...
...
@@ -33,11 +33,18 @@ export const schema: ISchema = {
grid
:
true
,
},
properties
:
{
ctl
:
{
type
:
'object'
,
'x-component'
:
'Children'
,
'x-component-props'
:
{
children
:
'{{controllerBtns}}'
,
},
},
name
:
{
type
:
'string'
,
'x-component'
:
'Search'
,
'x-component-props'
:
{
placeholder
:
'
商品
名称'
,
placeholder
:
'
价格策略
名称'
,
},
},
},
...
...
@@ -54,14 +61,14 @@ export const schema: ISchema = {
},
},
properties
:
{
strateg
yName
:
{
commodit
yName
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'
价格策略
名称'
,
placeholder
:
'
商品
名称'
,
style
:
{
width
:
'174px'
},
}
},
priceType
List
:
{
priceType
:
{
type
:
'string'
,
enum
:
[
{
...
...
@@ -73,6 +80,10 @@ export const schema: ISchema = {
value
:
1
,
},
{
label
:
'价格需要询价'
,
value
:
2
,
},
{
label
:
'积分兑换商品'
,
value
:
3
,
}
...
...
@@ -376,7 +387,7 @@ export const formProduct: ISchema = {
type
:
'string'
,
'x-component'
:
'ModalSearch'
,
'x-component-props'
:
{
placeholder
:
'请输入商品名称'
,
placeholder
:
'请输入商品
编号/
名称'
,
align
:
'flex-left'
,
},
},
...
...
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