Authored by 张丽霞

分期模块,review by 陈林

... ... @@ -157,7 +157,7 @@ export default class Open extends React.Component {
let {cellList, agreeProtocol,nextBtnEnable,showBankAlert,banks,nextBtnText} = openPageInfo;
let checkboxIcon = require('../../image/check_icon.png');
if (!agreeProtocol) {
checkboxIcon = require('../../image/fenqi_3_ic.png');
checkboxIcon = require('../../image/uncheck_icon.png');
}
let nextBtnColor = nextBtnEnable ? '#444444' : '#b0b0b0';
return (
... ...
... ... @@ -116,15 +116,17 @@ export default class RepayList extends React.Component {
}else {
return(
<View style={styles.container}>
{repaymentList.length>0?
<ListView
contentContainerStyle={styles.contentContainer}
enableEmptySections={true}
dataSource={this.dataSource.cloneWithRows(repaymentList)}
renderRow={this._renderRow}
/>
:null
}
<View style={{height:height - this.state.bottomContainerPosition_x - (57.5 + 44) * DEVICE_WIDTH_RATIO}}>
{repaymentList.length>0?
<ListView
contentContainerStyle={styles.contentContainer}
enableEmptySections={true}
dataSource={this.dataSource.cloneWithRows(repaymentList)}
renderRow={this._renderRow}
/>
:null
}
</View>
{repaymentList.length?
<View style={[styles.bottomContainer, {bottom:this.state.bottomContainerPosition_x}]}>
<View style={styles.repaymentTotalContainer}>
... ...
... ... @@ -84,6 +84,7 @@ class RepayListContainer extends Component {
}
_onPressRepaylistCellDetail(cellInfo) {
this.props.actions.onPressRepaylistCellDetail(cellInfo);
}
_onPressPayNow() {
... ...
'use strict';
import ReactNative from 'react-native';
import ReactNative, {Platform}from 'react-native';
import InstallmentService from '../../services/InstallmentService';
const {
... ... @@ -109,7 +109,9 @@ export function onPressOpenNext() {
activateParams[item.get('inputKey')]= item.get('text');
}
});
let activateService = (uid) => {
let activateService = (uid, ip) => {
activateParams.ip = ip;
activateParams.from_client_type = Platform.OS === 'ios' ? 'iphone' : 'android';
dispatch(nextBtnProcessingRequest());
return new InstallmentService(app.host).checkVerifyCode(uid, activateParams.mobile, activateParams.snsCheckCode)
.then(json => {
... ... @@ -129,8 +131,6 @@ export function onPressOpenNext() {
})
.then(json => {
dispatch(nextBtnProcessingSuccess());
console.log('------1');
console.log(json);
let tipMessage = '';
if (json.status == '3') {
json.failReason = json.failReason || '姓名、身份证、银行卡不匹配';
... ... @@ -139,17 +139,23 @@ export function onPressOpenNext() {
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
})
.catch(error => {
dispatch(updateTipMessage(error.message))
dispatch(nextBtnProcessingFailure());
});
}
ReactNative.NativeModules.YH_CommonHelper.uid()
.then(uid => {
activateService(uid);
ReactNative.NativeModules.YH_CommonHelper.ipWithcallback((ip)=> {
activateService(uid,ip);
});
})
.catch(error => {
ReactNative.NativeModules.YH_CommonHelper.login()
.then(uid => {
activateService(uid);
ReactNative.NativeModules.YH_CommonHelper.ipWithcallback((ip)=> {
activateService(uid,ip);
});
})
.catch(error => {
... ...
... ... @@ -122,6 +122,7 @@ function processAmtList(list, queryDays) {
};
if (list) {
_.forEach(list, (data, key) => {
data.isChecked = false;
// 第一条选中
if (key == 0) {
data.isChecked = true;
... ... @@ -258,20 +259,31 @@ export function onPressRepaylistCellCheckbox(cellInfo) {
let {app, repayList} = getState();
let {repaymentList,queryDays} = repayList;
repaymentList = repaymentList.toJS();
let sameBillNoList =[];
let index = 0
let curIndexInSameBillList = 0;
repaymentList.map((item, i) => {
if (item.billNo == cellInfo.billNo) {
if (item.currTerm == cellInfo.currTerm) {
curIndexInSameBillList=index;
}
item.sameBillIndex = index;
sameBillNoList.push(item);
index++;
}
})
let formateData;
let curIndex = cellInfo.key;
let tipMessage = '';
if (curIndex == 0) {
if (repaymentList[curIndex+1].isChecked) {
if (curIndexInSameBillList == 0) {
if (sameBillNoList[curIndexInSameBillList+1].isChecked) {
tipMessage = '同一个分期订单不能跨期还款,请按时间顺序还款';
dispatch(setTipMessage(tipMessage));
}else {
repaymentList[curIndex].isChecked = !repaymentList[curIndex].isChecked;
formateData = amtAndFeeCount(repaymentList);
dispatch(updatRepaymentListAndFormateData({repaymentList,formateData}));
}
}else if (curIndex == repaymentList.length - 1) {
if (!repaymentList[curIndex-1].isChecked) {
}else if (curIndexInSameBillList == sameBillNoList.length - 1) {
if (!sameBillNoList[curIndexInSameBillList-1].isChecked) {
tipMessage = '同一个分期订单不能跨期还款,请按时间顺序还款';
dispatch(setTipMessage(tipMessage));
}else {
... ... @@ -280,7 +292,7 @@ export function onPressRepaylistCellCheckbox(cellInfo) {
dispatch(updatRepaymentListAndFormateData({repaymentList,formateData}));
}
}else {
if (!repaymentList[curIndex-1].isChecked || repaymentList[curIndex + 1].isChecked) {
if (!sameBillNoList[curIndexInSameBillList-1].isChecked || sameBillNoList[curIndexInSameBillList + 1].isChecked) {
tipMessage = '同一个分期订单不能跨期还款,请按时间顺序还款';
dispatch(setTipMessage(tipMessage));
}else {
... ... @@ -344,6 +356,12 @@ function processBankCardsInfo(list) {
}
return [];
}
export function onPressRepaylistCellDetail(cellInfo) {
return (dispatch, getState) => {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.instalmentMyOrderDetail","params":{"order_code":"${cellInfo.billNo}"}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
}
export function getBankCards() {
return (dispatch, getState) => {
... ...