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
黄庭坚
jinfa-platform
Commits
aeb81bbb
Commit
aeb81bbb
authored
Aug 31, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修改商品物流模块为空
parent
fb95bffe
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
395 additions
and
245 deletions
+395
-245
index.ts
src/module/channelProductModule/index.ts
+12
-0
selectProduct.tsx
...pages/commodity/products/addChannelItem/selectProduct.tsx
+253
-0
addDirectChannel.tsx
src/pages/commodity/products/addDirectChannel.tsx
+55
-226
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+18
-7
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+2
-2
productImageForm.tsx
...s/commodity/products/addProductsItem/productImageForm.tsx
+5
-5
directChannel.tsx
src/pages/commodity/products/directChannel.tsx
+5
-5
index.ts
src/store/channelProduct/index.ts
+41
-0
index.tsx
src/store/index.tsx
+4
-0
No files found.
src/module/channelProductModule/index.ts
0 → 100644
View file @
aeb81bbb
import
{
GetProductChannelCommodityGetCommodityListResponseDetail
}
from
'@/services'
;
export
interface
IChannelProductModule
{
productSelectRowInStore
:
GetProductChannelCommodityGetCommodityListResponseDetail
;
priceType
:
number
;
productName
:
string
;
setProductSelectRowInStore
(
data
:
GetProductChannelCommodityGetCommodityListResponseDetail
):
void
;
setPriceType
(
data
:
number
):
void
;
setProductName
(
data
:
string
):
void
;
}
\ No newline at end of file
src/pages/commodity/products/addChannelItem/selectProduct.tsx
0 → 100644
View file @
aeb81bbb
import
React
,
{
useState
,
useRef
,
useEffect
}
from
'react'
import
{
Button
,
Form
,
Radio
,
Table
}
from
'antd'
import
{
PlusOutlined
,
}
from
'@ant-design/icons'
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
;
import
{
createAsyncFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
;
import
{
addChannelSchema
}
from
'../schema/channelSchema'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
ModalTable
from
'@/components/ModalTable'
import
{
GetProductChannelCommodityGetCommodityListResponseDetail
}
from
'@/services'
;
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
;
import
SearchSelect
from
'@/components/NiceForm/components/SearchSelect'
import
Search
from
'@/components/NiceForm/components/Search'
import
Submit
from
'@/components/NiceForm/components/Submit'
import
{
inject
,
observer
}
from
'mobx-react'
import
{
store
}
from
'@/store'
const
layout
=
{
labelCol
:
{
span
:
2
,
},
wrapperCol
:
{
span
:
12
,
},
}
interface
IProps
{
onRef
:
(
refs
:
any
)
=>
void
;
}
const
productFormActions
=
createAsyncFormActions
()
const
SelectProduct
:
React
.
FC
<
IProps
>
=
(
props
)
=>
{
const
{
onRef
}
=
props
const
productRef
=
useRef
<
any
>
({})
const
productFormRef
=
useRef
()
const
[
formProduct
]
=
Form
.
useForm
()
const
[
source
,
setSource
]
=
useState
(
1
)
const
[
visibleAddTabs
,
setVisibleAddTabs
]
=
useState
(
false
)
const
[
productRowSelection
,
productRowCtl
]
=
useRowSelectionTable
({
type
:
'radio'
})
const
[
selectProduct
,
setSelectProduct
]
=
useState
<
GetProductChannelCommodityGetCommodityListResponseDetail
[]
>
()
const
{
ChannelProudctStore
}
=
store
const
{
setProductSelectRowInStore
,
setPriceType
,
setProductName
}
=
ChannelProudctStore
const
productColumns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
,
key
:
'id'
,
},
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
key
:
'name'
,
},
{
title
:
'品类'
,
dataIndex
:
[
'customerCategory'
,
'name'
],
key
:
'customerCategory'
,
},
{
title
:
'品牌'
,
dataIndex
:
[
'brand'
,
'name'
],
key
:
'brand'
,
},
{
title
:
'单位'
,
dataIndex
:
'unitName'
,
key
:
'unitName'
,
}
]
const
productedColumns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
,
key
:
'id'
,
},
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
key
:
'name'
,
},
{
title
:
'品类'
,
dataIndex
:
[
'customerCategory'
,
'name'
],
key
:
'customerCategory'
,
},
{
title
:
'品牌'
,
dataIndex
:
[
'brand'
,
'name'
],
key
:
'brand'
,
},
{
title
:
'单位'
,
dataIndex
:
'unitName'
,
key
:
'unitName'
,
},
{
title
:
'操作'
,
dataIndex
:
'option'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
return
(
<>
<
Button
type=
'link'
onClick=
{
()
=>
clickDelete
(
record
)
}
>
删除
</
Button
>
</>
)
}
}
]
useEffect
(()
=>
{
onRef
(
productFormRef
)
formProduct
.
setFieldsValue
({
source
:
source
})
// 获取会员角色列表
PublicApi
.
getMemberManageChannelLowerRoleList
().
then
(
res
=>
{
const
{
data
}
=
res
console
.
log
(
data
)
})
},
[])
useEffect
(()
=>
{
console
.
log
(
productRowCtl
.
selectRow
[
0
])
if
(
productRowCtl
.
selectRow
.
length
>
0
){
setPriceType
(
productRowCtl
.
selectRow
[
0
].
priceType
)
setProductName
(
productRowCtl
.
selectRow
[
0
].
name
)
setProductSelectRowInStore
(
productRowCtl
.
selectRow
[
0
])
}
},
[
productRowCtl
.
selectRow
])
useEffect
(()
=>
{
if
(
visibleAddTabs
)
productRef
?.
current
?.
schemaAction
?.
setFieldState
(
'parentMemberId'
,
state
=>
{
console
.
log
(
'parentMemberId'
)
state
.
visible
=
source
===
1
?
true
:
false
})
},
[
visibleAddTabs
])
// 获取渠道商品
const
fetchProductData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getProductChannelCommodityGetCommodityList
({...
params
,
source
:
source
}).
then
(
res
=>
{
const
{
data
}
=
res
resolve
(
data
)
})
})
}
// 获取上级渠道下拉列表
const
fetchSelectOptions
=
async
()
=>
{
const
{
data
}
=
await
PublicApi
.
getMemberManageChannelUpperList
();
return
data
.
map
(
v
=>
({
label
:
v
.
name
,
value
:
v
.
memberId
}))
}
const
handleSourceChange
=
(
v
:
any
)
=>
{
setSource
(
v
.
target
.
value
)
setSelectProduct
([])
}
const
handleOkAddTabs
=
()
=>
{
setSelectProduct
(
productRowCtl
.
selectRow
)
setVisibleAddTabs
(
false
)
}
const
handleCancelAddTabs
=
()
=>
{
setVisibleAddTabs
(
false
)
// productRowCtl.setSelectedRowKeys([])
}
const
clickDelete
=
(
record
:
any
)
=>
{
setSelectProduct
([])
}
return
(<>
<
Form
{
...
layout
}
form=
{
formProduct
}
ref=
{
productFormRef
}
name=
"add-channel-origin"
labelAlign=
"left"
>
<
Form
.
Item
name=
"source"
label=
"选择商品来源"
rules=
{
[{
required
:
true
,
message
:
'请选择商品来源'
}]
}
>
<
Radio
.
Group
onChange=
{
handleSourceChange
}
>
<
Radio
value=
{
1
}
>
上级渠道商品
</
Radio
>
<
Radio
value=
{
2
}
>
渠道自有商品
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
</
Form
>
<
Button
onClick=
{
()
=>
setVisibleAddTabs
(
true
)
}
style=
{
{
width
:
'100%'
,
marginTop
:
24
,
marginBottom
:
24
,
backgroundColor
:
'#fafbfc'
}
}
>
<
PlusOutlined
/>
新增
{
source
===
1
?
'上级渠道商品'
:
'渠道自有商品'
}
</
Button
>
<
Table
rowKey=
"id"
dataSource=
{
selectProduct
}
columns=
{
productedColumns
}
/>
{
/* 选择商品 */
}
<
ModalTable
modalTitle=
{
source
===
1
?
'选择上级渠道商品'
:
'选择渠道自有商品'
}
confirm=
{
handleOkAddTabs
}
cancel=
{
handleCancelAddTabs
}
visible=
{
visibleAddTabs
}
resetModal=
{
{
destroyOnClose
:
true
,
forceRender
:
true
}
}
columns=
{
productColumns
}
rowSelection=
{
productRowSelection
}
fetchTableData=
{
(
params
:
any
)
=>
fetchProductData
(
params
)
}
currentRef=
{
productRef
}
tableProps=
{
{
rowKey
:
'id'
,
onRow
:
(
record
)
=>
({
onClick
:
()
=>
{
productRowCtl
.
setSelectRow
([
record
]);
productRowCtl
.
setSelectedRowKeys
([
record
.
id
]);
},
})
}
}
formilyProps=
{
{
ctx
:
{
schema
:
addChannelSchema
,
actions
:
productFormActions
,
components
:
{
ModalSearch
:
Search
,
SearchSelect
,
Submit
}
,
effects
:
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'name'
,
FORM_FILTER_PATH
,
)
useAsyncSelect
(
'parentMemberId'
,
fetchSelectOptions
,
)
}
}
}
}
/>
</>)
}
export
default
observer
(
SelectProduct
)
\ No newline at end of file
src/pages/commodity/products/addDirectChannel.tsx
View file @
aeb81bbb
...
...
@@ -13,19 +13,13 @@ import { ColumnType } from 'antd/lib/table/interface';
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
styles
from
'./index.less'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
{
createAsyncFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
;
import
{
searchBrandOptionEffect
,
searchCustomerCategoryOptionEffect
}
from
'./effect'
;
import
{
addChannelSchema
}
from
'./schema/channelSchema'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
ModalTable
from
'@/components/ModalTable'
import
{
GetProductChannelCommodityGetChannelCommodityResponse
,
GetProductChannelCommodityGetCommodityListResponseDetail
}
from
'@/services'
;
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
;
import
SearchSelect
from
'@/components/NiceForm/components/SearchSelect'
import
Search
from
'@/components/NiceForm/components/Search
'
import
Submit
from
'@/components/NiceForm/components/Submi
t'
import
SelectProduct
from
'./addChannelItem/selectProduct'
import
{
store
}
from
'@/store
'
import
{
inject
,
observer
}
from
'mobx-reac
t'
const
{
Item
}:
any
=
Form
...
...
@@ -52,24 +46,15 @@ const layoutSetPrice = {
wrapperCol
:
{
span
:
24
},
}
const
productFormActions
=
createAsyncFormActions
()
const
AddDirectChannel
:
React
.
FC
<
{}
>
=
(
props
)
=>
{
const
productRef
=
useRef
<
any
>
({})
const
[
formProduct
]
=
Form
.
useForm
()
const
[
formPrice
]
=
Form
.
useForm
()
const
[
formMember
]
=
Form
.
useForm
()
const
[
setPriceForm
]
=
Form
.
useForm
()
const
[
source
,
setSource
]
=
useState
(
1
)
const
[
isAllMember
,
setIsAllMember
]
=
useState
(
true
)
const
[
visibleAddTabs
,
setVisibleAddTabs
]
=
useState
(
false
)
const
[
modifyModal
,
setModifyModal
]
=
useState
(
false
)
const
[
visibleChannelMember
,
setVisibleChannelMember
]
=
useState
(
false
)
const
[
visibleAddSpec
,
setVisibleAddSpec
]
=
useState
(
false
)
const
[
productRowSelection
,
productRowCtl
]
=
useRowSelectionTable
({
type
:
'radio'
})
const
[
selectProduct
,
setSelectProduct
]
=
useState
<
GetProductChannelCommodityGetCommodityListResponseDetail
[]
>
()
const
[
priceType
,
setPriceType
]
=
useState
<
number
>
()
const
[
productName
,
setProductName
]
=
useState
<
string
>
()
const
[
specColumn
,
setSpecColumn
]
=
useState
<
any
[]
>
([])
const
[
specTableData
,
setSpecTableData
]
=
useState
<
any
[]
>
([])
...
...
@@ -87,37 +72,12 @@ const AddDirectChannel:React.FC<{}> = (props) => {
const
[
selectedMemberRowKeys
,
setSelectedMemberRowKeys
]
=
useState
<
any
>
([])
const
[
selectMemberRow
,
setSelectMemberRow
]
=
useState
<
any
[]
>
([])
// 选中的会员弹框数据
const
[
memberColumn
,
setMemberColumn
]
=
useState
<
any
[]
>
([])
const
[
queryId
,
setQueryId
]
=
useState
<
number
>
()
// const [productInfoByEdit, setProductInfoByEdit] = useState<GetProductChannelCommodityGetChannelCommodityResponse>()
const
productColumns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
,
key
:
'id'
,
},
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
key
:
'name'
,
},
{
title
:
'品类'
,
dataIndex
:
[
'customerCategory'
,
'name'
],
key
:
'customerCategory'
,
},
{
title
:
'品牌'
,
dataIndex
:
[
'brand'
,
'name'
],
key
:
'brand'
,
},
{
title
:
'单位'
,
dataIndex
:
'unitName'
,
key
:
'unitName'
,
},
]
let
[
formRefs
,
setFormRefs
]
=
useState
([])
//子form的ref数组
const
{
ChannelProudctStore
}
=
store
const
{
priceType
,
productName
,
productSelectRowInStore
}
=
ChannelProudctStore
const
columnsSetMember
:
ColumnType
<
any
>
[]
=
[
{
...
...
@@ -155,11 +115,11 @@ const AddDirectChannel:React.FC<{}> = (props) => {
const
{
data
}
=
res
// setProductInfoByEdit(data)
formProduct
.
setFieldsValue
({
source
:
data
.
source
})
setSource
(
data
.
source
)
//
setSource(data.source)
// @ts-ignore
setSelectProduct
([
data
])
productRowCtl
.
setSelectRow
([
data
])
productRowCtl
.
setSelectedRowKeys
([
data
.
commodityId
])
//
setSelectProduct([data])
//
productRowCtl.setSelectRow([data])
//
productRowCtl.setSelectedRowKeys([data.commodityId])
formPrice
.
setFieldsValue
({
isMemberPrice
:
data
.
isMemberPrice
})
formMember
.
setFieldsValue
({
channelMemberRoleId
:
data
.
channelMemberRoleId
,
isAllMember
:
data
.
isAllMember
})
// 还差适用会员...
...
...
@@ -167,8 +127,8 @@ const AddDirectChannel:React.FC<{}> = (props) => {
setOriginTableData
(
data
.
unitPriceAndPicList
)
structureInitPriceTable
(
data
.
unitPriceAndPicList
,
data
.
name
)
})
else
formProduct
.
setFieldsValue
({
source
:
source
})
//
else
//
formProduct.setFieldsValue({source: source})
// 获取会员角色列表
PublicApi
.
getMemberManageChannelLowerRoleList
().
then
(
res
=>
{
...
...
@@ -182,35 +142,11 @@ const AddDirectChannel:React.FC<{}> = (props) => {
if
(
visibleAddSpec
)
fetchSpecData
()
},
[
visibleAddSpec
])
useEffect
(()
=>
{
if
(
productRowCtl
.
selectRow
.
length
>
0
){
setPriceType
(
productRowCtl
.
selectRow
[
0
].
priceType
)
setProductName
(
productRowCtl
.
selectRow
[
0
].
name
)
}
},
[
productRowCtl
.
selectRow
])
useEffect
(()
=>
{
if
(
visibleAddTabs
)
productRef
?.
current
?.
schemaAction
?.
setFieldState
(
'parentMemberId'
,
state
=>
{
console
.
log
(
'parentMemberId'
)
state
.
visible
=
source
===
1
?
true
:
false
})
},
[
visibleAddTabs
])
// 获取渠道商品
const
fetchProductData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getProductChannelCommodityGetCommodityList
({...
params
,
source
:
source
}).
then
(
res
=>
{
const
{
data
}
=
res
resolve
(
data
)
})
})
}
// 获取商品规格列表
const
fetchSpecData
=
(
params
?:
any
)
=>
{
PublicApi
.
getProductChannelCommodityGetCommodityUnitPrice
({
id
:
product
RowCtl
.
selectedRowKeys
[
0
]
}).
then
(
res
=>
{
PublicApi
.
getProductChannelCommodityGetCommodityUnitPrice
({
id
:
product
SelectRowInStore
.
id
+
''
}).
then
(
res
=>
{
const
{
data
}
=
res
setOriginTableData
(
data
)
if
(
data
.
length
>
0
)
...
...
@@ -218,12 +154,6 @@ const AddDirectChannel:React.FC<{}> = (props) => {
})
}
// 获取上级渠道下拉列表
const
fetchSelectOptions
=
async
()
=>
{
const
{
data
}
=
await
PublicApi
.
getMemberManageChannelUpperList
();
return
data
.
map
(
v
=>
({
label
:
v
.
name
,
value
:
v
.
memberId
}))
}
// 获取渠道会员
const
fetchMemberData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -386,11 +316,6 @@ const AddDirectChannel:React.FC<{}> = (props) => {
console
.
log
(
key
)
}
const
handleSourceChange
=
(
v
:
any
)
=>
{
setSource
(
v
.
target
.
value
)
setSelectProduct
([])
}
const
handleIsAllMemberChange
=
(
v
:
any
)
=>
{
setIsAllMember
(
v
.
target
.
value
)
}
...
...
@@ -411,19 +336,10 @@ const AddDirectChannel:React.FC<{}> = (props) => {
}
}
const
handleOkAddTabs
=
()
=>
{
setSelectProduct
(
productRowCtl
.
selectRow
)
setVisibleAddTabs
(
false
)
}
const
handleCancelAddTabs
=
()
=>
{
setVisibleAddTabs
(
false
)
// productRowCtl.setSelectedRowKeys([])
}
const
handleAddButton
=
(
param
:
string
)
=>
{
// spec member
if
(
productRowCtl
.
selectedRowKeys
[
0
]){
console
.
log
(
productSelectRowInStore
,
priceType
,
productName
)
if
(
productSelectRowInStore
){
if
(
param
===
'spec'
)
setVisibleAddSpec
(
true
)
else
if
(
param
===
'member'
)
...
...
@@ -577,34 +493,35 @@ const AddDirectChannel:React.FC<{}> = (props) => {
)
})
Promise
.
all
(
data
).
then
((
values
)
=>
{
console
.
log
(
values
,
productRowCtl
.
selectRow
,
priceTableData
,
memberRowCtl
.
selectedRowKeys
,
originTableData
,
'vvvv'
)
let
params
:
any
=
{
...
values
[
0
],
...
values
[
1
],
...
values
[
2
]
}
if
(
productRowCtl
.
selectRow
.
length
>
0
){
params
.
commodityId
=
productRowCtl
.
selectRow
[
0
].
commodityId
params
.
parentMemberId
=
productRowCtl
.
selectRow
[
0
].
parentMemberId
params
.
parentMemberName
=
productRowCtl
.
selectRow
[
0
].
parentMemberName
}
if
(
memberRowCtl
.
selectRow
.
length
>
0
)
params
.
purchaserList
=
memberRowCtl
.
selectedRowKeys
let
tempUnitPrice
=
[]
priceTableData
.
map
(
item
=>
{
tempUnitPrice
.
push
(
{
goods
:
{
id
:
item
[
'goodsId'
]
},
unitPrice
:
item
[
'单价'
],
attributeAndValueList
:
originTableData
.
filter
(
_
=>
_
.
id
===
item
.
id
)[
0
].
attributeAndValueList
,
commodityPic
:
originTableData
.
filter
(
_
=>
_
.
id
===
item
.
id
)[
0
].
commodityPic
}
)
})
params
.
unitPriceAndPicList
=
tempUnitPrice
params
.
channelMemberRoleId
=
1
//仅供调试
queryId
?
params
.
id
=
queryId
:
null
console
.
log
(
params
,
'paramsparamsparamsparams'
)
PublicApi
.
postProductChannelCommoditySaveOrUpdateChannelCommodity
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
history
.
goBack
()
})
console
.
log
(
values
,
'vv'
)
// console.log(values, productRowCtl.selectRow, priceTableData, memberRowCtl.selectedRowKeys, originTableData, 'vvvv')
// let params: any = { ...values[0], ...values[1], ...values[2] }
// if(productRowCtl.selectRow.length > 0){
// params.commodityId = productRowCtl.selectRow[0].commodityId
// params.parentMemberId = productRowCtl.selectRow[0].parentMemberId
// params.parentMemberName = productRowCtl.selectRow[0].parentMemberName
// }
// if(memberRowCtl.selectRow.length > 0)
// params.purchaserList = memberRowCtl.selectedRowKeys
// let tempUnitPrice = []
// priceTableData.map(item => {
// tempUnitPrice.push(
// {
// goods: { id: item['goodsId'] },
// unitPrice: item['单价'],
// attributeAndValueList: originTableData.filter(_ => _.id === item.id)[0].attributeAndValueList,
// commodityPic: originTableData.filter(_ => _.id === item.id)[0].commodityPic
// }
// )
// })
// params.unitPriceAndPicList = tempUnitPrice
// params.channelMemberRoleId = 1 //仅供调试
// queryId ? params.id = queryId : null
// console.log(params, 'paramsparamsparamsparams')
// PublicApi.postProductChannelCommoditySaveOrUpdateChannelCommodity(params).then(res=>{
// if(res.code === 1000)
// history.goBack()
// })
})
}
...
...
@@ -620,33 +537,12 @@ const AddDirectChannel:React.FC<{}> = (props) => {
>
<
Card
>
<
Tabs
onChange=
{
callback
}
type=
"card"
defaultActiveKey=
"7"
>
<
TabPane
tab=
"选择商品"
key=
"1"
forceRender=
{
true
}
>
<
Form
{
...
layout
}
form=
{
formProduct
}
name=
"add-channel-origin"
labelAlign=
"left"
>
<
Form
.
Item
name=
"source"
label=
"选择商品来源"
rules=
{
[{
required
:
true
,
message
:
'请选择商品来源'
}]
}
>
<
Radio
.
Group
onChange=
{
handleSourceChange
}
>
<
Radio
value=
{
1
}
>
上级渠道商品
</
Radio
>
<
Radio
value=
{
2
}
>
渠道自有商品
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
</
Form
>
<
Button
onClick=
{
()
=>
setVisibleAddTabs
(
true
)
}
style=
{
{
width
:
'100%'
,
marginTop
:
24
,
marginBottom
:
24
,
backgroundColor
:
'#fafbfc'
}
}
>
<
PlusOutlined
/>
新增
{
source
===
1
?
'上级渠道商品'
:
'渠道自有商品'
}
</
Button
>
<
Table
rowKey=
"id"
dataSource=
{
selectProduct
}
columns=
{
productColumns
}
/>
<
TabPane
tab=
"选择商品"
key=
"1"
forceRender=
{
false
}
>
<
SelectProduct
onRef=
{
(
refs
)
=>
setFormRefs
([...
formRefs
,
refs
])
}
/>
</
TabPane
>
<
TabPane
tab=
"设置价格"
key=
"2"
forceRender=
{
tru
e
}
>
<
TabPane
tab=
"设置价格"
key=
"2"
forceRender=
{
fals
e
}
>
<
Form
{
...
layout
}
form=
{
formPrice
}
...
...
@@ -685,7 +581,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
}
<
Table
rowKey=
"id"
dataSource=
{
priceTableData
}
columns=
{
priceColumn
}
style=
{
{
clear
:
'both'
}
}
/>
</
TabPane
>
<
TabPane
tab=
"适用会员"
key=
"3"
forceRender=
{
tru
e
}
>
<
TabPane
tab=
"适用会员"
key=
"3"
forceRender=
{
fals
e
}
>
<
Form
{
...
layout
}
form=
{
formMember
}
...
...
@@ -728,73 +624,6 @@ const AddDirectChannel:React.FC<{}> = (props) => {
}
</
TabPane
>
</
Tabs
>
{
/* 以下是modal */
}
<
ModalTable
modalTitle=
{
source
===
1
?
'选择上级渠道商品'
:
'选择渠道自有商品'
}
confirm=
{
handleOkAddTabs
}
cancel=
{
handleCancelAddTabs
}
visible=
{
visibleAddTabs
}
resetModal=
{
{
destroyOnClose
:
true
,
forceRender
:
true
}
}
columns=
{
productColumns
}
rowSelection=
{
productRowSelection
}
fetchTableData=
{
(
params
:
any
)
=>
fetchProductData
(
params
)
}
currentRef=
{
productRef
}
tableProps=
{
{
rowKey
:
'id'
,
onRow
:
(
record
)
=>
({
onClick
:
()
=>
{
productRowCtl
.
setSelectRow
([
record
]);
productRowCtl
.
setSelectedRowKeys
([
record
.
id
]);
},
})
}
}
formilyProps=
{
{
ctx
:
{
schema
:
addChannelSchema
,
actions
:
productFormActions
,
components
:
{
ModalSearch
:
Search
,
SearchSelect
,
Submit
}
,
effects
:
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'name'
,
FORM_FILTER_PATH
,
)
useAsyncSelect
(
'parentMemberId'
,
fetchSelectOptions
,
)
}
}
}
}
// controlRender={
// <NiceForm
// actions={productFormActions}
// onSubmit={values =>productRef.current.reload(values)}
// effects={($, actions) => {
// useStateFilterSearchLinkageEffect(
// $,
// actions,
// 'name',
// FORM_FILTER_PATH,
// )
// FormEffectHooks.onFieldChange$('brandId').subscribe(state => {
// searchBrandOptionEffect(actions, 'brandId')
// })
// FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(state => {
// searchCustomerCategoryOptionEffect(actions, 'customerCategoryId')
// })
// useAsyncSelect(
// 'parentMemberId',
// fetchSelectOptions,
// )
// }}
// schema={addChannelSchema}
// />
// }
/>
<
Modal
title=
"设置价格"
...
...
@@ -1009,4 +838,4 @@ const AddDirectChannel:React.FC<{}> = (props) => {
</
PageHeaderWrapper
>)
}
export
default
AddDirectChannel
\ No newline at end of file
export
default
observer
(
AddDirectChannel
)
\ No newline at end of file
src/pages/commodity/products/addProducts.tsx
View file @
aeb81bbb
...
...
@@ -81,12 +81,22 @@ const AddProducts: React.FC<{}> = (props) => {
delete
_itme
.
customerAttributeId
})
let
_bacsicForm
=
{...
values
[
0
]}
if
(
values
.
length
>
0
){
for
(
let
i
=
0
;
i
<
values
.
length
;
i
++
){
// 过滤出物流form
if
(
values
[
i
].
deliveryType
){
_bacsicForm
=
{
...
_bacsicForm
,
logistics
:
{...
values
[
i
]}
}
}
else
{
_bacsicForm
=
{
...
_bacsicForm
,
...
values
[
i
]
}
}
}
}
_bacsicForm
.
customerCategoryId
=
_bacsicForm
.
customerCategoryId
[
_bacsicForm
.
customerCategoryId
.
length
-
1
]
let
_params
=
{
...
_bacsicForm
,
...
values
[
2
],
logistics
:
{...
values
[
3
]},
...
values
[
4
],
//
...values[2],
//
logistics: {...values[3]},
//
...values[4],
commodityAttributeList
:
productSelectAttribute
,
// unitPriceAndPicList: productAttributeAndImageParams,
commodityRemark
:
productDescription
,
...
...
@@ -124,10 +134,11 @@ const AddProducts: React.FC<{}> = (props) => {
try
{
if
(
productAttributeAndImageParams
.
length
>
0
){
productAttributeAndImageParams
.
map
(
_item
=>
{
if
(
_item
.
goodsCustomerAttributeList
.
length
>
0
){
console
.
log
(
_item
,
'_item'
)
if
(
_item
.
attributeAndValueList
.
length
>
0
){
_item
.
goods
=
{
id
:
_item
.
goodsId
}
delete
_item
.
goodsId
_item
.
goodsCustomerAttribut
eList
.
map
(
__item
=>
{
_item
.
attributeAndValu
eList
.
map
(
__item
=>
{
delete
__item
.
customerAttributeName
// __item.customerAttributeValueId = __item.id
// **** 新字段结构变更
...
...
@@ -138,8 +149,8 @@ const AddProducts: React.FC<{}> = (props) => {
delete
__item
.
customerAttributeId
})
}
_item
.
attributeAndValueList
=
_item
.
goodsCustomerAttributeList
delete
_item
.
goodsCustomerAttributeList
//
_item.attributeAndValueList = _item.goodsCustomerAttributeList
//
delete _item.goodsCustomerAttributeList
if
(
_item
.
commodityPic
.
length
>
0
){
// 编辑情况下兼顾手动添加图片列表属性
_item
.
commodityPic
=
_item
.
commodityPic
.
map
(
__item
=>
__item
?.
response
?.
data
||
__item
?.
url
)
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
aeb81bbb
...
...
@@ -231,8 +231,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
id
:
attributeValObjArr
[
0
][
0
].
id
,
value
:
item
.
toString
()
})
_paramsArray
.
push
({
goodsId
:
_tableDataSource
[
index
]
?
_tableDataSource
[
index
][
'对应货品'
]
:
0
,
goodsCustomerAttribut
eList
:
_tempArr
,
unitPrice
:
_tableDataSource
[
index
]
&&
_tableDataSource
[
index
][
'单价'
]})
/*带上货品id 带上单价*/
})
:
_paramsArray
.
push
({
goodsId
:
_tableDataSource
[
0
]
?
_tableDataSource
[
0
][
'对应货品'
]
:
0
,
goodsCustomerAttribut
eList
:
[],
unitPrice
:
_tableDataSource
[
0
]
&&
_tableDataSource
[
0
][
'单价'
]})
/*带上货品id 带上单价*/
_paramsArray
.
push
({
goodsId
:
_tableDataSource
[
index
]
?
_tableDataSource
[
index
][
'对应货品'
]
:
0
,
attributeAndValu
eList
:
_tempArr
,
unitPrice
:
_tableDataSource
[
index
]
&&
_tableDataSource
[
index
][
'单价'
]})
/*带上货品id 带上单价*/
})
:
_paramsArray
.
push
({
goodsId
:
_tableDataSource
[
0
]
?
_tableDataSource
[
0
][
'对应货品'
]
:
0
,
attributeAndValu
eList
:
[],
unitPrice
:
_tableDataSource
[
0
]
&&
_tableDataSource
[
0
][
'单价'
]})
/*带上货品id 带上单价*/
setPriceAttributeParams
(
_paramsArray
)
console
.
log
(
_paramsArray
,
'params'
)
}
...
...
src/pages/commodity/products/addProductsItem/productImageForm.tsx
View file @
aeb81bbb
...
...
@@ -50,10 +50,10 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
/* 给数据添加图片字段 */
useEffect
(()
=>
{
console
.
log
(
'图片111'
,
priceAttributeParams
)
//
console.log('图片111', priceAttributeParams)
let
_priceAttributeParams
:
any
=
[]
if
(
productInfoByEdit
?.
id
){
// id判断是否新增还是编辑
console
.
log
(
'图片222'
,
priceAttributeParams
)
//
console.log('图片222', priceAttributeParams)
setSetImageType
(
productInfoByEdit
.
isAllAttributePic
)
setIsAllAttributePic
(
productInfoByEdit
.
isAllAttributePic
)
let
_commodityPicList
=
productInfoByEdit
.
unitPriceAndPicList
.
map
(
_
=>
_
.
commodityPic
)
...
...
@@ -223,11 +223,11 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
{
!
setImageType
&&
priceAttributeParamsByRender
?.
length
>
0
&&
priceAttributeParamsByRender
.
map
(
(
item
,
index
)
=>
{
return
Array
.
isArray
(
item
.
goodsCustomerAttribut
eList
)
&&
return
Array
.
isArray
(
item
.
attributeAndValu
eList
)
&&
<
li
key=
{
index
}
className=
{
defaultChecked
==
index
?
styles
.
activedLi
:
""
}
onClick=
{
()
=>
clickItemTab
(
index
)
}
>
<
span
>
{
item
.
goodsCustomerAttribut
eList
.
map
((
_item
,
_index
)
=>
_item
.
value
).
join
(
'/'
)
item
.
attributeAndValu
eList
.
map
((
_item
,
_index
)
=>
_item
.
value
).
join
(
'/'
)
}
</
span
>
</
li
>
...
...
@@ -239,7 +239,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
<
Col
span=
{
20
}
style=
{
{
padding
:
24
}
}
>
{
!
setImageType
?
(
priceAttributeParamsByRender
?.
length
>
0
&&
priceAttributeParamsByRender
[
0
]?.
goodsCustomerAttribut
eList
?.
length
!=
0
?
priceAttributeParamsByRender
.
map
((
item
,
index
)
=>
(
priceAttributeParamsByRender
?.
length
>
0
&&
priceAttributeParamsByRender
[
0
]?.
attributeAndValu
eList
?.
length
!=
0
?
priceAttributeParamsByRender
.
map
((
item
,
index
)
=>
<
div
key=
{
index
+
100
}
style=
{
defaultChecked
==
index
?
{
display
:
'block'
}
:
{
display
:
'none'
}
}
>
<
div
className=
{
styles
.
pictureCardBox
}
>
<
div
className=
"clearfix"
>
...
...
src/pages/commodity/products/directChannel.tsx
View file @
aeb81bbb
...
...
@@ -94,9 +94,9 @@ const DirectChannel: React.FC<{}> = () => {
render
:
(
text
:
any
,
record
:
any
)
=>
<>
¥
{
record
.
min
}
~ ¥
{
record
.
max
}
</>
},
{
title
:
'渠道会员
名称
'
,
dataIndex
:
'
parentMember
Name'
,
key
:
'
parentMember
Name'
,
title
:
'渠道会员
角色
'
,
dataIndex
:
'
channelMemberRole
Name'
,
key
:
'
channelMemberRole
Name'
,
},
{
title
:
'商品来源'
,
...
...
@@ -298,11 +298,11 @@ const DirectChannel: React.FC<{}> = () => {
>
<
PlusOutlined
/>
新建
</
Button
>
<
Dropdown
overlay=
{
menuMore
}
trigger=
{
[
'click'
]
}
>
{
/*
<Dropdown overlay={menuMore} trigger={['click']}>
<Button>
更多 <DownOutlined />
</Button>
</
Dropdown
>
</Dropdown>
*/
}
</
Space
>
);
...
...
src/store/channelProduct/index.ts
0 → 100644
View file @
aeb81bbb
import
{
action
,
computed
,
observable
,
runInAction
}
from
'mobx'
import
{
IChannelProductModule
}
from
'@/module/channelProductModule'
;
// mobx要用到的数据类型
import
{
GetProductChannelCommodityGetCommodityListResponseDetail
}
from
'@/services'
;
/**
* 渠道直采商品
*/
class
ChannelProductStore
implements
IChannelProductModule
{
// 选择商品区块
@
observable
public
productSelectRowInStore
:
GetProductChannelCommodityGetCommodityListResponseDetail
=
null
;
@
observable
public
priceType
:
number
=
null
@
observable
public
productName
:
string
=
null
// 加工接口返回的数据,用户编辑回显数据
// @computed
// public get getBasicFormParamsByEdit(): IBasicFormParam {
// return {
// commodityAreaList: this.productInfoByEdit?.commodityAreaList.map(item => [item.provinceCode, item.cityCode]),
// }
// }
@
action
.
bound
public
setProductSelectRowInStore
(
data
:
GetProductChannelCommodityGetCommodityListResponseDetail
)
{
this
.
productSelectRowInStore
=
data
;
}
@
action
.
bound
public
setPriceType
(
data
:
number
){
this
.
priceType
=
data
;
}
@
action
.
bound
public
setProductName
(
data
:
string
){
this
.
productName
=
data
;
}
}
export
default
ChannelProductStore
src/store/index.tsx
View file @
aeb81bbb
import
UserStore
from
'./user'
import
ThemeStore
from
'./theme'
import
ProductStroe
from
'./product'
import
ChannelProudctStore
from
'./channelProduct'
import
SiteStore
from
'./site'
import
CategoryStore
from
'./category'
import
React
from
'react'
;
import
{
Provider
}
from
'mobx-react'
import
{
ILoginModule
}
from
'@/module/userModule'
;
import
{
IProductModule
}
from
'@/module/productModule'
import
{
IChannelProductModule
}
from
'@/module/channelProductModule'
// import { ProductContext } from '@/pages/commodity/products/addProducts';
...
...
@@ -29,12 +31,14 @@ import { IProductModule } from '@/module/productModule'
export
interface
IStore
{
UserStore
:
ILoginModule
;
ProductStore
:
IProductModule
;
ChannelProudctStore
:
IChannelProductModule
;
}
export
const
store
=
{
UserStore
:
new
UserStore
,
ThemeStore
:
new
ThemeStore
,
ProductStore
:
new
ProductStroe
,
ChannelProudctStore
:
new
ChannelProudctStore
,
SiteStore
:
new
SiteStore
,
CategoryStore
:
new
CategoryStore
}
...
...
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