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

fix: 修改平台营销活动

parent 51b017ed
...@@ -65,3 +65,18 @@ ...@@ -65,3 +65,18 @@
* 老会员(仅会员用户) * 老会员(仅会员用户)
*/ */
export const SUITABLE_TYPE_OLD_MEMBER = 4; export const SUITABLE_TYPE_OLD_MEMBER = 4;
/**
* 活动参与类型 - 商家报名活动 1
*/
export const AVTIVITY_SIGNUP_MERCHANTREG = 1;
/**
* 活动参与类型 - 平台自建活动 2
*/
export const AVTIVITY_SIGNUP_PLATFORM = 2;
/**
* 活动类型 - 抽奖 10
*/
export const AVTIVITY_TYPE_LOTTERY = 10;
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
import React, { Fragment, useEffect, useState } from 'react'; import React, { Fragment, useEffect, useState } from 'react';
import { history, Prompt } from 'umi'; import { history, Prompt } from 'umi';
import { Form, Button } from 'antd'; import { Form, Button } from 'antd';
import { ACTIVITYTYPEARRAY } from './components/constants';
import PeripheralLayout from '@/components/DetailLayout'; import PeripheralLayout from '@/components/DetailLayout';
import BasicInfoLayout from './components/basicLayout'; import BasicInfoLayout from './components/basicLayout';
import RulesLayout from './components/rulesLayout'; import RulesLayout from './components/rulesLayout';
...@@ -14,7 +13,10 @@ import ApplyMemberLayout from './components/applyMember'; ...@@ -14,7 +13,10 @@ import ApplyMemberLayout from './components/applyMember';
import { useEventEmitter } from '@umijs/hooks'; import { useEventEmitter } from '@umijs/hooks';
import PrizeListLayout from './components/prizeListLayout'; import PrizeListLayout from './components/prizeListLayout';
import { isEmpty } from '@antv/util'; import { isEmpty } from '@antv/util';
import { getMarketingMerchantActivityGetActivityTypeList, getMarketingPlatformActivityDetail, getMarketingPlatformMerchantActivityGetActivityTypeList, postMarketingPlatformActivitySave, postMarketingPlatformActivityUpdate } from '@/services/MarketingV2Api'; import { getMarketingMerchantActivityGetActivityTypeList, getMarketingPlatformActivityDetail, postMarketingPlatformActivitySave, postMarketingPlatformActivityUpdate } from '@/services/MarketingV2Api';
import {
AVTIVITY_TYPE_LOTTERY
} from '@/constants/const/marketing';
const layout: any = { const layout: any = {
colon: false, colon: false,
...@@ -30,25 +32,6 @@ const Link = [ ...@@ -30,25 +32,6 @@ const Link = [
{ id: 'applyMemberLayout', title: '适用会员' }, { id: 'applyMemberLayout', title: '适用会员' },
] ]
// const avtivityTypes = [
// { lable: '特价促销', value: 1 },
// { lable: '直降促销', value: 2 },
// { lable: '折价促销', value: 3 },
// { lable: '满量促销', value: 4 },
// { lable: '满额促销', value: 5 },
// { lable: '赠送促销', value: 6 },
// { lable: '多件促销', value: 7 },
// { lable: '组合促销', value: 8 },
// { lable: '拼团', value: 9 },
// { lable: '抽奖', value: 10 },
// { lable: '砍价', value: 11 },
// { lable: '秒杀', value: 12 },
// { lable: '换购', value: 13 },
// { lable: '预售', value: 14 },
// { lable: '套餐', value: 15 },
// { lable: '试用', value: 16 },
// ]
type objType = { type objType = {
lable: string, lable: string,
value: number value: number
...@@ -317,9 +300,9 @@ const AddedMarketing = (props: any) => { ...@@ -317,9 +300,9 @@ const AddedMarketing = (props: any) => {
form={form} form={form}
{...layout} {...layout}
> >
<BasicInfoLayout form={form} focus$={focus$} isEdit={path === 'edit' ? true : false} /> <BasicInfoLayout avtivityTypes={avtivityTypes} form={form} focus$={focus$} isEdit={path === 'edit' ? true : false} />
<RulesLayout form={form} focus$={focus$} /> <RulesLayout form={form} focus$={focus$} />
{value === 10 && (<PrizeListLayout form={form} prizeList={prizeList} focus$={value} />)} {value === AVTIVITY_TYPE_LOTTERY && (<PrizeListLayout form={form} prizeList={prizeList} focus$={value} />)}
<PartakeUserLayout onGetLevel={handleGetLevel} onSetLevel={memberLevelList} setMemberType={memberType} /> <PartakeUserLayout onGetLevel={handleGetLevel} onSetLevel={memberLevelList} setMemberType={memberType} />
<ShopLayout onGetShopList={handleGetShopList} onSetShopList={shopList} /> <ShopLayout onGetShopList={handleGetShopList} onSetShopList={shopList} />
<ApplyMemberLayout dataView={dataView} getInviteList={getInviteList} /> <ApplyMemberLayout dataView={dataView} getInviteList={getInviteList} />
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import CardLayout from '../card'; import CardLayout from '../card';
import { ACTIVITYTYPEARRAY } from '../constants';
import { Form, Row, Col, Input, Select, Radio, Tooltip, Space, DatePicker } from 'antd'; import { Form, Row, Col, Input, Select, Radio, Tooltip, Space, DatePicker } from 'antd';
import { FormInstance } from 'antd/es/form/Form'; import { FormInstance } from 'antd/es/form/Form';
import { EventEmitter } from '@umijs/hooks/lib/useEventEmitter' import { EventEmitter } from '@umijs/hooks/lib/useEventEmitter'
import moment from 'moment'; import moment from 'moment';
import { QuestionCircleOutlined } from '@ant-design/icons'; import { QuestionCircleOutlined } from '@ant-design/icons';
import { isEmpty } from '@formily/antd/esm/shared';
import {
AVTIVITY_SIGNUP_MERCHANTREG,
AVTIVITY_SIGNUP_PLATFORM,
AVTIVITY_TYPE_LOTTERY
} from '@/constants/const/marketing';
const { Option } = Select; const { Option } = Select;
const text = "商家报名活动指由平台建立的,商家参与的营销活动,平台创建活动后,不设置活动商品,由商家报名参加,活动商品由平台从报名通过的商家商品中选择。平台自建活动为平台单独使用的活动,目前平台自建活动仅支持抽奖活动。" const text = "商家报名活动指由平台建立的,商家参与的营销活动,平台创建活动后,不设置活动商品,由商家报名参加,活动商品由平台从报名通过的商家商品中选择。平台自建活动为平台单独使用的活动,目前平台自建活动仅支持抽奖活动。"
interface BasicInfoProps { interface BasicInfoProps {
/** 活动类型 */
avtivityTypes: any[],
focus$?: EventEmitter<void>, focus$?: EventEmitter<void>,
/** FormInstance */ /** FormInstance */
form?: FormInstance, form?: FormInstance,
...@@ -19,7 +26,7 @@ interface BasicInfoProps { ...@@ -19,7 +26,7 @@ interface BasicInfoProps {
} }
const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => { const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => {
const { focus$, form, isEdit } = props; const { focus$, form, isEdit, avtivityTypes } = props;
const [activitySignUpType, setActivitySignUpType] = useState<Number>(0) const [activitySignUpType, setActivitySignUpType] = useState<Number>(0)
const startTimeDisabled = (current, name) => { const startTimeDisabled = (current, name) => {
...@@ -55,20 +62,20 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => { ...@@ -55,20 +62,20 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => {
}; };
const handleChange = (e, option) => { const handleChange = (e, option) => {
if (e !== 10) { if (e !== AVTIVITY_TYPE_LOTTERY) {
setActivitySignUpType(1) setActivitySignUpType(AVTIVITY_SIGNUP_MERCHANTREG)
form.setFieldsValue({ 'activitySignUpType': 1 }) form.setFieldsValue({ 'activitySignUpType': AVTIVITY_SIGNUP_MERCHANTREG })
} else { } else {
setActivitySignUpType(2) setActivitySignUpType(AVTIVITY_SIGNUP_PLATFORM)
form.setFieldsValue({ 'activitySignUpType': 2 }) form.setFieldsValue({ 'activitySignUpType': AVTIVITY_SIGNUP_PLATFORM })
} }
focus$.emit(option); focus$.emit(option);
} }
useEffect(() => { useEffect(() => {
if (isEdit) { if (isEdit) {
setActivitySignUpType(1); setActivitySignUpType(AVTIVITY_SIGNUP_MERCHANTREG);
form.setFieldsValue({ 'activitySignUpType': 1 }) form.setFieldsValue({ 'activitySignUpType': AVTIVITY_SIGNUP_MERCHANTREG })
} }
}, [isEdit]) }, [isEdit])
...@@ -94,7 +101,7 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => { ...@@ -94,7 +101,7 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => {
rules={[{ required: true, message: '请输入活动名称' }]} rules={[{ required: true, message: '请输入活动名称' }]}
> >
<Select placeholder="请选择活动类型" onChange={handleChange} disabled={isEdit}> <Select placeholder="请选择活动类型" onChange={handleChange} disabled={isEdit}>
{ACTIVITYTYPEARRAY.map((item) => <Option key={'ACTIVITY_TYPE' + item.value} value={item.value}>{item.lable}</Option>)} {!isEmpty(avtivityTypes) && avtivityTypes.map((item) => <Option key={'ACTIVITY_TYPE' + item.value} value={item.value}>{item.lable}</Option>)}
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
...@@ -103,8 +110,8 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => { ...@@ -103,8 +110,8 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => {
rules={[{ required: true, message: '请输入活动名称' }]} rules={[{ required: true, message: '请输入活动名称' }]}
> >
<Radio.Group disabled> <Radio.Group disabled>
<Radio value={1}>商家报名活动</Radio> <Radio value={AVTIVITY_SIGNUP_MERCHANTREG}>商家报名活动</Radio>
<Radio value={2}>平台自建活动</Radio> <Radio value={AVTIVITY_SIGNUP_PLATFORM}>平台自建活动</Radio>
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
</Col> </Col>
...@@ -188,7 +195,7 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => { ...@@ -188,7 +195,7 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => {
</Form.Item> </Form.Item>
</Space> </Space>
</Form.Item> </Form.Item>
{activitySignUpType === 1 && ( {activitySignUpType === AVTIVITY_SIGNUP_MERCHANTREG && (
<Form.Item <Form.Item
label="要求报名时间" label="要求报名时间"
style={{ margin: 0 }} style={{ margin: 0 }}
......
{}
\ No newline at end of file
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