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
0d4af2b5
Commit
0d4af2b5
authored
Feb 17, 2022
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改装修内容未null时报错,以及组合促销已选择时,过滤其余活动
parent
9f5aab62
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
79 additions
and
33 deletions
+79
-33
useGetLayout.ts
...nagement/activePage/fixtures/common/hooks/useGetLayout.ts
+3
-4
useSaveData.ts
...anagement/activePage/fixtures/common/hooks/useSaveData.ts
+1
-1
editPanelForm.tsx
...ctivePage/fixtures/components/EditPanel/editPanelForm.tsx
+31
-13
index.tsx
...ures/components/EditPanelFormily/FormilyProduct/index.tsx
+4
-2
index.less
...vePage/fixtures/components/Layouts/Combination/index.less
+1
-1
index.tsx
...ivePage/fixtures/components/Layouts/Combination/index.tsx
+30
-9
index.less
...Page/fixtures/components/Layouts/CommodityList/index.less
+2
-0
swapCoupon.tsx
.../fixtures/components/Layouts/CommodityList/swapCoupon.tsx
+2
-2
product.tsx
...t/activePage/fixtures/components/ProductPanel/product.tsx
+5
-1
No files found.
src/pages/transaction/marketingAbility/marketingActivitiesManagement/activePage/fixtures/common/hooks/useGetLayout.ts
View file @
0d4af2b5
...
...
@@ -171,7 +171,6 @@ const createComponent = (
let
parentChildKeys
=
[];
let
parentChildConfig
=
{};
let
configRest
=
{};
console
.
log
(
isDept
,
"isDept: "
+
isDept
);
if
(
isDept
)
{
const
sonConfig
=
createComponent
(
{
...
...
@@ -289,10 +288,10 @@ function useGetLayout() {
return
prev
},
{
ids
:
[],
label
:
{}
})
/** 获取组合促销请求体 */
const
combinationRequestData
=
adornContent
.
combination
.
props
.
childrenData
.
reduce
((
prev
,
next
,
_index
)
=>
{
prev
=
[...
prev
,
...
next
.
childrenData
]
const
combinationRequestData
=
adornContent
.
combination
?.
props
?.
childrenData
?
.
reduce
((
prev
,
next
,
_index
)
=>
{
prev
=
[...
prev
,
...
(
next
.
childrenData
||
[])
]
return
prev
},
[])
},
[])
||
[]
/** 获取其他活动的请求体 */
const
activityRequestData
=
Object
.
keys
(
adornContent
).
reduce
((
all
,
_item
)
=>
{
if
(
ACTIVITY_LIST
.
includes
(
_item
as
any
)
&&
_item
!==
'combination'
)
{
...
...
src/pages/transaction/marketingAbility/marketingActivitiesManagement/activePage/fixtures/common/hooks/useSaveData.ts
View file @
0d4af2b5
...
...
@@ -107,7 +107,7 @@ function useSaveData(options: Options) {
const
childrenData
=
childNodes
.
map
((
_record
)
=>
{
const
childTargetProps
=
pageConfig
[
_record
].
props
;
return
childTargetProps
.
id
;
});
})
.
filter
(
Boolean
)
;
// const childrenData = products?.map((_item) => _item.id) || [];
result
=
generaterData
(
result
,
dataIndex
,
{
sort
:
sort
,
...
...
src/pages/transaction/marketingAbility/marketingActivitiesManagement/activePage/fixtures/components/EditPanel/editPanelForm.tsx
View file @
0d4af2b5
...
...
@@ -88,7 +88,6 @@ const EditPanelForm = () => {
clearSelectedStatus
();
setVisible
(
false
);
};
console
.
log
(
selectedInfo
);
useEffect
(()
=>
{
if
(
selectedInfo
===
null
)
{
...
...
@@ -96,6 +95,10 @@ const EditPanelForm = () => {
return
;
}
const
componentType
=
(
selectedInfo
as
any
)?.
otherProps
?.
type
;
if
(
componentType
===
'combinationItemProduct'
)
{
handleOnClose
();
return
;
}
const
propsMapToValue
=
{
top
:
{
...
...
@@ -124,7 +127,9 @@ const EditPanelForm = () => {
setFormValue
({
product
:
{
...
selectedInfo
.
props
,
}
},
/** 当selectedInfo.props 未空对象的时候就不会更新当前value, 所有添加uuid */
uuid
:
Math
.
random
()
});
setSchema
(
activityProducts
);
}
else
{
...
...
@@ -141,34 +146,43 @@ const EditPanelForm = () => {
:
propsMapToValue
?.[
componentType
];
setSchema
(
tempSchema
);
setFormValue
(
tempFormValue
);
setFormValue
(
{...
tempFormValue
,
uuid
:
Math
.
random
()
}
);
}
/** 16 种活动,请求是需要带上活动类型 */
const
activityType
=
ACTIVITY_MAP
[
componentType
]
?
{
activityType
:
ACTIVITY_MAP
[
componentType
]
}
:
{};
const
isWithLabels
=
componentType
===
'suggestProductItem'
?
{
isWithLabels
:
true
}
:
{
isWithLabels
:
false
};
const
isWithMinType
=
minTypeToOne
.
includes
(
componentType
)
?
1
:
minTypeToTwo
.
includes
(
componentType
)
?
2
:
null
// console.log(hotItem".substring(0, 1));
formActions
.
setFieldState
(
'product'
,
(
fieldState
)
=>
{
const
[,
parentKey
]
=
selectedInfo
.
parentKey
.
split
(
'-'
);
const
isCombination
=
componentType
===
'combinationItem'
;
/** 如果是组合促销, 要是已经选择了一个组合促销数据,那么搜索活动商品列表时需要添加当前活动id */
let
withActivityId
=
{};
if
(
isCombination
)
{
const
[,
currentCombinationActivityId
]
=
sameKeys
[
`combination_
${
+
(
parentKey
)
-
1
}
`
][
0
].
split
(
'_'
);
withActivityId
=
currentCombinationActivityId
===
'undefined'
?
{}
:
{
id
:
currentCombinationActivityId
}
}
const
disabledKeys
=
componentType
===
'suggestProductItem'
?
sameKeys
[
`suggestProduct_
${
parseInt
(
parentKey
)
-
1
}
`
]
:
componentType
===
'combinationItem'
?
sameKeys
[
`combination_
${
parseInt
(
parentKey
)
-
1
}
`
]
?
sameKeys
[
`suggestProduct_
${
+
(
parentKey
)
-
1
}
`
]
:
isCombination
?
sameKeys
[
`combination_
${
+
(
parentKey
)
-
1
}
`
]
:
sameKeys
[
`
${
componentType
?.
substring
(
0
,
componentType
.
length
-
4
)}
`] || [];
FormPath.setIn(fieldState, 'props.x-component-props', {
activityImage: activityImage,
...activityType,
disabledKeys: disabledKeys,
...isWithLabels,
...withActivityId,
activityImage: activityImage,
disabledKeys: disabledKeys,
minType: isWithMinType,
// fetchOptions: fetchMemberOptions,
});
});
setVisible(true);
}, [selectedInfo]);
const handleSubmit = (values) => {
console.log(values);
console.log(
"Submit",
values);
const componentType = (selectedInfo as any)?.otherProps?.type;
const valueMapToProps = {
top: {
...
...
@@ -185,7 +199,11 @@ const EditPanelForm = () => {
}
};
let currentProps = {};
if (activityListItem.includes(componentType) || componentType === 'suggestProductItem' || componentType === 'hotItem') {
if (
activityListItem.includes(componentType)
|| componentType === 'suggestProductItem'
|| componentType === 'hotItem'
) {
currentProps = values.product;
} else if (activityList.includes(componentType)) {
currentProps = {
...
...
@@ -203,7 +221,7 @@ const EditPanelForm = () => {
title: (currentProps as any)?.title || (currentProps as any)?.productName || (currentProps as any)?.name
});
handleOnClose();
formActions.reset();
//
formActions.reset();
};
const renderUploadChild = (value) => {
...
...
src/pages/transaction/marketingAbility/marketingActivitiesManagement/activePage/fixtures/components/EditPanelFormily/FormilyProduct/index.tsx
View file @
0d4af2b5
...
...
@@ -78,11 +78,13 @@ const FormilyActivityProduct: React.FC<Iprops> & { isFieldComponent: boolean } =
const
fetchData
=
async
(
params
:
GetMarketingAdornPlatformActivityListAdornRequest
)
=>
{
const
withActivityType
=
componentProps
?.
activityType
?
{
activityType
:
componentProps
?.
activityType
}
:
{};
const
minType
=
componentProps
?.
minType
?
{
minType
:
componentProps
.
minType
}
:
{};
const
withActivityId
=
componentProps
?.
id
?
{
id
:
componentProps
.
id
}
:
{}
const
common
=
{
...
params
,
shopId
:
shopId
?.
toString
(),
...
params
,
...
minType
,
...
withActivityType
...
withActivityType
,
...
withActivityId
,
};
const
isWithActivityType
=
common
;
return
await
getMarketingAdornMerchantActivityListAdorn
(
isWithActivityType
as
any
);
...
...
src/pages/transaction/marketingAbility/marketingActivitiesManagement/activePage/fixtures/components/Layouts/Combination/index.less
View file @
0d4af2b5
...
...
@@ -67,7 +67,7 @@
.simple {
width: 33.3%;
height: 150px;
min-
height: 150px;
padding-right: 12px;
// background-color: red;
display: flex;
...
...
src/pages/transaction/marketingAbility/marketingActivitiesManagement/activePage/fixtures/components/Layouts/Combination/index.tsx
View file @
0d4af2b5
...
...
@@ -14,6 +14,22 @@ interface Iprops {
theme
:
number
}
function
parseChildrenList
(
children
:
React
.
ReactNode
)
{
const
elements
=
React
.
Children
.
map
(
children
,
(
node
)
=>
{
if
(
React
.
isValidElement
(
node
))
{
const
key
=
node
.
key
!==
undefined
?
String
(
node
.
key
)
:
undefined
;
return
{
key
,
...
node
.
props
,
node
,
};
}
return
null
});
return
elements
||
[];
}
const
Combination
:
React
.
FC
<
Iprops
>
&
{
Item
:
typeof
CombinationItem
}
=
(
props
:
Iprops
)
=>
{
const
{
children
,
className
,
title
,
theme
,
status
=
true
,
...
other
}
=
props
;
const
visible
=
status
...
...
@@ -21,11 +37,12 @@ const Combination: React.FC<Iprops> & { Item: typeof CombinationItem } = (props:
const
divProps
=
{
onClick
,
onMouseOver
};
const
classNameStr
=
cx
(
styles
.
combiantion
,
className
,
{
[
styles
.
hide
]:
!
visible
});
const
childrenList
=
parseChildrenList
(
children
);
const
containerTitle
=
childrenList
.
length
===
0
?
`以下商品认选n件,只需m元`
:
childrenList
[
0
]?.
activityList
?.
find
((
_item
)
=>
_item
.
id
===
childrenList
[
0
]?.
activityId
)?.
label
;
const
omitGetOperateState
=
omit
(
other
,
'getOperateState'
)
// const { onClick, onDrag, onDragEnd, onDragEnter, onDragStart, onMouseOver, getOperateState } = other as any;
const
classNameStr
=
cx
(
styles
.
combiantion
,
className
,
{
[
styles
.
hide
]:
!
visible
});
const
count
=
React
.
Children
.
count
(
children
);
const
renderChildren
=
()
=>
{
return
(
...
...
@@ -46,7 +63,7 @@ const Combination: React.FC<Iprops> & { Item: typeof CombinationItem } = (props:
<
div
className=
{
classNameStr
}
{
...
divProps
}
>
{
/* <p className={styles.title}>{title}</p> */
}
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
[
'container-title'
]
}
>
以下商品认选2件,只需800元
</
div
>
<
div
className=
{
styles
[
'container-title'
]
}
>
{
containerTitle
}
</
div
>
{
renderChildren
()
}
{
count
>
0
&&
(
...
...
@@ -64,10 +81,10 @@ const Combination: React.FC<Iprops> & { Item: typeof CombinationItem } = (props:
}
const
CombinationItem
:
React
.
FC
<
any
>
=
(
props
:
any
)
=>
{
const
{
productImgUrl
,
discount
,
price
,
footer
,
sale
,
productName
,
id
,
activityPrice
}
=
props
as
any
;
const
{
onClick
,
on
Drag
,
onDragEnd
,
onDragEnter
,
onDragStart
,
on
MouseOver
,
getOperateState
,
className
}
=
props
as
any
;
const
{
productImgUrl
,
discount
,
price
,
footer
,
sale
,
productName
,
id
,
activityPrice
,
activityList
}
=
props
as
any
;
const
{
onClick
,
onMouseOver
,
getOperateState
,
className
}
=
props
as
any
;
const
divProps
=
{
onClick
,
on
Drag
,
onDragEnd
,
onDragEnter
,
onDragStart
,
on
MouseOver
onClick
,
onMouseOver
};
// const wrapClass = cx(styles.simple);
const
wrapClass
=
cx
(
styles
.
section
,
className
)
...
...
@@ -89,7 +106,11 @@ const CombinationItem: React.FC<any> = (props: any) => {
<
img
src=
{
productImgUrl
}
className=
{
styles
[
'simple-product-image'
]
}
/>
<
div
className=
{
styles
[
'simple-product-name'
]
}
>
{
productName
}
</
div
>
<
div
className=
{
styles
[
'simple-product-label'
]
}
>
<
CustomizeTag
>
800元2件
</
CustomizeTag
>
{
activityList
.
map
((
_item
)
=>
{
return
(
<
CustomizeTag
>
{
_item
.
label
}
</
CustomizeTag
>
)
})
}
</
div
>
</
div
>
</
div
>
...
...
src/pages/transaction/marketingAbility/marketingActivitiesManagement/activePage/fixtures/components/Layouts/CommodityList/index.less
View file @
0d4af2b5
...
...
@@ -26,6 +26,7 @@
background: #fff;
padding: 12px;
border-radius: 8px;
margin-bottom: 12px;
.commodityGroupEmpty {
min-height: 430px;
...
...
@@ -43,6 +44,7 @@
display: flex;
flex-direction: row;
margin-right: -12px;
flex-wrap: wrap;
}
.groupCommodityItem {
...
...
src/pages/transaction/marketingAbility/marketingActivitiesManagement/activePage/fixtures/components/Layouts/CommodityList/swapCoupon.tsx
View file @
0d4af2b5
...
...
@@ -22,7 +22,7 @@ const SwapCoupon = (props) => {
const
{
onClick
,
onDrag
,
onDragEnd
,
onDragEnter
,
onDragStart
,
onMouseOver
,
getOperateState
}
=
other
as
any
;
const
divProps
=
{
onClick
,
on
Drag
,
onDragEnd
,
onDragEnter
,
onDragStart
,
on
MouseOver
,
onClick
,
onMouseOver
,
};
const
handleTabChange
=
(
key
:
string
)
=>
{
setActiveKey
(
key
);
...
...
@@ -67,7 +67,7 @@ const SwapCoupon = (props) => {
<
span
className=
{
styles
.
num
}
>
{
_row
.
denomination
}
</
span
>
</
div
>
<
div
className=
{
styles
.
condition
}
>
{
`${intl.formatMessage({ id: 'activityPage.fill' })}${_row.useConditionMoney}${intl.formatMessage({ id: 'activityPage.available' })}`
}
</
div
>
<
div
className=
{
styles
.
couponType
}
>
{
_row
.
coupon
Name
}
</
div
>
<
div
className=
{
styles
.
couponType
}
>
{
_row
.
type
Name
}
</
div
>
</
div
>
);
})
...
...
src/pages/transaction/marketingAbility/marketingActivitiesManagement/activePage/fixtures/components/ProductPanel/product.tsx
View file @
0d4af2b5
...
...
@@ -160,7 +160,11 @@ const Product: React.FC<Iprops> = (props: Iprops) => {
</
div
>
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
.
product
}
>
<
img
className=
{
styles
.
img
}
src=
{
productImgUrl
}
/>
{
productImgUrl
&&
(
<
img
className=
{
styles
.
img
}
src=
{
productImgUrl
}
/>
)
||
<
div
className=
{
styles
.
img
}
/>
}
<
div
className=
{
styles
.
info
}
>
<
span
className=
{
styles
.
name
}
>
{
productName
}
</
span
>
<
span
className=
{
styles
.
price
}
>
¥
{
priceFormat
(
price
)
}
</
span
>
...
...
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