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

feat: 营销活动执行

parent 12a186ae
......@@ -6,12 +6,14 @@ import style from './index.less';
export interface BasicInfoProps {
effect?: any,
/** 栅格 */
span?: number
}
const count = 0;
const BasicLayout: React.FC<BasicInfoProps> = (props: any) => {
const { effect } = props;
const { effect, span } = props;
return (
<Card
......@@ -20,7 +22,7 @@ const BasicLayout: React.FC<BasicInfoProps> = (props: any) => {
>
<Row gutter={[8, 8]}>
{effect.length > count && effect.map((item, index) => (
<Col key={`effect_${index + 1}`} span={8}>
<Col key={`effect_${index + 1}`} span={span}>
{ item.col.map((it, idx) => (
<div className={style.cell} key={`effect_col_${idx + 1}`}>
<h5 className={style.label}>{it.label}: </h5>
......@@ -33,5 +35,7 @@ const BasicLayout: React.FC<BasicInfoProps> = (props: any) => {
</Card>
)
}
BasicLayout.defaultProps = {
span: 8,
}
export default BasicLayout
......@@ -15,12 +15,14 @@ export interface GeneraInfoProps {
extra?: ReactNode,
/** 是否开启没数据不显示字段 */
visible?: boolean,
/** 栅格 */
span?: number
}
const count = 0;
const GeneralLayout: React.FC<GeneraInfoProps> = (props: any) => {
const { effect, anchor, title, extra, visible } = props;
const { effect, anchor, title, extra, visible, span } = props;
return (
<Card
......@@ -30,7 +32,7 @@ const GeneralLayout: React.FC<GeneraInfoProps> = (props: any) => {
>
<Row gutter={[8, 8]}>
{effect.length > count && effect.map((item, index) => (
<Col key={`effect_${index + 1}`} span={8}>
<Col key={`effect_${index + 1}`} span={span}>
{item.col.map((it, idx) => (
<Fragment key={`effect_col_${idx + 1}`}>
{visible ? <>
......@@ -56,5 +58,7 @@ const GeneralLayout: React.FC<GeneraInfoProps> = (props: any) => {
</Card>
)
}
GeneralLayout.defaultProps = {
span: 8
}
export default GeneralLayout
......@@ -51,11 +51,13 @@ interface Iprops {
onClose: () => void,
onOk: (selectRow: number[] | string[], selectedRows: { [key: string]: any }[]) => void,
/** customKey */
customKey?: string
customKey?: string,
/** 宽度 */
width?: number
}
const TableModal: React.FC<Iprops> = (props: Iprops) => {
const { title, visible, schema, columns, effects, tableProps, mode, expressionScope, fetchData, onClose, onOk, value, format, customizeRadio, modalType, footer, customKey } = props;
const { title, visible, schema, columns, effects, tableProps, mode, expressionScope, fetchData, onClose, onOk, value, format, customizeRadio, modalType, footer, customKey, width } = props;
const ref = useRef<any>({});
const [rowSelection, RowCtl] = useRowSelectionTable({ type: customizeRadio && mode === 'radio' ? 'checkbox' : mode, customKey: customKey });
const isFirstLoad = useRef<boolean>(true);
......@@ -120,7 +122,7 @@ const TableModal: React.FC<Iprops> = (props: Iprops) => {
onClose={handleOnClose}
onCancel={handleOnClose}
// onOk={handleOk}
width={900}
width={width}
{...otherProps}
>
<StandardTable
......@@ -168,7 +170,8 @@ TableModal.defaultProps = {
format: null,
customizeRadio: false,
modalType: "Modal",
footer: null
footer: null,
width: 900
}
export default TableModal;
export const OuterStatusColor = (type) => {
switch (type) {
case 1:
case 2:
case 3:
case 6:
return 'warning'
case 4:
return 'success'
case 5:
return 'error'
case 7:
return 'processing'
default:
return 'default'
}
}
export const InnerStatusColor = (type) => {
switch (type) {
case 1:
case 2:
case 4:
case 6:
return 'warning'
case 3:
case 5:
return 'error'
case 7:
return 'processing'
case 9:
return 'success'
default:
return 'default'
}
}
/** 平台营销活动执行 */
import React from 'react';
import { useIntl } from 'umi';
import { Button, Tag, Typography } from 'antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { format } from '@/constants/dateFormat';
import { ColumnType } from 'antd/lib/table/interface';
import { getMarketingAbilityActivityExecutePlatformPage } from '@/services/MarketingV2Api';
import TableLayout from '@/components/TableLayout';
import { OuterStatusColor } from '../../common/tagColor';
import { PATTERN_MAPS } from '@/constants/regExp';
const Search = () => {
const intl = useIntl();
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'id',
render: (text) => <Button type='link' style={{ padding: 0 }}>{text}</Button>
},
{
title: '活动名称',
dataIndex: 'activityName',
},
{
title: '活动类型',
dataIndex: 'activityTypeName',
},
{
title: '活动开始时间',
dataIndex: 'startTime',
render: (text) => format(text)
},
{
title: '活动结束时间',
dataIndex: 'endTime',
render: (text) => format(text)
},
{
title: '参与客户数',
dataIndex: 'customerCount',
},
{
title: '已执行订单单数',
dataIndex: 'orderCount',
},
{
title: '已执行订单金额',
dataIndex: 'orderAmount',
render: (text) => (
<Typography.Text>{Number(text).toFixed(2)}</Typography.Text>
)
},
{
title: '外部状态',
dataIndex: 'statusName',
render: (text, _) => (
<Tag color={OuterStatusColor(_.status)}>{text}</Tag>
)
},
{
title: '操作',
dataIndex: 'opertion',
render: (text, _) => (
<Button type='link'>查看</Button>
)
}
]
const MarketingExecute = () => {
return (
<div>123</div>
)
<TableLayout
columns={columns}
effects="id"
fetch={getMarketingAbilityActivityExecutePlatformPage}
schema={{
type: 'object',
properties: {
mageLayout: {
type: "object",
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
justifyContent: 'space-between'
}
},
properties: {
id: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '活动ID'
},
'x-rules': [
{
pattern: PATTERN_MAPS.quantity,
message: '请输入ID',
},
],
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'Flex-Layout',
"x-component-props": {
rowStyle: {
justifyContent: "flex-start",
flexWrap: "nowrap"
},
colStyle: {//改变间隔
marginRight: 20
}
},
properties: {
activityName: {
type: 'string',
'x-component-props': {
placeholder: '活动名称',
allowClear: true,
style: {
width: 160,
},
},
},
'[startTime,endTime]': {
type: 'daterange',
'x-component-props': {
placeholder: ['开始时间', '结束时间'],
allowClear: true,
style: {
width: 240,
},
},
},
activityType: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '活动类型',
allowClear: true,
style: {
width: 160,
},
},
},
outerStatus: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '外部状态',
allowClear: true,
style: {
width: 160,
},
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
}}
/>
);
}
export default MarketingExecute;
export default Search;
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