Commit 601a0239 authored by tjy's avatar tjy

对接 会员审核

parent 69a28b1d
......@@ -80,6 +80,7 @@ const memberAbility =
{
path: '/memberAbility/manage/memberUpgradeRule',
name: 'memberUpgradeRule',
hidePageHeader: true,
component: '@/pages/member/memberUpgradeRule/index',
},
{
......
......@@ -61,6 +61,10 @@ const CardCheckBox = (props) => {
const value: number[] = props.value || []
const handleChange = (id) => {
// 如果处于不可编辑状态, 则无法选择
if (!props.editable) {
return false
}
if (value.includes(id)) {
const newValue = findItemAndDelete(value, id)
props.mutators.change(newValue)
......
import React from 'react'
const Children = ({props}) => {
const children = props["x-component-props"] ? props["x-component-props"].children : null
return children
}
Children.defaultProps = {}
Children.isFieldComponent = true;
export default Children
\ No newline at end of file
import React from 'react'
import styled from 'styled-components'
const CircleBox = (props) => {
return (
<div className='form-circle-box'>
{props.value}
</div>
)
}
CircleBox.defaultProps = {}
CircleBox.isFieldComponent = true;
export default CircleBox
\ No newline at end of file
import React, { useState, useEffect, useRef } from 'react';
import { Row, Col, Input, Button, Modal } from 'antd';
import { LinkOutlined } from '@ant-design/icons';
import styled from 'styled-components';
import cx from 'classnames';
import { StandardTable } from 'god';
import NiceForm from '@/components/NiceForm';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
const formActions = createFormActions();
const RowStyleLayout = styled(props => <div {...props} />)`
width: 100%;
.relevance {
border-color: #6b778c;
background-color: #6b778c;
}
`;
const data = [
{
key: '1',
role: '采购商',
businessType: '采购',
roleType: '服务消费',
memberType: '企业会员',
},
{
key: '2',
role: '供应商',
businessType: '商品供应',
roleType: '服务提供',
memberType: '企业会员',
},
];
// 模拟请求
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords);
setTimeout(() => {
resolve({
code: 200,
message: '',
data: queryResult ? [queryResult] : data,
});
}, 1000);
});
};
const Relevance = props => {
const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]);
const [visible, setVisible] = useState(false);
const propsParams = props.props['x-component-props'];
useEffect(() => {
console.log('props', propsParams);
}, []);
const handlePreview = () => {
setVisible(!visible);
};
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {},
};
const handleSubmit = type => {
if (type === 'confirm') {
} else {
}
setVisible(false);
};
return (
<RowStyleLayout>
<Row>
<Col span={16}>
<Input disabled></Input>
</Col>
<Col span={8}>
<Button
type="primary"
className="relevance"
icon={<LinkOutlined />}
onClick={handlePreview}
>
关联
</Button>
</Col>
</Row>
<Modal
title={propsParams.modalTitle || ''}
visible={visible}
width={propsParams.modalWidth || ''}
destroyOnClose
onOk={() => handleSubmit('confirm')}
onCancel={() => handleSubmit('cancel')}
>
<StandardTable
columns={propsParams.modalColumns}
currentRef={ref}
tableProps={{ rowKey: 'key' }}
rowSelection={rowSelection}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'search',
FORM_FILTER_PATH,
);
}}
schema={propsParams.modalSchema}
/>
}
/>
</Modal>
</RowStyleLayout>
);
};
Relevance.defaultProps = {};
Relevance.isFieldComponent = true;
export default Relevance;
......@@ -3,17 +3,27 @@ import { Slider, Input, Space } from 'antd'
const CustomSlider = (props) => {
const value = props.value || 0
const max = props.props['x-component-props']?.max || 0
const componentProps = props.props['x-component-props'] || {}
const { max = 0, width = '100%', layout = {}, isNumber = false } = componentProps
return (
<div style={{width: '100%'}}>
<div style={{width: '100%', ...layout}}>
<Slider
style={{width}}
disabled={!props.editable}
value={value}
onChange={e => props.mutators.change(e)}
{...props.props['x-component-props']}></Slider>
<Space>
<Input type='number' disabled max={max} value={props.value} onChange={e => props.mutators.change(e.target.value)} addonAfter='尺'/>
{ max && <span>还剩:{max - value}</span> }
</Space>
{...props.props['x-component-props']}/>
{
isNumber ?
<div>
<Input type='number' className='underline_input' max={max} value={props.value} onChange={e => props.mutators.change(e.target.value)}/>
</div>
:
<Space>
<Input type='number' disabled max={max} value={props.value} onChange={e => props.mutators.change(e.target.value)} addonAfter='尺'/>
{ max && <span>还剩:{max - value}</span> }
</Space>
}
</div>
)
}
......
......@@ -3,13 +3,13 @@ import { Input, Space, Button, Table } from 'antd'
import { PlusOutlined } from '@ant-design/icons'
const MultTable = (props) => {
const { columns } = props.props['x-component-props']
const { columns, prefix, rowKey } = props.props['x-component-props']
const value = props.value || []
return (
<div style={{width: '100%'}}>
<Button block icon={<PlusOutlined/>} type='dashed'>选择指定会员</Button>
{prefix}
<Table
rowKey='id'
rowKey={rowKey || 'id'}
columns={columns}
dataSource={value}
/>
......
import React, { useState } from 'react'
import { Input, Space, Button } from 'antd'
import { CaretUpOutlined, CaretDownOutlined } from '@ant-design/icons'
import { useFieldState, FormPath } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import React, { useState } from 'react';
import { Input, Space, Button } from 'antd';
import { CaretUpOutlined, CaretDownOutlined } from '@ant-design/icons';
import { useFieldState, FormPath, FormEffectHooks } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export interface SearchProps {
value: string,
mutators: any,
props: any
value: string;
mutators: any;
props: any;
}
const Search = (props) => {
console.log(props)
const Search = props => {
const [state, setState] = useFieldState({
filterSearch: false
})
filterSearch: false,
});
const justifyAlign = props.props['x-component-props'].align || 'flex-end';
const changeFilterVisible = () => {
if (state.filterSearch) {
props.form.reset({
// 清除FILTER_PARAMS下所有字段
selector: `*.${FORM_FILTER_PATH}.*`
})
selector: `*.${FORM_FILTER_PATH}.*`,
});
}
setState({
filterSearch: !state.filterSearch
})
}
filterSearch: !state.filterSearch,
});
};
return (
<Space size={20} style={{justifyContent: 'flex-end', width: '100%'}}>
<Space size={20} style={{ justifyContent: justifyAlign, width: '100%' }}>
<Input.Search
value={props.value || ''}
onChange={e => props.mutators.change(e.target.value)}
onSearch={(_,e) => {
e.preventDefault()
props.form.submit()
onSearch={(_, e) => {
e.preventDefault();
props.form.submit();
}}
{...props.props['x-component-props']}
/>
<Button onClick={changeFilterVisible}>高级筛选{state.filterSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}</Button>
<Button onClick={() => props.form.reset()}>重置</Button>
<Button onClick={changeFilterVisible}>
高级筛选
{state.filterSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}
</Button>
<Button
onClick={() => {
props.form.reset();
}}
>
重置
</Button>
</Space>
)
}
);
};
Search.defaultProps = {}
Search.defaultProps = {};
Search.isFieldComponent = true;
export default Search
\ No newline at end of file
export default Search;
.form-circle-box {
width: 160px;
height: 160px;
border: 3px solid #efefef;
background: #fff;
text-align: center;
line-height: 160px;
font-size: 20px;
border-radius: 50%;
}
.underline_input {
max-width: 200px;
background: none;
border: none;
outline: none;
font-size: 32px;
border-bottom: 1px solid #DFE1E6;
padding: 8px 19px;
text-align: center;
display: inline-block;
&:focus{
box-shadow: none;
border-bottom: 1px solid #DFE1E6;
}
}
\ No newline at end of file
import React from 'react';
import SchemaForm, {
IAntdSchemaFormProps,
createFormActions,
FormPath,
SchemaField,
IAntdSchemaFormProps, createVirtualBox, registerVirtualBox, Schema, SchemaField, FormButtonGroup, Reset, createControllerBox,
} from '@formily/antd';
import { Button, Space } from 'antd';
import { Button, Space, Row, Col } from 'antd';
import styled from 'styled-components'
import CustomUpload from './components/CustomUpload';
import CustomStatus from './components/CustomStatus';
import CustomAddArray from './components/CustomAddArray';
......@@ -16,9 +14,66 @@ import Text from './components/Text';
import CardCheckBox from './components/CardCheckBox';
import MultTable from './components/MultTable';
import CustomRegistryPhone from './components/CustomRegistryPhone';
import CustomRelevance from './components/CustomRelevance';
import Children from './components/Children';
import CircleBox from './components/CircleBox';
import './index.less'
import { Input } from '@formily/antd-components';
export interface NiceFormProps extends IAntdSchemaFormProps {}
const RowLayout = styled(props => <Row justify='end' {...props}/>)`
.mega-layout-item {
margin-bottom: 20px !important;
}
.mega-layout-container {
margin-bottom: 0;
}
`
registerVirtualBox('flex-layout', (_props) => {
const { children, props } = _props
const rowStyle = props['x-component-props'] ? props['x-component-props'].rowStyle : {}
const colStyle = props['x-component-props'] ? props['x-component-props'].colStyle : {}
return (
<RowLayout style={rowStyle}>
{
children.map((v, i) => <Col style={colStyle} key={i}>{v}</Col>)
}
</RowLayout>
)
})
registerVirtualBox('empty-layout', (_props) => {
const { children, props } = _props
return (
<div>{children}</div>
)
})
const SchemaFormButtonGroup = createVirtualBox('schemaButtonGroup', FormButtonGroup)
const SchemaButton = createVirtualBox('schemaButton', Button)
const SchemaSubmit = createVirtualBox('schemaSubmit', Submit)
const SchemaReset = createVirtualBox('schemaReset', Reset)
export const FlexBox = createVirtualBox('flexBox', props => <Row {...props}/>)
// 该组件用于schema中嵌套表单, 不过控制台会出现警告
const schemaLayout = createControllerBox("schemaLayout", (_props) => {
const { schema } = _props;
const componentProps = schema.getExtendsComponentProps();
const { properties } = schema.toJSON();
const nestedSchema = new Schema({
type: "object",
properties
});
// const { visible, title, onCancel, footer, ...others } = componentProps;
return (
<NiceForm>
<SchemaField schema={nestedSchema}></SchemaField>
</NiceForm>
);
});
const NiceForm: React.FC<NiceFormProps> = props => {
const { children, components, ...reset } = props;
const customComponents = {
......@@ -32,6 +87,11 @@ const NiceForm: React.FC<NiceFormProps> = props => {
CardCheckBox,
MultTable,
CustomRegistryPhone,
CustomRelevance,
Children,
CircleBox,
SchemaFormButtonGroup,
FlexBox
};
const defineComponents = Object.assign(customComponents, components);
......
import { useValueLinkageEffect, FormPath, FormEffectHooks } from '@formily/antd'
/**
* 联动逻辑, 主要用于处理省市区等联动, 必须手动设置 originData
* @param childKey 子集菜单key
* @param [transformFn] 用于是否转化label和value的字段,可不传
* @author xjm
* @example `
<NiceForm
onSubmit={values => console.log(values)}
actions = {actions}
effects={($, {setFieldState}) => {
onFormMount$().subscribe(() => {
mockData().then((data:any) => {
setFieldState('a', state => {
state.originData = data
state.props.enum = data.map(v => ({
label: v.name,
value: v.id
}))
})
})
})
useLinkEnumEffect(data => data.map(v => ({
label: v.name,
value: v.id
})), 'children')
}}
schema={{
type: 'object',
properties: {
a: {
type: 'string',
enum: [],
"x-linkages": [
{
type: 'value:linkage',
condition: "{{!!$value}}",
origin: 'a',
target: 'b',
}
]
},
b: {
type: 'string',
enum: [],
"x-linkages": [
{
type: 'value:linkage',
condition: "{{!!$value}}",
origin: 'b',
target: 'c'
}
]
},
c: {
type: 'string',
enum: []
}
}
}}
/>
*
* `
*/
export const useLinkEnumEffect = (childKey, transformFn?) => {
const { onFieldValueChange$ } = FormEffectHooks
useValueLinkageEffect({
type: 'value:linkage',
resolve: ({ origin, target }, { setFieldState, getFieldState }) => {
getFieldState(origin, state => {
console.log('origin', origin, 'state', state)
const { originData = [] } = state
setFieldState(target, targetState => {
if (state.value === undefined) {
} else {
if (originData.length > 0) {
const result = originData.find(v => v.id === state.value)[childKey] || []
if (state.modified) {
targetState.value = undefined
}
targetState.originData = result
targetState.props.enum = transformFn ? transformFn(result) : result
}
}
})
})
},
reject: ({ target }, { setFieldState, getFieldState }) => {
setFieldState(target, targetState => {
targetState.value = undefined
targetState.props.enum = []
})
}
})
}
\ No newline at end of file
import React from 'react'
import { Popconfirm, Button } from 'antd'
import { PlayCircleOutlined,PauseCircleOutlined } from '@ant-design/icons'
import React from 'react';
import { Popconfirm, Button } from 'antd';
import { PlayCircleOutlined, PauseCircleOutlined } from '@ant-design/icons';
export interface StatusSwitchProps {
record: any,
fieldNames?: string, // 自定义字段名称
expectTrueValue?: boolean|number|string, //期望为ture(有效)的值
handleConfirm?(),
handleCancel?()
record: any;
fieldNames?: string; // 自定义字段名称
expectTrueValue?: boolean | number | string; //期望为ture(有效)的值
handleConfirm?();
handleCancel?();
}
const StatusSwitch:React.FC<StatusSwitchProps> = (props) => {
const { record, fieldNames = 'state', expectTrueValue = 1 } = props
const StatusSwitch: React.FC<StatusSwitchProps> = props => {
const { record, fieldNames = 'state', expectTrueValue = 1 } = props;
return (
<Popconfirm
title="确定要执行这个操作?"
......@@ -20,16 +20,25 @@ const StatusSwitch:React.FC<StatusSwitchProps> = (props) => {
okText="是"
cancelText="否"
>
<Button type="link" style={record[fieldNames] === expectTrueValue?{color:'#00B37A'}:{color:'red'}}>
{record[fieldNames] === expectTrueValue?'有效':'无效'}
{
record[fieldNames] === expectTrueValue ?<PlayCircleOutlined /> : <PauseCircleOutlined />
<Button
type="link"
style={
record[fieldNames] === expectTrueValue
? { color: '#00B37A' }
: { color: 'red' }
}
>
{record[fieldNames] === expectTrueValue ? '有效' : '无效'}
{record[fieldNames] === expectTrueValue ? (
<PlayCircleOutlined />
) : (
<PauseCircleOutlined />
)}
</Button>
</Popconfirm>
)
}
);
};
StatusSwitch.defaultProps = {}
StatusSwitch.defaultProps = {};
export default StatusSwitch
\ No newline at end of file
export default StatusSwitch;
import React, { useRef, useState, useEffect } from 'react';
import { history } from 'umi';
import { StopOutlined, CheckSquareOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import {
PageHeader,
......@@ -22,7 +21,7 @@ import CheckboxTree from '@/components/CheckBoxTree';
import { useTreeTabs, FormState } from '@/hooks/useTreeTabs';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import NiceForm from '@/components/NiceForm';
import { auditSchema } from './schema';
import { auditModalSchema } from './schema';
import { PublicApi } from '@/services/api';
import styles from './index.less';
......@@ -38,9 +37,8 @@ interface ItemProps {
}
const auditDetail: React.FC<ItemProps> = (props: any) => {
const { pageStatus, id } = usePageStatus();
const { pageStatus, id, preview } = usePageStatus();
const { auditType, routeParams } = props;
console.log(auditType);
const [hActived, setHActived] = useState('1');
const [fActived, setfActived] = useState('1');
const [lActived, setlActived] = useState('1');
......@@ -73,6 +71,9 @@ const auditDetail: React.FC<ItemProps> = (props: any) => {
const { data } = res;
let buttons = data.buttons.map(v => ({ id: v.id, buttonName: v.name }));
setButtonInfos(buttons || []);
if (actionRef.current.setSelected) {
actionRef.current.setSelected(data.checkIds);
}
});
};
......@@ -130,14 +131,28 @@ const auditDetail: React.FC<ItemProps> = (props: any) => {
});
useEffect(() => {
const fetchDetailData = async () => {
const { data } = await PublicApi.getMemberValidateCommitDetail({
memberId: pageStatus === PageStatus.PREVIEW ? id : routeParams.memberId,
validateId: routeParams.validateId,
});
let getDetailFn;
switch (auditType) {
case '1':
getDetailFn = PublicApi.getMemberValidateCommitDetail;
break;
case '2':
getDetailFn = PublicApi.getMemberValidateStep1Detail;
break;
case '3':
getDetailFn = PublicApi.getMemberValidateStep2Detail;
break;
case '4':
getDetailFn = PublicApi.getMemberValidateConfirmDetail;
break;
}
getDetailFn({
memberId: pageStatus === PageStatus.PREVIEW ? id : routeParams.memberId,
validateId: routeParams.validateId,
}).then(res => {
const { data } = res;
setDetailData(data);
};
fetchDetailData();
});
}, []);
const actionRef = useRef<any>({});
......@@ -329,39 +344,29 @@ const auditDetail: React.FC<ItemProps> = (props: any) => {
title={
<>
<div className={styles['headerTop']}>
<div className={styles['headerTop-prefix']}>广</div>
<div className={styles['headerTop-prefix']}>
{detailData?.name?.substr(0, 1).toUpperCase()}
</div>
<div className={styles['headerTop-name']}>
广州市极致皮具有限公司
{detailData?.name}
</div>
<div className={styles[`levelIcon${'1'}`]}></div>
</div>
</>
}
extra={
<Button
className={styles['saveBtn']}
onClick={() => setModalVisible(true)}
>
提交
</Button>
// <>
// {auditType === '1' ? (
// <>
// </>
// ) : (
// <>
// <Button>
// <StopOutlined />
// 审核不通过
// </Button>
// <Button className={styles['saveBtn']}>
// <CheckSquareOutlined />
// 审核通过
// </Button>
// </>
// )}
// </>
<>
{pageStatus != PageStatus.PREVIEW ? (
<Button
className={styles['saveBtn']}
onClick={() => setModalVisible(true)}
>
提交
</Button>
) : (
''
)}
</>
}
footer={
<Tabs activeKey={hActived} onChange={val => setHActived(val)}>
......@@ -526,7 +531,7 @@ const auditDetail: React.FC<ItemProps> = (props: any) => {
}}
onSubmit={handleSubmit}
actions={auditAction}
schema={auditSchema}
schema={auditModalSchema}
/>
</Modal>
</PageHeaderWrapper>
......
This diff is collapsed.
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const auditSchema: ISchema = {
type: 'object',
......@@ -6,6 +7,103 @@ export const auditSchema: ISchema = {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{controllerBtns}}',
},
},
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
memberType: {
type: 'string',
default: 0,
enum: [],
'x-component-props': {},
},
roleId: {
type: 'string',
default: 0,
enum: [],
'x-component-props': {},
},
level: {
type: 'string',
default: 0,
enum: [],
'x-component-props': {},
},
source: {
type: 'string',
default: 0,
enum: [],
'x-component-props': {},
},
timeRange: {
type: 'string',
default: 0,
enum: [
{ label: '时间范围(全部)', value: 0 },
{ label: '今天', value: 1 },
{ label: '一周内', value: 2 },
{ label: '一个月内', value: 3 },
{ label: '三个月内', value: 4 },
{ label: '六个月内', value: 5 },
{ label: '一年内', value: 6 },
{ label: '一年前', value: 7 },
],
'x-component-props': {},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
},
};
export const auditModalSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelAlign: 'top',
},
......
import React, { ReactNode, useState, useRef, useEffect } from 'react';
import React, { useRef } from 'react';
import { history } from 'umi';
import { Row, Col, Tooltip, Button, Popconfirm, Card, Input } from 'antd';
import {
PlayCircleOutlined,
PauseCircleOutlined,
EyeOutlined,
} from '@ant-design/icons';
import { Button, Card } from 'antd';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import style from './index.less';
import { createFormActions } from '@formily/antd';
import EyePreview from '@/components/EyePreview';
import StatusSwitch from '@/components/StatusSwitch';
import NiceForm from '@/components/NiceForm';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { levelSchema } from './schema';
import { PublicApi } from '@/services/api';
import styles from './index.less';
const data = [
{
key: '1',
id: '1',
level: '1',
levelTab: '钻石会员',
levelType: '商户会员',
scoreTab: '交易分',
name: '采购商',
type: '服务消费',
roleType: '企业会员',
thresvalue: '100000',
status: 1,
},
{
key: '2',
id: '2',
level: '2',
levelTab: '钻石会员',
levelType: '商户会员',
scoreTab: '交易分',
name: '采购商',
type: '服务消费',
roleType: '企业会员',
thresvalue: '100000',
status: 2,
},
{
key: '3',
id: '3',
level: '3',
levelTab: '钻石会员',
levelType: '商户会员',
scoreTab: '交易分',
name: '采购商',
type: '服务消费',
roleType: '企业会员',
thresvalue: '100000',
status: 1,
},
{
key: '4',
id: '4',
level: '4',
levelTab: '钻石会员',
levelType: '商户会员',
scoreTab: '交易分',
name: '采购商',
type: '服务消费',
roleType: '企业会员',
thresvalue: '100000',
status: 2,
},
];
const formActions = createFormActions();
const memberLevel: React.FC<[]> = () => {
const ref = useRef({});
const [keywords, setKeywords] = useState('');
const fetchData = async (params: any) => {
const res = await PublicApi.getMemberManageLevelPage(params);
return res.data;
};
const MemberLevel: React.FC<[]> = () => {
const ref = useRef<any>({});
const columns: ColumnType<any>[] = [
{
......@@ -83,148 +36,97 @@ const memberLevel: React.FC<[]> = () => {
align: 'center',
key: 'level',
render: (text: any, record: any) => (
<div className={style[`levelIcon${record.level}`]}></div>
<div className={styles[`levelIcon${record.level}`]}></div>
),
},
{
title: '会员等级标签',
dataIndex: 'levelTab',
dataIndex: 'levelTag',
align: 'center',
key: 'levelTab',
key: 'levelTag',
render: (text: any, record: any) => (
<span className={style.nameCellTitle} onClick={() => handleSee(record)}>
{text}&nbsp;
<EyeOutlined />
</span>
<EyePreview
url={`/memberAbility/manage/addEquity?id=${record.id}&preview=1`}
>
{text}
</EyePreview>
),
},
{
title: '会员等级类型',
dataIndex: 'levelType',
dataIndex: 'memberLevelType',
align: 'center',
key: 'levelType',
key: 'memberLevelType',
},
{
title: '升级分值标签',
dataIndex: 'scoreTab',
dataIndex: 'scoreTag',
align: 'center',
key: 'scoreTab',
key: 'scoreTag',
},
{
title: '会员角色名称',
dataIndex: 'name',
dataIndex: 'roleName',
align: 'center',
key: 'name',
key: 'roleName',
},
{
title: '角色类型',
dataIndex: 'type',
dataIndex: 'roleTypeName',
align: 'center',
key: 'type',
key: 'roleTypeName',
},
{
title: '会员类型',
dataIndex: 'roleType',
dataIndex: 'memberTypeName',
align: 'center',
key: 'roleType',
key: 'memberTypeName',
},
{
title: '升级阈值',
dataIndex: 'thresvalue',
dataIndex: 'levelUpPoint',
align: 'center',
key: 'thresvalue',
key: 'levelUpPoint',
},
{
title: '状态',
dataIndex: 'status',
align: 'center',
key: 'status',
render: (text: any, record: any) => {
let component: ReactNode = null;
component = (
<Popconfirm
title="确定要执行这个操作?"
onConfirm={confirm}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button
type="link"
onClick={() => handleModify(record)}
style={
record.status === 1 ? { color: '#00B37A' } : { color: 'red' }
}
>
{record.status === 1 ? (
<>
<span>有效</span>
<PlayCircleOutlined />
</>
) : (
<>
<span>无效</span>
<PauseCircleOutlined />
</>
)}
</Button>
</Popconfirm>
);
return component;
},
render: (text: any, record: any) => (
<StatusSwitch
handleConfirm={() => handleModify(record)}
record={record}
fieldNames="status"
/>
),
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (record: any) => (
<Button type="link" onClick={record => handleSet(record)}>
render: (text: any, record: any) => (
<Button
type="link"
onClick={() =>
history.push(`/memberAbility/manage/addEquity?id=${record.id}`)
}
>
设置
</Button>
),
},
];
// 模拟请求
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
PublicApi.getMemberManageLevelPage({
cond: '',
current: params.current,
pageSize: params.pageSize,
}).then(res => {
resolve(res.data);
});
const handleModify = record => {
PublicApi.postMemberManageLevelStatus({
id: record.id,
status: record.status === 1 ? 0 : 1,
}).then(res => {
if (res.code === 1000) return ref.current.reload();
});
};
useEffect(() => {
console.log(keywords);
});
const handleSee = (record: any) => {};
const confirm = () => {
console.log('confirm');
};
const cancel = () => {
console.log('cancel');
};
const handleModify = (record: object) => {
// 通过传入的params字符串判断是修改那种类型的数据
console.log('执行状态修改', record);
};
const handleSearch = () => {};
const handleReset = () => {};
const handleSet = (record: any) => {
history.push('/memberAbility/manage/level/addEquity');
};
return (
<Card>
<StandardTable
......@@ -233,34 +135,26 @@ const memberLevel: React.FC<[]> = () => {
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<Row>
<Col className={style.col} span={12} offset={12}>
<Tooltip
trigger={['focus']}
placement="top"
title={
<span>
输入ID、会员等级、会员角色名称&nbsp;&nbsp;进行搜索
</span>
}
>
<Input.Search
style={{ width: '232px' }}
value={keywords}
placeholder="搜索"
onChange={e => setKeywords(e.target.value)}
onSearch={() => handleSearch}
/>
</Tooltip>
<Button className={style.resetBtn} onClick={() => handleReset()}>
重置
</Button>
</Col>
</Row>
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
$('onFormInputChange').subscribe(state => {
ref.current.reload(state.values);
});
useStateFilterSearchLinkageEffect(
$,
actions,
'cond',
FORM_FILTER_PATH,
);
}}
schema={levelSchema}
/>
}
/>
</Card>
);
};
export default memberLevel;
export default MemberLevel;
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const levelSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUI: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
},
properties: {
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
},
},
},
},
},
},
},
};
This diff is collapsed.
import React from 'react';
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
let id;
export const importSchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
......@@ -25,10 +22,9 @@ export const importSchema: ISchema = {
children: '{{controllerBtns}}',
},
},
name: {
cond: {
type: 'string',
'x-component': 'Search',
'x-mega-props': {},
'x-component-props': {
placeholder: '搜索',
},
......@@ -49,42 +45,31 @@ export const importSchema: ISchema = {
properties: {
memberType: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
default: 0,
enum: [],
'x-component-props': {},
},
roleId: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
default: 0,
enum: [],
'x-component-props': {},
},
level: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
default: 0,
enum: [],
'x-component-props': {},
},
source: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
default: 0,
enum: [],
'x-component-props': {},
},
timeRange: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
default: 0,
enum: [
{ label: '时间范围(全部)', value: 0 },
{ label: '今天', value: 1 },
......@@ -95,6 +80,7 @@ export const importSchema: ISchema = {
{ label: '一年内', value: 6 },
{ label: '一年前', value: 7 },
],
'x-component-props': {},
},
submit: {
'x-component': 'Submit',
......@@ -112,6 +98,34 @@ export const importSchema: ISchema = {
},
};
export const auditModalSchema = props => {
let modalSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelAlign: 'top',
},
properties: {
remark: {
type: 'string',
title: `会员${props.status === 1 ? '解冻' : '冻结'}原因`,
'x-component': 'textarea',
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
maxLength: 60,
},
'x-rules': [{ required: true, message: '请填写审核不通过原因' }],
},
},
},
},
};
return modalSchema;
};
const getCompnentValue = (elements: any) => {
let components = {};
for (let item of elements) {
......
import React, { useState, useRef, ReactNode } from 'react';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Card, Input, Button } from 'antd';
import { ContainerOutlined } from '@ant-design/icons';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import {
IFormFilter,
IButtonFilter,
} from 'god/dist/src/standard-table/TableController';
import './index.less';
import { PublicApi } from '@/services/api';
const data = [
{
key: '1',
id: '1',
rule: 1,
explain: '完成交易订单后,按照交易订单金额的百分比记入获取的升级分值',
type: '商户会员',
score: '',
},
{
key: '2',
id: '2',
rule: 1,
explain: '完成交易订单后,按照交易订单金额的百分比记入获取的升级分值',
type: '渠道会员',
score: '',
},
{
key: '3',
id: '3',
rule: 2,
explain: '完成交易订单后,按照交易订单金额的百分比记入获取的升级分值',
type: '商户会员',
score: '',
},
{
key: '4',
id: '4',
rule: 3,
explain: '完成交易订单后,按照交易订单金额的百分比记入获取的升级分值',
type: '商户会员',
score: '',
},
];
const fetchData = async (params: any) => {
const res = await PublicApi.getMemberManageLevelRulePage(params);
return res.data;
};
const memberUpgradeRule: React.FC<[]> = () => {
const MemberUpgradeRule: React.FC<[]> = () => {
const ref = useRef({});
const columns: ColumnType<any>[] = [
......@@ -57,27 +23,17 @@ const memberUpgradeRule: React.FC<[]> = () => {
key: 'id',
},
{
title: '升级规则',
dataIndex: 'rule',
title: '项目',
dataIndex: 'ruleName',
align: 'center',
key: 'rule',
render: (text: any, record: any) => (
<span>
{record.rule === 1 ? '交易' : record.rule === 2 ? '评价' : '登录'}
</span>
),
key: 'ruleName',
render: (text: any, record: any) => <span>{text}</span>,
},
{
title: '升级规则说明',
dataIndex: 'explain',
title: '项目说明',
dataIndex: 'remark',
align: 'center',
key: 'explain',
},
{
title: '适用会员等级类型',
dataIndex: 'type',
align: 'center',
key: 'type',
key: 'remark',
},
{
title: '可获取的分值',
......@@ -87,7 +43,7 @@ const memberUpgradeRule: React.FC<[]> = () => {
render: (text: any, record: any) => {
let component: ReactNode = null;
component =
record.rule === 1 ? (
record.ruleTypeEnum === 1 ? (
<Input addonAfter="%" value={record.score} />
) : (
<Input value={record.score} />
......@@ -96,29 +52,30 @@ const memberUpgradeRule: React.FC<[]> = () => {
},
},
];
// 模拟请求
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
PublicApi.getMemberManageLevelRulePage({
current: params.current,
pageSize: params.pageSize,
}).then(res => {
resolve(res.data);
});
});
};
const handleSubmit = () => {};
return (
<Card>
<StandardTable
tableProps={{ rowKey: 'id' }}
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
/>
</Card>
<PageHeaderWrapper
extra={
<Button
type="primary"
icon={<ContainerOutlined />}
onClick={handleSubmit}
>
保存
</Button>
}
>
<Card>
<StandardTable
tableProps={{ rowKey: 'id' }}
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
/>
</Card>
</PageHeaderWrapper>
);
};
export default memberUpgradeRule;
export default MemberUpgradeRule;
......@@ -47,7 +47,7 @@ const errorHandler = (error: ResponseError):IRequestError => {
const defaultHeaders = {
'Content-Type': 'Application/json',
'token': 'e1404c3d593ad198e88187553bc40b2c'
'token': 'd319db57b93759a3787a239c3d9c91b1'
}
/**
......
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