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
27f5a09a
Commit
27f5a09a
authored
Nov 26, 2021
by
GuanHua
Browse files
Options
Browse Files
Download
Plain Diff
merge: 合并代码
parents
5a199ff6
28503bbc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
385 additions
and
254 deletions
+385
-254
zh-CN.ts
src/locales/zh-CN.ts
+2
-0
priceManage.ts
src/locales/zh-CN/priceManage.ts
+117
-0
index.tsx
src/pages/priceManage/constant/index.tsx
+87
-86
index.tsx
src/pages/priceManage/effect/index.tsx
+55
-52
memberModal.tsx
...pages/priceManage/priceStrategy/component/memberModal.tsx
+11
-10
priceModal.tsx
src/pages/priceManage/priceStrategy/component/priceModal.tsx
+0
-0
priceSetting.tsx
...ages/priceManage/priceStrategy/component/priceSetting.tsx
+21
-19
productModal.tsx
...ages/priceManage/priceStrategy/component/productModal.tsx
+9
-7
index.tsx
src/pages/priceManage/priceStrategy/index.tsx
+38
-37
setStrategy.tsx
src/pages/priceManage/priceStrategy/setStrategy.tsx
+19
-18
index.tsx
src/pages/priceManage/schema/index.tsx
+26
-25
No files found.
src/locales/zh-CN.ts
View file @
27f5a09a
...
...
@@ -2,6 +2,7 @@ import common from './zh-CN/common'
import
menu
from
'./zh-CN/menu'
import
home
from
'./zh-CN/home'
import
shop
from
'./zh-CN/shop'
import
priceManage
from
'./zh-CN/priceManage'
export
default
{
'global.siteName'
:
'瓴犀'
,
...
...
@@ -9,4 +10,5 @@ export default {
...
menu
,
...
home
,
...
shop
,
...
priceManage
,
}
src/locales/zh-CN/priceManage.ts
0 → 100644
View file @
27f5a09a
export
default
{
'priceManage.constant.columnsSetMember.name'
:
'会员名称'
,
'priceManage.constant.columnsSetMember.memberTypeName'
:
'会员类型'
,
'priceManage.constant.columnsSetMember.roleName'
:
'会员角色'
,
'priceManage.constant.columnsSetMember.levelTag'
:
'会员等级'
,
'priceManage.constant.columnsSetProduct.code'
:
'商品编号'
,
'priceManage.constant.columnsSetProduct.name'
:
'商品名称'
,
'priceManage.constant.columnsSetProduct.customerCategory'
:
'品类'
,
'priceManage.constant.columnsSetProduct.brand'
:
'品牌'
,
'priceManage.constant.columnsSetProduct.unitName'
:
'单位'
,
'priceManage.constant.columnsSetProduct.priceType'
:
'商品定价'
,
'priceManage.constant.columnsSetProduct.priceType.1'
:
'现货价格'
,
'priceManage.constant.columnsSetProduct.priceType.2'
:
'价格需要询问'
,
'priceManage.constant.columnsUnitProduct.index'
:
'索引'
,
'priceManage.constant.columnsUnitProduct.goodsId'
:
'货品ID'
,
'priceManage.constant.columnsUnitProduct.name'
:
'商品名称'
,
'priceManage.constant.memberColumns.name'
:
'会员名称'
,
'priceManage.constant.memberColumns.memberTypeName'
:
'会员类型'
,
'priceManage.constant.memberColumns.roleName'
:
'角色'
,
'priceManage.constant.memberColumns.ctl'
:
'操作'
,
'priceManage.effect.goods'
:
'对应货品'
,
'priceManage.effect.unitPrice'
:
'单价'
,
'priceManage.effect.index'
:
'索引'
,
'priceManage.effect.goodsId'
:
'货品ID'
,
'priceManage.effect.goodsName'
:
'商品名称'
,
'priceManage.priceStrategy.columns.id'
:
'价格策略ID'
,
'priceManage.priceStrategy.columns.name'
:
'价格策略名称'
,
'priceManage.priceStrategy.columns.commodityCode'
:
'商品编号'
,
'priceManage.priceStrategy.columns.commodityName'
:
'商品名称'
,
'priceManage.priceStrategy.columns.customerCategory'
:
'品类'
,
'priceManage.priceStrategy.columns.brand'
:
'品牌'
,
'priceManage.priceStrategy.columns.unitName'
:
'单位'
,
'priceManage.priceStrategy.columns.priceType'
:
'商品定价'
,
'priceManage.priceStrategy.columns.priceType.1'
:
'现货价格'
,
'priceManage.priceStrategy.columns.priceType.2'
:
'价格需要询价'
,
'priceManage.priceStrategy.columns.priceType.3'
:
'积分兑换商品'
,
'priceManage.priceStrategy.columns.min'
:
'价格'
,
'priceManage.priceStrategy.columns.currency'
:
'¥'
,
'priceManage.priceStrategy.columns.isEnable'
:
'状态'
,
'priceManage.priceStrategy.columns.isEnable.1'
:
'有效'
,
'priceManage.priceStrategy.columns.isEnable.2'
:
'无效'
,
'priceManage.priceStrategy.columns.option'
:
'操作'
,
'priceManage.priceStrategy.popconfirm.title'
:
'确定要执行该操作?'
,
'priceManage.priceStrategy.popconfirm.okText'
:
'确定'
,
'priceManage.priceStrategy.popconfirm.cancelText'
:
'取消'
,
'priceManage.priceStrategy.popconfirm.link'
:
'删除'
,
'priceManage.priceStrategy.controllerBtns'
:
'新建'
,
'priceManage.priceStrategy.setStrategy.description'
:
'返回'
,
'priceManage.priceStrategy.setStrategy.title1'
:
'查看商品价格策略'
,
'priceManage.priceStrategy.setStrategy.title2'
:
'新建商品价格策略'
,
'priceManage.priceStrategy.setStrategy.title3'
:
'编辑商品价格策略'
,
'priceManage.priceStrategy.setStrategy.extra'
:
'保存'
,
'priceManage.priceStrategy.memberModal.modalTitle'
:
'选择会员'
,
'priceManage.priceStrategy.priceModal.unitPrice'
:
'单价'
,
'priceManage.priceStrategy.priceModal.index'
:
'索引'
,
'priceManage.priceStrategy.priceModal.error.1'
:
'请正确输入阶梯数量范围'
,
'priceManage.priceStrategy.priceModal.error.2'
:
'阶段的起始值必须为最小起订数'
,
'priceManage.priceStrategy.priceModal.title.1'
:
'批量设置价格'
,
'priceManage.priceStrategy.priceModal.title.2'
:
'设置价格'
,
'priceManage.priceStrategy.priceModal.ladderPrice'
:
'阶梯价格'
,
'priceManage.priceStrategy.priceModal.ladderPrice.rule'
:
'阶梯范围为必填项'
,
'priceManage.priceStrategy.priceModal.numberMin'
:
'最小数量'
,
'priceManage.priceStrategy.priceModal.numberMin.rule.1'
:
'阶梯最小数量为必填项'
,
'priceManage.priceStrategy.priceModal.numberMin.rule.2'
:
'阶梯数值仅限三位小数'
,
'priceManage.priceStrategy.priceModal.numberMax'
:
'最大数量'
,
'priceManage.priceStrategy.priceModal.numberMax.rule.1'
:
'阶梯最大数量为必填项'
,
'priceManage.priceStrategy.priceModal.numberMax.rule.2'
:
'阶梯数值仅限三位小数'
,
'priceManage.priceStrategy.priceModal.numberPrice'
:
'请输入单价'
,
'priceManage.priceStrategy.priceModal.numberPrice.rule.1'
:
'阶梯单价为必填项'
,
'priceManage.priceStrategy.priceModal.numberPrice.rule.2'
:
'阶梯单价仅限四位小数'
,
'priceManage.priceStrategy.priceModal.uniquePrice'
:
'请输入价格'
,
'priceManage.priceStrategy.priceModal.uniquePrice.label'
:
'单价'
,
'priceManage.priceStrategy.priceModal.uniquePrice.rule.1'
:
'请输入价格'
,
'priceManage.priceStrategy.priceModal.uniquePrice.rule.2'
:
'小数点后仅限四位'
,
'priceManage.priceStrategy.priceSetting.error.1'
:
'请先选择适用商城或商品'
,
'priceManage.priceStrategy.priceSetting.error.2'
:
'请先选择适用商城'
,
'priceManage.priceStrategy.priceSetting.error.3'
:
'请先选择适用商城或商品'
,
'priceManage.priceStrategy.priceSetting.ctl'
:
'操作'
,
'priceManage.priceStrategy.priceSetting.ctl.button'
:
'设置价格'
,
'priceManage.priceStrategy.priceSetting.unitPrice'
:
'单价'
,
'priceManage.priceStrategy.priceSetting.delete'
:
'删除'
,
'priceManage.priceStrategy.priceSetting.tableAddMemberButton'
:
'会员名称'
,
'priceManage.priceStrategy.priceSetting.tableAddMemberButton.button'
:
'选择指定会员'
,
'priceManage.priceStrategy.priceSetting.batchPriceButton.button'
:
'批量设置价格'
,
'priceManage.priceStrategy.priceSetting.connectProduct.button'
:
'选择'
,
'priceManage.priceStrategy.priceSetting.questionNameLabel'
:
'价格策略名称'
,
'priceManage.priceStrategy.priceSetting.questionNameLabel.tooltip'
:
'建议名称 :商品名称+会员名称'
,
'priceManage.priceStrategy.priceSetting.questionPriceTypeLabel'
:
'商品定价'
,
'priceManage.priceStrategy.priceSetting.questionPriceTypeLabel.tooltip'
:
'现货价格:表示是现货销售的价格,价格明码标价,采购时按照标价下单,价格需要询价:表示价格未设定,需要询价报价后再下单采购'
,
'priceManage.priceStrategy.productModal.modalTitle'
:
'选择商品'
,
'priceManage.schema.schema.name'
:
'价格策略名称'
,
'priceManage.schema.schema.commodityName'
:
'商品编号或名称'
,
'priceManage.schema.schema.priceType'
:
'商品定价'
,
'priceManage.schema.schema.priceType.1'
:
'所有'
,
'priceManage.schema.schema.priceType.2'
:
'现货价格'
,
'priceManage.schema.schema.priceType.3'
:
'价格需要询价'
,
'priceManage.schema.schema.brandId'
:
'商品品牌'
,
'priceManage.schema.schema.customerCategoryId'
:
'商品品类'
,
'priceManage.schema.schema.min'
:
'最低价格'
,
'priceManage.schema.schema.max'
:
'最高价格'
,
'priceManage.schema.schema.submit'
:
'查询'
,
'priceManage.schema.setPriceSchema.tab-1'
:
'选择商品'
,
'priceManage.schema.setPriceSchema.name'
:
'最长60个字符,30字汉字'
,
'priceManage.schema.setPriceSchema.name.rule'
:
'请填写价格策略名称'
,
'priceManage.schema.setPriceSchema.shopId'
:
'适用商城'
,
'priceManage.schema.setPriceSchema.productName'
:
'商品名称'
,
'priceManage.schema.setPriceSchema.priceType.1'
:
'现货价格'
,
'priceManage.schema.setPriceSchema.priceType.2'
:
'价格需要询问'
,
'priceManage.schema.setPriceSchema.tab-2'
:
'价格设置'
,
'priceManage.schema.setPriceSchema.tab-3'
:
'适用会员'
,
'priceManage.schema.formSearch.name'
:
'请输入会员名字'
,
'priceManage.schema.formSearch.submit'
:
'查询'
,
'priceManage.schema.formProduct.name'
:
'请输入商品编号/名称'
,
'priceManage.schema.formProduct.customerCategoryId'
:
'商品品类'
,
'priceManage.schema.formProduct.brandId'
:
'请选择品牌'
,
'priceManage.schema.formProduct.submit'
:
'查询'
,
}
src/pages/priceManage/constant/index.tsx
View file @
27f5a09a
// 选择商品和会员弹框的列
// 选择商品和会员弹框的列
import
{
getIntl
}
from
'umi'
;
export
const
columnsSetMember
:
any
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'memberId'
,
align
:
'center'
,
key
:
'memberId'
,
},
{
title
:
'会员名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
},
{
title
:
'会员类型'
,
dataIndex
:
'memberTypeName'
,
align
:
'center'
,
key
:
'memberTypeName'
,
},
{
title
:
'会员角色'
,
dataIndex
:
'roleName'
,
align
:
'center'
,
key
:
'roleName'
,
},
{
title
:
'会员等级'
,
dataIndex
:
'levelTag'
,
align
:
'center'
,
key
:
'levelTag'
,
}
]
{
title
:
'ID'
,
dataIndex
:
'memberId'
,
align
:
'center'
,
key
:
'memberId'
,
},
{
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsSetMember.name'
})
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
},
{
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsSetMember.memberTypeName'
})
,
dataIndex
:
'memberTypeName'
,
align
:
'center'
,
key
:
'memberTypeName'
,
},
{
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsSetMember.roleName'
})
,
dataIndex
:
'roleName'
,
align
:
'center'
,
key
:
'roleName'
,
},
{
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsSetMember.levelTag'
})
,
dataIndex
:
'levelTag'
,
align
:
'center'
,
key
:
'levelTag'
,
}
]
export
const
columnsSetProduct
:
any
[]
=
[
{
title
:
'商品编号'
,
dataIndex
:
'code'
,
align
:
'center'
,
key
:
'code'
,
},
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
width
:
210
,
ellipsis
:
true
,
},
{
title
:
'品类'
,
dataIndex
:
[
'customerCategory'
,
'name'
],
align
:
'center'
,
key
:
'customerCategory'
,
},
{
title
:
'品牌'
,
dataIndex
:
[
'brand'
,
'name'
],
align
:
'center'
,
key
:
'brand'
,
},
{
title
:
'单位'
,
dataIndex
:
'unitName'
,
align
:
'center'
,
key
:
'unitName'
,
},
{
title
:
'商品定价'
,
dataIndex
:
'priceType'
,
align
:
'center'
,
key
:
'priceType'
,
render
:
(
t
,
r
)
=>
t
===
1
?
'现货价格'
:
'价格需要询问'
},
]
{
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsSetProduct.code'
})
,
dataIndex
:
'code'
,
align
:
'center'
,
key
:
'code'
,
},
{
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsSetProduct.name'
})
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
width
:
210
,
ellipsis
:
true
,
},
{
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsSetProduct.customerCategory'
})
,
dataIndex
:
[
'customerCategory'
,
'name'
],
align
:
'center'
,
key
:
'customerCategory'
,
},
{
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsSetProduct.brand'
})
,
dataIndex
:
[
'brand'
,
'name'
],
align
:
'center'
,
key
:
'brand'
,
},
{
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsSetProduct.unitName'
})
,
dataIndex
:
'unitName'
,
align
:
'center'
,
key
:
'unitName'
,
},
{
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsSetProduct.priceType'
})
,
dataIndex
:
'priceType'
,
align
:
'center'
,
key
:
'priceType'
,
render
:
(
t
,
r
)
=>
t
===
1
?
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsSetProduct.priceType.1'
})
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsSetProduct.priceType.2'
})
},
]
// 和商品规格
// 和商品规格
export
const
columnsUnitProduct
:
any
[]
=
[
{
title
:
'索引'
,
dataIndex
:
'索引'
,
key
:
'索引'
,
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsUnitProduct.index'
})
,
dataIndex
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsUnitProduct.index'
})
,
key
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsUnitProduct.index'
})
,
align
:
'center'
,
className
:
'commonHide'
},
...
...
@@ -91,17 +92,17 @@ export const columnsUnitProduct: any[] = [
className
:
"commonHide"
},
{
title
:
'货品ID'
,
dataIndex
:
'货品ID'
,
key
:
'货品ID'
,
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsUnitProduct.goodsId'
})
,
dataIndex
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsUnitProduct.goodsId'
})
,
key
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsUnitProduct.goodsId'
})
,
align
:
'center'
,
className
:
'commonHide'
},
{
dataIndex
:
'商品名称'
,
key
:
'商品名称'
,
dataIndex
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsUnitProduct.name'
})
,
key
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsUnitProduct.name'
})
,
align
:
'center'
,
title
:
'商品名称'
,
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.columnsUnitProduct.name'
})
,
},
// ...,
// {
...
...
@@ -134,16 +135,16 @@ export const memberColumns: any[] = [
{
dataIndex
:
'name'
,
align
:
'center'
,
title
:
'会员名称'
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.memberColumns.name'
})
},
{
dataIndex
:
'memberTypeName'
,
title
:
'会员类型'
,
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.memberColumns.memberTypeName'
})
,
align
:
'center'
},
{
dataIndex
:
'roleName'
,
title
:
'角色'
,
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.memberColumns.roleName'
})
,
align
:
'center'
},
// {
...
...
@@ -153,7 +154,7 @@ export const memberColumns: any[] = [
// },
{
dataIndex
:
'ctl'
,
title
:
'操作'
,
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.constant.memberColumns.ctl'
})
,
align
:
'center'
,
}
]
src/pages/priceManage/effect/index.tsx
View file @
27f5a09a
import
{
useIntl
}
from
'umi'
;
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
;
import
{
columnsUnitProduct
}
from
'../constant'
;
import
{
GlobalConfig
}
from
'@/global/config'
;
...
...
@@ -32,66 +33,68 @@ export const searchCustomerCategoryOptionEffect = (context: any, fieldName: stri
// 构建设置价格 table 所需要的data和columns
export
const
constructTableData
=
(
data
:
any
,
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
pageStatus
:
any
)
=>
{
let
col
:
any
=
[...
columnsUnitProduct
]
let
temp
:
any
=
[]
// 兼容编辑价格策略 新增使用data 编辑使用data[0].commodityUnitPrice
let
_data_column
=
pageStatus
===
PageStatus
.
ADD
?
data
[
0
]
:
data
[
0
][
"commodityUnitPrice"
]
_data_column
.
attributeAndValueList
.
map
(
_item
=>
{
temp
.
push
({
title
:
_item
.
customerAttribute
.
name
,
dataIndex
:
[
_item
.
customerAttribute
.
name
,
'value'
],
key
:
_item
.
customerAttribute
.
name
})
})
const
intl
=
useIntl
();
let
col
:
any
=
[...
columnsUnitProduct
]
let
temp
:
any
=
[]
// 兼容编辑价格策略 新增使用data 编辑使用data[0].commodityUnitPrice
let
_data_column
=
pageStatus
===
PageStatus
.
ADD
?
data
[
0
]
:
data
[
0
][
"commodityUnitPrice"
]
_data_column
.
attributeAndValueList
.
map
(
_item
=>
{
temp
.
push
({
title
:
_item
.
customerAttribute
.
name
,
dataIndex
:
[
_item
.
customerAttribute
.
name
,
'value'
],
key
:
_item
.
customerAttribute
.
name
})
})
col
.
push
(
{
title
:
'对应货品'
,
dataIndex
:
'对应货品'
,
key
:
'对应货品'
},
...
temp
,
{
title
:
'单价'
,
dataIndex
:
'单价'
,
key
:
'单价'
,
render
:
(
text
,
record
)
=>
{
if
(
!
text
||
JSON
.
stringify
(
text
)
===
'{}'
)
return
null
return
Object
.
keys
(
text
).
map
((
v
,
i
)
=>
{
return
<><
span
key=
{
i
}
>
{
v
===
'0-0'
?
''
:
`${v}:`
}
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
text
[
v
]
}
</
span
></
span
><
br
/></>
})
}
col
.
push
(
{
title
:
intl
.
formatMessage
({
id
:
'priceManage.effect.goods'
})
,
dataIndex
:
intl
.
formatMessage
({
id
:
'priceManage.effect.goods'
})
,
key
:
intl
.
formatMessage
({
id
:
'priceManage.effect.goods'
})
},
...
temp
,
{
title
:
intl
.
formatMessage
({
id
:
'priceManage.effect.unitPrice'
})
,
dataIndex
:
intl
.
formatMessage
({
id
:
'priceManage.effect.unitPrice'
})
,
key
:
intl
.
formatMessage
({
id
:
'priceManage.effect.unitPrice'
})
,
render
:
(
text
,
record
)
=>
{
if
(
!
text
||
JSON
.
stringify
(
text
)
===
'{}'
)
return
null
return
Object
.
keys
(
text
).
map
((
v
,
i
)
=>
{
return
<><
span
key=
{
i
}
>
{
v
===
'0-0'
?
''
:
`${v}:`
}
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
text
[
v
]
}
</
span
></
span
><
br
/></>
})
}
})
// 兼容编辑价格策略 新增使用data 编辑使用data -> item -> commodityUnitPrice
let
_tableData
:
any
=
[]
data
.
map
((
item
,
index
)
=>
{
let
temp
:
any
=
{}
let
_item_differ
=
pageStatus
===
PageStatus
.
ADD
?
item
:
item
[
"commodityUnitPrice"
]
_item_differ
.
attributeAndValueList
.
map
(
_item
=>
{
temp
[
_item
.
customerAttribute
.
name
]
=
{
value
:
_item
.
customerAttributeValue
.
value
,
vId
:
_item
.
customerAttributeValue
.
id
,
id
:
_item
.
customerAttribute
.
id
}
})
// 兼容编辑价格策略 新增使用data 编辑使用data -> item -> commodityUnitPrice
let
_tableData
:
any
=
[]
data
.
map
((
item
,
index
)
=>
{
let
temp
:
any
=
{}
let
_item_differ
=
pageStatus
===
PageStatus
.
ADD
?
item
:
item
[
"commodityUnitPrice"
]
_item_differ
.
attributeAndValueList
.
map
(
_item
=>
{
temp
[
_item
.
customerAttribute
.
name
]
=
{
value
:
_item
.
customerAttributeValue
.
value
,
vId
:
_item
.
customerAttributeValue
.
id
,
id
:
_item
.
customerAttribute
.
id
}
})
_tableData
.
push
({
"id"
:
_item_differ
.
id
,
"索引"
:
index
,
"货品ID"
:
_item_differ
.
goods
?.
id
||
''
,
"商品名称"
:
ctx
.
getFieldValue
(
"productName"
),
"对应货品"
:
_item_differ
.
goods
?.
name
||
''
,
...
temp
,
"单价"
:
orderlyLadderPrice
(
item
.
unitPrice
)
})
_tableData
.
push
({
"id"
:
_item_differ
.
id
,
[
intl
.
formatMessage
({
id
:
'priceManage.effect.index'
})]:
index
,
[
intl
.
formatMessage
({
id
:
'priceManage.effect.goodsId'
})]:
_item_differ
.
goods
?.
id
||
''
,
[
intl
.
formatMessage
({
id
:
'priceManage.effect.goodsName'
})]:
ctx
.
getFieldValue
(
"productName"
),
[
intl
.
formatMessage
({
id
:
'priceManage.effect.goods'
})]:
_item_differ
.
goods
?.
name
||
''
,
...
temp
,
[
intl
.
formatMessage
({
id
:
'priceManage.effect.unitPrice'
})]:
orderlyLadderPrice
(
item
.
unitPrice
)
})
})
return
{
columsUnit
:
col
,
tableUnitData
:
_tableData
}
return
{
columsUnit
:
col
,
tableUnitData
:
_tableData
}
}
// 生成 Api 所需要的参数
export
const
transformParamsForApi
=
(
data
:
any
,
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
const
intl
=
useIntl
();
let
_params
:
any
=
{}
_params
[
"name"
]
=
data
.
name
_params
[
"priceType"
]
=
data
.
priceType
...
...
@@ -101,7 +104,7 @@ export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISche
_params
[
"type"
]
=
shopInfo
[
"type"
]
_params
[
"environment"
]
=
shopInfo
[
"environment"
]
_params
[
"commodity"
]
=
{
id
:
data
.
productId
}
if
(
data
?.
commodityMemberList
)
{
if
(
data
?.
commodityMemberList
)
{
_params
[
"commodityMemberList"
]
=
data
.
commodityMemberList
.
map
(
item
=>
({
memberId
:
item
.
memberId
,
memberName
:
item
.
name
,
...
...
@@ -112,7 +115,7 @@ export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISche
}
_params
[
"memberUnitPriceList"
]
=
data
.
memberUnitPriceList
.
map
(
item
=>
({
commodityUnitPrice
:
{
id
:
item
.
id
},
unitPrice
:
item
[
"单价"
]
unitPrice
:
item
[
intl
.
formatMessage
({
id
:
'priceManage.effect.unitPrice'
})
]
}))
return
{
...
...
@@ -122,7 +125,7 @@ export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISche
// 生成前端Form所需要的参数
export
const
transformDataForNiceForm
=
(
value
:
any
,
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
if
(
value
&&
JSON
.
stringify
(
value
)
!==
'{}'
)
{
if
(
value
&&
JSON
.
stringify
(
value
)
!==
'{}'
)
{
let
initValue
:
any
=
{};
initValue
[
"name"
]
=
value
.
name
initValue
[
"priceType"
]
=
value
.
priceType
...
...
src/pages/priceManage/priceStrategy/component/memberModal.tsx
View file @
27f5a09a
import
React
,
{
useEffect
}
from
'react'
import
React
,
{
useEffect
}
from
'react'
import
{
useIntl
}
from
'umi'
;
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
import
{
useModalTable
}
from
'../../model/useModalTable'
import
ModalTable
from
'@/components/ModalTable'
import
{
columnsSetMember
}
from
'../../constant'
import
{
formSearch
}
from
'../../schema'
import
{
formSearch
}
from
'../../schema'
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
import
ModalSearch
from
'@/components/NiceForm/components/Search'
...
...
@@ -19,15 +20,15 @@ export interface MemberModalProps {
currentRef
?:
any
,
}
const
MemberModal
:
React
.
FC
<
MemberModalProps
>
=
(
props
)
=>
{
const
MemberModal
:
React
.
FC
<
MemberModalProps
>
=
(
props
)
=>
{
const
{
type
=
"checkbox"
,
schemaAction
,
currentRef
,
...
restProps
}
=
props
const
intl
=
useIntl
();
const
{
visible
,
setVisible
,
rowSelection
,
rowSelectionCtl
,
}
=
useModalTable
({
type
,
customKey
:
"memberId"
})
}
=
useModalTable
({
type
,
customKey
:
"memberId"
})
const
{
id
,
...
...
@@ -54,7 +55,7 @@ const MemberModal:React.FC<MemberModalProps> = (props) => {
// schemaAction.setFieldValue('commodityMemberList', rowSelectionCtl.selectRow)
// // rowSelectionCtl.setSelectedRowKeys([])
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
schemaAction
.
setFieldState
(
'commodityMemberList'
,
state
=>
{
state
.
isDelete
=
true
})
...
...
@@ -77,9 +78,9 @@ const MemberModal:React.FC<MemberModalProps> = (props) => {
}
const
fetchMemberList
=
async
(
params
)
=>
{
const
excludeIds
=
await
getProductCommodityGetStrategyMemberByCommodityId
({
commodityId
:
schemaAction
.
getFieldValue
(
"productId"
)},
{
ctlType
:
'none'
})
const
excludeIds
=
await
getProductCommodityGetStrategyMemberByCommodityId
({
commodityId
:
schemaAction
.
getFieldValue
(
"productId"
)
},
{
ctlType
:
'none'
})
let
checkedMember
=
schemaAction
.
getFieldValue
(
'commodityMemberList'
)
if
(
schemaAction
.
getFieldState
(
'commodityMemberList'
).
isDelete
)
{
if
(
schemaAction
.
getFieldState
(
'commodityMemberList'
).
isDelete
)
{
params
.
excludeList
=
checkedMember
.
map
(
item
=>
({
memberId
:
item
.
memberId
,
roleId
:
item
.
roleId
,
...
...
@@ -90,13 +91,13 @@ const MemberModal:React.FC<MemberModalProps> = (props) => {
roleId
:
item
.
memberRoleId
,
}))
}
const
res
=
await
postMemberManageLowerConsumerPage
(
params
,
{
ctlType
:
'none'
});
const
res
=
await
postMemberManageLowerConsumerPage
(
params
,
{
ctlType
:
'none'
});
return
res
.
data
}
return
(
<
ModalTable
modalTitle=
'选择会员'
modalTitle=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.memberModal.modalTitle'
})
}
confirm=
{
handleOkAddMember
}
cancel=
{
handleCancelAddMember
}
visible=
{
visible
}
...
...
src/pages/priceManage/priceStrategy/component/priceModal.tsx
View file @
27f5a09a
This diff is collapsed.
Click to expand it.
src/pages/priceManage/priceStrategy/component/priceSetting.tsx
View file @
27f5a09a
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
import
{
useIntl
}
from
'umi'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
import
{
ISchemaFormActions
,
ISchema
,
FormEffectHooks
}
from
'@formily/antd'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
...
...
@@ -29,11 +30,12 @@ export interface PriceSettingProps {
}
const
fetchShopLists
=
async
()
=>
{
return
await
fectchShopListsSource
({
type
:
1
})
return
await
fectchShopListsSource
({
type
:
1
})
}
const
PriceSetting
:
React
.
FC
<
PriceSettingProps
>
=
(
props
)
=>
{
const
{
addSchemaAction
,
schema
,
formSubmit
,
onFieldChange
=
()
=>
{}
}
=
props
const
PriceSetting
:
React
.
FC
<
PriceSettingProps
>
=
(
props
)
=>
{
const
intl
=
useIntl
();
const
{
addSchemaAction
,
schema
,
formSubmit
,
onFieldChange
=
()
=>
{
}
}
=
props
const
priceRef
=
useRef
<
any
>
({})
const
productRef
=
useRef
<
any
>
({})
const
memberRef
=
useRef
<
any
>
({})
...
...
@@ -83,7 +85,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
const
shopId
=
addSchemaAction
.
getFieldValue
(
'shopId'
);
const
productId
=
addSchemaAction
.
getFieldValue
(
'productId'
);
if
(
!
shopId
||
!
productId
)
{
message
.
error
(
'请先选择适用商城或商品'
);
message
.
error
(
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.error.1'
})
);
return
;
}
...
...
@@ -108,7 +110,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
const
handleAddProductBtn
=
()
=>
{
const
shopId
=
addSchemaAction
.
getFieldValue
(
'shopId'
)
if
(
!
shopId
)
{
message
.
error
(
'请先选择适用商城'
)
message
.
error
(
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.error.2'
})
)
return
false
}
productRef
.
current
.
setVisible
(
true
)
...
...
@@ -125,7 +127,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
priceRef
.
current
.
setIsBatchSetting
(
true
)
priceRef
.
current
.
setVisible
(
true
)
}
else
{
message
.
error
(
'请先选择适用商城或商品'
)
message
.
error
(
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.error.3'
})
)
}
}
...
...
@@ -155,22 +157,22 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
state
.
dataSource
=
source
// 存源数据
priceType
!==
2
?
columsUnit
.
push
({
dataIndex
:
'ctl'
,
title
:
'操作'
,
title
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.ctl'
})
,
align
:
'center'
,
render
:
(
_i
,
_r
)
=>
<
Button
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
}
type=
'link'
onClick=
{
()
=>
handleSetProductPrice
(
_r
)
}
>
设置价格
</
Button
>
render
:
(
_i
,
_r
)
=>
<
Button
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
}
type=
'link'
onClick=
{
()
=>
handleSetProductPrice
(
_r
)
}
>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.ctl.button'
})
}
</
Button
>
})
:
columsUnit
.
pop
()
state
.
props
[
"x-component-props"
].
columns
=
columsUnit
})
ctx
.
setFieldValue
(
"memberUnitPriceList"
,
priceType
===
2
?
tableUnitData
.
map
(
item
=>
{
delete
item
[
"单价"
];
return
item
})
:
tableUnitData
)
ctx
.
setFieldValue
(
"memberUnitPriceList"
,
priceType
===
2
?
tableUnitData
.
map
(
item
=>
{
delete
item
[
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.unitPrice'
})
];
return
item
})
:
tableUnitData
)
// console.log(columsUnit, tableUnitData, source)
// 填充适用会员table
ctx
.
setFieldState
(
"commodityMemberList"
,
state
=>
{
memberColumns
[
memberColumns
.
length
-
1
].
render
=
(
text
,
record
)
=>
{
return
<
Button
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
}
type=
'link'
onClick=
{
()
=>
handleDeleteMemberTable
(
record
)
}
>
删除
</
Button
>
return
<
Button
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
}
type=
'link'
onClick=
{
()
=>
handleDeleteMemberTable
(
record
)
}
>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.delete'
})
}
</
Button
>
}
state
.
props
[
"x-component-props"
].
columns
=
memberColumns
})
...
...
@@ -180,30 +182,30 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
const
tableAddMemberButton
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
<>
<
p
style=
{
{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
flexWrap
:
'wrap'
}
}
>
<
Search
placeholder=
"会员名称"
placeholder=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.tableAddMemberButton'
})
}
onSearch=
{
value
=>
searchMember
(
value
)
}
style=
{
{
width
:
256
}
}
/>
</
p
>
<
Button
style=
{
{
marginBottom
:
16
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
handleAddMemberBtn
}
type=
'dashed'
>
选择指定会员
</
Button
>
<
Button
style=
{
{
marginBottom
:
16
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
handleAddMemberBtn
}
type=
'dashed'
>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.tableAddMemberButton.button'
})
}
</
Button
>
</>
// 批量设置价格按钮
const
batchPriceButton
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
priceType
!==
2
&&
<
Button
type=
"text"
onClick=
{
clickBatchSetPrice
}
style=
{
{
marginBottom
:
12
,
float
:
"right"
}
}
><
SettingOutlined
/>
批量设置价格
</
Button
>
const
batchPriceButton
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
priceType
!==
2
&&
<
Button
type=
"text"
onClick=
{
clickBatchSetPrice
}
style=
{
{
marginBottom
:
12
,
float
:
"right"
}
}
><
SettingOutlined
/>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.batchPriceButton.button'
})
}
</
Button
>
// 选择商品
const
connectProduct
=
pageStatus
===
PageStatus
.
ADD
&&
<
div
className=
'connectBtn'
onClick=
{
handleAddProductBtn
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
选择
</
div
>
const
connectProduct
=
pageStatus
===
PageStatus
.
ADD
&&
<
div
className=
'connectBtn'
onClick=
{
handleAddProductBtn
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.connectProduct.button'
})
}
</
div
>
const
questionNameLabel
=
<>
价格策略名称
<
Tooltip
title=
"建议名称 :商品名称+会员名称"
>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.questionNameLabel'
})
}
<
Tooltip
title=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.questionNameLabel.tooltip'
})
}
>
<
QuestionCircleOutlined
/>
</
Tooltip
>
</>
const
questionPriceTypeLabel
=
<>
商品定价
<
Tooltip
title=
"现货价格:表示是现货销售的价格,价格明码标价,采购时按照标价下单,价格需要询价:表示价格未设定,需要询价报价后再下单采购"
>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.questionPriceTypeLabel'
})
}
<
Tooltip
title=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.priceSetting.questionPriceTypeLabel.tooltip'
})
}
>
<
QuestionCircleOutlined
/>
</
Tooltip
>
</>
...
...
@@ -237,7 +239,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
// state.dataSource = pageStatus === PageStatus.PREVIEW ?
// GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value && state.value.includes(v.id))
// :
// state.dataSource = GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value)
// state.dataSource = GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value)
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
state
.
props
[
'x-component-props'
].
disabled
=
true
;
...
...
src/pages/priceManage/priceStrategy/component/productModal.tsx
View file @
27f5a09a
import
React
,
{
useEffect
}
from
'react'
import
React
,
{
useEffect
}
from
'react'
import
{
useIntl
}
from
'umi'
;
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
import
{
useModalTable
}
from
'../../model/useModalTable'
import
ModalTable
from
'@/components/ModalTable'
...
...
@@ -22,15 +23,16 @@ export interface ProductModalProps {
currentRef
?:
any
,
}
const
ProductModal
:
React
.
FC
<
ProductModalProps
>
=
(
props
)
=>
{
const
{
type
=
"radio"
,
schemaAction
,
currentRef
,
...
restProps
}
=
props
const
ProductModal
:
React
.
FC
<
ProductModalProps
>
=
(
props
)
=>
{
const
{
type
=
"radio"
,
schemaAction
,
currentRef
,
...
restProps
}
=
props
const
intl
=
useIntl
();
const
{
visible
,
setVisible
,
rowSelection
,
rowSelectionCtl
,
}
=
useModalTable
({
type
})
}
=
useModalTable
({
type
})
useEffect
(()
=>
{
if
(
currentRef
)
{
...
...
@@ -42,8 +44,8 @@ const ProductModal:React.FC<ProductModalProps> = (props) => {
}
},
[])
// 指定商品
const
fetchProductList
=
async
(
params
)
=>
{
// 指定商品
const
fetchProductList
=
async
(
params
)
=>
{
const
shopId
=
schemaAction
.
getFieldValue
(
'shopId'
)
let
shopInfo
:
any
=
GlobalConfig
.
web
.
shopInfo
.
filter
(
item
=>
item
.
id
===
shopId
)
...
...
@@ -79,7 +81,7 @@ const ProductModal:React.FC<ProductModalProps> = (props) => {
return
(
<
ModalTable
modalTitle=
'选择商品'
modalTitle=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.productModal.modalTitle'
})
}
confirm=
{
handleOkAddProduct
}
cancel=
{
handleCancel
}
visible=
{
visible
}
...
...
src/pages/priceManage/priceStrategy/index.tsx
View file @
27f5a09a
import
React
,
{
useRef
}
from
'react'
import
{
Button
,
Popconfirm
,
Card
,
Space
}
from
'antd'
import
{
Button
,
Popconfirm
,
Card
,
Space
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
StandardTable
}
from
'god'
import
{
ColumnType
}
from
'antd/lib/table/interface'
...
...
@@ -10,7 +10,7 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import
{
searchCustomerCategoryOptionEffect
,
searchBrandOptionEffect
}
from
'../effect'
import
{
schema
}
from
'../schema'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
import
{
history
}
from
'umi'
import
{
history
,
useIntl
}
from
'umi'
import
StatusSwitch
from
'@/components/StatusSwitch'
import
{
PlusOutlined
}
from
'@ant-design/icons'
import
{
getProductCommodityGetUnitPriceStrategyList
,
postProductCommodityDeleteUnitPriceStrategy
,
postProductCommodityUpdateUnitPriceStrategyStatus
}
from
'@/services/ProductV2Api'
...
...
@@ -18,16 +18,17 @@ import { getProductCommodityGetUnitPriceStrategyList, postProductCommodityDelete
const
formActions
=
createFormActions
();
const
PriceManage
:
React
.
FC
<
{}
>
=
()
=>
{
const
intl
=
useIntl
();
const
ref
=
useRef
<
any
>
({})
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'价格策略ID'
,
title
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.id'
})
,
dataIndex
:
'id'
,
key
:
'id'
,
},
{
title
:
'价格策略名称'
,
title
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.name'
})
,
dataIndex
:
'name'
,
key
:
'name'
,
className
:
'commonPickColor'
,
...
...
@@ -43,66 +44,66 @@ const PriceManage: React.FC<{}> = () => {
// key: 'commodity',
// },
{
title
:
'商品编号'
,
title
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.commodityCode'
})
,
dataIndex
:
[
"commodity"
,
"code"
],
key
:
'commodity'
,
},
{
title
:
'商品名称'
,
title
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.commodityName'
})
,
dataIndex
:
[
"commodity"
,
"name"
],
key
:
"commodity"
,
},
{
title
:
'品类'
,
title
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.customerCategory'
})
,
dataIndex
:
[
"commodity"
,
"customerCategory"
,
"name"
],
key
:
'commodity'
,
},
{
title
:
'品牌'
,
title
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.brand'
})
,
dataIndex
:
[
"commodity"
,
"brand"
,
"name"
],
key
:
'commodity'
,
},
{
title
:
'单位'
,
title
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.unitName'
})
,
dataIndex
:
[
"commodity"
,
"unitName"
],
key
:
'commodity'
,
},
{
title
:
'商品定价'
,
title
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.priceType'
})
,
dataIndex
:
'priceType'
,
key
:
'priceType'
,
render
:
(
t
,
r
)
=>
{
if
(
t
===
1
)
return
'现货价格'
if
(
t
===
2
)
return
'价格需要询价'
if
(
t
===
3
)
return
'积分兑换商品'
if
(
t
===
1
)
return
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.priceType.1'
})
if
(
t
===
2
)
return
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.priceType.2'
})
if
(
t
===
3
)
return
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.priceType.3'
})
}
},
{
title
:
'价格'
,
title
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.min'
})
,
dataIndex
:
'min'
,
key
:
'min'
,
render
:
(
text
:
any
,
reocrd
:
any
)
=>
{
if
(
reocrd
.
priceType
===
1
)
{
if
(
reocrd
.
max
===
reocrd
.
min
)
return
<>
¥
{
reocrd
.
min
}
</>
render
:
(
text
:
any
,
reocrd
:
any
)
=>
{
if
(
reocrd
.
priceType
===
1
)
{
if
(
reocrd
.
max
===
reocrd
.
min
)
return
<>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.currency'
})
}
{
reocrd
.
min
}
</>
else
return
<>
¥
{
reocrd
.
min
}
~ ¥
{
reocrd
.
max
}
</>
return
<>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.currency'
})
}{
reocrd
.
min
}
~
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.currency'
})
}
{
reocrd
.
max
}
</>
}
if
(
reocrd
.
priceType
===
3
)
{
if
(
reocrd
.
max
===
reocrd
.
min
)
if
(
reocrd
.
priceType
===
3
)
{
if
(
reocrd
.
max
===
reocrd
.
min
)
return
<>
{
reocrd
.
min
}
</>
else
return
<>
{
reocrd
.
min
}
~
{
reocrd
.
max
}
</>
}
if
(
reocrd
.
priceType
===
2
)
if
(
reocrd
.
priceType
===
2
)
return
null
}
},
{
title
:
'状态'
,
title
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.isEnable'
})
,
dataIndex
:
'isEnable'
,
key
:
'isEnable'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(
...
...
@@ -115,26 +116,26 @@ const PriceManage: React.FC<{}> = () => {
),
filters
:
[
{
text
:
'有效'
,
text
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.isEnable.1'
})
,
value
:
true
,
},
{
text
:
'无效'
,
text
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.isEnable.2'
})
,
value
:
false
,
}
],
onFilter
:
(
value
,
record
)
=>
record
.
isEnable
===
value
,
},
{
title
:
'操作'
,
title
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.columns.option'
})
,
dataIndex
:
'option'
,
width
:
128
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
return
(
<>
<
Button
type=
'link'
className=
"padLeft0"
onClick=
{
()
=>
handleModify
(
record
)
}
>
修改
</
Button
>
<
Popconfirm
title=
"确定要执行该操作?"
okText=
"确定"
cancelText=
"取消"
onConfirm=
{
()
=>
handleDelete
(
record
)
}
>
<
Button
type=
'link'
className=
"padLeft0"
>
删除
</
Button
>
<
Popconfirm
title=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.popconfirm.title'
})
}
okText=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.popconfirm.okText'
})
}
cancelText=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.popconfirm.cancelText'
})
}
onConfirm=
{
()
=>
handleDelete
(
record
)
}
>
<
Button
type=
'link'
className=
"padLeft0"
>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.popconfirm.link'
})
}
</
Button
>
</
Popconfirm
>
</>
)
...
...
@@ -152,8 +153,8 @@ const PriceManage: React.FC<{}> = () => {
}
const
handleUpdateState
=
(
record
:
any
)
=>
{
postProductCommodityUpdateUnitPriceStrategyStatus
({
id
:
record
.
id
,
isEnable
:
!
record
.
isEnable
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
postProductCommodityUpdateUnitPriceStrategyStatus
({
id
:
record
.
id
,
isEnable
:
!
record
.
isEnable
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setTimeout
(()
=>
{
ref
.
current
.
reload
()
},
1000
)
...
...
@@ -167,7 +168,7 @@ const PriceManage: React.FC<{}> = () => {
const
handleDelete
=
(
record
:
any
)
=>
{
postProductCommodityDeleteUnitPriceStrategy
({
id
:
record
.
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
setTimeout
(()
=>
{
ref
.
current
.
reload
()
},
1000
)
...
...
@@ -179,9 +180,9 @@ const PriceManage: React.FC<{}> = () => {
<
Space
>
<
Button
type=
'primary'
onClick=
{
()
=>
history
.
push
(
'/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/add'
)
}
onClick=
{
()
=>
history
.
push
(
'/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/add'
)
}
>
<
PlusOutlined
/>
新建
<
PlusOutlined
/>
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.controllerBtns'
})
}
</
Button
>
</
Space
>
)
...
...
@@ -197,7 +198,7 @@ const PriceManage: React.FC<{}> = () => {
controlRender=
{
<
NiceForm
actions=
{
formActions
}
onSubmit=
{
values
=>
ref
.
current
.
reload
(
values
)
}
onSubmit=
{
values
=>
ref
.
current
.
reload
(
values
)
}
expressionScope=
{
{
controllerBtns
,
}
}
...
...
src/pages/priceManage/priceStrategy/setStrategy.tsx
View file @
27f5a09a
import
React
,
{
useCallback
,
useState
}
from
'react'
import
{
Button
,
Card
,
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
history
}
from
"umi"
import
{
history
,
useIntl
}
from
"umi"
import
ReutrnEle
from
'@/components/ReturnEle'
import
{
SaveOutlined
}
from
'@ant-design/icons'
import
{
createFormActions
}
from
'@formily/antd'
...
...
@@ -15,6 +15,7 @@ import { postProductCommoditySaveOrUpdateUnitPriceStrategy } from '@/services/Pr
const
addSchemaAction
=
createFormActions
()
const
SetStrategy
:
React
.
FC
<
{}
>
=
()
=>
{
const
intl
=
useIntl
();
const
{
id
,
preview
,
...
...
@@ -31,35 +32,35 @@ const SetStrategy: React.FC<{}> = () => {
// message.error('请选择指定适用会员')
// setBtnLoading(false)
// } else {
const
{
params
}
=
transformParamsForApi
(
values
,
addSchemaAction
)
const
{
params
}
=
transformParamsForApi
(
values
,
addSchemaAction
)
let
_params
=
{}
if
(
id
)
{
_params
[
"id"
]
=
Number
(
id
)
}
let
res
=
await
postProductCommoditySaveOrUpdateUnitPriceStrategy
({...
params
,
...
_params
})
if
(
res
.
code
===
1000
)
{
setTimeout
(()
=>
{
history
.
goBack
(
-
1
)
},
1000
)
}
setBtnLoading
(
false
)
let
_params
=
{}
if
(
id
)
{
_params
[
"id"
]
=
Number
(
id
)
}
let
res
=
await
postProductCommoditySaveOrUpdateUnitPriceStrategy
({
...
params
,
...
_params
})
if
(
res
.
code
===
1000
)
{
setTimeout
(()
=>
{
history
.
goBack
(
-
1
)
},
1000
)
}
setBtnLoading
(
false
)
// }
},
[])
return
(
<
PageHeaderWrapper
onBack=
{
()
=>
history
.
goBack
()
}
backIcon=
{
<
ReutrnEle
description=
"返回"
/>
}
backIcon=
{
<
ReutrnEle
description=
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.setStrategy.description'
})
}
/>
}
className=
"setStrategy"
title=
{
pageStatus
===
PageStatus
.
PREVIEW
?
'查看商品价格策略'
:
(
pageStatus
===
PageStatus
.
ADD
?
'新建商品价格策略'
:
'编辑商品价格策略'
)
}
title=
{
pageStatus
===
PageStatus
.
PREVIEW
?
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.setStrategy.title1'
})
:
(
pageStatus
===
PageStatus
.
ADD
?
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.setStrategy.title2'
})
:
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.setStrategy.title3'
})
)
}
extra=
{
(
pageStatus
!==
PageStatus
.
PREVIEW
pageStatus
!==
PageStatus
.
PREVIEW
?
(
<
Button
key=
"1"
loading=
{
btnLoading
}
onClick=
{
()
=>
addSchemaAction
.
submit
()
}
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
>
保存
{
intl
.
formatMessage
({
id
:
'priceManage.priceStrategy.setStrategy.extra'
})
}
</
Button
>
)
)
:
null
)
}
>
...
...
src/pages/priceManage/schema/index.tsx
View file @
27f5a09a
import
{
getIntl
}
from
'umi'
;
import
{
ISchema
}
from
'@formily/antd'
;
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
getProductSelectGetSelectBrand
}
from
'@/services/ProductV2Api'
;
...
...
@@ -28,7 +29,7 @@ export const schema: ISchema = {
type
:
'string'
,
'x-component'
:
'Search'
,
'x-component-props'
:
{
placeholder
:
'价格策略名称'
,
placeholder
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.schema.name'
})
,
},
},
},
...
...
@@ -48,7 +49,7 @@ export const schema: ISchema = {
commodityName
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'商品编号或名称'
,
placeholder
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.schema.commodityName'
})
,
style
:
{
width
:
'174px'
},
}
},
...
...
@@ -56,15 +57,15 @@ export const schema: ISchema = {
type
:
'string'
,
enum
:
[
{
label
:
'所有'
,
label
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.schema.priceType.1'
})
,
value
:
0
,
},
{
label
:
'现货价格'
,
label
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.schema.priceType.2'
})
,
value
:
1
,
},
{
label
:
'价格需要询价'
,
label
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.schema.priceType.3'
})
,
value
:
2
,
},
// {
...
...
@@ -73,7 +74,7 @@ export const schema: ISchema = {
// }
],
'x-component-props'
:
{
placeholder
:
'商品定价'
,
placeholder
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.schema.priceType'
})
,
style
:
{
width
:
'174px'
},
},
},
...
...
@@ -81,7 +82,7 @@ export const schema: ISchema = {
type
:
'string'
,
'x-component'
:
'CustomInputSearch'
,
'x-component-props'
:
{
placeholder
:
'商品品牌'
,
placeholder
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.schema.brandId'
})
,
showSearch
:
true
,
showArrow
:
true
,
defaultActiveFirstOption
:
false
,
...
...
@@ -96,7 +97,7 @@ export const schema: ISchema = {
type
:
'string'
,
'x-component'
:
'CustomCategorySearch'
,
'x-component-props'
:
{
placeholder
:
'商品品类'
,
placeholder
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.schema.customerCategoryId'
})
,
showSearch
:
true
,
notFoundContent
:
null
,
style
:
{
width
:
'174px'
},
...
...
@@ -108,7 +109,7 @@ export const schema: ISchema = {
type
:
'number'
,
'x-component'
:
'NumberRange'
,
'x-component-props'
:
{
placeholder
:
[
'最低价格'
,
'最高价格'
],
placeholder
:
[
getIntl
().
formatMessage
({
id
:
'priceManage.schema.schema.min'
}),
getIntl
().
formatMessage
({
id
:
'priceManage.schema.schema.max'
})
],
},
},
submit
:
{
...
...
@@ -117,7 +118,7 @@ export const schema: ISchema = {
span
:
1
,
},
'x-component-props'
:
{
children
:
'查询'
,
children
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.schema.submit'
})
,
},
},
},
...
...
@@ -143,7 +144,7 @@ export const setPriceSchema: ISchema = {
"type"
:
"object"
,
"x-component"
:
"tabpane"
,
"x-component-props"
:
{
"tab"
:
"选择商品"
,
"tab"
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.setPriceSchema.tab-1'
})
,
},
"properties"
:
{
MEGA_LAYOUT1
:
{
...
...
@@ -159,12 +160,12 @@ export const setPriceSchema: ISchema = {
type
:
'string'
,
title
:
'{{questionNameLabel}}'
,
"x-component-props"
:
{
placeholder
:
'最长60个字符,30字汉字'
placeholder
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.setPriceSchema.name'
})
},
"x-rules"
:
[
{
required
:
true
,
message
:
'请填写价格策略名称'
message
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.setPriceSchema.name.rule'
})
},
{
limitByte
:
true
,
...
...
@@ -175,7 +176,7 @@ export const setPriceSchema: ISchema = {
shopId
:
{
type
:
'number'
,
enum
:
[],
title
:
'适用商城'
,
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.setPriceSchema.shopId'
})
,
required
:
true
,
"x-component-props"
:
{
disabled
:
false
,
...
...
@@ -183,7 +184,7 @@ export const setPriceSchema: ISchema = {
},
productName
:
{
type
:
'string'
,
title
:
'商品名称'
,
title
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.setPriceSchema.productName'
})
,
"x-mega-props"
:
{
full
:
true
},
...
...
@@ -207,11 +208,11 @@ export const setPriceSchema: ISchema = {
required
:
true
,
enum
:
[
{
label
:
'现货价格'
,
label
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.setPriceSchema.priceType.1'
})
,
value
:
1
},
{
label
:
'价格需要询问'
,
label
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.setPriceSchema.priceType.2'
})
,
value
:
2
}
],
...
...
@@ -228,7 +229,7 @@ export const setPriceSchema: ISchema = {
"type"
:
"object"
,
"x-component"
:
"tabpane"
,
"x-component-props"
:
{
"tab"
:
"价格设置"
"tab"
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.setPriceSchema.tab-2'
})
},
"properties"
:
{
MEGA_LAYOUT2
:
{
...
...
@@ -260,7 +261,7 @@ export const setPriceSchema: ISchema = {
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
"tab"
:
"适用会员"
"tab"
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.setPriceSchema.tab-3'
})
},
properties
:
{
MEGA_LAYOUT3
:
{
...
...
@@ -302,7 +303,7 @@ export const setPriceSchema: ISchema = {
type
:
'string'
,
'x-component'
:
'ModalSearch'
,
'x-component-props'
:
{
placeholder
:
'请输入会员名字'
,
placeholder
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.formSearch.name'
})
,
align
:
'flex-left'
,
advanced
:
false
,
},
...
...
@@ -328,7 +329,7 @@ export const setPriceSchema: ISchema = {
span
:
1
},
"x-component-props"
:
{
children
:
'查询'
,
children
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.formSearch.submit'
})
,
}
}
}
...
...
@@ -342,7 +343,7 @@ export const formProduct: ISchema = {
type
:
'string'
,
'x-component'
:
'ModalSearch'
,
'x-component-props'
:
{
placeholder
:
'请输入商品编号/名称'
,
placeholder
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.formProduct.submit'
})
,
align
:
'flex-left'
,
},
},
...
...
@@ -365,7 +366,7 @@ export const formProduct: ISchema = {
type
:
'string'
,
'x-component'
:
'CustomCategorySearch'
,
'x-component-props'
:
{
placeholder
:
'商品品类'
,
placeholder
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.formProduct.customerCategoryId'
})
,
showSearch
:
true
,
notFoundContent
:
null
,
style
:
{
width
:
'174px'
},
...
...
@@ -377,7 +378,7 @@ export const formProduct: ISchema = {
type
:
'string'
,
"x-component"
:
'SearchSelect'
,
"x-component-props"
:
{
placeholder
:
'请选择品牌'
,
placeholder
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.formProduct.brandId'
})
,
fetchSearch
:
getProductSelectGetSelectBrand
,
style
:
{
width
:
160
...
...
@@ -390,7 +391,7 @@ export const formProduct: ISchema = {
span
:
1
},
"x-component-props"
:
{
children
:
'查询'
children
:
getIntl
().
formatMessage
({
id
:
'priceManage.schema.formProduct.submit'
})
}
}
}
...
...
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