Authored by chenl

增加订单详情逻辑。review by 张丽霞。

... ... @@ -16,6 +16,9 @@ import Toast from '../../../common/components/Toast';
import MyOrderDetailPayListCell from './MyOrderDetailPayListCell';
import YH_Image from '../../../common/components/YH_Image';
import SlicedImage from '../../../common/components/SlicedImage';
import LoadingIndicator from '../../../common/components/LoadingIndicator';
import BankSafePay from '../installment/BankSafePay';
import ConfirmPay from '../installment/ConfirmPay';
export default class MyOrderDetail extends React.Component {
constructor(props) {
... ... @@ -38,7 +41,7 @@ export default class MyOrderDetail extends React.Component {
render() {
let orderInfo = this.props.orderInfo;
let {isFetching, orderInfo, showBankSafePayView, showConfirmPayView, payCard, formateData} = this.props.myOrderDetail;
if(!orderInfo)
return null;
... ... @@ -63,7 +66,7 @@ export default class MyOrderDetail extends React.Component {
let checked = this.props.isChecked;
let checkboxIcon = require('../../image/uncheck_icon.png');
if (!checked) {
if (checked) {
checkboxIcon = require('../../image/check_icon.png');
}
... ... @@ -114,10 +117,35 @@ export default class MyOrderDetail extends React.Component {
<Text style={styles.payDesc} numberOfLines={1}>{"含服务费¥5.00"}</Text>
<TouchableOpacity style={styles.payButtonContainer} activeOpacity={1} onPress={() => {
this.props.onPressChangeCard && this.props.onPressChangeCard();}}>
this.props.onPressPayNow && this.props.onPressPayNow()}}>
<Text style={styles.payButton}>立即还款</Text>
</TouchableOpacity>
</View>
<LoadingIndicator
isVisible={isFetching}
/>
{showBankSafePayView?
<BankSafePay
payCard={payCard}
formateData={formateData}
closeBankSafePay={this.props.closeBankSafePay}
bankSafePayNow={this.props.bankSafePayNow}
changeBankCard={this.props.changeBankCard}
/>
:null
}
{showConfirmPayView?
<ConfirmPay
reSendConfirmPaySnsCode={this.props.reSendConfirmPaySnsCode}
cancelPayInConfirm={this.props.cancelPayInConfirm}
confirmPayAction={this.props.confirmPayAction}
payCard={payCard}
/>
:null
}
</View>
... ...
... ... @@ -39,7 +39,7 @@ export default class MyOrderDetailPayListCell extends React.Component {
let checked = data.get("isChecked");
let checkboxIcon = require('../../image/uncheck_icon.png');
if (!checked) {
if (checked) {
checkboxIcon = require('../../image/check_icon.png');
}
... ... @@ -49,7 +49,7 @@ export default class MyOrderDetailPayListCell extends React.Component {
<View style={styles.container} >
<View style={styles.sortContainer}>
{
!isPayable ? <Image style={styles.checkboxIcon} source={checkboxIcon}/>
isPayable ? <Image style={styles.checkboxIcon} source={checkboxIcon}/>
: <Text style={styles.sortText} numberOfLines={1}>{sort}</Text>
}
</View>
... ...
... ... @@ -47,19 +47,51 @@ class InstallmentMyOrderDetailContainer extends Component {
constructor(props) {
super(props);
this._reloadPage = this._reloadPage.bind(this);
// this._onPressCheckAll = this._onPressCheckAll.bind(this);
this._onPressPayNow = this._onPressPayNow.bind(this);
this._closeBankSafePay = this._closeBankSafePay.bind(this);
this._bankSafePayNow = this._bankSafePayNow.bind(this);
this._cancelPayInConfirm = this._cancelPayInConfirm.bind(this);
this._reSendConfirmPaySnsCode = this._reSendConfirmPaySnsCode.bind(this);
this._confirmPayAction = this._confirmPayAction.bind(this);
}
_reloadPage() {
this.props.actions.getOrderDetail();
}
_onPressPayNow() {
this.props.actions.onPressPayNow();
}
_closeBankSafePay() {
this.props.actions.setBankSafePayViewStatus(false);
}
_bankSafePayNow() {
this.props.actions.bankSafePayNow();
}
_cancelPayInConfirm() {
this.props.actions.setShowConfirmPayViewStatus(false);
}
_reSendConfirmPaySnsCode() {
this.props.actions.reSendConfirmPaySnsCode();
}
_confirmPayAction(snsCode) {
this.props.actions.confirmPayAction(snsCode);
}
componentDidMount() {
this.props.actions.getOrderDetail();
}
render() {
let {error, orderInfo} = this.props.myOrderDetail;
let {error} = this.props.myOrderDetail;
if (error) {
return (
<ServerError
... ... @@ -71,7 +103,15 @@ class InstallmentMyOrderDetailContainer extends Component {
return (
<MyOrderDetail
style={styles.container}
orderInfo={orderInfo}
myOrderDetail={this.props.myOrderDetail}
// onPressRepaylistCellCheckbox={this._onPressRepaylistCellCheckbox}
// onPressCheckAll={this._onPressCheckAll}
onPressPayNow={this._onPressPayNow}
closeBankSafePay={this._closeBankSafePay}
bankSafePayNow={this._bankSafePayNow}
cancelPayInConfirm={this._cancelPayInConfirm}
reSendConfirmPaySnsCode={this._reSendConfirmPaySnsCode}
confirmPayAction={this._confirmPayAction}
/>
);
... ...
... ... @@ -14,6 +14,8 @@ GET_ORDER_DETAIL_REQUEST,
GET_ORDER_DETAIL_FAILURE,
GET_ORDER_DETAIL_SUCCESS,
SET_BANK_SAFE_PAY_VIEW_STATUS,
} = require('../../constants/actionTypes').default;
... ... @@ -94,3 +96,37 @@ export function setTipMessage(message){
}
}
export function setBankSafePayViewStatus(status){
return {
type: SET_BANK_SAFE_PAY_VIEW_STATUS,
payload: status,
}
}
// onPressPayNow
export function onPressPayNow() {
return (dispatch, getState) => {
// dispatch(getBankCards());
dispatch(setBankSafePayViewStatus(true));
// let {app, repayList} = getState();
// let {repaymentList,queryDays,formateData} = repayList;
// repaymentList = repaymentList.toJS();
// formateData = formateData.toJS();
// let termsList = [];
// _.forEach(repaymentList, (data) => {
// if (data.isChecked) {
// termsList.push({
// index: data.key,
// orderCode: data.billNo,
// termNo: data.currTerm
// });
// }
// });
// dispatch(updateRepayTermList(termsList));
}
}
... ...
... ... @@ -10,6 +10,11 @@ let InitialState = Record({
orderCode: '',
orderInfo: Map(),
formateData: Map(),
payCard: Map(),
showBankSafePayView: false,
showConfirmPayView: false,
});
export default InitialState;
... ...
... ... @@ -12,6 +12,9 @@ const {
GET_ORDER_DETAIL_FAILURE,
GET_ORDER_DETAIL_SUCCESS,
SET_BANK_SAFE_PAY_VIEW_STATUS,
SET_SHOW_CONFIRM_PAY_VIEW_STATUS,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -36,6 +39,10 @@ export default function appReducer(state = initialState, action) {
return state.set('isFetching', false)
.set('error', null)
.set('orderInfo', Immutable.fromJS(action.payload));
case SET_BANK_SAFE_PAY_VIEW_STATUS:
return state.set('showBankSafePayView',action.payload);
case SET_SHOW_CONFIRM_PAY_VIEW_STATUS:
return state.set('showConfirmPayView', action.payload);
}
return state;
... ...