Commit aee64065 authored by superman's avatar superman

publish 0.0.1

parent 7dd98321
This diff is collapsed.
import React, {Component, PropTypes} from 'react';
export default class CopyToClipboard extends Component {
constructor(props, context) {
super(props, context);
this.state = {
success: false
};
}
static propType = {
copyText: PropTypes.string
};
handleClick() {
const targetId = '_hiddenCopyText_';
let target = document.getElementById(targetId);
if (!target) {
target = document.createElement("textarea");
target.style.position = "absolute";
target.style.left = "-9999px";
target.style.top = "0";
target.id = targetId;
document.body.appendChild(target);
}
target.textContent = this.props.copyText || '';
// select the content
let currentFocus = document.activeElement;
target.focus();
target.setSelectionRange(0, target.value.length);
// copy the selection
let success;
try {
success = document.execCommand("copy");
} catch (e) {
success = false;
}
// restore original focus
if (currentFocus && typeof currentFocus.focus === "function") {
currentFocus.focus();
}
// clear temporary content
target.textContent = "";
if (success) {
this.setState({success});
setTimeout(()=> {
this.setState({success: false});
}, 1500);
}
}
render() {
const styles = require('./CopyToClipboard.less');
return (
<div className={styles.copybox} onClick={this.handleClick.bind(this)}>
{this.props.children}
{
this.state.success &&
<div className={styles.success}>
Copied!
</div>
}
</div>
);
}
}
.copybox {
position: relative;
.success {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background-color: rgba(75, 184, 255, .75);
color: #fff;
display: table;
vertical-align: middle;
text-align: center;
}
}
...@@ -125,7 +125,7 @@ export default class BaseInfoForm extends Component { ...@@ -125,7 +125,7 @@ export default class BaseInfoForm extends Component {
/> />
</Form.Item> </Form.Item>
<Form.Item label="产品简介" {...formItemLayout}> <Form.Item label="产品简介" {...formItemLayout}>
<Input type="textarea" rows={5} placeholder="产品简介" <Input type="textarea" autosize={{minRows:5, maxRows:20}} placeholder="产品简介"
{...getFieldProps('summary', { {...getFieldProps('summary', {
initialValue: product.summary initialValue: product.summary
})} })}
......
...@@ -75,7 +75,7 @@ export default class HuikuanInfoForm extends Component { ...@@ -75,7 +75,7 @@ export default class HuikuanInfoForm extends Component {
/> />
</Form.Item> </Form.Item>
<Form.Item label="打款须知" help="接收打款的一些必要告知信息" {...formItemLayout}> <Form.Item label="打款须知" help="接收打款的一些必要告知信息" {...formItemLayout}>
<Input type="textarea" rows={10} placeholder="" <Input type="textarea" autosize={{minRows:5, maxRows:20}} placeholder=""
{...getFieldProps('fundRaisedAccount.memo', { {...getFieldProps('fundRaisedAccount.memo', {
initialValue: fundRaisedAccount.memo initialValue: fundRaisedAccount.memo
})} })}
......
...@@ -58,7 +58,7 @@ export default class AddItem extends Component { ...@@ -58,7 +58,7 @@ export default class AddItem extends Component {
<Input placeholder="公告标题" {...getFieldProps('title')} /> <Input placeholder="公告标题" {...getFieldProps('title')} />
</Form.Item> </Form.Item>
<Form.Item label="内容" {...formItemLayout}> <Form.Item label="内容" {...formItemLayout}>
<Input placeholder="公告内容" type="textarea" {...getFieldProps('announcement')} /> <Input placeholder="公告内容" type="textarea" autosize={{minRows:5, maxRows:20}} {...getFieldProps('announcement')} />
</Form.Item> </Form.Item>
<Form.Item {...footerFormSubmitLayout} style={{marginTop:30}}> <Form.Item {...footerFormSubmitLayout} style={{marginTop:30}}>
<Button type="primary" htmlType="submit" loading={loading}><Icon type="save"/>创建</Button> <Button type="primary" htmlType="submit" loading={loading}><Icon type="save"/>创建</Button>
......
...@@ -72,7 +72,12 @@ export default class List extends Component { ...@@ -72,7 +72,12 @@ export default class List extends Component {
}, { }, {
title: '内容', title: '内容',
dataIndex: 'announcement', dataIndex: 'announcement',
key: 'announcement' key: 'announcement',
render: (announcement, record)=>(
<span title={announcement}>
{announcement && (announcement.length > 20 ? announcement.substr(0,20)+'...' : announcement)}
</span>
)
}, { }, {
title: '创建时间', title: '创建时间',
dataIndex: 'dateCreated', dataIndex: 'dateCreated',
......
import React, {Component, PropTypes} from 'react'; import React, {Component, PropTypes} from 'react';
import {Router, Route, IndexRoute, Link} from 'react-router'; import {Router, Route, IndexRoute, Link} from 'react-router';
import Layout from '../../components/Layout/Layout'; import Layout from '../../components/Layout/Layout';
import {connect} from 'react-redux';
import {Collapse, Menu, Icon, Upload} from 'antd';
import {Collapse, Menu, Icon} from 'antd';
const Panel = Collapse.Panel; const Panel = Collapse.Panel;
const SubMenu = Menu.SubMenu; const SubMenu = Menu.SubMenu;
const MenuItemGroup = Menu.ItemGroup; const MenuItemGroup = Menu.ItemGroup;
@connect(state=>({
user: state.user
}))
export default class App extends Component { export default class App extends Component {
static propTypes = { static propTypes = {
children: PropTypes.object.isRequired, children: PropTypes.object.isRequired,
...@@ -51,10 +53,30 @@ export default class App extends Component { ...@@ -51,10 +53,30 @@ export default class App extends Component {
to: '/remittance/audits', to: '/remittance/audits',
cn: '报单审核', cn: '报单审核',
en: 'Remittance Audits' en: 'Remittance Audits'
},{
to: '/withdraw/audits',
cn: '提现审核',
en: 'Withdraw Money'
}
]
},{
title:'消息管理',
items:[
{
to: '/customMessages',
cn: '消息列表',
en: 'Messages'
},{
to: '/customMessages/create',
cn: '推送消息',
en: 'Send Message'
} }
] ]
} }
]; ];
const {user} = this.props;
const logo = require('./images/logo.png'); const logo = require('./images/logo.png');
return ( return (
<div className={styles.normal}> <div className={styles.normal}>
...@@ -63,9 +85,11 @@ export default class App extends Component { ...@@ -63,9 +85,11 @@ export default class App extends Component {
</div> </div>
<div className={styles.content}> <div className={styles.content}>
<div className={styles.side}> <div className={styles.side}>
<Menu mode="inline" defaultOpenKeys={['sub1']}> <Menu mode="inline" defaultOpenKeys={['sub1']}>
<SubMenu key="sub1" title={<span><Icon type="mail" /><span>业务管理</span></span>}> <SubMenu key="sub1" title={<span><Icon type="mail" /><span>业务管理</span></span>}>
{ {
user && user.token &&
mainMenu.map((menu, mi)=> mainMenu.map((menu, mi)=>
<MenuItemGroup title={menu.title} key={mi}> <MenuItemGroup title={menu.title} key={mi}>
{ {
...@@ -79,10 +103,15 @@ export default class App extends Component { ...@@ -79,10 +103,15 @@ export default class App extends Component {
) )
} }
</SubMenu> </SubMenu>
<SubMenu key="sub2" title={<span><Icon type="folder" /><span>基本功能</span></span>}>
<Menu.Item>
<MenuItemContent to="/upload" cn="图片上传" en="Upload Images" />
</Menu.Item>
</SubMenu>
</Menu> </Menu>
</div> </div>
<div className={styles.main}> <div className={styles.main}>
{this.props.children} {user && user.token && this.props.children}
</div> </div>
</div> </div>
<div className={styles.foot}> <div className={styles.foot}>
......
import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
import {
Row,
Col,
Form,
Input,
Button,
Checkbox,
Select,
message,
Tabs,
Cascader,
Radio,
Upload,
Icon,
Modal,
DatePicker,
Table,
Spin
} from 'antd';
import Copy from '../../components/CopyToClipboard/CopyToClipboard';
import Layout from '../../components/Layout/Layout';
import MainHeader from '../../components/MainHeader';
import {
handleUpload
} from '../../utils';
@connect(state=>({
user: state.user
}))
@Form.create()
export default class BaseUpload extends Component {
constructor(props, context) {
super(props, context);
this.state = {
fileList: []
};
}
render() {
const {user} = this.props;
const styles = require('./BaseUpload.less');
const header = (<MainHeader breadcrumb={['基本功能', '图片上传']} title="图片上传"/>);
return (
<Layout header={header}>
<Row>
<Col span="20">
<Upload.Dragger action="/api/fileUpload/upload"
multiple={true}
headers={{
authorization: user && user.token,
}}
onChange={info=>this.setState({fileList: handleUpload(info)})}
showUploadList={false}
onPreview={(e)=>console.log(e)}
>
<p className="ant-upload-drag-icon">
<Icon type="inbox"/>
</p>
<p className="ant-upload-text">点击或将图片拖拽到此区域上传</p>
<p className="ant-upload-hint">支持单个或批量上传,严禁上传公司内部资料及其他违禁文件</p>
</Upload.Dragger>
<ul className={styles.fileList}>
{
this.state.fileList.map(file=>
<li key={file.uid}>
<Copy copyText={file.url}>
<Row>
<Col span="4"><Icon type="paper-clip"
style={{marginRight:'.3em'}}/>{file.name}</Col>
<Col span="20">{file.url ? file.url : '正在上传...'}</Col>
</Row>
</Copy>
</li>
)
}
</ul>
</Col>
</Row>
</Layout>
);
}
}
.fileList {
margin-top: 30px;
li {
margin: 10px 0;
}
}
import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
import {
Row,
Col,
Form,
Input,
Button,
Checkbox,
Select,
message,
Tabs,
Cascader,
Radio,
Upload,
Icon,
Modal,
DatePicker,
Table,
Spin
} from 'antd';
import Layout from '../../components/Layout/Layout';
import MainHeader from '../../components/MainHeader';
import {formItemLayout, footerFormSubmitLayout} from '../../utils';
@connect(state=>({
loading: state.customMessage.loading,
}))
@Form.create()
export default class AddItem extends Component {
constructor(props, content) {
super(props, content);
this.state = {
redirectName: '请选择',
sendName: '请选择'
}
}
handleSubmit(e) {
e.preventDefault();
const data = this.props.form.getFieldsValue();
data.customMessage.redirectType = this.state.redirectName;
data.customMessage.sendType = this.state.sendName;
console.log(data);
this.props.dispatch({
type: 'CREATE_MESSAGE_ITEM',
data
});
}
render = ()=> {
const {loading, form:{getFieldProps}, location:{query}} = this.props;
const header = (<MainHeader breadcrumb={['消息管理', '推送消息']}
title="推送消息"/>);
const redirectNamePlaceholder = {0:'无需填写', 1:'请输入一个产品ID', 2:'请输入消息跳转指定的URL地址'};
const sendNamePlaceholder = {1:'无需填写', 2:'请输入一个产品ID', 3:'请输入接收消息的人员的手机号码'};
return (
<Layout header={header}>
<Spin spinning={loading}>
<Form horizontal onSubmit={this.handleSubmit.bind(this)}>
<Form.Item label="推送渠道" {...formItemLayout}>
<Row>
<Col span="6">
<Select placeholder="请选择" {...getFieldProps('customMessage.channelType')} >
<Select.Option value="1">微信</Select.Option>
<Select.Option value="3">APP</Select.Option>
</Select>
</Col>
</Row>
</Form.Item>
<Form.Item label="消息跳转" {...formItemLayout}>
<Row>
<Col span="6">
<Select placeholder="请选择"
value={this.state.redirectName}
onChange={value=>this.setState({redirectName: value})}>
<Select.Option value="0"></Select.Option>
<Select.Option value="1">产品ID</Select.Option>
<Select.Option value="2">URL</Select.Option>
</Select>
</Col>
<Col span="18" style={{paddingLeft:'.5em'}}>
<Input placeholder={redirectNamePlaceholder[this.state.redirectName]}
{...getFieldProps('customMessage.redirect')} />
</Col>
</Row>
</Form.Item>
<Form.Item label="推送对象" {...formItemLayout}>
<Row>
<Col span="6">
<Select placeholder="请选择"
value={this.state.sendName}
onChange={value=>this.setState({sendName: value})}>
<Select.Option value="1">全局推送</Select.Option>
<Select.Option value="2">产品ID</Select.Option>
<Select.Option value="3">手动导入</Select.Option>
</Select>
</Col>
<Col span="18" style={{paddingLeft:'.5em'}}>
<Input placeholder={sendNamePlaceholder[this.state.sendName]}
{...getFieldProps('customMessage.send')} />
</Col>
</Row>
</Form.Item>
<Form.Item label="消息标题" {...formItemLayout}>
<Input placeholder="消息标题" {...getFieldProps('customMessage.title')} />
</Form.Item>
<Form.Item label="消息摘要" {...formItemLayout}>
<Input placeholder="消息摘要" type="textarea"
autosize={{minRows:3, maxRows:10}} {...getFieldProps('customMessage.abstracts')} />
</Form.Item>
<Form.Item label="消息正文" {...formItemLayout}>
<Input placeholder="消息正文" type="textarea"
autosize={{minRows:3, maxRows:10}} {...getFieldProps('customMessage.contents')} />
</Form.Item>
<Form.Item {...footerFormSubmitLayout} style={{marginTop:30}}>
<Button type="primary" htmlType="submit" loading={loading}><Icon type="save"/>立即推送</Button>
<Button onClick={e=>{e.preventDefault(); this.props.history.goBack();}}
style={{marginLeft:'1em'}}>
<Icon type="rollback"/>返回
</Button>
</Form.Item>
</Form>
</Spin>
</Layout>
);
}
}
import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
import {Link} from 'react-router';
import {Form, Input, Button, Checkbox, message, Row, Col, Spin, Icon} from 'antd';
import {
formatDateTime,
tradeStatusToString,
tradeCreateTypeToString
} from '../../utils';
import Layout from '../../components/Layout/Layout';
import MainHeader from '../../components/MainHeader';
@connect(state=>({
loading: state.customMessage.loading,
item: state.customMessage.item
}))
export default class Item extends Component {
componentDidMount() {
const {dispatch, params:{id}} = this.props;
dispatch({
type: 'FETCH_MESSAGE_ITEM',
id
});
};
render() {
const {item, loading} = this.props;
const styles = require('../Trade/Item.less');
const tw = 8;
const vw = 16;
const header = (<MainHeader breadcrumb={['消息管理', '消息详情']}
title={((item && item.title) ? item.title + ' - ' : '') + '消息详情'}/>);
return (
<Layout header={header}>
{
item ?
<div className={styles.trade}>
<div className={styles.tradeTable}>
<Row type="flex" justify="space-around" align="middle">
<Col span={tw}>消息ID</Col>
<Col span={vw}>{item.id}</Col>
</Row>
<Row type="flex" justify="space-around" align="middle">
<Col span={tw}>消息标题</Col>
<Col span={vw}>{item.title}</Col>
</Row>
<Row type="flex" justify="space-around" align="middle">
<Col span={tw}>消息摘要</Col>
<Col span={vw}>{item.abstracts}</Col>
</Row>
<Row type="flex" justify="space-around" align="middle">
<Col span={tw}>消息正文</Col>
<Col span={vw}>{item.contents}</Col>
</Row>
<Row type="flex" justify="space-around" align="middle">
<Col span={tw}>跳转内容</Col>
<Col span={vw}>
<span>{'类型:'+(item.redirectName||'')}</span>
{
item.redirect &&
<span style={{marginLeft:'1em'}}>{'内容:'+item.redirect}</span>
}
</Col>
</Row>
<Row type="flex" justify="space-around" align="middle">
<Col span={tw}>推送渠道</Col>
<Col
span={vw}>{item.channelName}</Col>
</Row>
<Row type="flex" justify="space-around" align="middle">
<Col span={tw}>推送时间</Col>
<Col
span={vw}>{item.dateCreated && item.dateCreated.replace(/[年月]/g, '-').replace(/日/g, '')}</Col>
</Row>
<Row type="flex" justify="space-around" align="middle">
<Col span={tw}>推送人数</Col>
<Col span={vw}>{item.count}</Col>
</Row>
<Row type="flex" justify="space-around" align="middle">
<Col span={tw}>推送类型</Col>
<Col span={vw}>{item.sendName}</Col>
</Row>
<Row type="flex" justify="space-around" align="middle">
<Col span={tw}>推送对象</Col>
<Col span={vw}>{item.send}</Col>
</Row>
</div>
<p>
<Button onClick={e=>{e.preventDefault(); this.props.history.goBack();}}
style={{marginLeft:'1em'}}>
<Icon type="rollback"/>返回
</Button>
</p>
</div>
:
<Spin spinning={loading}/>
}
</Layout>
);
}
};
import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
import {Table, Icon, Button, Switch, Form} from 'antd';
import {serialize, formatDateTime, productStatusToString, footerFormSubmitLayout} from '../../utils';
import {Link} from 'react-router';
import Layout from '../../components/Layout/Layout';
import MainHeader from '../../components/MainHeader';
@connect(state=>({
items: state.customMessage.items,
loading: state.customMessage.loading,
total: state.customMessage.total,
}))
export default class List extends Component {
constructor(props, context) {
super(props, context);
}
componentDidMount() {
this.fetchList(this.props.location.query);
};
fetchList(query) {
this.props.dispatch({
type: 'FETCH_MESSAGE_LIST',
query
});
};
handleRowClick({id}) {
this.props.history.push('/customMessages/' + id);
}
render() {
const {total, items, loading, history:{replace}, location:{pathname, query}} = this.props;
const pagination = {
total: total,
pageSize: parseInt(query.s, 10) || 10,
current: parseInt(query.p, 10) || 1,
showSizeChanger: true,
onShowSizeChange: (current, pageSize)=> {
console.log('Current: ', current, '; PageSize: ', pageSize);
query.p = current;
query.s = pageSize;
replace(pathname + '?' + serialize(query));
this.fetchList(query);
},
onChange: (current)=> {
console.log('Current: ', current);
query.p = current;
replace(pathname + '?' + serialize(query));
this.fetchList(query);
}
};
const columns = [
{
title: 'ID',
dataIndex: 'id',
key: 'id',
width: 50
}, {
title: '推送时间',
dataIndex: 'dateCreated',
key: 'dateCreated',
width: 150,
className: 'tac',
render: (dateCreated, record)=>(
<span>
{dateCreated && dateCreated.replace(/[年|月]/g, '-').replace(/日/g, '')}
</span>
)
}, {
title: '推送渠道',
dataIndex: 'channelName',
key: 'channelName',
className: 'tac',
width: 120
}, {
title: '标题',
dataIndex: 'title',
key: 'title'
}
];
const header = (<MainHeader breadcrumb={['消息管理', '消息列表']} title="消息列表"/>);
return (
<Layout header={header}>
<Table className="ant-table" columns={columns}
dataSource={Array.isArray(items)?items:[]}
loading={loading}
pagination={pagination}
scroll={{ y: window.innerHeight-380 }}
onRowClick={this.handleRowClick.bind(this)}
/>
</Layout>
);
}
}
import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
import {
Row,
Col,
Form,
Input,
Button,
Checkbox,
Select,
message,
Tabs,
Cascader,
Radio,
Upload,
Icon,
Modal,
DatePicker,
Table,
Spin
} from 'antd';
import Layout from '../../components/Layout/Layout';
import MainHeader from '../../components/MainHeader';
import {formItemLayout, footerFormSubmitLayout} from '../../utils';
@connect(state=>({
loading: state.remittance.loading,
audit: state.remittance.audit,
}))
@Form.create()
export default class EditItem extends Component {
constructor() {
super(...arguments);
}
componentDidMount() {
this.fetchItem(this.props.params.id);
};
fetchItem(id) {
this.props.dispatch({
type: 'FETCH_AUDIT_ITEM',
id
});
};
handleSubmit(e) {
e.preventDefault();
const data = this.props.form.getFieldsValue();
data.id = this.props.audit.id;
console.log(data);
// this.props.dispatch({
// type: 'UPDATE_AUDIT_ITEM',
// data
// });
}
render() {
const {audit, loading, form:{getFieldProps}, location:{query}} = this.props;
const header = (<MainHeader breadcrumb={['审核管理', '报单审核','审核详情']}
title={(audit && audit.title ? audit.title + ' - ' : '') + '审核详情'}/>);
return (
<Layout header={header}>
<Spin spinning={loading}>
{
audit &&
<Form horizontal onSubmit={this.handleSubmit.bind(this)}>
<Form.Item label="产品募集情况" {...formItemLayout}>
<Input placeholder="公告标题"
{...getFieldProps('title', {
initialValue: audit.title
})} />
</Form.Item>
<Form.Item label="内容" {...formItemLayout}>
<Input placeholder="公告内容" autosize={{ minRows: 5 }} type="textarea"
{...getFieldProps('announcement', {
initialValue: audit.announcement
})} />
</Form.Item>
<Form.Item {...footerFormSubmitLayout} style={{marginTop:30}}>
<Button type="primary" htmlType="submit" loading={loading}><Icon
type="save"/>修改</Button>
<Button onClick={e=>{e.preventDefault(); this.props.history.goBack();}}
style={{marginLeft:'1em'}}>
<Icon type="rollback"/>返回
</Button>
</Form.Item>
</Form>
}
</Spin>
</Layout>
);
}
}
...@@ -2,9 +2,9 @@ import React, {Component, PropTypes} from 'react'; ...@@ -2,9 +2,9 @@ import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {Table, Icon} from 'antd'; import {Table, Icon} from 'antd';
import {Link} from 'react-router'; import {Link} from 'react-router';
import {serialize, formatDateTime, tradeStatusToString} from '../../../utils'; import {serialize, formatDateTime, remittanceAuditStatusToString} from '../../utils';
import Layout from '../../../components/Layout/Layout'; import Layout from '../../components/Layout/Layout';
import MainHeader from '../../../components/MainHeader'; import MainHeader from '../../components/MainHeader';
const columns = [ const columns = [
{ {
...@@ -47,7 +47,7 @@ const columns = [ ...@@ -47,7 +47,7 @@ const columns = [
key: 'status', key: 'status',
width: 120, width: 120,
className: 'tac', className: 'tac',
render: (status, record)=>(<span data-status={status}>{tradeStatusToString(status)}</span>) render: (status, record)=>(<span data-status={status}>{remittanceAuditStatusToString(status)}</span>)
}, { }, {
title: '操作', title: '操作',
key: 'operation', key: 'operation',
...@@ -56,8 +56,12 @@ const columns = [ ...@@ -56,8 +56,12 @@ const columns = [
className: 'tac', className: 'tac',
render: (text, record)=>( render: (text, record)=>(
<span> <span>
<Link to={'/trades/contract/'+ record.id} onClick={e=>e.stopPropagation()}>审核</Link> {
record.status == 1 &&
<Link to={'/remittance/audits/'+ record.id} onClick={e=>e.stopPropagation()}>审核</Link>
}
</span> </span>
) )
} }
]; ];
...@@ -80,7 +84,7 @@ export default class List extends Component { ...@@ -80,7 +84,7 @@ export default class List extends Component {
fetchList(query) { fetchList(query) {
this.props.dispatch({ this.props.dispatch({
type: 'FETCH_AUDIT_LIST', type: 'FETCH_REMITTANCE_LIST',
query query
}); });
} }
...@@ -114,15 +118,15 @@ export default class List extends Component { ...@@ -114,15 +118,15 @@ export default class List extends Component {
}; };
const header = (<MainHeader breadcrumb={['审核管理', '报单审核']} const header = (<MainHeader breadcrumb={['审核管理', '报单审核']}
title="审核列表"/>); title="报单审核列表"/>);
return ( return (
<Layout header={header}> <Layout header={header}>
<Table className="ant-table" columns={columns} <Table className="ant-table" columns={columns}
dataSource={Array.isArray(items)?items:[]} dataSource={Array.isArray(items) ? items : []}
loading={loading} loading={loading}
pagination={pagination} pagination={pagination}
scroll={{ y: window.innerHeight-380 }} scroll={{y: window.innerHeight - 380}}
onRowClick={this.handleRowClick.bind(this)} onRowClick={this.handleRowClick.bind(this)}
/> />
</Layout> </Layout>
......
This diff is collapsed.
import React, { Component, PropTypes } from 'react';
import classnames from 'classnames';
import styles from './Todo.less';
const Todo = ({ data, onToggleComplete }) => {
const { text, isComplete } = data;
const todoCls = classnames({
[styles.normal]: true,
[styles.isComplete]: isComplete,
});
return (
<div className={todoCls}>
<div className={styles.checkbox}>
<input
type="checkbox"
value=""
checked={isComplete}
onChange={onToggleComplete.bind(this)}
/>
</div>
<div className={styles.text}>
{text}
</div>
</div>
);
};
Todo.propTypes = {
data: PropTypes.object.isRequired,
onToggleComplete: PropTypes.func.isRequired,
};
export default Todo;
.normal {
display: flex;
}
.checkbox {
margin-right: 6px;
}
.isComplete {
color: #ccc;
text-decoration: line-through;
}
import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
import {Spin} from 'antd';
import Todo from './Todo';
import styles from './Todos.less';
const Todos = ({todos, dispatch}) => {
const handleToggleComplete = (id) => {
dispatch({
type: 'todos/toggleComplete',
payload: id,
});
};
const renderList = () => {
const {list, loading} = todos;
if (loading) {
return <Spin />;
}
return (
<div className={styles.list}>
{list.map(item => <Todo
key={item.id}
data={item}
onToggleComplete={handleToggleComplete.bind(this, item.id)}
/>
)}
</div>
);
};
return (
<div className={styles.normal}>
{renderList()}
</div>
);
};
Todos.propTypes = {};
function filter(todos, pathname) {
const newList = todos.list.filter(todo => {
if (pathname === '/actived') {
return !todo.isComplete;
}
if (pathname === '/completed') {
return todo.isComplete;
}
return true;
});
return {...todos, list: newList};
}
function mapStateToProps({todos}, {location}) {
return {
todos: filter(todos, location.pathname),
};
}
export default connect(mapStateToProps)(Todos);
...@@ -49,6 +49,15 @@ export default class AddItem extends Component { ...@@ -49,6 +49,15 @@ export default class AddItem extends Component {
}; };
} }
componentDidMount(){
const {item} = this.props;
if (item && item.id) {
this.props.dispatch({
type: 'INIT_TRADE'
});
}
}
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const {item} = nextProps; const {item} = nextProps;
if (item && item.id) { if (item && item.id) {
...@@ -64,10 +73,38 @@ export default class AddItem extends Component { ...@@ -64,10 +73,38 @@ export default class AddItem extends Component {
e.preventDefault(); e.preventDefault();
const data = this.props.form.getFieldsValue(); const data = this.props.form.getFieldsValue();
data.itemId = this.props.location.query.itemId; data.itemId = this.props.location.query.itemId;
console.log(data);
if(!data.itemId){
message.warning('未知的产品ID');
return;
}
if (data.remittance.remittanceTime) { if (data.remittance.remittanceTime) {
data.remittance.remittanceTime = formatDateTime(data.remittance.remittanceTime); data.remittance.remittanceTime = formatDateTime(data.remittance.remittanceTime);
} }
const {identityCardList, bankCardList, receiptList, signaturePages} = this.state;
if(Array.isArray(identityCardList) && identityCardList.length){
data.remittance.identityCardFront = identityCardList[0] && identityCardList[0].url;
data.remittance.identityCardBack = identityCardList[1] && identityCardList[1].url;
}
if(Array.isArray(bankCardList) && bankCardList.length){
data.remittance.bankCardPic = bankCardList[0] && bankCardList[0].url;
}
if(Array.isArray(receiptList) && receiptList.length){
data.remittance.remittanceReceipt = receiptList[0] && receiptList[0].url;
}
if(Array.isArray(signaturePages) && signaturePages.length){
let tmp = [];
signaturePages.forEach(file=>{
tmp.push(file.url);
})
data.remittance.signaturePages = JSON.stringify(tmp);
}
console.log(data);
this.props.dispatch({ this.props.dispatch({
type: 'CREATE_TRADE_ITEM', type: 'CREATE_TRADE_ITEM',
data, data,
...@@ -95,7 +132,7 @@ export default class AddItem extends Component { ...@@ -95,7 +132,7 @@ export default class AddItem extends Component {
<Form.Item {...smallFormItemLayout} label="投资人身份证号码" help="请如实填写投资人18位身份证号码"> <Form.Item {...smallFormItemLayout} label="投资人身份证号码" help="请如实填写投资人18位身份证号码">
<Input placeholder="" {...getFieldProps('buyer.identityCardNumber')} /> <Input placeholder="" {...getFieldProps('buyer.identityCardNumber')} />
</Form.Item> </Form.Item>
<Form.Item {...formItemLayout} label="投资人身份证正反面照片"> <Form.Item {...formItemLayout} label="投资人身份证照片" help="投资人身份证正反面照片">
<Upload action="/api/fileUpload/upload" listType="picture-card" <Upload action="/api/fileUpload/upload" listType="picture-card"
multiple={true} multiple={true}
headers={{ headers={{
......
This diff is collapsed.
...@@ -25,10 +25,7 @@ export default class Item extends Component { ...@@ -25,10 +25,7 @@ export default class Item extends Component {
}); });
}; };
handleGoBack(e) {
e.preventDefault();
this.props.history.goBack();
};
render() { render() {
const {item, loading} = this.props; const {item, loading} = this.props;
...@@ -140,7 +137,7 @@ export default class Item extends Component { ...@@ -140,7 +137,7 @@ export default class Item extends Component {
</p> </p>
</div> </div>
: :
<Spin loading={loading}/> <Spin spinning={loading}/>
} }
</Layout> </Layout>
); );
......
import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
import {Table, Icon} from 'antd';
import {Link} from 'react-router';
import {serialize, formatDateTime, remittanceAuditStatusToString} from '../../utils';
import Layout from '../../components/Layout/Layout';
import MainHeader from '../../components/MainHeader';
const columns = [
{
title: 'ID',
dataIndex: 'id',
key: 'id',
width: 70
}, {
title: '提款人',
dataIndex: 'bankCard',
key: 'bankCard',
render: (bankCard, record)=>(<span>{bankCard.userName}</span>)
}, {
title: '提现金额',
dataIndex: 'amount',
key: 'amount',
width: 100,
className: 'tac',
}, {
title: '申请时间',
dataIndex: 'dateCreated',
key: 'dateCreated',
width: 150,
className: 'tac',
render: (dateCreated, record)=>(
<span>
{dateCreated && formatDateTime(dateCreated)}
</span>
)
}, {
title: '状态',
dataIndex: 'status',
key: 'status',
width: 120,
className: 'tac',
render: (status, record)=>(<span data-status={status}>{remittanceAuditStatusToString(status)}</span>)
}, {
title: '操作',
key: 'operation',
width: 60,
// fixed:'right',
className: 'tac',
render: (text, record)=>(
<span>
{
record.status == 1 &&
<Link to={'/withdraw/audits/'+ record.id} onClick={e=>e.stopPropagation()}>审核</Link>
}
</span>
)
}
];
@connect(state=>({
items: state.withdraw.audits,
loading: state.withdraw.loading,
total: state.withdraw.total,
}))
export default class List extends Component {
constructor(props, context) {
super(props, context);
}
componentDidMount() {
this.fetchList(this.props.location.query);
};
fetchList(query) {
this.props.dispatch({
type: 'FETCH_WITHDRAW_LIST',
query
});
}
handleRowClick({id}) {
this.props.history.push('/withdraw/audits/' + id);
}
render() {
const {total, items, loading, history:{replace}, location:{pathname, query}} = this.props;
const pagination = {
total: total,
pageSize: parseInt(query.s, 10) || 10,
current: parseInt(query.p, 10) || 1,
showSizeChanger: true,
onShowSizeChange: (current, pageSize)=> {
console.log('Current: ', current, '; PageSize: ', pageSize);
query.p = current;
query.s = pageSize;
replace(pathname + '?' + serialize(query));
this.fetchList(query);
},
onChange: (current) => {
console.log('Current: ', current);
query.p = current;
replace(pathname + '?' + serialize(query));
this.fetchList(query);
}
};
const header = (<MainHeader breadcrumb={['审核管理', '提现审核']}
title="提现审核列表"/>);
return (
<Layout header={header}>
<Table className="ant-table" columns={columns}
dataSource={Array.isArray(items) ? items : []}
loading={loading}
pagination={pagination}
scroll={{y: window.innerHeight - 380}}
onRowClick={this.handleRowClick.bind(this)}
/>
</Layout>
);
}
}
import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
import {
Row,
Col,
Form,
Input,
Button,
Checkbox,
Select,
message,
Tabs,
Cascader,
Radio,
Upload,
Icon,
Modal,
DatePicker,
Table,
Spin
} from 'antd';
import Layout from '../../components/Layout/Layout';
import MainHeader from '../../components/MainHeader';
import {
formatDateTime,
formItemLayout,
smallFormItemLayout,
footerFormSubmitLayout,
remittanceAuditStatusToString
} from '../../utils';
@connect(state=>({
loading: state.withdraw.loading,
audit: state.withdraw.audit,
}))
@Form.create()
export default class PassItem extends Component {
constructor() {
super(...arguments);
}
componentDidMount() {
this.fetchItem(this.props.params.id);
};
fetchItem(id) {
this.props.dispatch({
type: 'FETCH_WITHDRAW_ITEM',
id
});
};
handleSubmit(status, e) {
e.preventDefault();
const data = this.props.form.getFieldsValue();
data.id = this.props.params.id;
data.status = status;
console.log(data);
if (status == 9) {
delete data.memo;
}
this.props.dispatch({
type: 'PASS_WITHDRAW_ITEM',
data
});
}
render() {
const {audit, loading, form:{getFieldProps}, location:{query}} = this.props;
let title = (audit && audit.nickname ? audit.nickname + ' - ' : '');
let readOnly = true;
if (audit) {
switch (audit.status) {
case 1:
title += '报单审核详情';
readOnly = false;
break;
case 5:
title += '审核失败';
break;
case 9:
title += '审核成功';
}
} else {
title += '提现审核详情';
}
const header = (<MainHeader breadcrumb={['审核管理', '提现审核','审核详情']} title={title}/>);
let memo = [];
if (audit) {
if (audit.status == 1) {
const {bankCard, balance, balanceLong, amountLong} = audit;
if (!balance) {
memo.push('无余额可用');
} else if (balanceLong < amountLong) {
memo.push('余额不足');
}
const {name, bank, bankBranch, num} = bankCard;
if (!name) {
memo.push('无持卡人');
}
if (!num) {
memo.push('无银行卡号');
}
if (!bank || !bankBranch) {
memo.push('无开户行信息');
}
} else {
memo.push(audit.memo);
}
}
memo = memo.join('\n');
return (
<Layout header={header}>
<Spin spinning={loading}>
{
audit &&
<Form horizontal>
<Form.Item label="申请时间" {...smallFormItemLayout}>
<Input placeholder="申请时间" readOnly
defaultValue={audit.dateCreated && formatDateTime(audit.dateCreated) || '错误的时间'}
/>
</Form.Item>
<Form.Item label="当前余额" {...smallFormItemLayout}>
<Input placeholder="当前余额" readOnly
defaultValue={audit.balance}/>
</Form.Item>
<Form.Item label="持卡人信息" {...smallFormItemLayout}>
<Input placeholder="持卡人信息" readOnly
defaultValue={'持卡人:'+(audit.name || '') + ' 卡号:'+(audit.number || '')}/>
</Form.Item>
<Form.Item label="银行卡信息" {...smallFormItemLayout}>
<Input placeholder="银行卡信息" readOnly
defaultValue={(audit.bankCard.bank || '') + ( audit.bankCard.bankBranch || '') }/>
</Form.Item>
<Form.Item label="提现金额" {...smallFormItemLayout}>
<Input placeholder="实际入账金额" readOnly defaultValue={audit.amount}/>
</Form.Item>
<Form.Item label="拒绝理由" {...smallFormItemLayout}>
<Input placeholder="拒绝理由" readOnly={readOnly} type="textarea" autosize
{...getFieldProps('memo', {
initialValue: memo
})} />
</Form.Item>
<Form.Item {...footerFormSubmitLayout} style={{marginTop:30}}>
{
audit.status == 1 &&
<span>
<Button size="large" type="primary" onClick={this.handleSubmit.bind(this, 9)}>
<Icon type="check-circle-o"/>通过
</Button>
<Button size="large" type="ghost" onClick={this.handleSubmit.bind(this, 5)}
style={{margin:'auto 1em' }}>
<Icon type="cross-circle-o"/>拒绝
</Button>
</span>
}
<Button onClick={e=>{e.preventDefault(); this.props.history.goBack();}}>
<Icon type="rollback"/>返回
</Button>
</Form.Item>
</Form>
}
</Spin>
</Layout>
);
}
}
...@@ -13,4 +13,11 @@ export TradeAddItem from './Trade/AddItem'; ...@@ -13,4 +13,11 @@ export TradeAddItem from './Trade/AddItem';
export AnnouncementList from './Announcement/List'; export AnnouncementList from './Announcement/List';
export AnnouncementEditItem from './Announcement/EditItem'; export AnnouncementEditItem from './Announcement/EditItem';
export AnnouncementAddItem from './Announcement/AddItem'; export AnnouncementAddItem from './Announcement/AddItem';
export RemittanceAuditList from './Remittance/Audit/List'; export RemittanceAuditList from './Remittance/List';
export RemittanceAuditPassItem from './Remittance/PassItem';
export WithDrawList from './Withdraw/List';
export PassWithDrawItem from './Withdraw/PassItem';
export CustomMessageList from './CustomMessage/List';
export CustomMessageAddItem from './CustomMessage/AddItem';
export CustomMessageItem from './CustomMessage/Item';
export BaseUpload from './BaseFunction/BaseUpload';
...@@ -5,6 +5,13 @@ ...@@ -5,6 +5,13 @@
font-size: 14px; font-size: 14px;
background-color: #e9ecf3; background-color: #e9ecf3;
} }
//input[type="text"][readonly],
//textarea[readonly]{
// background-color: #fafafa !important;
//}
//.ant-cascader-input[type="text"][readonly]{
// background-color: #fff !important;
//}
label, label,
.ant-form-item { .ant-form-item {
font-size: 14px !important; font-size: 14px !important;
......
import {handleActions} from 'redux-actions';
import {combineReducer} from 'redux';
const message = handleActions({
['FETCH_MESSAGE_LIST'](state) {
return {...state, loading: true};
},
['FETCH_MESSAGE_LIST_SUCCESS'](state, action) {
return {...state, loading: false, items: action.items, total: action.total};
},
['FETCH_MESSAGE_LIST_FAILED'](state, action) {
return {...state, err: action.err, loading: false};
},
['FETCH_MESSAGE_ITEM'](state){
return {...state, loading: true}
},
['FETCH_MESSAGE_ITEM_SUCCESS'](state, action){
return {...state, loading: false, item: action.item}
},
['FETCH_MESSAGE_ITEM_FAILED'](state, action){
return {...state, err: action.err, loading: false}
},
['CREATE_MESSAGE_ITEM'](state){
return {...state, loading: true}
},
['CREATE_MESSAGE_ITEM_SUCCESS'](state, action){
return {...state, loading: false, item: action.item}
},
['CREATE_MESSAGE_ITEM_FAILED'](state, action){
return {...state, err: action.err, loading: false}
}
}, {
items: [],
loading: false,
});
export default message;
import {handleActions} from 'redux-actions'; import {handleActions} from 'redux-actions';
import {combineReducer} from 'redux'; import {combineReducer} from 'redux';
const audit = handleActions({ const remittance = handleActions({
['FETCH_AUDIT_LIST'](state) { ['FETCH_REMITTANCE_LIST'](state) {
return {...state, loading: true,}; return {...state, loading: true,};
}, },
['FETCH_AUDIT_LIST_SUCCESS'](state, action) { ['FETCH_REMITTANCE_LIST_SUCCESS'](state, action) {
return {...state, loading: false, audits: action.items, total: action.total}; return {...state, loading: false, audits: action.items, total: action.total};
}, },
['FETCH_AUDIT_LIST_FAILED'](state, action) { ['FETCH_REMITTANCE_LIST_FAILED'](state, action) {
return {...state, err: action.err, loading: false}; return {...state, err: action.err, loading: false};
}, },
['FETCH_AUDIT_ITEM'](state) { ['FETCH_REMITTANCE_ITEM'](state) {
return {...state, loading: true,}; return {...state, loading: true,};
}, },
['FETCH_AUDIT_ITEM_SUCCESS'](state, action) { ['FETCH_REMITTANCE_ITEM_SUCCESS'](state, action) {
return {...state, loading: false, audit: action.item}; return {...state, loading: false, audit: action.item};
}, },
['FETCH_AUDIT_ITEM_FAILED'](state, action) { ['FETCH_REMITTANCE_ITEM_FAILED'](state, action) {
return {...state, err: action.err, loading: false}; return {...state, err: action.err, loading: false};
}, },
['PASS_REMITTANCE_ITEM'](state){
return {...state, loading: true};
},
['PASS_REMITTANCE_ITEM_SUCCESS'](state, action){
const audit = {...state.audit, status: action.status};
return {...state, loading: false, audit};
},
['PASS_REMITTANCE_ITEM_FAILED'](state, action){
return {...state, loading: false, err: action.err};
}
}, { }, {
drawMoneys:[],
audits: [], audits: [],
loading: false, loading: false,
}); });
export default audit; export default remittance;
import {handleActions} from 'redux-actions';
import {combineReducer} from 'redux';
const withdraw = handleActions({
['FETCH_WITHDRAW_LIST'](state) {
return {...state, loading: true};
},
['FETCH_WITHDRAW_LIST_SUCCESS'](state, action) {
return {...state, loading: false, audits: action.items, total: action.total};
},
['FETCH_WITHDRAW_LIST_FAILED'](state, action) {
return {...state, err: action.err, loading: false};
},
['FETCH_WITHDRAW_ITEM'](state) {
return {...state, loading: true};
},
['FETCH_WITHDRAW_ITEM_SUCCESS'](state, action) {
return {...state, loading: false, audit: action.item};
},
['FETCH_WITHDRAW_ITEM_FAILED'](state, action) {
return {...state, err: action.err, loading: false};
},
['PASS_WITHDRAW_ITEM'](state){
return {...state, loading: true};
},
['PASS_WITHDRAW_ITEM_SUCCESS'](state, action){
const audit = {...state.audit, status: action.status};
if(action.status == 5){
audit.memo = action.memo;
}
return {...state, loading: false, audit};
},
['PASS_WITHDRAW_ITEM_FAILED'](state, action){
return {...state, loading: false, err: action.err};
}
}, {
audits: [],
loading: false,
});
export default withdraw;
...@@ -16,7 +16,14 @@ import { ...@@ -16,7 +16,14 @@ import {
AnnouncementList, AnnouncementList,
AnnouncementEditItem, AnnouncementEditItem,
AnnouncementAddItem, AnnouncementAddItem,
RemittanceAuditList , RemittanceAuditList,
RemittanceAuditPassItem,
WithDrawList,
PassWithDrawItem,
CustomMessageList,
CustomMessageAddItem,
CustomMessageItem,
BaseUpload
} from '../containers/index'; } from '../containers/index';
export default (store)=> { export default (store)=> {
...@@ -50,11 +57,22 @@ export default (store)=> { ...@@ -50,11 +57,22 @@ export default (store)=> {
</Route> </Route>
<Route path="remittance"> <Route path="remittance">
<Route path="audits"> <Route path="audits">
<IndexRoute component={RemittanceAuditList} /> <IndexRoute component={RemittanceAuditList}/>
<Route path=":id" component={RemittanceAuditPassItem}/>
</Route> </Route>
</Route> </Route>
<Route path="/actived" component={Home}/> <Route path="withdraw">
<Route path="/completed" component={Home}/> <Route path="audits">
<IndexRoute component={WithDrawList}/>
<Route path=":id" component={PassWithDrawItem}/>
</Route>
</Route>
<Route path="customMessages">
<IndexRoute component={CustomMessageList}/>
<Route path="create" component={CustomMessageAddItem}/>
<Route path=":id" component={CustomMessageItem}/>
</Route>
<Route path="upload" component={BaseUpload} />
</Route> </Route>
<Route path="/login" component={Login}/> <Route path="/login" component={Login}/>
<Route path="*" component={NotFound}/> <Route path="*" component={NotFound}/>
......
import {takeLatest} from 'redux-saga';
import {take, call, put, fork, cancel, select} from 'redux-saga/effects';
import {fetchList, fetchItem, createItem} from '../services/customMessage';
import {message} from 'antd';
function* getList(query) {
try {
const {total, customMessageViewDOs} = yield call(fetchList, query);
yield put({
type: 'FETCH_MESSAGE_LIST_SUCCESS',
total,
items: customMessageViewDOs
});
} catch (err) {
console.log(err);
message.error(err);
yield put({
type: 'FETCH_MESSAGE_LIST_FAILED',
err,
});
}
}
function* watchList() {
while (true) {
const {query} = yield take('FETCH_MESSAGE_LIST');
yield fork(getList, query);
}
}
function* getItem(id) {
try {
const item = yield call(fetchItem, id);
yield put({
type: 'FETCH_MESSAGE_ITEM_SUCCESS',
item
});
} catch (err) {
console.log(err);
message.error(err);
yield put({
type: 'FETCH_MESSAGE_ITEM_FAILED',
err
});
}
}
function* watchItem() {
while (true) {
const {id} = yield take('FETCH_MESSAGE_ITEM');
yield fork(getItem, id);
}
}
function* addItem(data) {
try{
const item = yield call(createItem, data);
message.success('创建成功!');
yield put({
type: 'CREATE_MESSAGE_ITEM_SUCCESS',
item: {...item, ...data}
});
}catch(err){
console.log(err);
message.error(err);
yield put({
type:'CREATE_MESSAGE_ITEM_FAILED',
err
});
}
}
function* watchAdd() {
while (true) {
const {data} = yield take('CREATE_MESSAGE_ITEM');
yield fork(addItem, data);
}
}
export default function*() {
yield fork(watchList);
yield fork(watchItem);
yield fork(watchAdd);
}
import {takeLatest} from 'redux-saga'; import {takeLatest} from 'redux-saga';
import {take, call, put, fork, cancel, select} from 'redux-saga/effects'; import {take, call, put, fork, cancel, select} from 'redux-saga/effects';
import {fetchAuditList, fetchAuditItem} from '../services/remittance'; import {
fetchList, fetchItem, pass,
} from '../services/remittance';
import {message} from 'antd'; import {message} from 'antd';
function* getAuditList(query) { function* getList(query) {
try { try {
const {total, audits} = yield call(fetchAuditList, query); const {total, audits} = yield call(fetchList, query);
yield put({ yield put({
type: 'FETCH_AUDIT_LIST_SUCCESS', type: 'FETCH_REMITTANCE_LIST_SUCCESS',
total, total,
items: audits items: audits
}); });
...@@ -15,46 +17,70 @@ function* getAuditList(query) { ...@@ -15,46 +17,70 @@ function* getAuditList(query) {
console.log(err); console.log(err);
message.error(err); message.error(err);
yield put({ yield put({
type: 'FETCH_AUDIT_LIST_FAILED', type: 'FETCH_REMITTANCE_LIST_FAILED',
err, err,
}); });
} }
} }
function* watchAuditList() { function* watchList() {
while (true) { while (true) {
const {query} = yield take('FETCH_AUDIT_LIST'); const {query} = yield take('FETCH_REMITTANCE_LIST');
yield fork(getAuditList, query); yield fork(getList, query);
} }
} }
function* getAuditItem(id) { function* getItem(id) {
try { try {
const item = yield call(fetchAuditItem, id); const item = yield call(fetchItem, id);
yield put({ yield put({
type: 'FETCH_AUDIT_ITEM_SUCCESS', type: 'FETCH_REMITTANCE_ITEM_SUCCESS',
item item
}); });
} catch (err) { } catch (err) {
console.log(err); console.log(err);
message.error(err); message.error(err);
yield put({ yield put({
type: 'FETCH_AUDIT_ITEM_FAILED', type: 'FETCH_REMITTANCE_ITEM_FAILED',
err err
}); });
} }
} }
function* watchAuditItem() { function* watchItem() {
while (true) { while (true) {
const {id} = yield take('FETCH_AUDIT_ITEM'); const {id} = yield take('FETCH_REMITTANCE_ITEM');
yield fork(getAuditItem, id); yield fork(getItem, id);
} }
} }
function* passItem(data){
try {
yield call(pass, data);
yield put({
type: 'PASS_REMITTANCE_ITEM_SUCCESS',
status: data.status
});
} catch (err) {
console.log(err);
message.error(err);
yield put({
type: 'PASS_REMITTANCE_ITEM_FAILED',
err
});
}
}
function* watchPassItem() {
while (true) {
const {data} = yield take('PASS_REMITTANCE_ITEM');
yield fork(passItem, data);
}
}
export default function*() { export default function*() {
yield fork(watchAuditList); yield fork(watchList);
yield fork(watchAuditItem); yield fork(watchItem);
// yield fork(watchAdd); yield fork(watchPassItem);
// yield fork(watchEdit);
} }
import {takeLatest} from 'redux-saga';
import {take, call, put, fork, cancel, select} from 'redux-saga/effects';
import { fetchList, fetchItem, pass } from '../services/withdraw';
import {message} from 'antd';
function* getList(query) {
try {
const {total, audits} = yield call(fetchList, query);
yield put({
type: 'FETCH_WITHDRAW_LIST_SUCCESS',
total,
items: audits
});
} catch (err) {
console.log(err);
message.error(err);
yield put({
type: 'FETCH_WITHDRAW_LIST_FAILED',
err,
});
}
}
function* watchList() {
while (true) {
const {query} = yield take('FETCH_WITHDRAW_LIST');
yield fork(getList, query);
}
}
function* getItem(id) {
try {
const item = yield call(fetchItem, id);
yield put({
type: 'FETCH_WITHDRAW_ITEM_SUCCESS',
item
});
} catch (err) {
console.log(err);
message.error(err);
yield put({
type: 'FETCH_WITHDRAW_ITEM_FAILED',
err
});
}
}
function* watchItem() {
while (true) {
const {id} = yield take('FETCH_WITHDRAW_ITEM');
yield fork(getItem, id);
}
}
function* passItem(data){
try {
yield call(pass, data);
yield put({
type: 'PASS_WITHDRAW_ITEM_SUCCESS',
status: data.status,
memo: data.memo
});
} catch (err) {
console.log(err);
message.error(err);
yield put({
type: 'PASS_WITHDRAW_ITEM_FAILED',
err
});
}
}
function* watchPassItem() {
while (true) {
const {data} = yield take('PASS_WITHDRAW_ITEM');
yield fork(passItem, data);
}
}
export default function*() {
yield fork(watchList);
yield fork(watchItem);
yield fork(watchPassItem);
}
...@@ -12,7 +12,7 @@ export async function fetchItem(id) { ...@@ -12,7 +12,7 @@ export async function fetchItem(id) {
} }
export async function createItem(item) { export async function createItem(item) {
return xFetch('/api/announcements/save', { return xFetch('/api/announcements', {
method: 'POST', method: 'POST',
body: serialize(item) body: serialize(item)
}); });
......
import xFetch from './xFetch';
import {serialize} from '../utils';
export async function fetchList(query) {
const data = {...query};
return xFetch('/api/customMessages' + '?' + serialize(data));
}
export async function fetchItem(id) {
return xFetch('/api/customMessages/' + id);
}
export async function createItem(item) {
return xFetch('/api/customMessages', {
method: 'POST',
body: serialize(item)
});
}
import xFetch from './xFetch'; import xFetch from './xFetch';
import {serialize} from '../utils'; import {serialize} from '../utils';
export async function fetchAuditList(query) { export async function fetchList(query) {
return xFetch('/api/remittance/audits' +'?' + serialize(query)); return xFetch('/api/remittance/audits' + '?' + serialize(query));
} }
export async function fetchAuditItem(id) { export async function fetchItem(id) {
return xFetch('/api/remittance/audits/'+id); return xFetch('/api/remittance/audits/' + id);
} }
// export async function fetchItem(id) { export async function pass(data) {
// return xFetch('/api/trades/'+ id); return xFetch('/api/remittance/audits/op/' + data.id, {
// } method: 'POST',
// body: serialize(data)
// export async function createItem(data){ });
// return xFetch('/api/trades', { }
// method:'POST',
// body: serialize(data)
// });
// }
//
// export async function settlementItem(id){
// return xFetch('/api/trade/commission/settlement/'+id);
// }
...@@ -2,9 +2,6 @@ import xFetch from './xFetch'; ...@@ -2,9 +2,6 @@ import xFetch from './xFetch';
import {serialize} from '../utils'; import {serialize} from '../utils';
export async function fetch(username, password) { export async function fetch(username, password) {
// let form = new FormData();
// form.append('username', username);
// form.append('password', password);
return xFetch('/api/authenticate', { return xFetch('/api/authenticate', {
method: 'POST', method: 'POST',
body: serialize({username, password}) body: serialize({username, password})
......
import xFetch from './xFetch';
import {serialize} from '../utils';
export async function fetchList(query) {
return xFetch('/api/withdraw/audits' + '?' + serialize(query));
}
export async function fetchItem(id) {
return xFetch('/api/withdraw/audits/' + id);
}
export async function pass(data) {
return xFetch('/api/withdraw/audits/op/' + data.id, {
method: 'POST',
body: serialize(data)
});
}
...@@ -160,6 +160,15 @@ export function transformUploadThumbUrl(fileList) { ...@@ -160,6 +160,15 @@ export function transformUploadThumbUrl(fileList) {
file.url = result[0].url; file.url = result[0].url;
file.thumbUrl = result[0].url + '!t'; file.thumbUrl = result[0].url + '!t';
} }
return {
uid: file.uid,
status: file.status,
type: file.type,
url: file.url,
thumbUrl: file.thumbUrl,
name:file.name,
size:file.size
}
} }
return file; return file;
}); });
...@@ -173,3 +182,16 @@ export function handleUpload(info, limit){ ...@@ -173,3 +182,16 @@ export function handleUpload(info, limit){
return transformUploadThumbUrl(fileList); return transformUploadThumbUrl(fileList);
} }
export function remittanceAuditStatusToString(status) {
switch (status){
case 1:
return '待审核';
case 5:
return '审核失败';
case 9:
return '审核成功';
default:
return '未定义';
}
}
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