Commit 084cb108 authored by GuanHua's avatar GuanHua
parents fe084a88 e8d405f4
......@@ -105,8 +105,8 @@ const CouponsDrawer: React.FC<CouponsDrawerProps> = (props: CouponsDrawerProps)
key: 'belongName',
render: (text: any, record: any) => (
<Space direction='vertical'>
<StatusTag title={record.type === 1 ? '平台' : '商家'} type={record.type === 1 ? 'success' : 'primary'} />
{record.type === 2 && <Typography.Text type='secondary'>{text}</Typography.Text>}
<StatusTag title={record.belongType === 1 ? '平台' : '商家'} type={record.belongType === 1 ? 'success' : 'primary'} />
{record.belongType === 2 && <Typography.Text type='secondary'>{text}</Typography.Text>}
</Space>
)
},
......
......@@ -29,7 +29,8 @@ const MarketingSwitch: React.FC<MarketingSwitchProps> = (props: any) => {
let _pageConfig: any = { ...pageConfig }
const _marketingConfig = MarketingConfigs[`marketingConfig_${type}`];
_pageConfig = cloneDeep({ ..._pageConfig, ..._marketingConfig });
_pageConfig['0'].childNodes?.push(`11-${type}`);
const _insertIndex = _pageConfig['0'].childNodes.indexOf('10');
_pageConfig['0'].childNodes?.splice(_insertIndex, 0, `11-${type}`);
updatePageConfig(_pageConfig);
} else {
const _type = `11-${type}`;
......
.treeSelect {
.treeSelect_category {
border: 1px solid #EDEEEF;
border-radius: 4px;
font-size: 12px;
color: #252D37;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
padding: 8px;
margin-bottom: 8px;
cursor: pointer;
span{
margin-right: 8px;
}
}
.treeSelect_category_active{
background-color: rgba(0,169,143,0.08);
border-color: #00A98F;
}
.treeSelect_category_level2 {
border: 1px solid #EDEEEF;
border-radius: 4px;
font-size: 12px;
color: #252D37;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
padding: 8px 8px 8px 16px;
margin-bottom: 8px;
cursor: pointer;
span{
margin-right: 8px;
}
}
.treeSelect_category_level3 {
border: 1px solid #EDEEEF;
border-radius: 4px;
font-size: 12px;
color: #252D37;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
padding: 8px 8px 8px 24px;
margin-bottom: 8px;
cursor: pointer;
span{
margin-right: 8px;
}
}
}
import React, { useCallback } from 'react';
import { Button } from 'antd';
import { CaretDownOutlined, CaretRightOutlined, PlusOutlined, PictureOutlined } from '@ant-design/icons';
import cx from 'classnames';
import { cloneDeep } from 'lodash';
import { selectComponent, PageConfigType, PropsType, ChildNodesType, SelectedInfoBaseType, SelectedInfoType, clearSelectedStatus, STATE_PROPS, createActions } from '@lingxi-disign/core';
import { useSelector } from '@lingxi-disign/react';
import styles from './index.less';
interface TreeSelectProps {
config: any,
changePageConfig: (config) => void,
pageConfig: PageConfigType
}
type SettingPanelType = {
selectedInfo: SelectedInfoType,
pageConfig: PageConfigType
}
const ControlUpdate = () => true;
const TreeSelect: React.FC<TreeSelectProps> = (props: any) => {
const { config, changePageConfig, pageConfig } = props;
const { selectedInfo } = useSelector<SettingPanelType, STATE_PROPS>(['selectedInfo']);
const _handleActive = (key: string, isActive: boolean) => {
console.log(pageConfig)
let _pageConfig: any = cloneDeep(pageConfig);
_pageConfig[key].isActive = !isActive;
changePageConfig(_pageConfig);
setTimeout(() => {
_handleSelectComponent(key)
}, 1000)
}
const _handleSelectComponent = (key: string | undefined) => {
if (!key) return;
if (!selectedInfo || selectedInfo.selectedKey !== key) {
const specialProps: SelectedInfoBaseType = {
parentKey: "0",
key,
domTreeKeys: ["0", key],
};
selectComponent(specialProps);
} else {
clearSelectedStatus();
}
};
const _handleAddComponent = (parentKey: string, level: number) => {
let _pageConfig: any = cloneDeep(pageConfig);
const _key = `${parentKey}-${new Date().getTime()}`;
const _props = {
key: _key,
title: '顶部导航1',
canEdit: true,
canHide: false,
componentName: "MobileHeaderNav",
componentType: "mobileHeaderNav",
level: 2,
props: {}
}
_pageConfig[parentKey].childNodes ? _pageConfig[parentKey].childNodes.push(_key) : _pageConfig[parentKey].childNodes = [_key];
_pageConfig[parentKey].props.dataList ? _pageConfig[parentKey].props.dataList.push(_props) : _pageConfig[parentKey].props.dataList = [_props];
_pageConfig[_key] = _props;
console.log(_pageConfig)
createActions({type: 'resetPageConfig',payload: {..._pageConfig}})
changePageConfig(_pageConfig);
}
const _render = (item: any) => {
if (item.componentName != 'MallLayout') {
if (item.level === 1) {
return (
<div key={item.key}>
<div className={cx(styles.treeSelect_category, item.isActive ? styles.treeSelect_category_active : {})} onClick={() => { _handleActive(item.key, item.isActive) }}>
{item.isActive ? <CaretRightOutlined /> : <CaretDownOutlined />} {item.title}
</div>
{item.isActive ? (<div>
{item.props.dataList.map((child) => _render(child))}
<Button type="dashed" block icon={<PlusOutlined />} onClick={() => { _handleAddComponent(item.key, item.level) }}>{item.addButton}</Button>
</div>) : null}
</div>
)
} else if (item.level === 2) {
if (item.isCategory) {
return (
<div key={item.key}>
<div className={cx(styles.treeSelect_category_level2, item.isActive ? styles.treeSelect_category_active : {})} onClick={() => { _handleActive(item.key, item.isActive) }}>
{item.isActive ? <CaretRightOutlined /> : <CaretDownOutlined />} {item.title}
</div>
{item.isActive ? (<div>
{item.props.dataList.map((child) => _render(child))}
<Button type="dashed" block icon={<PlusOutlined />} onClick={() => { _handleAddComponent(item.key, item.level) }}>{item.addButton}</Button>
</div>) : null}
</div>
)
} else {
return (
<div key={item.key}>
<div className={cx(styles.treeSelect_category_level2, item.isActive ? styles.treeSelect_category_active : {})} onClick={() => { _handleActive(item.key, item.isActive) }}>
<PictureOutlined /> {item.title}
</div>
</div>
)
}
} else {
return (
<div key={item.key}>
<div className={cx(styles.treeSelect_category_level3, item.isActive ? styles.treeSelect_category_active : {})} onClick={() => { _handleActive(item.key, item.isActive) }}>
<PictureOutlined /> {item.title}
</div>
</div>
)
}
}
return null
}
return (
<div className={styles.treeSelect}>
{config.map((item) => _render(item))}
</div>
);
}
export default TreeSelect;
......@@ -168,6 +168,7 @@ export const marketingConfig_2 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 2,
},
......@@ -202,6 +203,7 @@ export const marketingConfig_3 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 4,
exType: 1
......@@ -229,7 +231,7 @@ export const marketingConfig_4 = {
componentName: 'MarketingCard.Header',
componentType: PROPS_SETTING_TYPES.marketingCardHeader,
props: {
type: 3,
type: 4,
},
},
'11-4-2': {
......@@ -237,8 +239,9 @@ export const marketingConfig_4 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 4,
type: 3,
},
childNodes: [],
childComponentName: 'MarketingCard.GoodsItem',
......@@ -263,8 +266,7 @@ export const marketingConfig_5 = {
componentName: 'MarketingCard.Header',
componentType: PROPS_SETTING_TYPES.marketingCardHeader,
props: {
type: 4,
exType: 2
type: 5
},
},
'11-5-2': {
......@@ -272,8 +274,10 @@ export const marketingConfig_5 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 5,
type: 4,
exType: 2
},
childNodes: [],
childComponentName: 'MarketingCard.GoodsItem',
......@@ -306,6 +310,7 @@ export const marketingConfig_6 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 5,
exType: 1
......@@ -333,8 +338,7 @@ export const marketingConfig_7 = {
componentName: 'MarketingCard.Header',
componentType: PROPS_SETTING_TYPES.marketingCardHeader,
props: {
type: 5,
exType: 2
type: 7,
},
},
'11-7-2': {
......@@ -342,8 +346,10 @@ export const marketingConfig_7 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 7,
type: 5,
exType: 2
},
childNodes: [],
childComponentName: 'MarketingCard.GoodsItem',
......@@ -368,7 +374,7 @@ export const marketingConfig_8 = {
componentName: 'MarketingCard.Header',
componentType: PROPS_SETTING_TYPES.marketingCardHeader,
props: {
type: 6,
type: 8,
},
},
'11-8-2': {
......@@ -376,8 +382,9 @@ export const marketingConfig_8 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 8,
type: 6,
},
childNodes: [],
childComponentName: 'MarketingCard.GoodsItem',
......@@ -411,7 +418,9 @@ export const marketingConfig_9 = {
canHide: false,
componentName: 'MarketingCard.CommonContainer',
props: {
type: 9,
type: 6,
span: 10,
containerScorll: true
},
childNodes: [],
childComponentName: 'MarketingCard.CouponsItem',
......@@ -436,7 +445,7 @@ export const marketingConfig_10 = {
componentName: 'MarketingCard.Header',
componentType: PROPS_SETTING_TYPES.marketingCardHeader,
props: {
type: 7,
type: 10,
},
},
'11-10-2': {
......@@ -444,8 +453,9 @@ export const marketingConfig_10 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 10,
type: 7,
},
childNodes: [],
childComponentName: 'MarketingCard.GoodsItem',
......@@ -469,7 +479,7 @@ export const marketingConfig_11 = {
title: '标题栏',
componentName: 'MarketingCard.Header',
props: {
type: 8,
type: 11,
},
},
'11-11-2': {
......@@ -477,8 +487,9 @@ export const marketingConfig_11 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 11,
type: 8,
},
childNodes: [],
childComponentName: 'MarketingCard.GoodsItem',
......@@ -511,6 +522,7 @@ export const marketingConfig_12 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 12,
},
......@@ -577,6 +589,7 @@ export const marketingConfig_14 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 13,
exType: 1
......@@ -611,6 +624,7 @@ export const marketingConfig_15 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 13,
exType: 2
......@@ -645,6 +659,7 @@ export const marketingConfig_16 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 14,
},
......@@ -678,6 +693,7 @@ export const marketingConfig_17 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 16,
},
......@@ -787,8 +803,9 @@ export const marketingConfig_19 = {
canEdit: true,
canHide: false,
componentName: 'MarketingCard.CommonContainer',
maxLength: 3,
props: {
type: 10,
type: 11,
},
childNodes: [],
childComponentName: 'MarketingCard.GoodsItem',
......
......@@ -14,13 +14,13 @@ import styles from './index.less';
interface MarketingCardCouponProps {
id?: number,
type?: number,
belongType?: number,
// 当前选中组件的key
selectedKey?: any,
}
const MarketingCardCoupon: React.FC<MarketingCardCouponProps> = (props: MarketingCardCouponProps) => {
const { id, type, selectedKey } = props;
const { id, belongType, selectedKey } = props;
const [drawerVisible, setDrawerVisible] = useState(false);
const [record, setRecord] = useState<any>();
const _onClose = () => {
......@@ -28,15 +28,17 @@ const MarketingCardCoupon: React.FC<MarketingCardCouponProps> = (props: Marketin
}
useEffect(() => {
if (id && id != record?.id) {
PublicApi.postMarketingCouponPlatformActivityPageSelectDetail({ couponList: [{ couponType: type, id: id }] }).then((res) => {
PublicApi.postMarketingCouponPlatformActivityPageSelectDetail({ couponList: [{ couponType: belongType, id: id }] }).then((res) => {
if (res.code === 1000) {
setRecord(res.data[0]);
}else{
setRecord('')
}
}).catch(err => console.log(err))
}).catch(_ => setRecord(''))
}else if(!id){
setRecord('');
}
}, [id, type])
}, [id, belongType])
const _onChooseConfirm = (record) => {
setRecord(record);
changeProps({
......
......@@ -88,6 +88,7 @@
flex-direction: row;
align-items: center;
justify-content: center;
margin-bottom: 8px;
img {
width: 24px;
......
......@@ -20,12 +20,13 @@ import styles from './index.less';
interface SuggestProductCommodityProps {
id?: any,
actType?: any,
exType?: any
// 当前选中组件的key
selectedKey?: any
}
const SuggestProductCommodity: React.FC<SuggestProductCommodityProps> = (props: SuggestProductCommodityProps) => {
const { id, actType, selectedKey } = props;
const { id, actType, exType, selectedKey } = props;
const { query: { shopId } }: any = history.location
const [record, setRecord] = useState<any>([]);
......@@ -48,7 +49,8 @@ const SuggestProductCommodity: React.FC<SuggestProductCommodityProps> = (props:
...params,
shopId
};
const isWithActivityType = actType ? { ...common, activityType: actType } : common;
// const isWithActivityType = actType ? { ...common, activityType: actType } : common;
const isWithActivityType = common;
return await PublicApi.getMarketingPlatformActivityListAdorn(isWithActivityType as any);
};
......@@ -56,10 +58,54 @@ const SuggestProductCommodity: React.FC<SuggestProductCommodityProps> = (props:
setRecord(data);
const _data = data[0];
let _exData;
switch (1) {
switch (actType) {
case 1:
_exData = { ..._data, img: _data.productImgUrl, originalPrice: priceFormat(_data.price), discountPrice: priceFormat(_data.activityPrice), isnull: false }
break;
case 2:
_exData = { ..._data, img: _data.productImgUrl, info: '直降60元', originalPrice: priceFormat(_data.price), discountPrice: priceFormat(_data.activityPrice), isnull: false }
break;
case 3:
_exData = { ..._data, img: _data.productImgUrl, info: '5折起', originalPrice: priceFormat(_data.price), discountPrice: priceFormat(_data.activityPrice), isnull: false }
break;
case 4:
if (exType === 1) {
_exData = { ..._data, img: _data.productImgUrl, info: '满3件减50', originalPrice: priceFormat(_data.price), discountPrice: priceFormat(_data.activityPrice), isnull: false }
} else {
_exData = { ..._data, img: _data.productImgUrl, info: '满3件8折', discountPrice: priceFormat(_data.activityPrice), isnull: false }
}
break;
case 5:
if (exType === 1) {
_exData = { ..._data, img: _data.productImgUrl, info: '满100减10', originalPrice: priceFormat(_data.price), discountPrice: priceFormat(_data.activityPrice), isnull: false }
} else {
_exData = { ..._data, img: _data.productImgUrl, info: '满100打5折', originalPrice: priceFormat(_data.price), discountPrice: priceFormat(_data.activityPrice), isnull: false }
}
break;
case 6:
_exData = { ..._data, img: _data.productImgUrl, info: `原价${_data.price}元`, isnull: false }
break;
case 7:
_exData = { ..._data, img: _data.productImgUrl, info: `第2件5折`, originalPrice: priceFormat(_data.price), discountPrice: priceFormat(_data.activityPrice), isnull: false }
break;
case 8:
_exData = { ..._data, img: _data.productImgUrl, info: `99元4件`, discountPrice: priceFormat(_data.activityPrice), isnull: false }
break;
case 11:
_exData = { ..._data, img: _data.productImgUrl, info: `已送出 186 件`, discountPrice: priceFormat(_data.activityPrice), isnull: false }
break;
case 12:
_exData = { ..._data, img: _data.productImgUrl, direction: 'column', originalPrice: priceFormat(_data.price), discountPrice: priceFormat(_data.activityPrice), isnull: false }
break;
case 13:
_exData = { ..._data, img: _data.productImgUrl, info: `加20元换购`, isnull: false }
break;
case 14:
_exData = { ..._data, img: _data.productImgUrl, info: `10元抵100`, originalPrice: priceFormat(_data.price), discountPrice: priceFormat(_data.activityPrice), isnull: false }
break;
case 16:
_exData = { ..._data, img: _data.productImgUrl, info: `已送出 186 件`, originalPrice: priceFormat(_data.price), discountPrice: priceFormat(_data.activityPrice), isnull: false }
break;
default:
break;
}
......
......@@ -29,6 +29,7 @@
&>img {
width: 40px;
height: 40px;
border-radius: 50%;
}
&-add {
......
......@@ -54,7 +54,8 @@ const PropsSettings: React.FC<PropsSettingsPropsType> = (props) => {
case PROPS_SETTING_TYPES.marketingCardGood:
const _parentKey: any = parentKey;
const _type = pageConfig?.[_parentKey]?.props?.type;
return <MarketingCardGood {..._props} actType={_type} />
const _exType = pageConfig?.[_parentKey]?.props?.exType;
return <MarketingCardGood {..._props} actType={_type} exType={_exType} />
case PROPS_SETTING_TYPES.bottomNavigationItems:
return <BottomNavigationClient {..._props} />
case PROPS_SETTING_TYPES.couponsModal:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment