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

fix: 修改营销活动BUG

parent 4fef721e
......@@ -28,7 +28,7 @@ const ProgressLayout: React.FC<ProgressProps> = (props: any) => {
useEffect(() => {
if (!isEmpty(context)) {
console.log(context)
console.log(context, 10086)
setLogStatesStatus(context.externalLogStates ? LOGSTATESTYPE.EXTERNALSTATES : LOGSTATESTYPE.INTERIORSTATES)
setData(context)
}
......
......@@ -33,10 +33,12 @@ interface AddedFormLayoutProps {
title?: string,
/** 二次询价 */
two?: boolean,
/** 二次询价地址显示 */
isDefault?: boolean
}
const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
const { isEdit, id, fetchRequest, spam, title, two, shopId } = props;
const { isEdit, id, fetchRequest, spam, title, two, shopId, isDefault } = props;
const [form] = Form.useForm();
const [loading, setLoading] = useState<boolean>(false)
const [unsaved, setUnsaved] = useState<boolean>(false);
......@@ -314,7 +316,7 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
>
<BasicInfoLatyout getMemberInfo={getMemberInfo} memb={memberInfo} isEdit={spam || two} />
<InquiryProductLayout isEdit={two} form={form} getInquiryProduct={getInquiryProduct} member={memberInfo} setInquiryProduct={inquiryProduct} />
<TradeTermsLayout isEdit getFullAddress={getFullAddress} getContacts={getContacts} fullAddress={fullAddress} />
<TradeTermsLayout isEdit={isEdit} isDefault={isDefault} getFullAddress={getFullAddress} getContacts={getContacts} fullAddress={fullAddress} />
<AttachLayout enclosureUrls={enclosureUrls} getEnclosureUrls={getEnclosureUrls} removeEnclosureUrls={removeEnclosureUrls} />
</Form>
}
......
......@@ -25,10 +25,12 @@ interface TradeTermsLayoutProps {
fullAddress?: any,
/** 二次询价 */
isEdit?: boolean,
/** 二次询价地址显示 */
isDefault?: boolean
}
const TradeTermsLayout: React.FC<TradeTermsLayoutProps> = (props: any) => {
const { getFullAddress, getContacts, fullAddress, isEdit } = props;
const { getFullAddress, getContacts, fullAddress, isEdit, isDefault } = props;
const [visible, setVisible] = useState<boolean>(false)
const [address, setaddress] = useState<any>({});
const [telCode, setTelCode] = useState<any>([]);
......@@ -105,9 +107,12 @@ const TradeTermsLayout: React.FC<TradeTermsLayoutProps> = (props: any) => {
setaddress({
id: fullAddress.fullAddressId,
})
console.log(fullAddress)
}
}, [fullAddress])
console.log(isEdit, 10086)
return (
<Card
id="tradeTermsLayout"
......@@ -124,9 +129,8 @@ const TradeTermsLayout: React.FC<TradeTermsLayoutProps> = (props: any) => {
</Form.Item>
<Form.Item label='交付地址' className={style.address_style}>
<AddressSelect
echo={isEdit}
extra={fullAddress.fullAddress}
value={address}
echo={isDefault}
value={isDefault ? fullAddress.fullAddress : address}
isDefaultAddress
addressType={1}
disabled={false}
......
......@@ -10,6 +10,7 @@ const RfqEnquiryOrder = (props: any) => {
<AddForm
id={id}
isEdit
isDefault
title={props.route.name}
fetchRequest={postTransactionInquiryListAdd}
two
......
......@@ -3,6 +3,7 @@ import { Space, Tooltip, Typography } from 'antd';
import StatusTag from '@/components/StatusTag';
import { format } from '@/pages/transaction/common/dateFormat';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { isEmpty } from 'lodash';
/** * 活动类型 */
export enum ACTIVITYTYPE {
/** 特价促销 */
......@@ -191,7 +192,7 @@ export const GeneralEffect = (int, data) => {
col: [
{
label: '优惠规则', extra: <Space direction='vertical'>
{data.ladderList.map(item => (<div>{`满 ${item.discount} 件, 打 ${item.num / 10} 折`}</div>))}
{!isEmpty(data.ladderList) && data.ladderList.map(item => (<div>{`满 ${item.num} 件, 打 ${item.discount / 10} 折`}</div>))}
</Space>
},
{
......
......@@ -96,7 +96,7 @@ const ActivityUserLayout: React.FC<ActivityUserLayoutProps> = (props: any) => {
<Col span={6}>
<div className={style.cell}>
<h5 className={style.label}>会员角色: </h5>
<h5 className={style.content}>{item.roleTypeName}</h5>
<h5 className={style.content}>{item.roleName}</h5>
</div>
</Col>
<Col span={6}>
......
......@@ -84,7 +84,7 @@ const DetialLayout = () => {
let interiorLogStates: any = [];
let externalLogs: any = [];
let interiorLogs: any = [];
data.outerTaskList.forEach((item: any) => {
(data.outerTaskList || []).forEach((item: any) => {
externalLogStates.push({
state: item.step,
stateName: null,
......@@ -92,9 +92,9 @@ const DetialLayout = () => {
operationalProcess: item.taskName,
roleName: item.roleName,
})
data.externalLogStates = externalLogStates;
})
data.innerTaskList.forEach((item: any) => {
data.externalLogStates = externalLogStates;
(data.innerTaskList || []).forEach((item: any) => {
interiorLogStates.push({
state: item.step,
stateName: null,
......@@ -102,9 +102,9 @@ const DetialLayout = () => {
operationalProcess: item.taskName,
roleName: item.roleName,
})
data.interiorLogStates = interiorLogStates;
})
data.outerRecordDOList.forEach((item: any, index: number) => {
data.interiorLogStates = interiorLogStates;
(data.outerRecordDOList || []).forEach((item: any, index: number) => {
externalLogs.push({
operation: item.operate,
createTime: item.operateTime,
......@@ -115,9 +115,9 @@ const DetialLayout = () => {
state: item.status,
step: index,
})
data.externalLogs = externalLogs;
})
data.innerRecordDOList.forEach((item: any, index: number) => {
data.externalLogs = externalLogs;
(data.innerRecordDOList || []).forEach((item: any, index: number) => {
interiorLogs.push({
auditOpinion: item.opinion,
createMemberId: item.memberId,
......@@ -135,8 +135,8 @@ const DetialLayout = () => {
state: item.step,
step: item.step,
})
data.interiorLogs = interiorLogs;
})
data.interiorLogs = interiorLogs;
setAllusers([
{
title: '适用用户',
......
......@@ -241,7 +241,6 @@ const AddedMarketing = () => {
})
}, [])
return (
<Fragment>
<PeripheralLayout
......
......@@ -7,7 +7,7 @@ import { MinusOutlined, PlusOutlined } from '@ant-design/icons';
import moment from 'moment';
import style from './index.less';
import CardLayout from '../card';
import { OVERLAYACTIVITYTYPE, OVERRUNRULETYPE, PROMOTIONTYPE, LADDERBOLIST } from '../../constants';
import { OVERLAYACTIVITYTYPE, PROMOTIONTYPE, LADDERBOLIST } from '../../constants';
interface RulesLayoutProps {
/** umi-hooks */
......@@ -29,6 +29,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
......@@ -40,6 +41,17 @@ 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) {
......@@ -61,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>
)
......@@ -501,7 +525,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
name={['activityDefined', 'assembleNum']}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^-?[0-2][1-9]\d*$/;
const pattern = /^\+?[1-9]\d*$/;
if (!value) {
return Promise.reject(new Error('请输入成团人数'));
}
......@@ -542,7 +566,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
initialValue={24}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^(0?\.[1-9]|1\d|2[0-3])(\.\d{1,1})?$/;
const pattern = /^(0?\.[1-9]|1\d|2[0-4])(\.\d{1,1})?$/;
if (!value) {
return Promise.reject(new Error('请输入成团时间'));
}
......
/**
* 活动类型
*/
type activityType = {
type activityType = {
lable: string,
value: number,
}[]
......@@ -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 },
],
}
}
}
/** 超限规则 */
......@@ -136,23 +162,23 @@ export const PROMOTIONTYPE = (int) => {
}
}
/** 满量/额减 */
export const LADDERBOLIST = (int, type=1) => {
export const LADDERBOLIST = (int, type = 1) => {
switch (Number(int)) {
case 4:
return {
tooltip: type === 1 ? '优惠金额为最后订单总额减去的优惠金额' : '折扣为最后订单总额的折扣,输入数字,如85折,输入85,9折输入90',
label: `满量${type ===1 ? '减' : '折'}`,
message: `请新增满量${type ===1 ? '减' : '折'}`,
addon: '数量' ,
label: `满量${type === 1 ? '减' : '折'}`,
message: `请新增满量${type === 1 ? '减' : '折'}`,
addon: '数量',
addonAfter: type === 1 ? '减' : '打',
addonBefore: type === 1 ? '元' : '折',
}
case 5:
return {
tooltip: type === 1 ? '优惠金额为最后订单总额减去的优惠金额' : '折扣为最后订单总额的折扣,输入数字,如85折,输入85,9折输入90',
label: `满额${type ===1 ? '减' : '折'}`,
message: `请新增满额${type ===1 ? '减' : '折'}`,
addon: '元' ,
label: `满额${type === 1 ? '减' : '折'}`,
message: `请新增满额${type === 1 ? '减' : '折'}`,
addon: '元',
addonAfter: type === 1 ? '减' : '打',
addonBefore: type === 1 ? '元' : '折',
}
......
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