Commit 043bee1b authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

fix: 修改叠加活动互斥

parent 82b912ec
...@@ -29,49 +29,75 @@ export const OVERLAYACTIVITYTYPE = (int) => { ...@@ -29,49 +29,75 @@ export const OVERLAYACTIVITYTYPE = (int) => {
case 1: case 1:
case 2: case 2:
case 3: case 3:
return [ return {
B: [
{ label: '满量促销', value: 4 }, { label: '满量促销', value: 4 },
{ label: '满额促销', value: 5 }, { label: '满额促销', value: 5 },
],
C: [
{ label: '赠送促销', value: 6 }, { label: '赠送促销', value: 6 },
{ label: '换购', value: 13 }, { label: '换购', value: 13 },
] ]
}
case 4: case 4:
case 5: case 5:
return [ return {
A: [
{ label: '特价促销', value: 1 }, { label: '特价促销', value: 1 },
{ label: '直降促销', value: 2 }, { label: '直降促销', value: 2 },
{ label: '折扣促销', value: 3 }, { label: '折扣促销', value: 3 },
],
B: [
{ label: '赠送促销', value: 6 }, { label: '赠送促销', value: 6 },
{ label: '换购', value:13 }, ],
] C: [
{ label: '换购', value: 13 },
],
}
case 6: case 6:
return [ return {
A: [
{ label: '特价促销', value: 1 }, { label: '特价促销', value: 1 },
{ label: '直降促销', value: 2 }, { label: '直降促销', value: 2 },
{ label: '折扣促销', value: 3 }, { label: '折扣促销', value: 3 },
],
B: [
{ label: '满量促销', value: 4 }, { label: '满量促销', value: 4 },
{ label: '满额促销', value: 5 }, { label: '满额促销', value: 5 },
],
C: [
{ label: '多件促销', value: 7 }, { label: '多件促销', value: 7 },
{ label: '组合促销', value: 8 }, { label: '组合促销', value: 8 },
{ label: '换购', value: 13 }, { label: '换购', value: 13 },
] ],
}
case 7: case 7:
case 8: case 8:
return [ return {
B: [
{ label: '赠送促销', value: 6 }, { label: '赠送促销', value: 6 },
],
C: [
{ label: '换购', value: 13 }, { label: '换购', value: 13 },
] ]
}
case 13: case 13:
return [ return {
A: [
{ label: '特价促销', value: 1 }, { label: '特价促销', value: 1 },
{ label: '直降促销', value: 2 }, { label: '直降促销', value: 2 },
{ label: '折扣促销', value: 3 }, { label: '折扣促销', value: 3 },
],
B: [
{ label: '满量促销', value: 4 }, { label: '满量促销', value: 4 },
{ label: '满额促销', value: 5 }, { label: '满额促销', value: 5 },
],
C: [
{ label: '多件促销', value: 6 }, { label: '多件促销', value: 6 },
{ label: '组合促销', value: 7 }, { label: '组合促销', value: 7 },
{ label: '换购', value: 8 }, { label: '换购', value: 8 },
] ],
}
} }
} }
/** 超限规则 */ /** 超限规则 */
......
import React, { Fragment, useState } from 'react'; import React, { Fragment, useState } from 'react';
import { OVERLAYACTIVITYTYPE, OVERRUNRULETYPE, PROMOTIONTYPE, LADDERBOLIST } from '../constants' import { OVERLAYACTIVITYTYPE, PROMOTIONTYPE, LADDERBOLIST } from '../constants'
import { Form, Checkbox, Radio, Input, Space, Button, DatePicker, Select } from 'antd'; import { Form, Checkbox, Radio, Input, Space, Button, DatePicker, Select } from 'antd';
import { EventEmitter } from '@umijs/hooks/lib/useEventEmitter'; import { EventEmitter } from '@umijs/hooks/lib/useEventEmitter';
import { FormInstance } from 'antd/es/form/Form'; import { FormInstance } from 'antd/es/form/Form';
...@@ -28,6 +28,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => { ...@@ -28,6 +28,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
const { focus$, form } = props; const { focus$, form } = props;
const [option, setOption] = useState<optionProps>(); const [option, setOption] = useState<optionProps>();
const [ladderType, setLadderType] = useState<number>(1); const [ladderType, setLadderType] = useState<number>(1);
const [rejec, setRejec] = useState<any>({});
const handleActivityDefinedBO = (e) => { const handleActivityDefinedBO = (e) => {
const { value } = e.target const { value } = e.target
...@@ -39,6 +40,18 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => { ...@@ -39,6 +40,18 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
form.resetFields(['activityDefined']); form.resetFields(['activityDefined']);
}); });
const rejection = (key: string, num: number) => {
console.log(num, 10086)
const data = { ...rejec };
if (data[key] === num) {
data[key] = null
} else {
data[key] = num
}
setRejec({ ...data })
}
/** 叠加活动类型 */ /** 叠加活动类型 */
const allowActivity = (int = 1) => { const allowActivity = (int = 1) => {
switch (int) { switch (int) {
...@@ -60,9 +73,21 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => { ...@@ -60,9 +73,21 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
className={style.rulesLayout} className={style.rulesLayout}
> >
<Checkbox.Group> <Checkbox.Group>
{OVERLAYACTIVITYTYPE(int)?.map(item => ( {!isEmpty(OVERLAYACTIVITYTYPE(int)?.A) && (
OVERLAYACTIVITYTYPE(int)?.A!.map(item => (
<Checkbox key={item.value} value={item.value} disabled={rejec?.A && item.value !== rejec?.A} onChange={(value) => rejection('A', item.value)}>{item.label}</Checkbox>
))
)}
{!isEmpty(OVERLAYACTIVITYTYPE(int)?.B) && (
OVERLAYACTIVITYTYPE(int)?.B.map(item => (
<Checkbox key={item.value} value={item.value} disabled={rejec?.B && item.value !== rejec?.B} onChange={(value) => rejection('B', item.value)}>{item.label}</Checkbox>
))
)}
{!isEmpty(OVERLAYACTIVITYTYPE(int)?.C) && (
OVERLAYACTIVITYTYPE(int)?.C.map(item => (
<Checkbox key={item.value} value={item.value}>{item.label}</Checkbox> <Checkbox key={item.value} value={item.value}>{item.label}</Checkbox>
))} ))
)}
</Checkbox.Group> </Checkbox.Group>
</Form.Item> </Form.Item>
) )
......
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