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
linweijiong
jinfa-platform
Commits
b252db73
Commit
b252db73
authored
Sep 17, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:渠道商品批量上下架
parent
052b717c
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
303 additions
and
960 deletions
+303
-960
SearchSelect.tsx
src/components/NiceForm/components/SearchSelect.tsx
+4
-3
directChannel.tsx
src/pages/commodity/products/directChannel.tsx
+63
-14
channelSchema.tsx
src/pages/commodity/products/schema/channelSchema.tsx
+52
-137
RuleSetting.tsx
...s/transaction/transactionRules/components/RuleSetting.tsx
+126
-235
index.tsx
src/pages/transaction/transactionRules/effects/index.tsx
+6
-22
index.less
src/pages/transaction/transactionRules/index.less
+0
-41
index.tsx
src/pages/transaction/transactionRules/schema/index.tsx
+45
-506
index.tsx
src/utils/index.tsx
+7
-2
No files found.
src/components/NiceForm/components/SearchSelect.tsx
View file @
b252db73
...
...
@@ -128,9 +128,10 @@ const SearchSelect = (props: ISchemaFieldComponentProps) => {
filterOption=
{
false
}
loading=
{
loading
}
options=
{
dataSource
}
getPopupContainer=
{
triggerNode
=>
{
return
triggerNode
}
}
// getPopupContainer={triggerNode => {
// return triggerNode
// }}
getPopupContainer=
{
()
=>
document
.
getElementById
(
'root'
)
}
/* 处理option被遮挡 */
value=
{
props
.
value
}
dropdownRender=
{
originNode
=>
<
SelectContent
confirm=
{
confirm
}
resetField=
{
resetField
}
parentRef=
{
ref
}
handleChange=
{
handleChange
}
multiple=
{
multiple
}
value=
{
props
.
value
}
>
{
originNode
}
</
SelectContent
>
}
{
...
multipleProps
}
...
...
src/pages/commodity/products/directChannel.tsx
View file @
b252db73
...
...
@@ -307,27 +307,76 @@ const DirectChannel: React.FC<{}> = () => {
const
handleUpDown
=
()
=>
{
setIsDisabledOKbtn
(
true
)
let
params
:
any
=
{
idList
:
isBatchOption
?
selectRow
.
map
(
item
=>
item
.
id
)
:
[
currentOptionId
],
shopList
:
checkedValues
let
params
:
any
=
{}
if
(
isBatchOption
){
params
=
{
idList
:
selectRow
.
map
(
item
=>
item
.
id
),
shopList
:
checkedValues
}
}
else
{
params
=
{
id
:
currentOptionId
,
shopList
:
checkedValues
}
}
if
(
isUp
)
if
(
checkedValues
.
length
>
0
){
PublicApi
.
postProductChannelCommodityPublishCommodity
(
params
).
then
(
res
=>
{
if
(
isBatchOption
){
// 批量操作区分上下架
if
(
isUp
){
if
(
checkedValues
.
length
>
0
){
PublicApi
.
postProductChannelCommodityBatchPublishCommodity
(
params
).
then
(
res
=>
{
setUpDownModal
(
false
)
ref
.
current
.
reload
()
setIsDisabledOKbtn
(
false
)
})
}
else
{
setIsDisabledOKbtn
(
false
)
message
.
error
(
'请选择需要上架的渠道商城'
)
}
}
else
{
PublicApi
.
postProductChannelCommodityBatchOffPublishCommodity
(
params
).
then
(
res
=>
{
setUpDownModal
(
false
)
ref
.
current
.
reload
()
setIsDisabledOKbtn
(
false
)
})
}
}
else
{
if
(
isUp
){
if
(
checkedValues
.
length
>
0
){
PublicApi
.
postProductChannelCommodityPublishCommodity
(
params
).
then
(
res
=>
{
setUpDownModal
(
false
)
ref
.
current
.
reload
()
setIsDisabledOKbtn
(
false
)
})
}
else
{
setIsDisabledOKbtn
(
false
)
message
.
error
(
'请选择需要上架的渠道商城'
)
}
}
else
{
setIsDisabledOKbtn
(
false
)
message
.
error
(
'请选择需要上架的渠道商城'
)
PublicApi
.
postProductChannelCommodityPublishCommodity
(
params
).
then
(
res
=>
{
setUpDownModal
(
false
)
ref
.
current
.
reload
()
setIsDisabledOKbtn
(
false
)
})
}
else
PublicApi
.
postProductChannelCommodityOffPublishCommodity
(
params
).
then
(
res
=>
{
setUpDownModal
(
false
)
ref
.
current
.
reload
()
setIsDisabledOKbtn
(
false
)
})
}
// if(isUp)
// if(checkedValues.length > 0){
// PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => {
// setUpDownModal(false)
// ref.current.reload()
// setIsDisabledOKbtn(false)
// })
// }else{
// setIsDisabledOKbtn(false)
// message.error('请选择需要上架的渠道商城')
// }
// else
// PublicApi.postProductChannelCommodityOffPublishCommodity(params).then(res => {
// setUpDownModal(false)
// ref.current.reload()
// setIsDisabledOKbtn(false)
// })
}
...
...
src/pages/commodity/products/schema/channelSchema.tsx
View file @
b252db73
...
...
@@ -208,150 +208,64 @@ export const channelSchema: ISchema = {
// 添加渠道商品模态框高级筛选
export
const
addChannelSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
name
:
{
type
:
'string'
,
'x-component'
:
'ModalSearch'
,
'x-component-props'
:
{
placeholder
:
'商品名称'
,
align
:
'flex-left'
,
properties
:
{
name
:
{
type
:
'string'
,
'x-component'
:
'ModalSearch'
,
'x-component-props'
:
{
placeholder
:
'商品名称'
,
align
:
'flex-left'
,
},
},
[
FORM_FILTER_PATH
]:
{
type
:
'object'
,
'x-component'
:
'flex-layout'
,
'x-component-props'
:
{
rowStyle
:
{
flexWrap
:
'nowrap'
,
style
:
{
marginRight
:
0
}
},
colStyle
:
{
marginTop
:
20
,
},
},
[
FORM_FILTER_PATH
]:
{
type
:
'object'
,
'x-component'
:
'flex-layout'
,
'x-component-props'
:
{
rowStyle
:
{
flexWrap
:
'nowrap'
,
style
:
{
marginRight
:
0
}
},
colStyle
:
{
marginTop
:
20
,
},
properties
:
{
categoryId
:
{
type
:
'string'
,
"x-component"
:
'SearchSelect'
,
"x-component-props"
:
{
placeholder
:
'请选择品类'
,
className
:
'fixed-ant-selected-down'
,
fetchSearch
:
PublicApi
.
getProductSelectGetSelectCategory
,
}
},
properties
:
{
categoryId
:
{
type
:
'string'
,
"x-component"
:
'SearchSelect'
,
"x-component-props"
:
{
placeholder
:
'请选择品类'
,
className
:
'fixed-ant-selected-down'
,
// 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch
:
PublicApi
.
getProductSelectGetSelectCategory
,
}
},
brandId
:
{
type
:
'string'
,
"x-component"
:
'SearchSelect'
,
"x-component-props"
:
{
placeholder
:
'请选择品牌'
,
fetchSearch
:
PublicApi
.
getProductSelectGetSelectBrand
,
}
brandId
:
{
type
:
'string'
,
"x-component"
:
'SearchSelect'
,
"x-component-props"
:
{
placeholder
:
'请选择品牌'
,
fetchSearch
:
PublicApi
.
getProductSelectGetSelectBrand
,
}
},
parentMemberId
:
{
type
:
'string'
,
enum
:
[],
'x-component-props'
:
{
placeholder
:
'上级渠道'
,
},
parentMemberId
:
{
type
:
'string'
,
enum
:
[],
'x-component-props'
:
{
placeholder
:
'上级渠道'
,
},
},
submit
:
{
"x-component"
:
'Submit'
,
"x-mega-props"
:
{
span
:
1
},
submit
:
{
"x-component"
:
'Submit'
,
"x-mega-props"
:
{
span
:
1
},
"x-component-props"
:
{
children
:
'查询'
}
"x-component-props"
:
{
children
:
'查询'
}
}
}
}
// type: 'object',
// properties: {
// mageLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// properties: {
// topLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// 'x-component-props': {
// grid: true,
// },
// properties: {
// name: {
// type: 'string',
// 'x-component': 'Search',
// 'x-component-props': {
// placeholder: '商品名称',
// },
// },
// },
// },
// [FORM_FILTER_PATH]: {
// type: 'object',
// 'x-component': 'flex-layout',
// 'x-component-props': {
// rowStyle: {
// flexWrap: 'nowrap',
// justifyContent: 'flex-start'
// },
// colStyle: {
// marginLeft: 20,
// },
// },
// properties: {
// brandId: {
// type: 'string',
// 'x-component': 'CustomInputSearch',
// 'x-component-props': {
// placeholder: '商品品牌',
// showSearch: true,
// showArrow: true,
// defaultActiveFirstOption: false,
// filterOption: false,
// notFoundContent: null,
// searchValue: null,
// dataoption: [],
// },
// },
// customerCategoryId: {
// type: 'string',
// 'x-component': 'CustomInputSearch',
// 'x-component-props': {
// placeholder: '商品品类',
// showSearch: true,
// showArrow: true,
// defaultActiveFirstOption: false,
// filterOption: false,
// notFoundContent: null,
// searchValue: null,
// dataoption: [],
// },
// },
// parentMemberId: {
// type: 'string',
// enum: [],
// 'x-component-props': {
// placeholder: '上级渠道',
// },
// },
// submit: {
// 'x-component': 'Submit',
// 'x-mega-props': {
// span: 1,
// },
// 'x-component-props': {
// children: '查询',
// },
// },
// },
// },
// },
// },
// },
}
}
\ No newline at end of file
src/pages/transaction/transactionRules/components/RuleSetting.tsx
View file @
b252db73
...
...
@@ -5,7 +5,7 @@ import EyePreview from '@/components/EyePreview'
import
{
findItemAndDelete
}
from
'@/utils'
import
{
ISchemaFormActions
,
ISchema
,
FormEffectHooks
}
from
'@formily/antd'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
import
{
createAdd
Repository
Effect
,
useUnitPreview
}
from
'../effects'
import
{
createAdd
ContractTemplate
Effect
,
useUnitPreview
}
from
'../effects'
import
{
PublicApi
}
from
'@/services/api'
import
{
PlusOutlined
,
...
...
@@ -20,7 +20,6 @@ import SearchSelect from '@/components/NiceForm/components/SearchSelect'
import
Search
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'
export
interface
RuleSettingProps
{
addSchemaAction
:
ISchemaFormActions
,
...
...
@@ -29,218 +28,137 @@ export interface RuleSettingProps {
formSubmit
?(
values
)
}
const
fetchMemberList
=
async
(
params
)
=>
{
const
res
=
await
PublicApi
.
getMemberMaintenancePage
(
params
)
return
res
.
data
}
const
priceTypeMaps
=
{
[
MALL_TYPE
[
0
]]:
[
1
,
2
],
[
MALL_TYPE
[
1
]]:
[
3
],
[
MALL_TYPE
[
2
]]:
[
1
],
[
MALL_TYPE
[
3
]]:
[
1
],
[
MALL_TYPE
[
4
]]:
[
3
]
}
const
RuleSetting
:
React
.
FC
<
RuleSettingProps
>
=
(
props
)
=>
{
const
{
addSchemaAction
,
schema
,
formSubmit
,
onFieldChange
=
()
=>
{}
}
=
props
const
[
visibleChannelMember
,
setVisibleChannelMember
]
=
useState
(
false
)
const
[
visibleChannelRroduct
,
setVisibleChannelRroduct
]
=
useState
(
false
)
const
[
productRowSelection
,
productRowCtl
]
=
useRowSelectionTable
({
customKey
:
'productId'
})
const
[
memberRowSelection
,
memberRowCtl
]
=
useRowSelectionTable
({
customKey
:
'memberId'
})
const
[
productRowSelection
,
productRowCtl
]
=
useRowSelectionTable
({
type
:
'radio'
})
const
{
id
,
preview
,
pageStatus
}
=
usePageStatus
()
const
initValue
=
useInitValue
(
PublicApi
.
getWarehouseFreightSpaceDetails
)
useUnitPreview
(
initValue
,
addSchemaAction
)
const
fetchProductList
=
async
(
params
)
=>
{
const
shopType
=
addSchemaAction
.
getFieldValue
(
'shopType
'
)
const
res
=
await
PublicApi
.
get
ProductCommodityCommonGetCommodityDetail
List
({
const
tradingRulesId
=
addSchemaAction
.
getFieldValue
(
'transactionProcesssId
'
)
const
res
=
await
PublicApi
.
get
OrderTradingRulesProduct
List
({
...
params
,
shopType
,
environment
:
1
,
// 根据商城类型手动传输定价类型
priceTypeList
:
priceTypeMaps
[
shopType
]
?
priceTypeMaps
[
shopType
]
:
undefined
tradingRulesId
,
})
return
res
.
data
}
//
会员选择后的表格
//
table删除商品
const
handleDeleteTable
=
(
id
)
=>
{
const
value
=
addSchemaAction
.
getFieldValue
(
'applyMember'
)
addSchemaAction
.
setFieldValue
(
'applyMember'
,
findItemAndDelete
(
value
,
id
))
}
const
handleAddMemberBtn
=
()
=>
{
const
checkBoxs
=
addSchemaAction
.
getFieldValue
(
'applyMember'
)
memberRowCtl
.
setSelectedRowKeys
(
checkBoxs
.
map
(
v
=>
v
.
memberId
))
memberRowCtl
.
setSelectRow
(
checkBoxs
)
setVisibleChannelMember
(
true
)
const
value
=
addSchemaAction
.
getFieldValue
(
'products'
)
console
.
log
(
value
,
'v'
,
findItemAndDelete
(
value
,
id
))
addSchemaAction
.
setFieldValue
(
'products'
,
findItemAndDelete
(
value
,
id
,
'productId'
))
}
// 弹出商品选择
const
handleAddProductBtn
=
()
=>
{
const
shopType
=
addSchemaAction
.
getFieldValue
(
'shopType'
)
if
(
!
shopType
)
{
message
.
error
(
'请先选择商城类型'
)
return
false
}
productRowCtl
.
setSelectedRowKeys
([])
productRowCtl
.
setSelectRow
([])
// const transactionProcesss = addSchemaAction.getFieldValue('transactionProcesssId')
// if (!transactionProcesss) {
// message.error('请先选择交易流程')
// return false
// }
const
checkBoxs
=
addSchemaAction
.
getFieldValue
(
'products'
)
productRowCtl
.
setSelectedRowKeys
(
checkBoxs
.
map
(
v
=>
v
.
productId
))
productRowCtl
.
setSelectRow
(
checkBoxs
)
setVisibleChannelRroduct
(
true
)
}
// 新增会员
const
tableAddButton
=
<
Button
style=
{
{
marginBottom
:
16
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
handleAddMemberBtn
}
type=
'dashed'
>
选择指定会员
</
Button
>
// 新增商品
const
tableAddButton
=
<
Button
style=
{
{
marginBottom
:
16
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
handleAddProductBtn
}
type=
'dashed'
>
选择指定商品
</
Button
>
const
tableColumns
=
[
{
dataIndex
:
'memberId'
,
title
:
'ID'
,
align
:
'center'
},
{
dataIndex
:
'name'
,
align
:
'center'
,
title
:
'会员名称'
,
render
:
(
_
,
record
)
=>
<
EyePreview
url=
{
`/memberCenter/memberAbility/manage/addMember?id=${record.memberId}&preview=1`
}
>
{
_
}
</
EyePreview
>
},
{
dataIndex
:
'memberTypeName'
,
title
:
'会员类型'
,
align
:
'center'
},
{
dataIndex
:
'ctl'
,
title
:
'操作'
,
align
:
'center'
,
render
:
(
_
,
record
)
=>
<
Button
type=
'link'
onClick=
{
()
=>
handleDeleteTable
(
record
.
id
)
}
>
删除
</
Button
>
}
{
dataIndex
:
'productId'
,
title
:
'ID'
,
key
:
'productId'
},
{
dataIndex
:
'productName'
,
title
:
'商品名称'
,
key
:
'productName'
,
render
:
(
_
,
record
)
=>
<
EyePreview
url=
{
`/memberCenter/commodityAbility/commodity/products/viewProducts?id=${record.productId}`
}
>
{
_
}
</
EyePreview
>
},
{
dataIndex
:
'category'
,
title
:
'品类'
,
key
:
'category'
},
{
dataIndex
:
'brand'
,
title
:
'品牌'
,
key
:
'brand'
},
{
dataIndex
:
'productPrice'
,
title
:
'商品定价'
,
key
:
'productPrice'
},
{
dataIndex
:
'ctl'
,
title
:
'操作'
,
render
:
(
_
,
record
)
=>
<
Button
type=
'link'
onClick=
{
()
=>
handleDeleteTable
(
record
.
productId
)
}
>
删除
</
Button
>
}
]
const
connectProduct
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
<
div
className=
'connectBtn'
onClick=
{
handleAddProductBtn
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
选择
</
div
>
// 仓位设置表单提交
// 规则设置表单提交
const
handleSubmit
=
async
(
values
)
=>
{
formSubmit
&&
formSubmit
(
values
)
}
// 会员添加弹窗控制
const
handleOkAddMember
=
()
=>
{
setVisibleChannelMember
(
false
)
addSchemaAction
.
setFieldValue
(
'applyMember'
,
memberRowCtl
.
selectRow
)
}
const
handleCancelAddMember
=
()
=>
{
setVisibleChannelMember
(
false
)
}
// 商品添加弹窗控制
const
handleOkAddProduct
=
async
()
=>
{
setVisibleChannelRroduct
(
false
)
const
selectResult
=
productRowCtl
.
selectRow
[
0
]
if
(
!
selectResult
)
{
return
null
}
const
goodsId
=
selectResult
.
goodsId
addSchemaAction
.
setFieldValue
(
'productName'
,
selectResult
.
name
)
addSchemaAction
.
setFieldValue
(
'category'
,
selectResult
.
customerCategoryName
)
addSchemaAction
.
setFieldValue
(
'brand'
,
selectResult
.
brandName
)
addSchemaAction
.
setFieldValue
(
'unit'
,
selectResult
.
unitName
)
addSchemaAction
.
setFieldValue
(
'productId'
,
selectResult
.
id
)
addSchemaAction
.
setFieldState
(
'inventory'
,
state
=>
{
state
.
props
[
"x-props"
]
=
{
addonAfter
:
<
div
style=
{
{
marginLeft
:
4
}
}
>
{
selectResult
.
unitName
}
</
div
>
}
})
// 查询到的货品id
const
{
data
}
=
await
PublicApi
.
getProductGoodsGetGoods
({
id
:
goodsId
})
// 设置货品名称
addSchemaAction
.
setFieldValue
(
'itemNo'
,
data
.
name
)
addSchemaAction
.
setFieldValue
(
'products'
,
productRowCtl
.
selectRow
)
}
const
handleCancelAddProduct
=
()
=>
{
setVisibleChannelRroduct
(
false
)
}
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'
,
}
]
const
columnsSetProduct
:
any
[]
=
[
{
title
:
'商品ID'
,
dataIndex
:
'id'
,
align
:
'center'
,
key
:
'id'
,
{
dataIndex
:
'productId'
,
title
:
'ID'
,
key
:
'productId'
},
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
{
dataIndex
:
'productName'
,
title
:
'商品名称'
,
key
:
'productName'
},
{
{
dataIndex
:
'category'
,
title
:
'品类'
,
dataIndex
:
'customerCategoryName'
,
align
:
'center'
,
key
:
'customerCategoryName'
,
key
:
'category'
},
{
title
:
'品牌'
,
dataIndex
:
'brandName'
,
align
:
'center'
,
key
:
'brandName'
,
{
dataIndex
:
'brand'
,
title
:
'品牌'
,
key
:
'brand'
},
{
title
:
'单位'
,
dataIndex
:
'unitName'
,
align
:
'center'
,
key
:
'unitName'
,
{
dataIndex
:
'productPrice'
,
title
:
'商品定价'
,
key
:
'productPrice'
},
]
const
formSearch
:
ISchema
=
{
type
:
'object'
,
properties
:
{
name
:
{
type
:
'string'
,
"x-component"
:
'Search'
,
"x-component-props"
:
{
placeholder
:
'请输入会员名称'
}
}
}
}
// 商品弹框高级筛选
const
formProduct
:
ISchema
=
{
type
:
'object'
,
properties
:
{
n
ame
:
{
productN
ame
:
{
type
:
'string'
,
'x-component'
:
'ModalSearch'
,
'x-component-props'
:
{
placeholder
:
'请输入商品名称
/ID
'
,
placeholder
:
'请输入商品名称'
,
align
:
'flex-left'
,
},
},
...
...
@@ -264,7 +182,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
"x-component"
:
'SearchSelect'
,
"x-component-props"
:
{
placeholder
:
'请选择品类'
,
className
:
'fixed-ant-selected-down'
,
// 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
className
:
'fixed-ant-selected-down'
,
fetchSearch
:
PublicApi
.
getProductSelectGetSelectCustomerCategory
,
style
:
{
width
:
160
...
...
@@ -298,87 +216,60 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
return
(
<>
<
NiceForm
previewPlaceholder=
' '
editable=
{
pageStatus
!==
PageStatus
.
PREVIEW
}
initialValues=
{
initValue
}
expressionScope=
{
{
tableColumns
,
tableAddButton
,
connectProduct
}
}
effects=
{
(
$
,
{
setFieldState
})
=>
{
FormEffectHooks
.
onFormInputChange$
().
subscribe
(()
=>
{
onFieldChange
()
})
createAddRepositoryEffect
(
addSchemaAction
)
$
(
'onFieldValueChange'
,
'shopType'
).
subscribe
(
parentState
=>
{
if
(
parentState
.
value
)
{
console
.
log
(
'review'
)
setFieldState
(
'shopIds'
,
state
=>
{
state
.
props
[
"x-component-props"
].
dataSource
=
pageStatus
===
PageStatus
.
PREVIEW
?
GlobalConfig
.
web
.
shopInfo
.
filter
(
v
=>
v
.
type
===
parentState
.
value
&&
state
.
value
.
includes
(
v
.
id
))
:
GlobalConfig
.
web
.
shopInfo
.
filter
(
v
=>
v
.
type
===
parentState
.
value
)
<
NiceForm
previewPlaceholder=
' '
editable=
{
pageStatus
!==
PageStatus
.
PREVIEW
}
initialValues=
{
initValue
}
expressionScope=
{
{
tableColumns
,
tableAddButton
,
}
}
effects=
{
(
$
,
{
setFieldState
})
=>
{
FormEffectHooks
.
onFormInputChange$
().
subscribe
(()
=>
{
onFieldChange
()
})
createAddContractTemplateEffect
(
addSchemaAction
)
$
(
'onFieldValueChange'
,
'isElectronicContract'
).
subscribe
(
parentState
=>
{
setFieldState
(
'contractTemplateId'
,
state
=>
{
state
.
visible
=
parentState
.
value
})
}
})
}
}
onSubmit=
{
handleSubmit
}
actions=
{
addSchemaAction
}
schema=
{
schema
}
/>
})
}
}
onSubmit=
{
handleSubmit
}
actions=
{
addSchemaAction
}
schema=
{
schema
}
/>
{
/* 选择商品 */
}
<
ModalTable
modalTitle=
'选择渠道会员'
confirm=
{
handleOkAddMember
}
cancel=
{
handleCancelAddMember
}
visible=
{
visibleChannelMember
}
columns=
{
columnsSetMember
}
rowSelection=
{
memberRowSelection
}
fetchTableData=
{
params
=>
fetchMemberList
(
params
)
}
formilyProps=
{
{
ctx
:
{
schema
:
formSearch
}
}
}
tableProps=
{
{
rowKey
:
'memberId'
}
}
/>
<
ModalTable
modalTitle=
'选择商品'
confirm=
{
handleOkAddProduct
}
cancel=
{
handleCancelAddProduct
}
visible=
{
visibleChannelRroduct
}
columns=
{
columnsSetProduct
}
rowSelection=
{
productRowSelection
}
fetchTableData=
{
params
=>
fetchProductList
(
params
)
}
formilyProps=
{
{
ctx
:
{
schema
:
formProduct
,
components
:
{
ModalSearch
:
Search
,
SearchSelect
,
Submit
}
,
effects
:
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'name'
,
FORM_FILTER_PATH
,
);
}
modalTitle=
'选择商品'
confirm=
{
handleOkAddProduct
}
cancel=
{
handleCancelAddProduct
}
visible=
{
visibleChannelRroduct
}
columns=
{
columnsSetProduct
}
rowSelection=
{
productRowSelection
}
fetchTableData=
{
params
=>
fetchProductList
(
params
)
}
formilyProps=
{
{
ctx
:
{
schema
:
formProduct
,
components
:
{
ModalSearch
:
Search
,
SearchSelect
,
Submit
}
,
effects
:
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'productName'
,
FORM_FILTER_PATH
,
);
}
}
}
tableProps=
{
{
rowKey
:
'id'
,
onRow
:
(
record
)
=>
({
onClick
:
()
=>
{
productRowCtl
.
setSelectRow
([
record
]);
productRowCtl
.
setSelectedRowKeys
([
record
.
id
]);
},
})
}
}
/>
}
tableProps=
{
{
rowKey
:
'productId'
}
}
/>
</>
)
...
...
src/pages/transaction/transactionRules/effects/index.tsx
View file @
b252db73
...
...
@@ -4,26 +4,11 @@ import { PublicApi } from '@/services/api';
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
;
const
{
onFieldValueChange$
}
=
FormEffectHooks
export
const
useWarehouseSelect
=
(
context
:
ISchemaFormActions
)
=>
{
onFieldValueChange$
(
'warehouseId'
).
subscribe
(
state
=>
{
// 货品ID
const
goodsId
=
context
.
getFieldValue
(
'productId'
)
const
warehouseId
=
state
.
value
PublicApi
.
getWarehouseInventoryByItemNo
({
warehouseId
,
itemId
:
goodsId
}).
then
(
res
=>
{
const
{
data
}
=
res
context
.
setFieldValue
(
'NO_SUBMIT3'
,
data
.
inventory
)
})
})
}
export
const
createAddRepositoryEffect
=
(
context
:
ISchemaFormActions
)
=>
{
const
fetchWarehouseAll
=
async
()
=>
{
const
{
data
}
=
await
PublicApi
.
getWarehouseWarehouseAll
()
context
.
setFieldState
(
'warehouseId'
,
state
=>
{
state
.
warehouseLists
=
data
export
const
createAddContractTemplateEffect
=
(
context
:
ISchemaFormActions
)
=>
{
const
fetchListContractTemplateAll
=
async
()
=>
{
const
{
data
}
=
await
PublicApi
.
getOrderSelectListContractTemplate
()
context
.
setFieldState
(
'contractTemplateId'
,
state
=>
{
state
.
contractTemplateLists
=
data
})
return
data
.
map
(
v
=>
({
value
:
v
.
id
,
...
...
@@ -31,8 +16,7 @@ export const createAddRepositoryEffect = (context: ISchemaFormActions) => {
}))
}
useAsyncSelect
(
'warehouseId'
,
fetchWarehouseAll
)
useWarehouseSelect
(
context
)
useAsyncSelect
(
'contractTemplateId'
,
fetchListContractTemplateAll
)
}
export
const
useUnitPreview
=
(
initValue
,
context
)
=>
{
...
...
src/pages/transaction/transactionRules/index.less
View file @
b252db73
...
...
@@ -13,43 +13,3 @@
cursor: pointer;
}
}
// 添加仓位
.storeItemRadio{
display: flex;
flex-wrap: wrap;
// width: 320px;
margin: 0 auto;
& label{
width: 320px !important;
height: 48px !important;
line-height: 48px !important;
margin: 8px 0;
margin-right: 24px;
}
}
//仓位调拨
.circleAmount{
width: 160px;
height: 160px;
border: 4px solid #edeef2;
background-color: #fafbfc;
border-radius: 50%;
& p{
height: 160px;
line-height: 160px;
text-align: center;
font-size: 20px;
font-weight: bold;
}
}
//查看仓位
.amount{
font-size:24px;
font-weight:bold;
color:rgba(23,43,77,1);
}
\ No newline at end of file
src/pages/transaction/transactionRules/schema/index.tsx
View file @
b252db73
...
...
@@ -6,232 +6,6 @@ import { PublicApi } from '@/services/api';
import
{
SHOP_TYPES
}
from
'@/constants'
;
import
{
padRequiredMessage
}
from
'@/utils'
;
// 将获取的商城转化为可用类型
const
getShopTypeMap
=
(()
=>
{
console
.
log
(
GlobalConfig
.
web
.
shopInfo
)
return
GlobalConfig
.
web
.
shopInfo
.
reduce
((
prev
,
next
)
=>
{
const
shopTypeEnumValue
=
SHOP_TYPES
.
find
(
v
=>
v
.
value
===
next
.
type
)
if
(
!
shopTypeEnumValue
)
{
return
prev
}
if
(
!
prev
.
find
(
v
=>
v
.
value
===
shopTypeEnumValue
.
value
))
{
prev
.
push
(
shopTypeEnumValue
)
}
return
prev
},
[])
})()
export
const
repositMoreSchema
:
ISchema
=
padRequiredMessage
({
type
:
'object'
,
properties
:
{
REPOSIT_TABS
:
{
type
:
'object'
,
"x-component"
:
"tab"
,
"x-component-props"
:
{
type
:
'card'
},
properties
:
{
"tab-1"
:
{
"type"
:
"object"
,
"x-component"
:
"tabpane"
,
"x-component-props"
:
{
"tab"
:
"基本信息"
},
"properties"
:
{
MEGA_LAYOUT1
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
wrapperCol
:
8
,
labelAlign
:
'left'
},
properties
:
{
name
:
{
type
:
'string'
,
"x-rules"
:
[
{
required
:
true
,
message
:
'请输入仓位名称'
},
{
limitByte
:
true
,
// 自定义校验规则
maxByte
:
60
}
],
title
:
'仓位名称'
,
"x-component-props"
:
{
placeholder
:
'建议名称:商品名称+商城名称+渠道描述'
}
},
shopType
:
{
type
:
'string'
,
enum
:
SHOP_TYPES
,
title
:
'商城类型'
,
required
:
true
},
productName
:
{
type
:
'string'
,
title
:
'商品名称'
,
"x-mega-props"
:
{
full
:
true
},
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
"{{connectProduct}}"
},
"x-rules"
:
[
{
required
:
true
,
message
:
'请选择商品'
}
],
},
category
:
{
type
:
'string'
,
display
:
false
},
brand
:
{
type
:
'string'
,
display
:
false
},
unit
:
{
type
:
'string'
,
display
:
false
},
productId
:
{
type
:
'string'
,
display
:
false
},
warehouseId
:
{
type
:
'string'
,
title
:
'对应仓库名称'
,
enum
:
[]
},
itemNo
:
{
type
:
'string'
,
"x-component"
:
'Text'
,
title
:
'对应货品'
,
default
:
'暂无'
},
inventory
:
{
type
:
'number'
,
"x-component"
:
"CustomSlider"
,
"x-rules"
:
[
{
required
:
true
,
message
:
'请分配仓位库存'
}
],
"x-component-props"
:
{
min
:
0
,
max
:
200
},
title
:
'分配仓位库存'
,
},
inventoryDeductWay
:
{
type
:
'radio'
,
title
:
'库存扣减方式'
,
required
:
true
,
enum
:
[
{
label
:
'按仓位随机扣减'
,
value
:
1
},
{
label
:
'按仓库位置远近扣除'
,
value
:
2
}
],
default
:
1
}
}
}
}
},
"tab-2"
:
{
"type"
:
"object"
,
"x-component"
:
"tabpane"
,
"x-component-props"
:
{
"tab"
:
"适用商城"
},
"properties"
:
{
MEGA_LAYOUT2
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
labelAlign
:
'left'
},
properties
:
{
"shopIds"
:
{
"type"
:
"array:number"
,
"x-component"
:
'CardCheckBox'
,
"x-component-props"
:
{
dataSource
:
[]
},
"title"
:
"适用商城"
,
"x-rules"
:
[
{
required
:
true
,
message
:
'请选择适用商城'
}
],
}
}
}
}
},
"tab-3"
:
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
"tab"
:
"适用会员"
},
properties
:
{
MEGA_LAYOUT3
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
labelAlign
:
'left'
},
properties
:
{
"isAllMemberShare"
:
{
"type"
:
"radio"
,
enum
:
[
{
label
:
'所有会员共享(默认)'
,
value
:
1
},
{
label
:
'指定会员'
,
value
:
0
},
],
"title"
:
"选择渠道会员"
,
default
:
1
,
required
:
true
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'applyMember'
,
"condition"
:
"{{!$value}}"
}
]
},
applyMember
:
{
type
:
'array:number'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'memberId'
,
columns
:
"{{tableColumns}}"
,
prefix
:
"{{tableAddButton}}"
}
}
}
}
}
}
}
}
}
})
// 新增规则
export
const
ruleDetailSchema
:
ISchema
=
padRequiredMessage
({
...
...
@@ -257,295 +31,61 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
"x-component-props"
:
{
labelCol
:
4
,
wrapperCol
:
8
,
labelAlign
:
'left'
labelAlign
:
'left'
,
style
:
{
height
:
'400px'
}
},
properties
:
{
name
:
{
type
:
'string'
,
required
:
true
,
title
:
'
仓位
名称'
,
title
:
'
规则
名称'
,
"x-component-props"
:
{
placeholder
:
'
建议名称:商品名称+商城名称+渠道描述
'
placeholder
:
'
请输入规则名称
'
},
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
60
maxByte
:
48
}
]
},
shopType
:
{
type
:
'string'
,
enum
:
getShopTypeMap
,
title
:
'商城类型'
,
required
:
true
},
productName
:
{
type
:
'string'
,
title
:
'商品名称'
,
"x-mega-props"
:
{
full
:
true
},
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
"{{connectProduct}}"
},
required
:
true
},
category
:
{
transactionProcesssId
:
{
type
:
'string'
,
display
:
false
},
brand
:
{
type
:
'string'
,
display
:
false
},
unit
:
{
type
:
'string'
,
display
:
false
},
productId
:
{
type
:
'string'
,
display
:
false
},
warehouseId
:
{
type
:
'string'
,
title
:
'仓库名称'
,
enum
:
[]
},
itemNo
:
{
type
:
'string'
,
"x-component"
:
'Text'
,
title
:
'对应货品'
,
default
:
'暂无'
},
NO_SUBMIT3
:
{
type
:
'string'
,
"x-component"
:
'Text'
,
title
:
'当前仓货品库存'
},
inventory
:
{
type
:
'number'
,
"x-mega-props"
:
{
full
:
true
},
required
:
true
,
title
:
'分配仓位库存'
,
},
inventoryDeductWay
:
{
type
:
'radio'
,
title
:
'库存扣减方式'
,
title
:
'流程选择'
,
required
:
true
,
enum
:
[
{
label
:
'按仓位随机扣减'
,
value
:
1
},
{
label
:
'按仓库位置远近扣除'
,
value
:
2
}
],
default
:
1
}
}
}
}
},
"tab-2"
:
{
"type"
:
"object"
,
"x-component"
:
"tabpane"
,
"x-component-props"
:
{
"tab"
:
"适用商城"
},
"properties"
:
{
MEGA_LAYOUT2
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
labelAlign
:
'left'
},
properties
:
{
"shopIds"
:
{
"type"
:
"array:number"
,
"x-component"
:
'CardCheckBox'
,
"x-component"
:
'SearchSelect'
,
"x-component-props"
:
{
dataSource
:
GlobalConfig
.
web
.
shopInfo
},
"title"
:
"适用商城"
,
required
:
true
,
}
}
}
}
},
"tab-3"
:
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
"tab"
:
"适用商品"
},
properties
:
{
MEGA_LAYOUT3
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
labelAlign
:
'left'
},
properties
:
{
"isAllMemberShare"
:
{
"type"
:
"radio"
,
enum
:
[
{
label
:
'所有会员共享(默认)'
,
value
:
1
},
{
label
:
'指定会员'
,
value
:
0
},
],
"title"
:
"选择渠道会员"
,
default
:
1
,
required
:
true
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'applyMember'
,
"condition"
:
"{{!$value}}"
}
]
},
applyMember
:
{
type
:
'array:number'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'memberId'
,
columns
:
"{{tableColumns}}"
,
prefix
:
"{{tableAddButton}}"
placeholder
:
'请选择交易流程'
,
className
:
'fixed-ant-selected-down'
,
fetchSearch
:
PublicApi
.
getOrderTradingRulesTransactionProcessList
,
}
}
}
}
}
}
}
}
}
})
// 仓位设置
export
const
repositTabOneSchema
:
ISchema
=
padRequiredMessage
({
type
:
'object'
,
properties
:
{
REPOSIT_TABS
:
{
type
:
'object'
,
"x-component"
:
"tab"
,
"x-component-props"
:
{
tabPosition
:
'left'
},
properties
:
{
"tab-1"
:
{
"type"
:
"object"
,
"x-component"
:
"tabpane"
,
"x-component-props"
:
{
"tab"
:
"基本信息"
},
"properties"
:
{
MEGA_LAYOUT1
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
wrapperCol
:
8
,
labelAlign
:
'left'
},
properties
:
{
name
:
{
type
:
'string'
,
required
:
true
,
title
:
'仓位名称'
,
editable
:
false
,
"x-component-props"
:
{
placeholder
:
'建议名称:商品名称+商城名称+渠道描述'
},
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
60
}
]
},
shopType
:
{
type
:
'string'
,
enum
:
getShopTypeMap
,
title
:
'商城类型'
,
required
:
true
},
productName
:
{
type
:
'string'
,
title
:
'商品名称'
,
editable
:
false
,
"x-mega-props"
:
{
full
:
true
},
"x-component-props"
:
{
disabled
:
true
,
},
required
:
true
},
category
:
{
type
:
'string'
,
display
:
false
},
brand
:
{
type
:
'string'
,
display
:
false
},
unit
:
{
type
:
'string'
,
display
:
false
},
productId
:
{
type
:
'string'
,
display
:
false
},
warehouseId
:
{
type
:
'string'
,
title
:
'仓库名称'
,
editable
:
false
,
enum
:
[]
},
itemNo
:
{
type
:
'string'
,
"x-component"
:
'Text'
,
title
:
'对应货品'
,
default
:
'暂无'
},
NO_SUBMIT3
:
{
type
:
'string'
,
"x-component"
:
'Text'
,
title
:
'当前仓货品库存'
},
inventory
:
{
type
:
'number'
,
"x-mega-props"
:
{
full
:
true
MEGA_LAYOUT1_1
:
{
type
:
'object'
,
'x-component'
:
'mega-layout'
,
'x-component-props'
:
{
label
:
'电子合同'
,
wrapperCol
:
24
,
},
required
:
true
,
title
:
'分配仓位库存'
,
},
inventoryDeductWay
:
{
type
:
'radio'
,
title
:
'库存扣减方式'
,
required
:
true
,
enum
:
[
{
label
:
'按仓位随机扣减'
,
value
:
1
properties
:
{
isElectronicContract
:
{
type
:
'string'
,
"x-component-props"
:
{
children
:
"使用电子合同"
},
"x-component"
:
"checkboxsingle"
,
default
:
false
},
{
label
:
'按仓库位置远近扣除'
,
value
:
2
contractTemplateId
:
{
type
:
'string'
,
required
:
true
,
enum
:
[],
"x-component-props"
:
{
placeholder
:
'请选择电子合同模板'
},
visible
:
false
}
],
default
:
1
}
}
}
}
...
...
@@ -570,7 +110,7 @@ export const repositTabOneSchema: ISchema = padRequiredMessage({
"type"
:
"array:number"
,
"x-component"
:
'CardCheckBox'
,
"x-component-props"
:
{
dataSource
:
[]
dataSource
:
GlobalConfig
.
web
.
shopInfo
},
"title"
:
"适用商城"
,
required
:
true
,
...
...
@@ -583,7 +123,7 @@ export const repositTabOneSchema: ISchema = padRequiredMessage({
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
"tab"
:
"适用
会员
"
"tab"
:
"适用
商品
"
},
properties
:
{
MEGA_LAYOUT3
:
{
...
...
@@ -594,28 +134,28 @@ export const repositTabOneSchema: ISchema = padRequiredMessage({
labelAlign
:
'left'
},
properties
:
{
"is
AllMemberShar
e"
:
{
"is
TacitlyApprov
e"
:
{
"type"
:
"radio"
,
enum
:
[
{
label
:
'所有
会员共享
(默认)'
,
value
:
1
},
{
label
:
'指定
会员'
,
value
:
0
},
{
label
:
'所有
商品
(默认)'
,
value
:
1
},
{
label
:
'指定
商品'
,
value
:
2
},
],
"title"
:
"
选择渠道会员
"
,
"title"
:
"
适用商品
"
,
default
:
1
,
required
:
true
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'
applyMember
'
,
"condition"
:
"{{
!$value
}}"
target
:
'
products
'
,
"condition"
:
"{{
$value === 2
}}"
}
]
},
applyMember
:
{
products
:
{
type
:
'array:number'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'
member
Id'
,
rowKey
:
'
product
Id'
,
columns
:
"{{tableColumns}}"
,
prefix
:
"{{tableAddButton}}"
}
...
...
@@ -627,4 +167,4 @@ export const repositTabOneSchema: ISchema = padRequiredMessage({
}
}
}
})
\ No newline at end of file
})
src/utils/index.tsx
View file @
b252db73
...
...
@@ -165,10 +165,15 @@ export function omit(obj: any, arr: string[]) {
return
tempObj
}
export
const
findItemAndDelete
=
(
arr
:
any
[],
target
)
=>
{
/**
* @param { Object[] } arr 源数据
* @param { any } target 目标值 通常是id等主键
* @param { string } customKey 可选 自定义主键 默认'id'
*/
export
const
findItemAndDelete
=
(
arr
:
any
[],
target
:
any
,
customKey
?:
string
)
=>
{
const
newArr
=
[...
arr
]
if
(
newArr
.
length
>
0
&&
isObject
(
newArr
[
0
]))
{
return
newArr
.
filter
(
v
=>
v
.
id
!==
target
)
return
newArr
.
filter
(
v
=>
v
[
customKey
||
'id'
]
!==
target
)
}
const
targetIndex
=
arr
.
indexOf
(
target
)
if
(
targetIndex
===
-
1
)
{
...
...
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