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

fix: 修改叠加活动互斥

parent 82b912ec
......@@ -29,49 +29,75 @@ export const OVERLAYACTIVITYTYPE = (int) => {
case 1:
case 2:
case 3:
return [
{ label: '满量促销', value: 4 },
{ label: '满额促销', value: 5 },
{ label: '赠送促销', value: 6 },
{ label: '换购', value: 13 },
]
return {
B: [
{ label: '满量促销', value: 4 },
{ label: '满额促销', value: 5 },
],
C: [
{ label: '赠送促销', value: 6 },
{ label: '换购', value: 13 },
]
}
case 4:
case 5:
return [
{ label: '特价促销', value: 1 },
{ label: '直降促销', value: 2 },
{ label: '折扣促销', value: 3 },
{ label: '赠送促销', value: 6 },
{ label: '换购', value:13 },
]
return {
A: [
{ label: '特价促销', value: 1 },
{ label: '直降促销', value: 2 },
{ label: '折扣促销', value: 3 },
],
B: [
{ label: '赠送促销', value: 6 },
],
C: [
{ label: '换购', value: 13 },
],
}
case 6:
return [
{ label: '特价促销', value: 1 },
{ label: '直降促销', value: 2 },
{ label: '折扣促销', value: 3 },
{ label: '满量促销', value: 4 },
{ label: '满额促销', value: 5 },
{ label: '多件促销', value: 7 },
{ label: '组合促销', value: 8 },
{ label: '换购', value: 13 },
]
return {
A: [
{ label: '特价促销', value: 1 },
{ label: '直降促销', value: 2 },
{ label: '折扣促销', value: 3 },
],
B: [
{ label: '满量促销', value: 4 },
{ label: '满额促销', value: 5 },
],
C: [
{ label: '多件促销', value: 7 },
{ label: '组合促销', value: 8 },
{ label: '换购', value: 13 },
],
}
case 7:
case 8:
return [
{ label: '赠送促销', value: 6 },
{ label: '换购', value: 13 },
]
return {
B: [
{ label: '赠送促销', value: 6 },
],
C: [
{ label: '换购', value: 13 },
]
}
case 13:
return [
{ label: '特价促销', value: 1 },
{ label: '直降促销', value: 2 },
{ label: '折扣促销', value: 3 },
{ label: '满量促销', value: 4 },
{ label: '满额促销', value: 5 },
{ label: '多件促销', value: 6 },
{ label: '组合促销', value: 7 },
{ label: '换购', value: 8 },
]
return {
A: [
{ label: '特价促销', value: 1 },
{ label: '直降促销', value: 2 },
{ label: '折扣促销', value: 3 },
],
B: [
{ label: '满量促销', value: 4 },
{ label: '满额促销', value: 5 },
],
C: [
{ label: '多件促销', value: 6 },
{ label: '组合促销', value: 7 },
{ label: '换购', value: 8 },
],
}
}
}
/** 超限规则 */
......
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 { EventEmitter } from '@umijs/hooks/lib/useEventEmitter';
import { FormInstance } from 'antd/es/form/Form';
......@@ -28,6 +28,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
const { focus$, form } = props;
const [option, setOption] = useState<optionProps>();
const [ladderType, setLadderType] = useState<number>(1);
const [rejec, setRejec] = useState<any>({});
const handleActivityDefinedBO = (e) => {
const { value } = e.target
......@@ -39,6 +40,18 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
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) => {
switch (int) {
......@@ -60,9 +73,21 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
className={style.rulesLayout}
>
<Checkbox.Group>
{OVERLAYACTIVITYTYPE(int)?.map(item => (
<Checkbox key={item.value} value={item.value}>{item.label}</Checkbox>
))}
{!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.Group>
</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