Commit 58b5bdd4 authored by superman's avatar superman

修改BUG

parent 282b4461
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -146,10 +146,11 @@ export default class ContactForm extends Component {
:
this.state.staffs.length ?
<table>
<Form.Item>
<table className="data-grid">
<thead>
<tr>
<th>姓名</th>
<th width="100">姓名</th>
<th>电话</th>
</tr>
</thead>
......@@ -164,6 +165,7 @@ export default class ContactForm extends Component {
}
</tbody>
</table>
</Form.Item>
:
<Form.Item {...footerFormSubmitLayout}>
还没有设置过任何一位服务经理及其联系电话
......
......@@ -56,7 +56,7 @@ export default class DateTimeSatausForm extends Component {
data.fundRaisedStartTime = formatDateTime(formData.fundRaisedStartTime[0]);
}
if (formData.fundRaisedStartTime[1]) {
data.fundRaisedEndTime = formatDateTime(formData.fundRaisedStartTime[0])
data.fundRaisedEndTime = formatDateTime(formData.fundRaisedStartTime[1])
}
if (formData.remittanceEndTime) {
data.remittanceEndTime = formatDateTime(formData.remittanceEndTime);
......@@ -83,6 +83,7 @@ export default class DateTimeSatausForm extends Component {
const {product, loading, form:{getFieldProps}, isCreate, isEdit} = this.props;
const {
fundReservationStartTime,
fundRaisedStartTime,
fundRaisedEndTime,
remittanceEndTime,
fundEstablishedTime,
......@@ -133,13 +134,13 @@ export default class DateTimeSatausForm extends Component {
<DatePicker.RangePicker showTime format="yyyy-MM-dd HH:mm:ss"
{...getFieldProps('fundRaisedStartTime', {
initialValue: [
fundReservationStartTime ? formatDateTime(fundReservationStartTime) : '',
fundRaisedStartTime ? formatDateTime(fundRaisedStartTime) : '',
fundRaisedEndTime ? formatDateTime(fundRaisedEndTime) : ''
]
})}
/>
:
((fundReservationStartTime ? formatDateTime(fundReservationStartTime) : NULL)
((fundRaisedStartTime ? formatDateTime(fundRaisedStartTime) : NULL)
+ ' 、' +
(fundRaisedEndTime ? formatDateTime(fundRaisedEndTime) : NULL))
......
......@@ -19,7 +19,15 @@ import {
Table,
Spin
} from 'antd';
import {arrayRemoveIndex, NULL, UUID, formItemLayout, smallFormItemLayout, footerFormSubmitLayout} from '../../utils';
import {
arrayRemoveIndex,
NULL,
UUID,
formItemLayout,
smallFormItemLayout,
footerFormSubmitLayout,
innerHTML
} from '../../utils';
export function CreateBaseElement() {
......@@ -107,8 +115,10 @@ export default class ElementForm extends Component {
}
render() {
const {form:{getFieldProps}, loading, isEdit} = this.props;
console.log(this.state.elements);
return (
<Spin spinning={loading}>
<Form horizontal onSubmit={this.handleSubmit.bind(this)}>
......@@ -152,20 +162,31 @@ export default class ElementForm extends Component {
</div>
:
this.state.elements.length ?
<table>
<tbody>
{
this.state.elements.map(item=> {
<Form.Item>
<table className="data-grid">
<colgroup>
<col width="150px"/>
<col />
</colgroup>
<thead>
<tr>
<th>元素标题</th>
<th>元素内容</th>
</tr>
</thead>
<tbody>
{
this.state.elements.map(item=>
item.title && item.content &&
<tr>
<tr key={item.key}>
<th>{item.title}</th>
<td>{item.content}</td>
<td {...innerHTML(item.content, true)}></td>
</tr>
}
)
}
</tbody>
</table>
)
}
</tbody>
</table>
</Form.Item>
:
<Form.Item {...footerFormSubmitLayout}>
还没有设置过任何基本要素
......
......@@ -192,7 +192,7 @@ componentWillReceiveProps(nextProps) {
:
(
this.state.yongjing.length ?
<table>
<table className="data-grid tac">
<thead>
<tr>
<th className="tac">最小投资额</th>
......
......@@ -47,7 +47,7 @@ export default class AddItem extends Component {
componentWillReceiveProps(nextProps) {
const {item} = nextProps;
if (item && item.id) {
this.props.history.push('/announcement/' + item.id);
this.props.history.replace('/announcement/' + item.id);
this.props.dispatch({
type: 'INIT_ANNOUNCEMENT'
});
......
......@@ -75,6 +75,16 @@
}
}
.ant-menu-inline .ant-menu-item,
.ant-menu-vertical .ant-menu-item{
border-right: 0;
margin-left: 0;
left: 0;
}
.ant-menu-inline .ant-menu-item-selected,
.ant-menu-inline .ant-menu-selected{
border-right: 0;
}
}
}
......
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 {Form, Input, Button, Popconfirm, Checkbox, message, Row, Col, Spin, Icon} from 'antd';
import {
formatDateTime,
tradeStatusToString,
......@@ -25,6 +25,12 @@ export default class Item extends Component {
});
};
handleEstablish(id) {
this.props.dispatch({
type: 'ESTABLISH_TRADE_ITEM',
id
});
}
render() {
......@@ -106,8 +112,8 @@ export default class Item extends Component {
<span>{'收益 ' + item.realReturn.sy}</span>
}
{
item.realReturn && item.commission &&
<span>{'佣金 ' + item.commission}</span>
item.commission &&
<span>{'佣金 ' + item.commission + '元'}</span>
}
</Col>
</Row>
......@@ -126,11 +132,28 @@ export default class Item extends Component {
</div>
<p>
{
(item.status == 11 || item.status == 21) && (! item.commissionId) &&
<Link to={'/trades/commission/'+ item.id}><Button>发放佣金</Button></Link>
item.status == 11 &&
<Popconfirm title="确定这个订单要成立了吗?" onConfirm={this.handleEstablish.bind(this, item.id)}>
<Button type="primary"
style={{marginRignt:'1em'}}>
<Icon type="like"/>订单成立
</Button>
</Popconfirm>
}
{
(item.status == 11 || item.status == 21) && (!item.commissionId) &&
<Link to={'/trades/commission/'+ item.id}>
<Button type="ghost">
<Icon type="pay-circle-o"/>发放佣金
</Button>
</Link>
}
<Link to={'/trades/contract/'+ item.id}><Button>邮寄合同</Button></Link>
<Button onClick={e=>{e.preventDefault(); this.props.history.goBack();}}
<Link to={'/trades/contract/'+ item.id}>
<Button type="ghost">
<Icon type="exception"/>邮寄合同
</Button>
</Link>
<Button type="ghost" onClick={e=>{e.preventDefault(); this.props.history.goBack();}}
style={{marginLeft:'1em'}}>
<Icon type="rollback"/>返回
</Button>
......
......@@ -71,7 +71,6 @@ const columns = [
<Link to={'/trades/commission/'+ record.id} onClick={e=>e.stopPropagation()}>佣金</Link>
</span>
}
</span>
)
}
......
......@@ -148,7 +148,7 @@
}
body {
.ant-modal-mask{
.ant-modal-mask {
animation-duration: 300ms !important;
}
.img-priview-dialog {
......@@ -189,4 +189,26 @@
}
}
.data-grid {
border-spacing: 0;
width:100%;
thead{
th{
background-color: #f8f8f8;
}
}
td, th {
border-bottom: 1px solid #e9e9e9;
padding: 5px 5px;
text-align: left;
vertical-align: top;
}
&.tac{
td, th{
text-align: center;
}
}
}
}
......@@ -41,11 +41,22 @@ const trade = handleActions({
return {...state, loading: true};
},
['SETTLEMENT_TRADE_ITEM_SUCCESS'](state, action){
return {...state, loading: false, item:{...state.item, ...action.item}};
return {...state, loading: false, item: {...state.item, ...action.item}};
},
['SETTLEMENT_TRADE_ITEM_FAILED'](state, action){
return {...state, err: action.err, loading: false};
},
['ESTABLISH_TRADE_ITEM'](state){
return {...state, loading: true};
},
['ESTABLISH_TRADE_ITEM_SUCCESS'](state, action){
return {...state, loading: false, item: {...state.item, ...action.item}};
},
['ESTABLISH_TRADE_ITEM_FAILED'](state, action){
return {...state, err: action.err, loading: false};
}
}, initState);
export default trade;
import {takeLatest} from 'redux-saga';
import {take, call, put, fork, cancel, select} from 'redux-saga/effects';
import {fetchList, fetchItem, createItem, settlementItem} from '../services/trade';
import {fetchList, fetchItem, createItem, settlementItem, establish} from '../services/trade';
import {message} from 'antd';
function* getList(query) {
......@@ -102,10 +102,38 @@ function* watchSettlement() {
}
}
function* establishItem(id) {
try {
yield call(establish, id);
message.success('^.^ 喜大普奔,订单成立了!');
yield put({
type: 'ESTABLISH_TRADE_ITEM_SUCCESS',
item: {
status: 21
}
});
} catch (err) {
console.log(err);
message.error(err);
yield put({
type: 'ESTABLISH_TRADE_ITEM_FAILED',
err
});
}
}
function* watchEstablishItem() {
while (true) {
const {id} = yield take('ESTABLISH_TRADE_ITEM');
yield fork(establishItem, id);
}
}
export default function*() {
yield fork(watchTradeList);
yield fork(watchTradeItem);
yield fork(watchAdd);
yield fork(watchSettlement);
yield fork(watchEstablishItem);
}
......@@ -2,19 +2,23 @@ import xFetch from './xFetch';
import {serialize} from '../utils';
export async function fetchList(query) {
return xFetch('/api/trades' +'?' + serialize(query));
return xFetch('/api/trades' + '?' + serialize(query));
}
export async function fetchItem(id) {
return xFetch('/api/trades/'+ id);
return xFetch('/api/trades/' + id);
}
export async function createItem(data){
export async function createItem(data) {
return xFetch('/api/trades', {
method:'POST',
method: 'POST',
body: serialize(data)
});
}
export async function settlementItem(id){
return xFetch('/api/trade/commission/settlement/'+id);
export async function settlementItem(id) {
return xFetch('/api/trade/commission/settlement/' + id);
}
export async function establish(id) {
return xFetch('/api/trade/success/' + id);
}
......@@ -225,3 +225,32 @@ export function remittanceAuditStatusToString(status) {
export function mobileSecrecy(mobile){
return (mobile+'').replace(/^(\d{3})(\d{4})(\d{4})$/g, (b,c,d,e)=>(c+'****'+e));
}
export function innerHTML(html, safe){
return {
dangerouslySetInnerHTML: {
__html: safe ? cr2br(htmlEncode(html)) :html
}
}
}
export function htmlEncode(text){
return (text+'').replace(/[\<\>\&]/gi, (m)=>{
switch(m){
case '<':
return '&lt;';
case '>':
return '&gt;';
case '&':
return '&amp;';
default:
return m;
}
});
}
export function cr2br(text){
return (text+'').replace(/\n/g, '<br/>');
}
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