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
bc0bbd02
Commit
bc0bbd02
authored
Sep 12, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:渠道商品新增修改、商品限制修改、修改商品各个区块变动数据处理
parent
e7b0b08b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
434 additions
and
457 deletions
+434
-457
commodityRoute.ts
config/routes/commodityRoute.ts
+7
-0
menu.ts
src/locales/zh-CN/menu.ts
+1
-0
index.ts
src/module/channelProductModule/index.ts
+3
-4
index.ts
src/module/productModule/index.ts
+1
-0
addAttribute.tsx
src/pages/classAndProperty/attribute/addAttribute.tsx
+6
-1
addPropertyValue.tsx
...pages/classAndProperty/propertyValue/addPropertyValue.tsx
+92
-19
index.tsx
src/pages/classAndProperty/propertyValue/index.tsx
+2
-2
addGoods.tsx
src/pages/commodity/goods/addGoods.tsx
+1
-0
selectChannel.tsx
...pages/commodity/products/addChannelItem/selectChannel.tsx
+5
-66
setPrice.tsx
src/pages/commodity/products/addChannelItem/setPrice.tsx
+4
-90
addDirectChannel.tsx
src/pages/commodity/products/addDirectChannel.tsx
+17
-66
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+4
-2
basicInfoForm.tsx
...ages/commodity/products/addProductsItem/basicInfoForm.tsx
+14
-1
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+0
-0
productAttributeForm.tsx
...mmodity/products/addProductsItem/productAttributeForm.tsx
+96
-35
selectGoodsForm.tsx
...es/commodity/products/addProductsItem/selectGoodsForm.tsx
+37
-24
directChannel.tsx
src/pages/commodity/products/directChannel.tsx
+65
-37
fastModifyPrice.tsx
src/pages/commodity/products/fastModifyPrice.tsx
+1
-1
modifyDirectChannel.tsx
src/pages/commodity/products/modifyDirectChannel.tsx
+0
-0
channelSchema.tsx
src/pages/commodity/products/schema/channelSchema.tsx
+21
-10
viewDirectChannel.tsx
src/pages/commodity/products/viewDirectChannel.tsx
+30
-79
index.ts
src/store/channelProduct/index.ts
+10
-16
index.ts
src/store/product/index.ts
+17
-4
No files found.
config/routes/commodityRoute.ts
View file @
bc0bbd02
...
...
@@ -146,6 +146,13 @@ const CommodityRoute = {
component
:
'@/pages/commodity/products/addDirectChannel'
,
},
{
path
:
'/memberCenter/commodityAbility/commodity/products/directChannel/modifyDirectChannel'
,
name
:
'modifyDirectChannel'
,
hideInMenu
:
true
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/modifyDirectChannel'
,
},
{
path
:
'/memberCenter/commodityAbility/commodity/products/directChannel/viewDirectChannel'
,
name
:
'viewDirectChannel'
,
hideInMenu
:
true
,
...
...
src/locales/zh-CN/menu.ts
View file @
bc0bbd02
...
...
@@ -49,6 +49,7 @@ export default {
'menu.commodityAbility.commodity.fastModifyPrice'
:
'快捷修改单价'
,
'menu.commodityAbility.commodity.directChannel'
:
'渠道直采商品'
,
'menu.commodityAbility.commodity.addDirectChannel'
:
'新建渠道直采商品'
,
'menu.commodityAbility.commodity.modifyDirectChannel'
:
'修改渠道直采商品'
,
'menu.commodityAbility.commodity.viewDirectChannel'
:
'渠道直采商品详情'
,
'menu.commodityAbility.repositories'
:
'仓位'
,
...
...
src/module/channelProductModule/index.ts
View file @
bc0bbd02
...
...
@@ -16,17 +16,15 @@ export interface IChannelProductModule {
productSourceInStore
:
number
;
priceType
:
number
;
productName
:
string
;
currentActiveKey
:
string
;
currentOperateChannel
:
IChannel
;
selectedRole
:
IRole
;
tableDataInSetPrice
:
GetProductChannelCommodityGetCommodityUnitPriceResponse
[];
selectChannel
:
any
[];
setProductSelectRowInStore
(
data
:
any
):
void
;
setProductSourceInStore
(
data
:
number
):
void
;
setPriceType
(
data
:
number
):
void
;
setProductName
(
data
:
string
):
void
;
setCurrentActiveKey
(
data
:
string
):
void
;
setCurrentOperateChannel
(
data
:
IChannel
):
void
;
setSelectedRole
(
data
:
IRole
):
void
;
setTableDataInSetPrice
(
data
:
GetProductChannelCommodityGetCommodityUnitPriceResponse
[]):
void
;
setSelectChannel
(
data
:
any
):
void
;
}
\ No newline at end of file
src/module/productModule/index.ts
View file @
bc0bbd02
...
...
@@ -37,6 +37,7 @@ export interface IProductSelectAttribute {
customerAttributeId
:
number
;
customerAttributeValueList
:
InnerAttributeValueList
[]
isPrice
:
boolean
;
isDate
:
boolean
;
}
export
interface
IDecsParams
{
...
...
src/pages/classAndProperty/attribute/addAttribute.tsx
View file @
bc0bbd02
...
...
@@ -134,13 +134,18 @@ const AddAtttribute: React.FC<{}> = () => {
const
handleLink
=
()
=>
{
setRoleVisible
(
true
)
let
menuFormData
=
menuForm
.
getFieldValue
(
'attribute'
)
console
.
log
(
formValue
,
'formValue'
,
menuFormData
)
let
chooseKey
=
menuFormData
&&
menuFormData
.
id
||
null
setSelectedRowKeys
([
chooseKey
])
}
// 特殊属性切换
const
onChangeSpecial
=
(
e
,
type
)
=>
{
if
(
e
.
target
.
checked
){
setIsSpecial
(
true
)
menuForm
.
setFieldsValue
({
type
:
2
})
}
else
{
setIsSpecial
(
false
)
}
if
(
type
===
'isDate'
)
menuForm
.
setFieldsValue
({
isArea
:
false
})
if
(
type
===
'isArea'
)
...
...
src/pages/classAndProperty/propertyValue/addPropertyValue.tsx
View file @
bc0bbd02
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
import
{
Row
,
Col
,
Form
,
Input
,
Select
,
Popconfirm
,
Button
,
Card
,
Modal
,
Tooltip
,
message
}
from
'antd'
;
import
{
Row
,
Col
,
Form
,
Input
,
Select
,
Popconfirm
,
Button
,
Card
,
Modal
,
Tooltip
,
message
,
Cascader
,
Spin
}
from
'antd'
;
import
{
LinkOutlined
,
QuestionCircleOutlined
,
}
from
'@ant-design/icons'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
history
}
from
'umi'
;
...
...
@@ -8,6 +8,7 @@ import { PropertyValueApi } from '@/services/classAndProperty/propertyValue/API'
import
{
PublicApi
}
from
'@/services/api'
;
import
TabTree
,
{
useTreeActions
,
createTreeActions
}
from
'@/components/TabTree'
;
import
{
useTreeTabs
}
from
'@/hooks/useTreeTabs'
;
import
{
GetManageAreaAllResponse
}
from
'@/services'
;
const
layout
=
{
labelCol
:
{
...
...
@@ -40,6 +41,9 @@ const AddPropertyValue: React.FC<{}> = () => {
const
[
selectRow
,
setSelectRow
]
=
useState
<
any
>
({})
const
[
attributeValueId
,
setAttributeValueId
]
=
useState
(
null
)
// url传入 可判断是编辑/新增
const
[
isSee
,
setIsSee
]
=
useState
(
false
)
// 判断查看依据
const
[
specialType
,
setSpecialType
]
=
useState
<
any
>
()
// 1-日期; 2-地区
const
[
proviceOptions
,
setProviceOptions
]
=
useState
<
GetManageAreaAllResponse
>
()
const
[
areaString
,
setAreaString
]
=
useState
<
string
>
()
/* 平台属性值列表树 */
const
{
...
...
@@ -49,7 +53,23 @@ const AddPropertyValue: React.FC<{}> = () => {
})
useEffect
(()
=>
{
const
{
attrId
,
attrName
,
attrValueId
,
isSee
}
=
history
.
location
.
query
//获取省市区
PublicApi
.
getManageAreaAll
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
let
arr
=
[...
res
.
data
]
//裁去最后一级别
for
(
let
index
in
arr
)
{
for
(
let
_index
in
arr
[
index
].
areaResponses
)
{
let
o
=
arr
[
index
].
areaResponses
//@ts-ignore
o
[
_index
].
areaResponses
=
null
}
}
setProviceOptions
(
arr
)
}
})
const
{
attrId
,
attrName
,
attrValueId
,
type
,
isSee
}
=
history
.
location
.
query
if
(
attrId
){
attrValueForm
.
setFieldsValue
({
customerAttribute
:
{
id
:
Number
(
attrId
)}})
}
...
...
@@ -60,7 +80,6 @@ const AddPropertyValue: React.FC<{}> = () => {
attrValueForm
.
setFieldsValue
({
id
:
attrValueId
})
setAttributeValueId
(
attrValueId
)
PublicApi
.
getProductCustomerGetCustomerAttributeValue
({
id
:
attrValueId
}).
then
(
res
=>
{
console
.
log
(
res
,
'detail'
)
if
(
res
.
code
===
1000
){
setFormValue
(
res
.
data
)
attrValueForm
.
setFieldsValue
(
res
.
data
)
...
...
@@ -70,20 +89,26 @@ const AddPropertyValue: React.FC<{}> = () => {
if
(
isSee
){
setIsSee
(
true
)
}
if
(
type
){
setSpecialType
(
type
)
}
},
[])
const
handleSubmitAllSetting
=
()
=>
{
attrValueForm
.
validateFields
().
then
(
values
=>
{
const
{
attrId
,
attrName
}
=
history
.
location
.
query
let
pararms
=
{...
values
}
const
{
attrId
,
attrName
,
type
}
=
history
.
location
.
query
let
pararms
:
any
=
{...
values
}
delete
pararms
.
attributeName
if
(
JSON
.
stringify
(
pararms
.
attributeValue
)
===
'{}'
)
delete
pararms
.
attributeValue
//@ts-ignore
if
(
type
===
'2'
)
pararms
.
value
=
areaString
if
(
type
===
'1'
)
pararms
.
value
=
'自动日期'
+
parseInt
(
Math
.
random
()
*
100
+
''
)
PublicApi
.
postProductCustomerSaveOrUpdateCustomerAttributeValue
(
pararms
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
// history.goBack()
history
.
push
(
`/memberCenter/commodityAbility/classAndProperty/propertyValue?attrId=
${
attrId
}
&attrName=
${
attrName
}
`
)
history
.
push
(
`/memberCenter/commodityAbility/classAndProperty/propertyValue?attrId=
${
attrId
}
&attrName=
${
attrName
}
&type=
${
type
}
`
)
})
}).
catch
(
error
=>
{
...
...
@@ -119,6 +144,16 @@ const AddPropertyValue: React.FC<{}> = () => {
setSelectRow
(
node
)
}
const
onCommodityAreaChange
=
(
value
:
any
,
selected
:
any
)
=>
{
let
arr
=
selected
.
map
(
item
=>
item
.
name
)
if
(
arr
.
length
>
1
){
setAreaString
(
arr
.
join
(
'/'
))
}
else
{
setAreaString
(
arr
.
toString
())
}
}
return
<
PageHeaderWrapper
onBack=
{
()
=>
history
.
goBack
()
}
backIcon=
{
<
ReutrnEle
description=
"返回"
/>
}
...
...
@@ -153,18 +188,56 @@ const AddPropertyValue: React.FC<{}> = () => {
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
18
}
>
<
Form
.
Item
name=
'value'
label=
'属性值名称'
rules=
{
[
{
required
:
true
,
message
:
'输入属性值名称!'
,
},
]
}
>
<
Input
placeholder=
"输入属性值名称"
disabled=
{
isSee
}
/>
</
Form
.
Item
>
{
specialType
!==
'1'
&&
specialType
!==
'2'
&&
<
Form
.
Item
name=
'value'
label=
'属性值名称'
rules=
{
[
{
required
:
true
,
message
:
'输入属性值名称!'
,
},
]
}
>
<
Input
placeholder=
"输入属性值名称"
disabled=
{
isSee
}
/>
</
Form
.
Item
>
}
{
specialType
===
'2'
&&
<
Form
.
Item
name=
'value'
label=
'属性值名称'
rules=
{
[
{
required
:
true
,
message
:
'输入属性值名称!'
,
},
]
}
>
<
Cascader
disabled=
{
isSee
}
options=
{
proviceOptions
}
changeOnSelect
onChange=
{
onCommodityAreaChange
}
placeholder=
"请选择地区"
fieldNames=
{
{
label
:
'name'
,
value
:
'code'
,
children
:
'areaResponses'
}
}
notFoundContent=
{
<
Spin
size=
"small"
/>
}
/>
</
Form
.
Item
>
}
{
specialType
===
'1'
&&
<
Form
.
Item
name=
'value'
label=
'属性值名称'
// rules=
{[
//
{
// required: true,
// message: '输入属性值名称!',
//
},
// ]
}
>
<
span
>
日期属性无须设置属性值,属性值由系统自动生成。
</
span
>
</
Form
.
Item
>
}
</
Col
>
<
Col
span=
{
18
}
>
<
Form
.
Item
...
...
src/pages/classAndProperty/propertyValue/index.tsx
View file @
bc0bbd02
...
...
@@ -93,7 +93,7 @@ const PropertyValue: React.FC<{}> = () => {
}
const
handleSee
=
(
record
:
any
)
=>
{
history
.
push
(
`/memberCenter/commodityAbility/classAndProperty/propertyValue/addPropertyValue?attrId=
${
selectKey
}
&attrName=
${
selectNode
.
_title
}
&attrValueId=
${
record
.
id
}
&isSee=true`
)
history
.
push
(
`/memberCenter/commodityAbility/classAndProperty/propertyValue/addPropertyValue?attrId=
${
selectKey
}
&attrName=
${
selectNode
.
_title
}
&attrValueId=
${
record
.
id
}
&isSee=true
&type=
${
record
.
type
}
`
)
}
const
columns
:
ColumnType
<
any
>
[]
=
[
...
...
@@ -241,7 +241,7 @@ const PropertyValue: React.FC<{}> = () => {
type=
"primary"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
{
history
.
push
(
`/memberCenter/commodityAbility/classAndProperty/propertyValue/addPropertyValue?attrId=${selectKey||history.location.query.attrId}&attrName=${selectNode?._title||history.location.query.attrName}`
)
history
.
push
(
`/memberCenter/commodityAbility/classAndProperty/propertyValue/addPropertyValue?attrId=${selectKey||history.location.query.attrId}&attrName=${selectNode?._title||history.location.query.attrName}
&type=${selectNode?.type||history.location.query.type}
`
)
}
}
>
新建
...
...
src/pages/commodity/goods/addGoods.tsx
View file @
bc0bbd02
...
...
@@ -212,6 +212,7 @@ const AddGoods = () => {
]
}
>
<
Cascader
disabled=
{
isSee
}
options=
{
customerCategoryTree
}
fieldNames=
{
{
label
:
'title'
,
value
:
'id'
,
children
:
'children'
}
}
placeholder=
"请选择品类"
...
...
src/pages/commodity/products/addChannelItem/selectChannel.tsx
View file @
bc0bbd02
...
...
@@ -44,7 +44,6 @@ export interface IMemberTableData {
memberTypeName
:
string
;
level
:
number
;
levelTag
:
string
;
status
:
number
;
// 5 上架 6 下架
}
const
SelectChannel
:
React
.
FC
<
IProps
>
=
(
props
)
=>
{
...
...
@@ -61,14 +60,9 @@ const SelectChannel:React.FC<IProps> = (props) => {
const
{
ChannelProudctStore
}
=
store
const
{
priceType
,
productName
,
productSourceInStore
,
productSelectRowInStore
,
setCurrentActiveKey
,
setCurrentOperateChannel
,
selectedRole
,
setSelectedRole
setSelectedRole
,
setSelectChannel
,
}
=
ChannelProudctStore
const
columnsSetMember
:
ColumnType
<
any
>
[]
=
[
...
...
@@ -132,24 +126,11 @@ const SelectChannel:React.FC<IProps> = (props) => {
key
:
'levelTag'
,
},
{
title
:
'状态'
,
dataIndex
:
'status'
,
key
:
'status'
,
render
:
(
text
:
number
,
record
:
IMemberTableData
)
=>
{
if
(
text
===
5
)
return
(<
span
style=
{
{
color
:
'#00B37A'
,
padding
:
'2px 5px'
,
background
:
'rgba(235,247,242,1)'
,
borderRadius
:
'4px'
}
}
>
已上架
</
span
>)
else
if
(
text
===
6
)
return
(<
span
style=
{
{
padding
:
'2px 5px'
,
background
:
'rgba(244,245,247,1)'
,
borderRadius
:
'4px'
}
}
>
已下架
</
span
>)
}
},
{
title
:
'操作'
,
dataIndex
:
'option'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
return
(
<>
<
Button
type=
'link'
onClick=
{
()
=>
clickSetPriceForChannel
(
record
)
}
>
设置
</
Button
>
{
history
.
location
.
query
?.
id
&&
(
record
.
status
===
6
?
<
Button
type=
'link'
>
上架
</
Button
>
:
<
Button
type=
'link'
>
下架
</
Button
>)
}
<
Button
type=
'link'
onClick=
{
()
=>
clickDeleteMember
(
record
)
}
>
删除
</
Button
>
</>
)
...
...
@@ -177,33 +158,12 @@ const SelectChannel:React.FC<IProps> = (props) => {
},
[])
useEffect
(()
=>
{
// 选择变动 重新构建数据 手动添加 status(5上架6下架)字段
selectMemberRow
.
map
(
item
=>
item
.
status
=
6
)
setMemberTableData
(
selectMemberRow
)
},
[
selectMemberRow
])
useEffect
(()
=>
{
// 表格数据变动 先保存
if
(
memberTableData
&&
memberTableData
.
length
>
0
){
console
.
log
(
memberTableData
,
formMember
.
getFieldsValue
(),
'传输数据'
)
let
params
:
any
=
{
...
formMember
.
getFieldsValue
()
}
let
_memberList
=
[]
memberTableData
.
map
(
item
=>
{
_memberList
.
push
({
memberId
:
item
.
memberId
,
memberName
:
item
.
name
,
status
:
item
.
status
})
})
params
.
source
=
productSourceInStore
params
.
memberList
=
_memberList
params
.
commodityId
=
productSelectRowInStore
.
id
params
.
channelMemberRoleName
=
selectedRole
.
children
PublicApi
.
postProductChannelCommoditySaveOrUpdateChannelCommodity
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
console
.
log
(
res
,
'二步保存'
)
})
}
// 表格数据变动 设置传输数据
setSelectChannel
(
memberTableData
)
},
[
memberTableData
])
// 获取渠道会员
...
...
@@ -248,7 +208,6 @@ const SelectChannel:React.FC<IProps> = (props) => {
const
clickDeleteMember
=
(
record
:
any
)
=>
{
setMemberTableData
(
memberTableData
=>
[...
memberTableData
].
filter
(
item
=>
item
.
memberId
!=
record
.
memberId
))
// memberRowCtl.setSelectedRowKeys(selectedRowKeys => [...selectedRowKeys].filter(item => item != record.memberId))
let
_keys
=
[...
memberRowCtl
.
selectedRowKeys
]
console
.
log
([...
_keys
].
filter
(
item
=>
item
!=
record
.
memberId
))
memberRowCtl
.
setSelectedRowKeys
([...
_keys
].
filter
(
item
=>
item
!=
record
.
memberId
))
...
...
@@ -258,22 +217,11 @@ const SelectChannel:React.FC<IProps> = (props) => {
setVisibleChannelMember
(
false
)
}
const
clickBatchSetting
=
()
=>
{
setCurrentActiveKey
(
'3'
)
// 跳转第三个tab
setCurrentOperateChannel
({
name
:
'所有渠道会员'
})
}
const
roleChange
=
(
value
:
number
,
option
:
IOption
)
=>
{
setSelectedOption
(
option
)
setSelectedRole
(
option
)
}
const
clickSetPriceForChannel
=
(
record
:
any
)
=>
{
console
.
log
(
record
)
setCurrentActiveKey
(
'3'
)
// 跳转第三个tab
setCurrentOperateChannel
({
name
:
record
.
name
,
memberId
:
record
.
memberId
})
}
const
clickSearchChannel
=
(
value
:
string
)
=>
{
if
(
value
)
setMemberTableData
(
memberTableData
=>
memberTableData
.
filter
(
item
=>
item
.
name
===
value
))
...
...
@@ -302,7 +250,7 @@ const SelectChannel:React.FC<IProps> = (props) => {
</Form.Item> */
}
<
Form
.
Item
label=
"选择渠道角色"
name=
"ch
annel
MemberRoleId"
name=
"ch
ild
MemberRoleId"
>
<
Select
onChange=
{
roleChange
}
placeholder=
"选择渠道会员角色"
>
{
...
...
@@ -338,15 +286,6 @@ const SelectChannel:React.FC<IProps> = (props) => {
/>
</
p
>
</
div
>
<
div
>
<
p
>
<
Button
type=
"text"
icon=
{
<
SettingOutlined
/>
}
onClick=
{
clickBatchSetting
}
>
批量设置渠道商品
</
Button
>
</
p
>
</
div
>
</
Col
>
</>
}
...
...
src/pages/commodity/products/addChannelItem/setPrice.tsx
View file @
bc0bbd02
...
...
@@ -68,7 +68,6 @@ const SetPrice:React.FC<IProps> = (props) => {
priceType
,
productName
,
productSelectRowInStore
,
currentOperateChannel
,
setTableDataInSetPrice
}
=
ChannelProudctStore
...
...
@@ -78,6 +77,10 @@ const SetPrice:React.FC<IProps> = (props) => {
},
[])
useEffect
(()
=>
{
constructedPrarams
()
},
[
priceTableData
])
useEffect
(()
=>
{
if
(
visibleAddSpec
)
fetchSpecData
()
},
[
visibleAddSpec
])
...
...
@@ -161,86 +164,6 @@ const SetPrice:React.FC<IProps> = (props) => {
setSpecTableData
(
_tableData
)
}
const
structureInitPriceTable
=
(
data
:
any
,
name
?:
string
)
=>
{
// 编辑初始 构建table 列columns
let
col
:
any
=
[]
let
temp
:
any
=
[]
data
[
0
].
attributeAndValueList
.
map
(
_item
=>
{
temp
.
push
({
title
:
_item
.
customerAttribute
.
name
,
dataIndex
:
[
_item
.
customerAttribute
.
name
,
'value'
],
key
:
_item
.
customerAttribute
.
name
})
})
col
.
push
({
title
:
'ID'
,
dataIndex
:
'id'
,
key
:
'id'
},
{
title
:
'GoodsId'
,
dataIndex
:
'goodsId'
,
key
:
'id'
,
className
:
'commonHide'
},
{
title
:
'索引'
,
dataIndex
:
'索引'
,
key
:
'索引'
,
className
:
'commonHide'
},
{
title
:
'商品名称'
,
dataIndex
:
'商品名称'
,
key
:
'商品名称'
},
{
title
:
'对应货品'
,
dataIndex
:
'对应货品'
,
key
:
'对应货品'
},
...
temp
,
{
title
:
priceType
===
3
?
'积分'
:
'单价'
,
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
/></>
})
}
},
{
title
:
'操作'
,
dataIndex
:
'option'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
return
(
<>
<
Button
type=
'link'
onClick=
{
()
=>
clickSetPrice
(
record
)
}
>
{
priceType
===
3
?
'设置积分'
:
'设置价格'
}
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
clickDelete
(
record
)
}
>
删除
</
Button
>
</>
)
}
}
)
setPriceColumn
(
col
)
let
_tableData
:
any
=
[]
data
.
map
((
item
,
index
)
=>
{
let
temp
:
any
=
{}
item
.
attributeAndValueList
.
map
(
_item
=>
{
temp
[
_item
.
customerAttribute
.
name
]
=
{
value
:
_item
.
customerAttributeValue
.
value
,
vId
:
_item
.
customerAttributeValue
.
id
,
id
:
_item
.
customerAttribute
.
id
}
})
_tableData
.
push
({
"id"
:
item
.
id
,
// 行数据id
"goodsId"
:
item
.
goods
.
id
,
// 货品ID
"索引"
:
index
,
"商品名称"
:
name
||
productName
,
"对应货品"
:
item
.
goods
.
name
,
...
temp
,
"单价"
:
item
.
unitPrice
})
})
setPriceTableData
(
_tableData
)
}
const
rowSelectionSetSpec
=
{
selectedRowKeys
:
selectedSpecRowKeys
,
onChange
:
(
selectedRowKeys
:
any
,
selectedRows
:
any
)
=>
{
...
...
@@ -325,7 +248,6 @@ const SetPrice:React.FC<IProps> = (props) => {
setPriceTableData
(
newTabeData
)
constructedPrarams
()
console
.
log
(
newTabeData
,
'价格修改之后的tableData'
)
})
}
...
...
@@ -340,8 +262,6 @@ const SetPrice:React.FC<IProps> = (props) => {
return
{...
item
,
unitPrice
:
price
}
})
console
.
log
(
originTableData
,
priceTableData
,
selectData
,
_data
,
'过滤'
)
setTableDataInSetPrice
(
_data
)
// 设置传输数据
}
...
...
@@ -392,12 +312,6 @@ const SetPrice:React.FC<IProps> = (props) => {
labelAlign=
"left"
initialValues=
{
{
isMemberPrice
:
true
}
}
>
<
Form
.
Item
label=
"当前设置会员"
>
{
currentOperateChannel
?.
name
||
'所有渠道会员'
}
</
Form
.
Item
>
<
Form
.
Item
name=
"isMemberPrice"
label=
{
...
...
src/pages/commodity/products/addDirectChannel.tsx
View file @
bc0bbd02
import
React
,
{
useState
,
useRef
,
useEffect
}
from
'react'
import
{
history
}
from
'umi'
;
import
{
Button
,
Form
,
Card
,
Tabs
,
Steps
}
from
'antd'
import
{
Button
,
Form
,
Card
,
Tabs
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
PlusOutlined
,
...
...
@@ -20,24 +20,9 @@ import { PublicApi } from '@/services/api';
const
{
TabPane
}
=
Tabs
const
steps
=
[
{
title
:
'First'
,
content
:
'First-content'
,
},
{
title
:
'Second'
,
content
:
'Second-content'
,
},
{
title
:
'Last'
,
content
:
'Last-content'
,
},
];
const
AddDirectChannel
:
React
.
FC
<
{}
>
=
(
props
)
=>
{
const
[
queryId
,
setQueryId
]
=
useState
<
number
>
()
const
[
isDisabledSave
,
setIsDisabledSave
]
=
useState
<
boolean
>
(
false
)
let
[
formRefs
,
setFormRefs
]
=
useState
([])
//子form的ref数组
const
{
ChannelProudctStore
}
=
store
...
...
@@ -45,45 +30,36 @@ const AddDirectChannel:React.FC<{}> = (props) => {
priceType
,
productName
,
productSelectRowInStore
,
currentActiveKey
,
currentOperateChannel
,
tableDataInSetPrice
,
selectedRole
,
se
tCurrentActiveKey
se
lectChannel
,
}
=
ChannelProudctStore
useEffect
(()
=>
{
console
.
log
(
'初始化'
)
return
()
=>
{
setCurrentActiveKey
(
'1'
)
}
},
[])
const
callback
=
(
key
:
string
)
=>
{
console
.
log
(
key
)
setCurrentActiveKey
(
key
)
}
const
onSave
=
()
=>
{
console
.
log
(
formRefs
,
'formRefs'
)
setIsDisabledSave
(
true
)
let
data
=
formRefs
.
map
(
async
__
=>
{
return
(
await
__
.
validateFields
()
)
})
Promise
.
all
(
data
).
then
((
values
)
=>
{
console
.
log
(
values
,
tableDataInSetPrice
,
'vv'
)
let
params
:
any
=
{}
values
.
map
(
item
=>
{
params
=
{
...
params
,
...
item
}
})
params
.
unitPriceAndPicList
=
tableDataInSetPrice
params
.
commodityId
=
productSelectRowInStore
.
id
params
.
channelMemberRoleName
=
selectedRole
.
children
if
(
params
.
isAllMember
)
params
.
isAllMemberPrice
=
true
PublicApi
.
postProductChannelCommoditySaveOrUpdateChannelCommodity
(
params
).
then
(
res
=>
{
params
.
parentMemberId
=
productSelectRowInStore
.
memberId
params
.
parentMemberName
=
productSelectRowInStore
.
memberName
params
.
childMemberRoleName
=
selectedRole
.
children
params
.
commodityMemberList
=
selectChannel
.
map
(
item
=>
({
memberId
:
item
.
memberId
,
memberName
:
item
.
name
}))
PublicApi
.
postProductChannelCommoditySaveChannelCommodity
(
params
).
then
(
res
=>
{
setIsDisabledSave
(
false
)
if
(
res
.
code
===
1000
)
history
.
goBack
()
})
...
...
@@ -95,54 +71,29 @@ const AddDirectChannel:React.FC<{}> = (props) => {
backIcon=
{
<
ReutrnEle
description=
"返回"
/>
}
title=
{
queryId
?
"编辑渠道直采商品"
:
"新建渠道直采商品"
}
extra=
{
[
<
Button
key=
"123"
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
onClick=
{
onSave
}
>
<
Button
key=
"123"
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
onClick=
{
onSave
}
disabled=
{
isDisabledSave
}
>
保存
</
Button
>,
]
}
>
<
Card
>
<
Tabs
onChange=
{
callback
}
type=
"card"
activeKey=
{
currentActiveKey
}
>
<
Tabs
onChange=
{
callback
}
type=
"card"
>
<
TabPane
tab=
"选择商品"
key=
"1"
>
<
SelectProduct
onRef=
{
(
refs
)
=>
setFormRefs
([...
formRefs
,
refs
])
}
/>
</
TabPane
>
<
TabPane
tab=
"
适用渠道
"
key=
"2"
>
<
Se
lectChannel
<
TabPane
tab=
"
设置价格
"
key=
"2"
>
<
Se
tPrice
onRef=
{
(
refs
)
=>
setFormRefs
([...
formRefs
,
refs
])
}
/>
</
TabPane
>
<
TabPane
tab=
"
设置价格
"
key=
"3"
>
<
Se
tPrice
<
TabPane
tab=
"
适用渠道
"
key=
"3"
>
<
Se
lectChannel
onRef=
{
(
refs
)
=>
setFormRefs
([...
formRefs
,
refs
])
}
/>
</
TabPane
>
</
Tabs
>
{
/* <Steps current={0}>
{steps.map(item => (
<Step key={item.title} title={item.title} />
))}
</Steps>
<div className="steps-content">{steps[current].content}</div>
<div className="steps-action">
{current < steps.length - 1 && (
<Button type="primary" onClick={() => this.next()}>
Next
</Button>
)}
{current === steps.length - 1 && (
<Button type="primary" onClick={() => message.success('Processing complete!')}>
Done
</Button>
)}
{current > 0 && (
<Button style={{ margin: '0 8px' }} onClick={() => this.prev()}>
Previous
</Button>
)}
</div> */
}
</
Card
>
</
PageHeaderWrapper
>)
}
...
...
src/pages/commodity/products/addProducts.tsx
View file @
bc0bbd02
...
...
@@ -258,7 +258,6 @@ const AddProducts: React.FC<{}> = (props) => {
setIsEnableCheck
(
false
)
setIsDisableSaveBtn
(
false
)
setReponseId
(
res
.
data
)
history
.
goBack
()
}
})
}).
then
(
e
=>
{
...
...
@@ -286,7 +285,10 @@ const AddProducts: React.FC<{}> = (props) => {
}
const
handleApplyCheck
=
()
=>
{
PublicApi
.
postProductCommodityApplyCheckCommodity
({
id
:
responseId
})
PublicApi
.
postProductCommodityApplyCheckCommodity
({
id
:
responseId
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
history
.
goBack
()
})
}
const
callback
=
(
key
:
any
)
=>
{
...
...
src/pages/commodity/products/addProductsItem/basicInfoForm.tsx
View file @
bc0bbd02
...
...
@@ -66,8 +66,16 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
const
[
proviceOptions
,
setProviceOptions
]
=
useState
<
GetManageAreaAllResponse
>
()
const
[
showCategory
,
setShowCategory
]
=
useState
(
null
)
const
[
areaParams
,
setAreaParams
]
=
useState
<
AreaParams
>
()
const
[
isUpdateAttribute
,
setIsUpdateAttribute
]
=
useState
<
boolean
>
(
true
)
const
{
ProductStore
}
=
store
const
{
setAreaOption
,
productInfoByEdit
,
getBasicFormParamsByEdit
,
setAttributeLists
,
setProductName
,
setSelectCategoryId
,
setSelectBrandId
}
=
ProductStore
const
{
setAreaOption
,
productInfoByEdit
,
getBasicFormParamsByEdit
,
setAttributeLists
,
setProductName
,
setSelectCategoryId
,
setSelectBrandId
}
=
ProductStore
useEffect
(()
=>
{
// 获取品类树
...
...
@@ -106,6 +114,9 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
handleBrandSearch
(
getBasicFormParamsByEdit
.
brandName
)
onCustomerCategoryChange
(
getBasicFormParamsByEdit
.
customerCategoryId
)
basicForm
.
setFieldsValue
(
getBasicFormParamsByEdit
)
setSelectCategoryId
(
getBasicFormParamsByEdit
.
customerCategoryId
)
setSelectBrandId
(
getBasicFormParamsByEdit
.
brandId
)
setIsUpdateAttribute
(
productInfoByEdit
.
isUpdateAttribute
)
}
},
[
productInfoByEdit
,
getBasicFormParamsByEdit
])
...
...
@@ -207,6 +218,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
]
}
>
<
Cascader
disabled=
{
!
isUpdateAttribute
}
options=
{
customerCategoryTree
}
fieldNames=
{
{
label
:
'title'
,
value
:
'id'
,
children
:
'children'
}
}
onChange=
{
onCustomerCategoryChange
}
...
...
@@ -225,6 +237,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
]
}
>
<
Select
disabled=
{
!
isUpdateAttribute
}
showSearch=
{
true
}
showArrow=
{
true
}
placeholder=
"请输入或选择商品品牌"
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
bc0bbd02
This diff is collapsed.
Click to expand it.
src/pages/commodity/products/addProductsItem/productAttributeForm.tsx
View file @
bc0bbd02
This diff is collapsed.
Click to expand it.
src/pages/commodity/products/addProductsItem/selectGoodsForm.tsx
View file @
bc0bbd02
import
React
,
{
useState
,
useEffect
,
useContext
}
from
'react'
import
React
,
{
useState
,
useEffect
,
useContext
,
useRef
}
from
'react'
import
{
history
}
from
'umi'
import
{
Button
,
Form
,
Select
,
Checkbox
}
from
'antd'
import
styles
from
'./index.less'
...
...
@@ -25,14 +25,23 @@ export interface Iprops {
}
const
SelectGoodsForm
:
React
.
FC
<
Iprops
>
=
(
props
)
=>
{
const
ref
=
useRef
<
any
>
({})
const
[
selectGoodsForm
]
=
Form
.
useForm
()
const
[
showSelectGoods
,
setIsSelectGoods
]
=
useState
<
boolean
>
(
false
)
const
[
isSelectGoods
,
setIsSelectGoods
]
=
useState
<
boolean
>
(
true
)
// 货品table显示隐藏
const
[
isChecked
,
setIsChecked
]
=
useState
<
boolean
>
(
true
)
const
[
selectGoodsRow
,
setSelectGoodsRow
]
=
useState
<
GetProductGoodsGetGoodsListResponseDetail
[]
>
([])
// 模态框选择的行数据
const
[
selectedGoodsRowKeys
,
setSelectedGoodsRowKeys
]
=
useState
<
Array
<
number
>>
([])
const
{
ProductStore
}
=
store
const
{
productInfoByEdit
,
selectCategoryId
,
selectBrandId
}
=
ProductStore
useEffect
(()
=>
{
// 品类 品牌变动重新渲染货品表格 清空选择 清空store
setSelectedGoodsRowKeys
([])
ProductStore
.
setSelectedGoods
([])
if
(
ref
.
current
.
reload
)
ref
.
current
.
reload
()
},
[
selectCategoryId
,
selectBrandId
])
useEffect
(()
=>
{
const
{
id
}
=
history
.
location
.
query
if
(
id
){
...
...
@@ -118,28 +127,32 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
}
return
(<>
<
Form
{
...
layout
}
form=
{
selectGoodsForm
}
name=
"select-goods"
labelAlign=
"left"
colon=
{
false
}
>
<
Form
.
Item
label=
"是否选择货品"
>
<
Checkbox
checked=
{
isChecked
}
onChange=
{
onSelectGoodsChange
}
>
选择货品
</
Checkbox
>
</
Form
.
Item
>
</
Form
>
{
/* {
showSelectGoods && */
}
<
StandardTable
columns=
{
goodsColumns
}
rowSelection=
{
rowSelection
}
tableProps=
{
{
rowKey
:
"id"
}
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
/>
{
/* } */
}
{
selectCategoryId
&&
selectBrandId
?
<>
<
Form
{
...
layout
}
form=
{
selectGoodsForm
}
name=
"select-goods"
labelAlign=
"left"
colon=
{
false
}
>
<
Form
.
Item
label=
"是否选择货品"
>
<
Checkbox
checked=
{
isChecked
}
onChange=
{
onSelectGoodsChange
}
>
选择货品
</
Checkbox
>
</
Form
.
Item
>
</
Form
>
{
isSelectGoods
&&
<
StandardTable
currentRef=
{
ref
}
columns=
{
goodsColumns
}
rowSelection=
{
rowSelection
}
tableProps=
{
{
rowKey
:
"id"
}
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
/>
}
</>
:
<
span
style=
{
{
opacity
:
0.6
}
}
>
暂无数据!
</
span
>
}
</>)
}
...
...
src/pages/commodity/products/directChannel.tsx
View file @
bc0bbd02
...
...
@@ -63,8 +63,8 @@ const DirectChannel: React.FC<{}> = () => {
},
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
key
:
'
name
'
,
dataIndex
:
[
'channelCommodity'
,
'commodity'
,
'name'
]
,
key
:
'
id
'
,
className
:
'commonPickColor'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
EyePreview
url=
{
`/memberCenter/commodityAbility/commodity/products/directChannel/viewDirectChannel?id=${record.id}`
}
...
...
@@ -74,53 +74,58 @@ const DirectChannel: React.FC<{}> = () => {
},
{
title
:
'品类'
,
dataIndex
:
[
'customerCategory'
,
'name'
],
dataIndex
:
[
'c
hannelCommodity'
,
'commodity'
,
'c
ustomerCategory'
,
'name'
],
key
:
'id'
,
},
{
title
:
'品牌'
,
dataIndex
:
[
'brand'
,
'name'
],
dataIndex
:
[
'
channelCommodity'
,
'commodity'
,
'
brand'
,
'name'
],
key
:
'id'
,
},
{
title
:
'单位'
,
dataIndex
:
'unitName'
,
key
:
'
unitName
'
,
dataIndex
:
[
'channelCommodity'
,
'commodity'
,
'unitName'
]
,
key
:
'
id
'
,
},
{
title
:
'价格'
,
dataIndex
:
'min'
,
key
:
'
min
'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<>
¥
{
record
.
min
}
~ ¥
{
record
.
max
}
</>
dataIndex
:
[
'channelCommodity'
,
'commodity'
,
'min'
]
,
key
:
'
id
'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<>
¥
{
text
}
~ ¥
{
record
.
channelCommodity
.
commodity
.
max
}
</>
},
{
title
:
'渠道会员角色'
,
dataIndex
:
'channelMemberRoleName'
,
key
:
'channelMemberRoleName'
,
dataIndex
:
'memberRoleName'
,
key
:
'memberRoleName'
,
},
{
title
:
'适用会员'
,
dataIndex
:
'memberName'
,
key
:
'memberName'
,
},
{
title
:
'商品来源'
,
dataIndex
:
'source'
,
key
:
'
source
'
,
dataIndex
:
[
'channelCommodity'
,
'source'
]
,
key
:
'
id
'
,
render
:
(
text
,
record
)
=>
text
===
1
?
'上级渠道'
:
'渠道自有'
},
{
title
:
'操作时间'
,
dataIndex
:
'createTime'
,
key
:
'
createTime
'
,
dataIndex
:
[
'channelCommodity'
,
'createTime'
]
,
key
:
'
id
'
,
render
:
(
text
,
record
)
=>
moment
(
text
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
},
{
title
:
'状态'
,
dataIndex
:
'status'
,
key
:
'
status
'
,
dataIndex
:
[
'channelCommodity'
,
'status'
]
,
key
:
'
id
'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
let
component
:
ReactNode
=
null
if
(
record
.
status
===
5
)
if
(
text
===
5
)
component
=
(<
span
style=
{
{
color
:
'#00B37A'
,
padding
:
'2px 5px'
,
background
:
'rgba(235,247,242,1)'
,
borderRadius
:
'4px'
}
}
>
已上架
</
span
>)
else
if
(
record
.
status
===
6
)
else
if
(
text
===
6
)
component
=
(<
span
style=
{
{
padding
:
'2px 5px'
,
background
:
'rgba(244,245,247,1)'
,
borderRadius
:
'4px'
}
}
>
已下架
</
span
>)
else
if
(
record
.
status
===
4
)
else
if
(
text
===
7
)
component
=
(<
span
style=
{
{
color
:
'#E63F3B'
,
padding
:
'2px 5px'
,
background
:
'rgba(255,235,230,1)'
,
borderRadius
:
'4px'
}
}
>
未上架
</
span
>)
return
component
}
...
...
@@ -128,23 +133,22 @@ const DirectChannel: React.FC<{}> = () => {
{
title
:
'操作'
,
dataIndex
:
'option'
,
align
:
'center'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
return
(
<>
{
(
record
.
status
===
5
)
?
<
Button
type=
'link'
onClick=
{
()
=>
clickUp
(
0
,
record
.
id
)
}
>
下架
</
Button
>
:
''
}
{
(
record
.
status
===
6
)
?
{
(
record
.
channelCommodity
.
status
===
5
)
?
<
Button
type=
'link'
onClick=
{
()
=>
clickUp
(
0
,
record
.
id
)
}
>
下架
</
Button
>
:
''
}
{
(
record
.
channelCommodity
.
status
===
6
)
?
<>
<
Button
type=
'link'
onClick=
{
()
=>
clickUp
(
1
,
record
.
id
)
}
>
上架
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
clickModify
(
record
.
id
)
}
>
修改
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
clickModify
(
record
)
}
>
修改
</
Button
>
</>
:
''
}
{
(
record
.
status
===
4
)
&&
{
(
record
.
channelCommodity
.
status
===
7
)
&&
<>
<
Button
type=
'link'
onClick=
{
()
=>
clickUp
(
1
,
record
.
id
)
}
>
上架
</
Button
>
<
Dropdown
overlay=
{
<
Menu
>
<
Menu
.
Item
><
Button
type=
'link'
onClick=
{
()
=>
clickModify
(
record
.
id
)
}
>
修改
</
Button
></
Menu
.
Item
>
<
Menu
.
Item
><
Button
type=
'link'
onClick=
{
()
=>
clickModify
(
record
)
}
>
修改
</
Button
></
Menu
.
Item
>
<
Menu
.
Item
><
Button
type=
'link'
onClick=
{
()
=>
clickDelete
(
record
.
id
)
}
>
删除
</
Button
></
Menu
.
Item
>
</
Menu
>
}
>
...
...
@@ -154,15 +158,14 @@ const DirectChannel: React.FC<{}> = () => {
</
Dropdown
>
</>
}
</>
)
}
}
];
const
clickModify
=
(
param
Id
:
number
)
=>
{
history
.
push
(
`/memberCenter/commodityAbility/commodity/products/directChannel/
addDirectChannel?id=
${
paramI
d
}
`
)
const
clickModify
=
(
param
s
:
any
)
=>
{
history
.
push
(
`/memberCenter/commodityAbility/commodity/products/directChannel/
modifyDirectChannel?id=
${
params
.
id
}
&commodityId=
${
params
.
channelCommodity
.
commodity
.
i
d
}
`
)
}
// paramId ? 单个删除 : 批量删除
...
...
@@ -186,7 +189,7 @@ const DirectChannel: React.FC<{}> = () => {
},
})
else
message
.
error
(
'请先选择需要
删除
的商品!'
)
message
.
error
(
'请先选择需要
操作
的商品!'
)
}
const
fetchData
=
(
params
:
any
)
=>
{
...
...
@@ -199,16 +202,37 @@ const DirectChannel: React.FC<{}> = () => {
})
}
const
getPageItemsMemberRole
=
async
()
=>
{
const
res
=
await
PublicApi
.
getMemberManageRoleList
()
const
{
data
}:
any
=
res
console
.
log
(
data
,
'data'
)
if
(
res
.
code
===
1000
)
{
return
{
memberRoleId
:
data
.
map
(
item
=>
({
label
:
item
.
roleName
,
value
:
item
.
roleId
})),
}
}
return
{}
}
const
handleBatchUp
=
()
=>
{
console
.
log
(
'批量上架'
)
setUpDownModal
(
true
)
setIsUp
(
1
)
if
(
selectedRowKeys
.
length
){
setUpDownModal
(
true
)
setIsUp
(
1
)
}
else
{
message
.
error
(
'请先选择需要操作的商品!'
)
}
}
const
handleBatchDown
=
()
=>
{
console
.
log
(
'批量下架'
)
setUpDownModal
(
true
)
setIsUp
(
0
)
if
(
selectedRowKeys
.
length
){
setUpDownModal
(
true
)
setIsUp
(
0
)
}
else
{
message
.
error
(
'请先选择需要操作的商品!'
)
}
}
const
rowSelection
=
{
...
...
@@ -245,7 +269,7 @@ const DirectChannel: React.FC<{}> = () => {
const
handleUpDown
=
()
=>
{
setIsDisabledOKbtn
(
true
)
let
params
=
{
channelCommodityI
d
:
currentOptionId
,
i
d
:
currentOptionId
,
shopList
:
checkedValues
}
if
(
isUp
)
...
...
@@ -298,11 +322,11 @@ const DirectChannel: React.FC<{}> = () => {
>
<
PlusOutlined
/>
新建
</
Button
>
{
/*
<Dropdown overlay={menuMore} trigger={['click']}>
<
Dropdown
overlay=
{
menuMore
}
trigger=
{
[
'click'
]
}
>
<
Button
>
更多
<
DownOutlined
/>
</
Button
>
</Dropdown>
*/
}
</
Dropdown
>
</
Space
>
);
...
...
@@ -329,6 +353,10 @@ const DirectChannel: React.FC<{}> = () => {
'name'
,
FORM_FILTER_PATH
,
)
// useAsyncInitSelect(
// ['memberRoleId'],
// getPageItemsMemberRole,
// );
FormEffectHooks
.
onFieldChange$
(
'brandId'
).
subscribe
(
state
=>
{
searchBrandOptionEffect
(
actions
,
'brandId'
)
})
...
...
src/pages/commodity/products/fastModifyPrice.tsx
View file @
bc0bbd02
...
...
@@ -270,7 +270,7 @@ const FastModifyPrice: React.FC<{}> = () => {
}
console
.
log
(
_priceRange
)
// @ts-ignore
PublicApi
.
postProductCommodityUpdateCommodityPrice
({
commodityId
:
currentRow
.
commodityId
,
unitPriceAndPicI
d
:
currentRow
.
id
,
unitPrice
:
_priceRange
}).
then
(
res
=>
{
PublicApi
.
postProductCommodityUpdateCommodityPrice
({
i
d
:
currentRow
.
id
,
unitPrice
:
_priceRange
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
){
ref
.
current
.
reload
()
setModifyModal
(
false
)
...
...
src/pages/commodity/products/modifyDirectChannel.tsx
0 → 100644
View file @
bc0bbd02
This diff is collapsed.
Click to expand it.
src/pages/commodity/products/schema/channelSchema.tsx
View file @
bc0bbd02
...
...
@@ -49,7 +49,13 @@ export const channelSchema: ISchema = {
memberName
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'会员名称'
placeholder
:
'适用渠道'
},
},
memberRoleName
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'渠道会员角色'
},
},
brandId
:
{
...
...
@@ -82,23 +88,28 @@ export const channelSchema: ISchema = {
dataoption
:
[]
},
},
s
tatus
:
{
s
ource
:
{
type
:
'string'
,
enum
:
[
{
label
:
'
待提交审核
'
,
label
:
'
上级渠道
'
,
value
:
1
,
},
{
label
:
'
待审核
'
,
label
:
'
渠道自有
'
,
value
:
2
,
},
{
label
:
'审核不通过'
,
value
:
3
,
},
}
],
'x-component-props'
:
{
placeholder
:
'商品状态'
,
style
:
{
width
:
'174px'
},
},
},
status
:
{
type
:
'string'
,
enum
:
[
{
label
:
'
审核通过
'
,
label
:
'
未上架
'
,
value
:
4
,
},
{
...
...
src/pages/commodity/products/viewDirectChannel.tsx
View file @
bc0bbd02
...
...
@@ -10,12 +10,12 @@ import { ColumnType } from 'antd/lib/table/interface'
import
ReutrnEle
from
'@/components/ReturnEle'
import
styles
from
"./index.less"
import
{
PublicApi
}
from
'@/services/api'
import
{
GetProductChannelCommodityGetChannelCommodityResponse
}
from
'@/services'
const
ViewDriectChannel
:
React
.
FC
<
{}
>
=
()
=>
{
const
[
channelDetails
,
setChannelDetails
]
=
useState
<
GetProductChannelCommodityGetChannelCommodityResponse
>
()
const
[
channelDetails
,
setChannelDetails
]
=
useState
<
any
>
()
const
[
priceTableData
,
setPriceTableData
]
=
useState
<
any
[]
>
([])
const
[
priceTableDataColumn
,
setPrcieTableColumn
]
=
useState
<
any
[]
>
([])
const
[
shopList
,
setShopList
]
=
useState
<
any
[]
>
([])
useEffect
(()
=>
{
const
{
id
}
=
history
.
location
.
query
...
...
@@ -24,10 +24,15 @@ const ViewDriectChannel: React.FC<{}> = () => {
setChannelDetails
(
data
)
constructTable
(
data
)
})
PublicApi
.
getProductChannelCommodityGetShop
({
id
:
id
}).
then
(
res
=>
{
setShopList
(
res
.
data
)
})
},
[])
const
constructTable
=
(
param
:
GetProductChannelCommodityGetChannelCommodityResponse
)
=>
{
const
{
unitPriceAndPicList
,
priceType
}
=
param
const
constructTable
=
(
param
:
any
)
=>
{
const
{
unitPriceAndPicList
,
channelCommodity
}
=
param
const
{
commodity
}
=
channelCommodity
if
(
unitPriceAndPicList
.
length
>
0
){
let
col
:
any
=
[]
let
temp
:
any
=
[]
...
...
@@ -63,7 +68,7 @@ const ViewDriectChannel: React.FC<{}> = () => {
},
...
temp
,
{
title
:
priceType
===
3
?
'积分'
:
'单价'
,
title
:
commodity
.
priceType
===
3
?
'积分'
:
'单价'
,
dataIndex
:
'单价'
,
key
:
'单价'
,
render
:
(
text
,
record
)
=>
{
...
...
@@ -84,10 +89,10 @@ const ViewDriectChannel: React.FC<{}> = () => {
})
_tableData
.
push
({
"id"
:
item
.
id
,
// 行数据id
"goodsId"
:
item
.
goods
.
id
,
// 货品ID
"goodsId"
:
item
.
goods
?
.
id
,
// 货品ID
"索引"
:
index
,
"商品名称"
:
param
.
name
,
"对应货品"
:
item
.
goods
.
name
,
"商品名称"
:
commodity
.
name
,
"对应货品"
:
item
.
goods
?
.
name
,
...
temp
,
"单价"
:
item
.
unitPrice
})
...
...
@@ -96,65 +101,6 @@ const ViewDriectChannel: React.FC<{}> = () => {
setPriceTableData
(
_tableData
)
}
}
const
dataSourcePrice
=
[
{
key
:
'1'
,
name
:
'胡彦斌'
,
color
:
'立白色'
,
size
:
'XXXXXXXXXXXXXXXL'
,
goods
:
'M-112/进口头层牛皮荔枝纹/红色/XL/¥15.50'
,
price
:
[
20
,
19
,
18
],
},
{
key
:
'2'
,
name
:
'胡一统'
,
color
:
'天青色'
,
size
:
'XXXXS'
,
goods
:
'M-10086/进口头层狗皮木纹/木色/XL/¥12.30'
,
price
:
[
1580
,
1450
,
1200
],
},
]
const
columnsPrice
:
ColumnType
<
any
>
[]
=
[
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
},
{
title
:
'颜色'
,
dataIndex
:
'color'
,
align
:
'center'
,
key
:
'color'
,
},
{
title
:
'尺码'
,
dataIndex
:
'size'
,
align
:
'center'
,
key
:
'size'
,
},
{
title
:
'对应货品'
,
dataIndex
:
'goods'
,
align
:
'center'
,
key
:
'goods'
,
},
{
title
:
'单价'
,
dataIndex
:
'price'
,
align
:
'center'
,
key
:
'price'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(
<>
{
text
&&
text
.
length
>
0
&&
text
.
map
((
item
:
any
,
index
:
any
)
=>
<
p
>
{
index
*
1000
+
1
}
~
{
1000
*
(
index
+
1
)
}
:
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
item
}
</
span
></
p
>)
}
</>
)
}
]
const
dataMember
=
[
{
...
...
@@ -212,22 +158,22 @@ const ViewDriectChannel: React.FC<{}> = () => {
return
<
span
className=
{
styles
.
pruductStatus
}
>
已上架
</
span
>
if
(
status
===
6
)
return
<
span
style=
{
{
padding
:
'2px 5px'
,
background
:
'rgba(244,245,247,1)'
,
borderRadius
:
'4px'
}
}
>
已下架
</
span
>
if
(
status
===
4
)
if
(
status
===
7
)
return
<
span
style=
{
{
color
:
'#E63F3B'
,
padding
:
'2px 5px'
,
background
:
'rgba(255,235,230,1)'
,
borderRadius
:
'4px'
}
}
>
未上架
</
span
>
}
const
content
=
<>
<
Descriptions
colon=
{
true
}
style=
{
{
marginTop
:
50
}
}
>
<
Descriptions
.
Item
label=
"商品状态"
>
{
renderStatus
(
channelDetails
?.
status
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"上级渠道"
>
经销5S店
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"商品状态"
>
{
renderStatus
(
channelDetails
?.
channelCommodity
?.
status
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"上级渠道"
>
{
channelDetails
?.
parentMemberName
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"上架商城"
>
{
channelDetails
?.
commodityShopList
?.
length
>
0
&&
channelDetails
.
commodityShopList
.
map
((
item
,
index
)
=>
<
span
key=
{
index
}
>
{
item
.
name
}
</
span
>)
shopList
.
length
>
0
&&
shopList
.
map
((
item
,
index
)
=>
item
.
isCheck
&&
<
span
key=
{
index
}
>
{
item
.
name
}
</
span
>)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"商品品类"
>
{
channelDetails
?.
c
ustomerCategory
?.
fullN
ame
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"商品品牌"
>
{
channelDetails
?.
brand
?.
name
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"单位"
>
{
channelDetails
?.
unitName
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"商品品类"
>
{
channelDetails
?.
c
hannelCommodity
?.
commodity
?.
customerCategory
?.
n
ame
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"商品品牌"
>
{
channelDetails
?.
channelCommodity
?.
commodity
?.
brand
?.
name
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"单位"
>
{
channelDetails
?.
channelCommodity
?.
commodity
?.
unitName
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"商品ID"
>
{
channelDetails
?.
id
}
</
Descriptions
.
Item
>
</
Descriptions
>
</>
...
...
@@ -244,7 +190,7 @@ const ViewDriectChannel: React.FC<{}> = () => {
<
Avatar
size=
{
48
}
shape=
"square"
src=
{
channelDetails
?.
unitPriceAndPicList
[
0
]?.
commodityPic
&&
channelDetails
.
unitPriceAndPicList
[
0
].
commodityPic
[
0
]
}
/>
<
span
style=
{
{
color
:
'rgba(23,43,77,1)'
,
fontSize
:
20
,
fontWeight
:
500
,
marginLeft
:
16
}
}
>
{
channelDetails
?.
name
}
</
span
>
<
span
style=
{
{
color
:
'#E63F3B'
,
padding
:
'2px 5px'
,
background
:
'rgba(255,235,230,1)'
,
borderRadius
:
'4px'
,
marginLeft
:
16
,
marginRight
:
16
}
}
>
{
channelDetails
?.
source
===
1
?
"上级渠道"
:
"渠道自有"
}
</
span
>
<
a
href=
{
channelDetails
?.
source
===
1
?
`/shop/commodity/detail?id=${channelDetails?.
id}`
:
`/memberCenter/commodityAbility/commodity/products/viewProducts?id=${channelDetails
?.id}`
}
>
去查看
>
</
a
>
<
a
href=
{
channelDetails
?.
source
===
1
?
`/shop/commodity/detail?id=${channelDetails?.
channelCommodity?.commodity?.id}`
:
`/memberCenter/commodityAbility/commodity/products/viewProducts?id=${channelDetails?.channelCommodity?.commodity
?.id}`
}
>
去查看
>
</
a
>
</
p
>
{
content
}
</
Card
>
...
...
@@ -263,16 +209,21 @@ const ViewDriectChannel: React.FC<{}> = () => {
</
Card
>
</
Space
>
<
Space
direction=
"vertical"
style=
{
{
width
:
'100%'
}
}
>
<
Card
headStyle=
{
{
borderBottom
:
'none'
}
}
title=
"
使用渠道会员
"
>
<
Card
headStyle=
{
{
borderBottom
:
'none'
}
}
title=
"
适用渠道
"
>
<
Row
>
<
Col
span=
{
3
}
>
<
p
>
渠道会员角色:
</
p
>
</
Col
>
<
Col
span=
{
21
}
>
<
p
>
{
channelDetails
?.
memberRoleName
}
</
p
>
</
Col
>
<
Col
span=
{
3
}
>
<
p
>
使用渠道会员
:
</
p
>
<
p
>
适用渠道
:
</
p
>
</
Col
>
<
Col
span=
{
21
}
>
<
p
>
{
channelDetails
?.
isAllMember
?
'所有渠道会员(默认)'
:
'指定渠道会员'
}
</
p
>
<
p
>
{
channelDetails
?.
memberName
}
</
p
>
</
Col
>
</
Row
>
{
channelDetails
?.
isAllMember
?
''
:
<
Table
dataSource=
{
dataMember
}
columns=
{
columnsMember
}
/>
}
</
Card
>
</
Space
>
</
PageHeaderWrapper
>
...
...
src/store/channelProduct/index.ts
View file @
bc0bbd02
...
...
@@ -9,12 +9,11 @@ class ChannelProductStore implements IChannelProductModule {
// 选择商品区块
@
observable
public
productSourceInStore
:
number
=
1
;
@
observable
public
productSelectRowInStore
:
any
=
null
;
@
observable
public
priceType
:
number
=
null
@
observable
public
productName
:
string
=
null
@
observable
public
currentActiveKey
:
string
=
'1'
@
observable
public
currentOperateChannel
:
IChannel
=
null
@
observable
public
tableDataInSetPrice
:
any
[]
=
null
@
observable
public
selectedRole
:
IRole
=
null
@
observable
public
priceType
:
number
=
null
;
@
observable
public
productName
:
string
=
null
;
@
observable
public
tableDataInSetPrice
:
any
[]
=
null
;
@
observable
public
selectedRole
:
IRole
=
null
;
@
observable
public
selectChannel
:
any
=
null
;
// 加工接口返回的数据,用户编辑回显数据
...
...
@@ -46,16 +45,6 @@ class ChannelProductStore implements IChannelProductModule {
}
@
action
.
bound
public
setCurrentActiveKey
(
data
:
string
){
this
.
currentActiveKey
=
data
;
}
@
action
.
bound
public
setCurrentOperateChannel
(
data
:
IChannel
){
this
.
currentOperateChannel
=
data
;
}
@
action
.
bound
public
setTableDataInSetPrice
(
data
:
any
[]){
this
.
tableDataInSetPrice
=
data
;
}
...
...
@@ -65,6 +54,11 @@ class ChannelProductStore implements IChannelProductModule {
this
.
selectedRole
=
data
;
}
@
action
.
bound
public
setSelectChannel
(
data
:
any
[]){
this
.
selectChannel
=
data
}
}
export
default
ChannelProductStore
src/store/product/index.ts
View file @
bc0bbd02
...
...
@@ -40,16 +40,21 @@ class ProductStore implements IProductModule {
let
attributeIdArr
=
attributeArr
.
map
(
item
=>
item
.
id
)
let
attributeValueIdArr
=
attributeValueArr
.
map
(
item
=>
item
.
map
(
_item
=>
_item
.
id
))
let
tempObj
=
{}
console
.
log
(
attributeArr
,
attributeValueArr
,
this
.
attributeLists
,
this
.
productSelectAttribute
,
'store Item'
)
//
console.log(attributeArr, attributeValueArr, this.attributeLists, this.productSelectAttribute,'store Item')
attributeIdArr
.
map
((
item
,
index
)
=>
{
if
(
attributeValueIdArr
[
index
].
length
>
1
){
tempObj
[
item
]
=
attributeValueIdArr
[
index
]
}
else
{
// 类型为2如果是一个的话 为配合checkbox Group也要生成数组
if
(
this
.
attributeLists
.
filter
(
_item
=>
_item
.
id
===
item
)[
0
]?.
type
===
2
)
// 多选
if
(
this
.
attributeLists
.
filter
(
_item
=>
_item
.
id
===
item
)[
0
]?.
type
===
2
)
{
// 多选
tempObj
[
item
]
=
attributeValueIdArr
[
index
]
else
}
else
if
(
this
.
attributeLists
.
filter
(
_item
=>
_item
.
id
===
item
)[
0
]?.
type
===
3
){
// 输入
tempObj
[
item
]
=
attributeValueArr
[
index
][
0
].
value
}
else
{
tempObj
[
item
]
=
attributeValueIdArr
[
index
][
0
]
}
}
})
return
tempObj
...
...
@@ -115,14 +120,22 @@ class ProductStore implements IProductModule {
this
.
tableDataSource
=
datas
;
}
// 清空商品编辑的数据里面的属性值 用于商品编辑时品类和品牌更改导致数据变动时
@
action
.
bound
public
clearProductDetailsUnitPriceAndPicListInEdit
(
data
?:
any
[])
{
this
.
productInfoByEdit
.
unitPriceAndPicList
=
[]
}
@
action
.
bound
public
clearData
(
data
?:
any
[])
{
this
.
tableDataSource
=
data
||
[];
//productName, selectedGoods, productSelectAttribute, productInfoByEdit
this
.
productName
=
null
;
this
.
selectedGoods
=
[];
this
.
productSelectAttribute
=
[];
this
.
productInfoByEdit
=
null
;
this
.
attributeLists
=
[];
this
.
selectCategoryId
=
null
;
this
.
selectBrandId
=
null
;
}
@
action
.
bound
...
...
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