Commit ea63a2da authored by GuanHua's avatar GuanHua

Merge branch 'dev' into test

parents b7898696 7c60ea56
......@@ -4,6 +4,8 @@
/node_modules
/npm-debug.log*
/yarn-error.log
/yarn.lock
/package-lock.json
# production
/dist
......
......@@ -21,6 +21,7 @@ import commentRoutes from './commentRoutes';
import contentRoute from './contentRoute'; // 内容管理
import balancedRoute from './balancedRoute'; // 平台结算管理
import capitalAccount from './capitalAccountRoute'; // 会员资金账户
import messageRoute from './messgeRoute'; // 消息管理
const routeList = [
pageCustomized,
calssPropertyRoute,
......@@ -37,6 +38,7 @@ const routeList = [
requisitionRoute,
enquiryOfferRoute,
capitalAccount,
messageRoute,
]
const router = [
......
/*
* 消息管理路由
*/
const router = {
path: '/message',
name: 'message',
icon: 'SmileOutlined',
hidePageHeader: true,
routes: [
{
path: '/message/messageList',
name: 'messageList',
component: '@/pages/message',
},
{
path: '/message/messageList/add',
name: 'addMessage',
hideInMenu: true,
component: '@/pages/message/addMessage',
},
]
}
export default router
......@@ -69,7 +69,29 @@ const router = {
component: '@/pages/ruleSettingManage/memberAuthManage/detail',
hideInMenu: true,
hidePageHeader: true
}
},
// 平台结算策略配置, 列表页
{
path: '/ruleSettingManager/platformSettlementStrategy',
name: 'platformSettlementStrategy',
component: '@/pages/ruleSettingManage/platformSettlementStrategy/list'
},
// 平台结算策略配置, 新增平台策略配置
{
path: '/ruleSettingManager/platformSettlementStrategy/add',
name: 'addplatformSettlementStrategy',
component: '@/pages/ruleSettingManage/platformSettlementStrategy/info',
hidePageHeader: true,
hideInMenu: true
},
// 平台结算策略配置, 平台策略配置详情页
{
path: '/ruleSettingManager/platformSettlementStrategy/detail',
name: 'platformSettlementStrategyDetail',
component: '@/pages/ruleSettingManage/platformSettlementStrategy/info',
hidePageHeader: true,
hideInMenu: true
}
]
}
export default router
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -70,6 +70,8 @@ export function render(oldRender:Function) {
}
console.log('render')
oldRender()
}).catch(() => {
oldRender()
})
} else {
oldRender()
......
import React, { ReactText, useRef, useEffect } from 'react'
import React, { ReactText, useRef, useEffect, useState } from 'react'
import {StandardTable} from 'god'
import { IStandardTableProps } from 'god/dist/src/standard-table'
import { Row, Col, Modal } from 'antd'
......@@ -22,11 +22,17 @@ export interface ModalTableProps extends IStandardTableProps<any> {
const ModalTable:React.FC<ModalTableProps> = (props) => {
const { width = 704,modalTitle, confirm, cancel, visible, currentRef, resetModal, modalType = 'none', ...resetTable } = props
const selfRef = currentRef || useRef<any>({})
const selfRef = currentRef || useRef<any>({});
// 这里modaltable 第一次渲染的话会加载两次,这里是因为visible reload加载一次,standard table 加载一次
const [firstRender, setFirstRender] = useState<boolean>(true)
useEffect(() => {
if (visible) {
// 重新开启时需reload接口
selfRef.current.reload && selfRef.current.reload()
// modaltable 第一次加载的时候不做任何操作,等下一次加载的时候才做
if(!firstRender) {
selfRef.current.reload && selfRef.current.reload()
}
setFirstRender(false);
} else {
selfRef.current.resetField && selfRef.current.resetField({
validate: false
......
......@@ -5,13 +5,13 @@
* @LastEditTime: 2020-08-31 18:59:18
* @Description: 状态 tag
*/
import React from 'react';
import React, { ReactNode } from 'react';
import classNames from 'classnames';
import styles from './index.less';
interface StatusTagProps {
type: 'success' | 'warnning' | 'default' | 'danger' | 'primary';
title: string;
title: string | ReactNode;
};
const StatusTag: React.FC<StatusTagProps> = ({ type, title }) => {
......
......@@ -107,6 +107,9 @@ export default {
'menu.ruleSettingManager.ruleDetails': '交易规则详情',
'menu.ruleSettingManager.memberAuthManage': '会员角色权限设置',
'menu.ruleSettingManager.memberAuthManageDetail': '会员角色权限设置',
'menu.ruleSettingManager.platformSettlementStrategy': '平台结算策略配置',
'menu.ruleSettingManager.addplatformSettlementStrategy': '新增平台结算策略',
'menu.ruleSettingManager.platformSettlementStrategyDetail': '平台结算策略详情',
// 品类和属性
'menu.classAndProperty': '平台品类及属性',
......@@ -193,5 +196,10 @@ export default {
'menu.capitalAccount.paymentWithdraw': '待支付提现',
'menu.capitalAccount.paymentDetails': '支付提现',
// 消息管理
'menu.message': '消息管理',
'menu.message.messageList': '消息列表',
'menu.message.addMessage': '新建消息',
}
// export default utils.transformDataPre(data, 'menu')
import React, { Component } from 'react';
class Home extends Component {
render() {
return (
<div
style={{
margin: '-24px',
}}
>
<img
src="https://shushangyun01.oss-cn-shenzhen.aliyuncs.com/bc7f3a2385c0438bafcf1b74212cc7721601275065050.png"
width="100%"
height="auto"
/>
</div>
);
}
}
export default Home
import React from 'react';
import { Chart, Interval } from 'bizcharts';
interface IProps {
currentIndex: number,
}
const ColumnChart: React.FC<IProps> = (props) => {
const { currentIndex } = props
const data1 = [
{ day: '08-01', sales: 38 },
{ day: '08-02', sales: 52 },
{ day: '08-03', sales: 61 },
{ day: '08-04', sales: 45 },
{ day: '08-05', sales: 48 },
{ day: '08-06', sales: 38 },
{ day: '08-07', sales: 38 },
];
const data2 = [
{ day: '08-01', sales: 38 },
{ day: '08-02', sales: 52 },
{ day: '08-03', sales: 61 },
{ day: '08-04', sales: 45 },
{ day: '08-05', sales: 48 },
{ day: '08-06', sales: 38 },
{ day: '08-07', sales: 38 },
{ day: '08-08', sales: 38 },
{ day: '08-09', sales: 48 },
{ day: '08-10', sales: 23 },
{ day: '08-11', sales: 35 },
{ day: '08-12', sales: 54 },
{ day: '08-13', sales: 32 },
{ day: '08-14', sales: 45 },
{ day: '08-15', sales: 32 },
];
return (
<Chart height={302} autoFit data={currentIndex === 2 ? data2 : data1} >
<Interval position="day*sales" />
</Chart>
)
}
export default ColumnChart;
\ No newline at end of file
import React from 'react';
import {
Chart,
Geom,
Axis,
Tooltip,
Legend,
Annotation,
Guide
} from 'bizcharts';
const { Line } = Guide;
interface IProps {
currentIndex: number,
}
const LineChart: React.FC<IProps> = (props) => {
const { currentIndex } = props
const data1 = [
{
"month": "2020-07-13",
"city": "供应链",
"revenue": 1
},
{
"month": "2020-07-13",
"city": "采购商",
"revenue": 1.56
},
{
"month": "2020-07-13",
"city": "加工企业",
"revenue": 1.66
},
{
"month": "2020-07-14",
"city": "供应链",
"revenue": 0.35
},
{
"month": "2020-07-14",
"city": "采购商",
"revenue": 0.89
},
{
"month": "2020-07-14",
"city": "加工企业",
"revenue": 0.89
},
{
"month": "2020-07-15",
"city": "供应链",
"revenue": 0.19
},
{
"month": "2020-07-15",
"city": "采购商",
"revenue": 0.18
},
{
"month": "2020-07-15",
"city": "加工企业",
"revenue": 0.28
},
{
"month": "2020-07-16",
"city": "供应链",
"revenue": 1.2
},
{
"month": "2020-07-16",
"city": "采购商",
"revenue": 0.59
},
{
"month": "2020-07-16",
"city": "加工企业",
"revenue": 0.28
},
{
"month": "2020-07-17",
"city": "供应链",
"revenue": 1.52
},
{
"month": "2020-07-17",
"city": "采购商",
"revenue": 0.3583
},
{
"month": "2020-07-17",
"city": "加工企业",
"revenue": 0.35
},
{
"month": "2020-07-18",
"city": "供应链",
"revenue": 1.15
},
{
"month": "2020-07-18",
"city": "采购商",
"revenue": 1.025
},
{
"month": "2020-07-18",
"city": "加工企业",
"revenue": 1.28
},
{
"month": "2020-07-19",
"city": "供应链",
"revenue": 1.132
},
{
"month": "2020-07-19",
"city": "采购商",
"revenue": 1.15
},
{
"month": "2020-07-19",
"city": "加工企业",
"revenue": 0.26
},
];
const data2 = [
{
"month": "2020-07-13",
"city": "供应链",
"revenue": 1
},
{
"month": "2020-07-13",
"city": "采购商",
"revenue": 1.56
},
{
"month": "2020-07-13",
"city": "加工企业",
"revenue": 1.66
},
{
"month": "2020-07-14",
"city": "供应链",
"revenue": 0.35
},
{
"month": "2020-07-14",
"city": "采购商",
"revenue": 0.89
},
{
"month": "2020-07-14",
"city": "加工企业",
"revenue": 0.89
},
{
"month": "2020-07-15",
"city": "供应链",
"revenue": 0.19
},
{
"month": "2020-07-15",
"city": "采购商",
"revenue": 0.18
},
{
"month": "2020-07-15",
"city": "加工企业",
"revenue": 0.28
},
{
"month": "2020-07-16",
"city": "供应链",
"revenue": 1.2
},
{
"month": "2020-07-16",
"city": "采购商",
"revenue": 0.59
},
{
"month": "2020-07-16",
"city": "加工企业",
"revenue": 0.28
},
{
"month": "2020-07-17",
"city": "供应链",
"revenue": 1.52
},
{
"month": "2020-07-17",
"city": "采购商",
"revenue": 0.3583
},
{
"month": "2020-07-17",
"city": "加工企业",
"revenue": 0.35
},
{
"month": "2020-07-18",
"city": "供应链",
"revenue": 1.15
},
{
"month": "2020-07-18",
"city": "采购商",
"revenue": 1.025
},
{
"month": "2020-07-18",
"city": "加工企业",
"revenue": 1.28
},
{
"month": "2020-07-19",
"city": "供应链",
"revenue": 1.132
},
{
"month": "2020-07-19",
"city": "采购商",
"revenue": 1.15
},
{
"month": "2020-07-19",
"city": "加工企业",
"revenue": 0.26
},
];
const scale = {
"revenue": {
"range": [
0,
1
],
"ticks": [
0,
1,
2,
3,
4
]
},
"month": {
"range":[0.05, 0.95]
}
};
return (
<Chart height={360} data={currentIndex === 2 ? data2 : data1} scale={scale} forceFit>
<Legend position="top-left" />
<Axis name="month" />
<Axis
name="revenue"
label={{
formatter: val => `${val}%`,
}}
/>
<Tooltip
showCrosshairs
shared
/>
<Geom type="line" tooltip={['revenue*city', (value, name) => {
return {
value: `${value.toFixed(3)} %`,
name
}
}]} position="month*revenue" size={2} color={'city'} />
<Geom
type="point"
tooltip={false}
position="month*revenue"
size={4}
shape={'circle'}
color={'city'}
style={{
stroke: '#fff',
lineWidth: 1,
}}
/>
<Annotation.Text
position={['50%', '50%']}
alignX="middle"
alignY="middle"
html={`<div style="color:#8c8c8c;font-size:1.16em;text-align: center;width: 10em;">项目总数<br><span style="color:red;font-size:2.5em;">${200}</span></div>`}
/>
</Chart>
);
}
export default LineChart;
\ No newline at end of file
// home页面样式
.homeCard{
border-radius: 3px;
position: relative;
:global {
.ant-card-head-title{
font-size: 12px;
color: #909399;
}
}
.numberDesc{
font-size: 32px;
font-weight: 500;
color: #303133;
}
.numberIcon{
text-align: right;
position: absolute;
top: -10px;
right: 0px;
}
}
.lineDesc{
display: flex;
align-items: center;
margin-top: 14px;
position: relative;
img{
display: block;
width: 48px;
height: 48px;
margin: 24px 16px 24px 24px;
}
.lineDescText{
p{
margin-bottom: 8px;
line-height: 1;
}
.lineDescTitle{
font-size: 24px;
font-weight: 500;
color: #303133;
}
.lineDescTip{
font-size: 12px;
font-weight: 400;
color: #909399;
}
}
a{
position: absolute;
right: 30px;
}
}
.chartBox{
margin-top: 24px;
}
.sideListBox{
:global{
.ant-list-item-meta-title{
font-size: 24px;
font-weight: 500;
color: #303133;
}
}
}
.sideAdBox{
height: 100px;
margin: 22px 24px 13px;
border-radius: 5px;
background-color: #6C9CEB;
position: relative;
a{
font-size: 16px;
font-weight: 500;
color: #FFFFFF;
height: 100px;
line-height: 100px;
margin-left: 24px;
}
img{
position: absolute;
right: 0;
bottom: 0;
}
}
.commodityTotalTitle{
text-align: center;
span{
font-size: 12px;
font-weight: 400;
color: #909399;
}
p{
height: 72px;
font-size: 24px;
font-weight: 500;
color: #303133;
line-height: 72px;
}
}
.commodityTotalDesc{
display: flex;
flex: 1;
.aHalfOfWidth {
width: 50%;
}
}
// 便签样式
.notePaperBox{
width: 100%;
height: 248px;
background: #6C9CEB;
border-radius: 3px;
.notePaperContainer{
width: calc(100% - 2px);
height: 50%;
border-top: 0;
.noteGap{
width: 96%;
height: calc(30% - 1px);
text-align: center;
border-top: 1px dashed #c5c5c5;
margin: 0 auto;
position: relative;
&::before{
content: '';
width: 10px;
height: 10px;
position: absolute;
border-radius: 50%;
border-left: 1px solid #F4F5F7;
background-color: #F4F5F7;
position:absolute;
left: -11px;
top: -5px;
}
&::after{
content: '';
width: 10px;
height: 10px;
position: absolute;
border-radius: 50%;
border-left: 1px solid #F4F5F7;
background-color: #F4F5F7;
position:absolute;
right: -11px;
top: -5px;
}
}
.noteHeader{
p{
display: flex;
align-items: center;
padding: 20px 0 8px;
color: #FFFFFF;
font-size: 14px;
font-weight: 500;
img{
padding: 0 16px 0 20px;
}
}
}
.noteBody{
width: 100%;
height: 70%;
text-align: center;
p{
color: #fff;
font-size: 24px;
font-weight: 500;
a{
color: #fff;
font-size: 14px;
font-weight: 400;
}
}
}
}
}
.notePaperBoxGreen{
background-color: #41CC9E;
}
.feeCustomCard{
background-color: #fff;
border-radius: 3px;
height: 110px;
}
.dataRiskTip{
font-size: 12px;
font-weight: 400;
color: #909399;
}
.dataRiskAction{
display: flex;
> p{
width: 240px;
height: 48px;
background: #FAFBFC;
line-height: 48px;
margin-right: 24px;
> img{
margin: 8px 16px;
}
}
}
// 适配
@media screen and (max-width: 1441px) {
.homeCard{
.numberDesc{
font-size: 28px;
}
}
.notePaperBox{
.notePaperContainer{
.noteHeader{
p{
font-size: 12px;
img{
padding: 0;
margin: 0 4px;
width: 36px;
height: 36px;
}
span{
padding-right: 4px;
}
}
}
}
}
}
\ No newline at end of file
This diff is collapsed.
.normal {
}
.title {
font-size: 24px;
color: #666;
}
// 500 error
// .wrapper{
// }
.errorBox{
width: 100%;
.desc{
......@@ -23,4 +14,4 @@
width: 100%;
height: 100%;
}
}
}
\ No newline at end of file
import React, { useState, useEffect } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Button, Card, Space, Radio, Row, Col, Table, Tabs, Tag, Avatar, Image, List, Badge } from 'antd'
import cx from 'classnames'
import {history} from 'umi'
import NiceForm from '@/components/NiceForm'
import { createFormActions, FormButtonGroup, Reset, Submit } from '@formily/antd'
import styles from './index.less'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import ReutrnEle from '@/components/ReturnEle'
const addSchemaAction = createFormActions()
const AddMessage: React.FC<{}> = () => {
const {
pageStatus,
id
} = usePageStatus()
const handleSubmit = (val) => {
console.log(val, 'vvv')
}
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title="新建消息"
>
<Card>
<NiceForm
labelCol={4}
labelAlign="left"
wrapperCol={12}
editable={pageStatus !== PageStatus.PREVIEW}
actions={addSchemaAction}
schema={{
type: 'object',
properties: {
roleName: {
type: 'string',
title: '发送对象',
required: true,
},
remark: {
type: 'textarea',
title: '发送标题',
"x-rules": [
{
required: true,
},
{
limitByte: true,
maxByte: 120,
}
],
"x-component-props": {
rows: 4
}
},
role123: {
type: 'string',
title: '消息跳转链接',
required: true,
},
remark123: {
type: 'textarea',
title: '消息内容',
required: true,
"x-rules": [
{
required: true,
},
{
limitByte: true,
maxByte: 200
}
],
"x-component-props": {
rows: 4
}
},
}
}}
onSubmit={handleSubmit}
>
<FormButtonGroup offset={4}>
<Submit>发送</Submit>
<Button onClick={()=>history.goBack()}>取消</Button>
</FormButtonGroup>
</NiceForm>
</Card>
</PageHeaderWrapper>
);
}
export default AddMessage
\ No newline at end of file
.customList{
:global{
.ant-list-item-meta{
align-items: center;
}
}
.messageText{
font-size: 14px;
font-weight: 400;
color: #606266;
}
.messageTitle{
margin: 0 30px;
font-size: 14px;
font-weight: 500;
color: #303133;
}
}
\ No newline at end of file
import React, { useState, useEffect } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Button, Card, Space, Radio, Row, Col, Table, Tabs, Tag, Avatar, Image, List, Badge } from 'antd'
import cx from 'classnames'
import {history} from 'umi'
import styles from './index.less'
import StatusTag from '@/components/StatusTag'
import { PlusOutlined } from '@ant-design/icons'
//图标
import messageIcon1 from '../../asserts/home-icon-1.png'
import messageIcon2 from '../../asserts/home-icon-2.png'
import messageIcon3 from '../../asserts/home-icon-8.png'
const Message: React.FC<{}> = () => {
const data = [
{
id: 1,
icon: messageIcon1,
status: 'success',
type: '系统消息',
title: '订单发货',
message: '订单发货,请注意查收,清单发货,请注意查收!',
time: '2015-15-05',
},
{
id: 2,
icon: messageIcon2,
status: 'success',
type: '系统消息',
title: '订单收货',
message: '订单发货,请注意查收,清单发货,请注意查收!',
time: '2015-15-05',
},
{
id: 3,
icon: messageIcon1,
status: 'primary',
type: '系统消息',
title: '系统消息',
message: '账户异常,请注意账户资金安全!',
time: '2015-15-05',
},
{
id: 4,
icon: messageIcon3,
status: 'primary',
type: '系统消息',
title: '系统消息',
message: '账户支出300元,请注意账户资金安全!',
time: '2015-15-05',
},
];
const renderMessage = (data) => {
return (
<>
<StatusTag type={data.status} title={data.type} />
<span className={styles.messageTitle}>{data.title}</span>
<span className={styles.messageText}>{data.message}</span>
</>
)
}
const showTotal = (total) => {
return `共 ${total} 条`;
}
return (
<PageHeaderWrapper>
<Card>
<p>
<Button type="primary" icon={<PlusOutlined />} onClick={()=>history.push('/message/messageList/add')} >新建</Button>
</p>
<List
itemLayout="horizontal"
dataSource={data}
className={styles.customList}
pagination={{
onChange: page => {
console.log(page);
},
pageSize: 10,
size: "small",
showQuickJumper: true,
total: 4,
showTotal: showTotal
}}
renderItem={item => (
<List.Item>
<List.Item.Meta
avatar={<Avatar src={item.icon} />}
title={renderMessage(item)}
/>
<div>{item.time}</div>
</List.Item>
)}
/>
</Card>
</PageHeaderWrapper>
);
}
export default Message
\ No newline at end of file
......@@ -119,7 +119,7 @@ const logisticsDetail: React.FC = () => {
<Descriptions.Item label="结算单数:">{infoDetail?.totalCount }</Descriptions.Item>
<Descriptions.Item label="结算金额:">{infoDetail?.amount}</Descriptions.Item>
<Descriptions.Item label="结算方式:">{infoDetail?.settlementWayName}</Descriptions.Item>
<Descriptions.Item label="外部状态:">
<Descriptions.Item label="结算状态:">
<StatusTag text={infoDetail?.statusName} />
</Descriptions.Item>
</Descriptions>
......
.flexRow() {
display: flex;
flex-direction: row;
}
.radiosContainer {
display: flex;
flex-direction: row;
.dayRadio {
margin-right: 20px
}
}
.values {
.days {
.flexRow();
// margin-left: 25px;
margin-top: 25px;
}
}
// .period {
// .flexRow();
// margin-bottom: 20px;
// .days {
// .flexRow();
// margin-left: 25px;
// }
// }
\ No newline at end of file
/*
* @Author: bILL
* @Date: 2020-10-20 17:39:16
* @Description: 新增会员结算结算方式
*/
import React, { useEffect, useState } from 'react';
import { Radio, Input, Tooltip } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import styles from './index.less';
import { registerValidationRules } from '@formily/antd' // 或者 @formily/next
const DAY = 1;
const MONTH = 2;
registerValidationRules({
settleMethodRule: value => {
const { active, otherValues } = value;
const isNumber = /^\d+$/; // 数字
const pattern = /[0-9]+\.[0-9]*/;
if(active == MONTH) {
return (otherValues[1] < 0 || otherValues[1] > 31) || pattern.test(otherValues[1]) ? '只允许填写1-31号': ''
} else {
return !isNumber.test(otherValues[0]) || pattern.test(otherValues[0]) ? '只允许填写正整数' : ""
}
}
})
const SettleMethod = (props) => {
const { active = DAY, otherValues = [30, 1] } = props.value || {};
const { daysVisible, monthVisible } = props;
const handleChange = (e, type) => {
if(active == type) {
return ;
}
const previewValue = otherValues
// setActive(type)
props.onChange({
active: type,
otherValues: previewValue
})
}
const handleInputChange = (value, type) => {
const target = type - 1;
const temp = [...otherValues];
temp[target] = value;
props.onChange({
active: type,
otherValues: temp
})
}
return (
<div>
<div className={styles.radiosContainer}>
<div className={styles.dayRadio}>
<Radio name="method" checked={active == DAY} onChange={(e) => handleChange(e, DAY)}>账期(默认)</Radio>
<Tooltip title="选择账期并设置账期天数后,即结算时间为T+账期天数,系统每天自动将支付时间达到账期天数的支付金额进行结算,如设置账期天数为30天,则系统每天结算支付时间达到30天的支付金额">
<QuestionCircleOutlined />
</Tooltip>
</div>
<div >
<Radio name="method" checked={active == MONTH} onChange={(e) => handleChange(e, MONTH)}>月结</Radio>
<Tooltip title="选择月结并设置每月结算日期后,系统将在每月结算日当天自动将上月发生的支付金额进行结算,如每月结算日期设置为每月1号,则每月1号系统自动结算上月所有已发生的支付金额">
<QuestionCircleOutlined />
</Tooltip>
</div>
</div>
<div className={styles.values}>
{
active === DAY
? <div className={styles.days}>
<div style={{margin: '0 20px 0 0px'}}>账期天数</div>
<div>
<Input
addonAfter={"天"}
value={otherValues[DAY - 1]}
onChange={(e) => handleInputChange(e.target.value, DAY)}
disabled={active !== DAY}
style={{width: '160px'}}
/></div>
</div>
: <div className={styles.days}>
<div style={{marginRight: '20px'}}>每月结算日期:每月</div>
<div>
<Input
addonAfter={"号"}
style={{width: '160px'}}
value={otherValues[MONTH - 1]}
onChange={(e) => handleInputChange(e.target.value, MONTH)}
disabled={active !== MONTH}
/>
</div>
</div>
}
</div>
<div>
{
!monthVisible && !daysVisible
? <div>请在pass平台配置结算方式,否则无法创建会员策略</div>
: null
}
</div>
</div>
)
}
const Index = (props) => {
const value = props.value || {active: 0, otherValues: [30, 1]};
const componentProps = props.props['x-component-props'] || {};
const options = componentProps.options || {};
// 默认选择
useEffect(() => {
// const componentProps = props.props['x-component-props'] || {};
const defaultValue = componentProps.default || {};
if(!options.days && !options.month) {
return
}
if(typeof props.initialValue == 'undefined') {
props.mutators.change(defaultValue)
} else {
props.mutators.change(props.initialValue)
}
}, [props.initialValue, options])
const onChange = (value) => {
props.mutators.change(value);
}
return (
<SettleMethod
value={value}
daysVisible={options.days}
monthVisible={options.month}
onChange={onChange}
/>
)
}
Index.isFieldComponent = true;
export default Index;
\ No newline at end of file
/*
* @Author: Bill
* @Date: 2020-10-19 16:54:15
* @Description: 新建会员策略支付策略
*/
import React, { useEffect, useState } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import NiceForm from '@/components/NiceForm';
import { Card, Button, message } from 'antd';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { PlusOutlined } from '@ant-design/icons'
import ModalTable from '@/components/ModalTable';
import SearchSelect from '@/components/NiceForm/components/SearchSelect'
import Search from '@/components/NiceForm/components/Search'
import Submit from '@/components/NiceForm/components/Submit'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { addSchema, memberSchema } from './schema';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import SettleMethod from '../../components/SettleMethod';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { PublicApi } from '@/services/api';
import { usePageStatus } from '@/hooks/usePageStatus';
import { history, Prompt } from 'umi'
import { useLinkageUtils } from '@/utils/formEffectUtils'
const { onFormInit$, onFieldValueChange$ } = FormEffectHooks
export const fetchOptions = (service) => {
return async function() {
const res = await service();
if(res.code === 1000) {
return res.data.map((item) => {return { label: item.text, value: item.id }})
}
return [];
}
}
const formActions = createFormActions();
const common_columns: any = [
{ title: 'ID', dataIndex: 'memberId' },
{
title: '会员名称',
dataIndex: 'name',
render: (text: string, record: any) => {
return record.name || record.memberName
}
},
{ title: '会员类型', dataIndex: 'memberTypeName' },
{ title: '会员角色', dataIndex: 'roleName' },
{
title: '会员等级',
dataIndex: 'levelTag',
render: (text: string, record: any) => {
return record.levelTag || record.levelName
}
},
]
const MemberSettleAdd: React.FC = () => {
const [visible, setVisible] = useState(false)
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'memberId' });
const [initialValue, setInitialValue] = useState({});
const [cacheMember, setCacheMember] = useState([]);
const { id, preview } = usePageStatus();
const [submitLoading, setSubmitLoading ] = useState(false);
const [unsaved, setUnsaved] = useState(true);
const isAdd = !id && !preview;
const tableAddButton = () => {
return (
<div>
<Button
onClick={() => setVisible(true)}
style={{marginBottom: 16}}
block
icon={<PlusOutlined/>}
type='dashed'
>
选择适用会员
</Button>
</div>
)
}
const columns = common_columns.concat(
[
{
title: '操作',
render: (text, record) => {
return (
<a onClick={() => handleRemove(record.memberId)}>删除</a>
)
}
}
]
);
const handleCancelAddMember = () => {
setVisible(false);
}
// 获取适用会员
const fetchMemberData = async (params: any) => {
///member/manage/all/provider/page
const { data, code } = await PublicApi.getMemberManageAllProviderPage(params);
if(code === 1000) {
return data
}
return [];
}
// 获取适用会员下拉搜索框
const fetchMemberSearchFilter = () => {
const linkage = useLinkageUtils();
onFormInit$().subscribe(() => {
PublicApi.getMemberManagePageitems({roleTypeEnum: '1'}).then(res => {
if(res.code === 1000) {
const { levels, memberTypes, roles } = res.data;
linkage.enum('level', levels.map((item) => ({label: item.levelTag, value: item.level})))
linkage.enum('memberTypeId', memberTypes.map((item) => ({label: item.memberTypeName, value: item.memberTypeId})))
linkage.enum('roleId', roles.map((item) => ({label: item.roleName, value: item.roleId})))
}
});
})
}
// 使用会员弹框确认
const handleOkAddMember = () => {
formActions.setFieldValue('Tabs.memberTab.someLists', memberRowCtl.selectRow);
setVisible(false);
}
// 提交
const handleSubmit = (value) => {
const memberList = value.someLists.map((item) => (
{
memberId: item.memberId,
roleId: item.roleId,
}
)
);
const tempData = {
name: value.name,
settlementOrderType: value.settlementOrderType,
memberList: value.isDefault ? [] : memberList,
settlementWay: value.settlementWay.active,
settlementDays: value.settlementWay.otherValues[0],
settlementDate: value.settlementWay.otherValues[1],
isDefault: value.isDefault
}
const serviceActions = isAdd
? PublicApi.postSettleAccountsPlatformConfigAddPlatformSettlementStrategy
: PublicApi.postSettleAccountsPlatformConfigUpdatePlatformSettlementStrategy
const postData = {...tempData, id: id || 0 }
console.log(postData)
setSubmitLoading(true);
setUnsaved(false);
serviceActions(postData).then((data) => {
setSubmitLoading(false);
if(data.code === 1000) {
history.push('/ruleSettingManager/platformSettlementStrategy')
}
})
}
// 提交
const handleClick = () => {
formActions.submit()
}
//
const handleRemove = (id: number) => {
const string = 'Tabs.memberTab.someLists';
const chooseList = formActions.getFieldValue(string);
const res = chooseList.filter((item) => item.memberId !== id);
formActions.setFieldValue(string, res);
// 必须设置key
memberRowCtl.setSelectRow(res);
memberRowCtl.setSelectedRowKeys(res.map((item) => item.memberId))
}
// 从PAAS平台--规则配置--平台规则配置取已勾选的结算方式决定是否显示结算方式
const fetchBalancedMethods = async () => {
const { data } = await PublicApi.getManageRuleConfigurationList({platformType: '5'});
const length = data.length
return {
days: length > 0 && data[0].check,
month: length > 1 && data[1].check
};
}
// 从PAAS平台--规则配置--平台规则配置取已勾选的结算方式决定是否显示结算方式
useEffect(() => {
fetchBalancedMethods().then(data => {
formActions.setFieldState('Tabs.basicTab.layout.settlementWay', (state) => {
//@ts-ignore
state.props['x-component-props']['options'] = data;
})
})
}, [])
/**
* 进入详情页之后,初始化数据
*/
useEffect(() => {
if(id) {
async function getInfo() {
const res = await PublicApi.getSettleAccountsPlatformConfigGetPlatformSettlementStrategyDetail({id})
if(res.code === 1000) {
setInitialValue({
name: res.data.name,
settlementOrderType: res.data.settlementOrderType,
memberList: res.data.memberList,
settlementWay: {
active: res.data.settlementWay,
otherValues: [res.data.settlementDays, res.data.settlementDate],
},
})
formActions.setFieldValue('Tabs.memberTab.layout.isDefault', res.data.isDefault)
formActions.setFieldValue('Tabs.memberTab.someLists', res.data.memberList);
// 必须设置key
memberRowCtl.setSelectRow(res.data.memberList);
memberRowCtl.setSelectedRowKeys(res.data.memberList.map((item) => item.memberId))
} else {
message.error({content: res.message})
}
}
getInfo();
}
}, [id])
return (
<PageHeaderWrapper
extra={[
<Button loading={submitLoading} key="1" type="primary" onClick={handleClick} >
保存
</Button>,
]}
>
<Card>
<NiceForm
actions={formActions}
initialValues={initialValue}
expressionScope={{
tableAddButton: tableAddButton(),
tableColumns: columns
}}
components={{SettleMethod}}
onSubmit={values => handleSubmit(values)}
schema={addSchema}
effects={() => {
// 获取单据类型
useAsyncSelect(
"settlementOrderType",
fetchOptions(PublicApi.getSettleAccountsCommonGetPlatformStrategySettlementOrderType )
)
}}
/>
<ModalTable
modalTitle='选择适用会员'
confirm={handleOkAddMember}
cancel={handleCancelAddMember}
visible={visible}
columns={common_columns}
rowSelection={memberRowSelection}
fetchTableData={params => fetchMemberData(params)}
tableProps={{
rowKey: 'memberId',
}}
width={1000}
formilyProps={
{
ctx: {
schema: memberSchema,
actions: formActions,
components: { ModalSearch: Search, SearchSelect, Submit } ,
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
)
fetchMemberSearchFilter()
}
}
}
}
/>
</Card>
<Prompt when={unsaved} message="内容还没保存,确定离开吗?"/>
</PageHeaderWrapper>
)
}
export default MemberSettleAdd
\ No newline at end of file
import { ISchema } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const';
/**
* 新增会员结算策略schema
*
*/
export const addSchema: ISchema = {
type: 'object',
properties: {
'Tabs': {
type: 'object',
'x-component': 'tab',
'x-component-props': {
type: 'card'
},
properties: {
basicTab: {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '基本信息'
},
properties: {
layout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 9,
labelAlign: 'left'
},
properties: {
name: {
title: '策略名称',
type: 'string',
'x-rules': [
{required: true, message: '请填写策略名称'},
]
},
settlementWay: {
title: '结算方式',
'x-component': 'SettleMethod',
'x-rules': [
{
required: true,
message: '请选择结算方式并填写信息'
},
{
settleMethodRule: true
}
],
'x-component-props': {
// options: {
// days: true,
// month: false
// },
default: {
active: 1,
otherValues: [30, 1]
}
}
},
settlementOrderType: {
type: 'string',
enum: [],
title: '结算单据',
'x-rules': [
{required: true, message: '请填写策略名称'},
]
}
},
}
}
},
memberTab: {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '适用会员'
},
properties: {
layout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 9,
labelAlign: 'left'
},
properties: {
isDefault: {
type: 'radio',
enum: [
{label: '所有会员(默认)', value: 1},
{label: '指定会员', value: 0},
],
default: 1,
title: '适用会员',
'x-linkages': [
{
type: 'value:visible',
target: '*(someLists)',
condition: '{{$value === 0}}'
}
]
}
}
},
someLists: {
type: 'array:number',
'x-mega-props': {
wrapperCol: 24,
},
'x-component': 'MultTable',
'x-component-props': {
rowKey: 'memberId',
prefix: "{{tableAddButton}}",
columns: "{{tableColumns}}"
// columns: "{{tableColumns}}",
}
}
}
}
}
}
}
}
export const memberSchema: ISchema = {
type: 'object',
properties: {
name: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '商品名称',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
},
properties: {
roleId: {
type: 'string',
enum: [],
"x-component-props": {
placeholder: '选择会员角色',
style: {width: '200px'},
allowClear: true,
}
},
memberTypeId: {
type: 'string',
enum: [],
"x-component-props": {
placeholder: '选择会员角色',
style: {width: '200px'},
allowClear: true,
}
},
level: {
type: 'string',
enum: [],
"x-component-props": {
placeholder: '选择会员角色',
style: {width: '200px'},
allowClear: true,
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
\ No newline at end of file
/**
* @author Bill
* @description 平台结算策略
*/
import React, { useRef } from 'react';
import { Card, Button } from 'antd';
import NiceForm from '@/components/NiceForm';
import { StandardTable } from 'god';
import { PublicApi } from '@/services/api';
import EyePreview from '@/components/EyePreview';
import StatusSwitch from '@/components/StatusSwitch';
import { createFormActions } from '@formily/antd';
import { PlusOutlined } from '@ant-design/icons';
import { ColumnsType } from 'antd/es/table';
import { history } from 'umi';
import schema from './schema'
const formActions = createFormActions();
const MemberSettle: React.FC<{}> = () => {
const ref = useRef<any>({});
const fetchData = async (params: any) => {
console.log(params);
const { current, pageSize, name } = params
const postData = {current, pageSize, name: name || ''}
const { data } = await PublicApi.getSettleAccountsPlatformConfigPagePlatformSettlementStrategy(postData);
return data;
};
const handleModify = async (record) => {
const { code } = await PublicApi.postSettleAccountsPlatformConfigSetPlatformSettlementStrategyStatus({id: record.id, status: record.status ? 0 : 1})
if(code == 1000) {
formActions.submit();
}
}
const columns: ColumnsType<any> = [
{title: 'ID',dataIndex: 'id',},
{
title: '策略名称',
dataIndex: 'name',
render: (text, record) => {
return (
<div>
<EyePreview
url={`/ruleSettingManager/platformSettlementStrategy/detail?id=${record.id}&preview=1`}
>
{text}
</EyePreview>
</div>
)
}
},
{ title: '结算方式', dataIndex: 'settlementWayName'},
{ title: '结算单据',dataIndex: 'settlementOrderTypeName'},
{
title: '状态',
dataIndex: 'status',
render: (text, record) => {
return (
<StatusSwitch
handleConfirm={() => handleModify(record)}
record={record}
fieldNames="status"
/>
)
}
},
]
const goToCreate = () => {
history.push('/ruleSettingManager/platformSettlementStrategy/add');
}
return (
<Card>
<StandardTable
tableProps={{
rowKey: 'id',
}}
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
expressionScope={{
createBtn: (
<div style={{width: '112px'}}>
<Button type="primary" onClick={goToCreate}><PlusOutlined /> 新建</Button>
</div>
)
}}
onSubmit={values => ref.current.reload(values)}
schema={schema}
/>
}
/>
</Card>
)
}
export default MemberSettle
\ No newline at end of file
import { ISchema } from '@formily/antd'
const schema: ISchema = {
type: 'object',
properties: {
layout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
columns: 6
},
properties: {
createBtn: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{createBtn}}'
},
"x-mega-props": {
"span": 4
},
},
name: {
type: 'string',
'x-component': 'Search',
"x-mega-props": {
"span": 2
},
'x-component-props': {
placeholder: '搜索',
advanced: false,
},
},
}
}
}
}
export default schema
\ No newline at end of file
import React, {Component} from 'react';
import { Button } from 'antd';
import styles from '../layouts/index.less';
import { inject, observer } from 'mobx-react'
import { ITestModule } from '@/module/testModule'
import { IStore } from '@/store';
import Loading from '@/components/Loading' // 测试loading组件
export interface ITestProps {
testStore?: ITestModule
}
@inject((store: IStore) => ({
testStore: store.testStore
}))
@observer
class Index extends Component<ITestProps, {}> {
render() {
const { testText, testNumber, testList,printInfo, setText, setNumber, getAsyncInfo } = this.props.testStore!
return <div>
{/* <Loading /> */}
<h3>{testText}|{testNumber}</h3>
<h3>{printInfo}</h3>
<h5>测试页面</h5>
<div>
<ul>
{
testList.length>0 && testList.map((item, index) => {
return (<li key={index}>{item}</li>)
})
}
</ul>
</div>
<Button onClick={() => {setText('调用mobx改变Text')}}>mobx改变Text</Button>
<Button onClick={() => {setNumber(10086)}}>mobx改变Number</Button>
<Button onClick={() => {getAsyncInfo()}}>mobx改变异步数据</Button>
</div>
}
}
export default Index
......@@ -132,7 +132,7 @@ class Index extends Component<{}, IndexState> {
<Col span={12} className="myCol">
<Carousel autoplay>
{
sceneList && sceneList.map(item => <ImageBox direction={"column"} width={410} height={453} imgUrl={item.imageUrl} />)
sceneList && sceneList.map(item => <ImageBox key={item.id} direction={"column"} width={410} height={453} imgUrl={item.imageUrl} />)
}
</Carousel>
</Col>
......
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