...
|
...
|
@@ -20,8 +20,14 @@ UPDATE_AGREE_PROTOCOL_STATUS, |
|
|
UPDATE_SNS_CHECK_CODE_ENABLE_STATUS,
|
|
|
UPDATE_CELL_LIST,
|
|
|
UPDATE_NEXT_BTN_ENABLE_STATUS,
|
|
|
UPDATE_NEXT_BTN_TEXT,
|
|
|
UPDATE_SNS_CHECK_CODE_TEXT,
|
|
|
UPDATE_TIP_MESSAGE,
|
|
|
NEXT_BTN_PROCESSING_REQUEST,
|
|
|
NEXT_BTN_PROCESSING_SUCCESS,
|
|
|
NEXT_BTN_PROCESSING_FAILURE,
|
|
|
|
|
|
SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO,
|
|
|
SET_INSTALLMENT_STATUS_PAGE_GOODS,
|
|
|
|
|
|
} = require('../../constants/actionTypes').default;
|
|
|
const codeContent = {
|
...
|
...
|
@@ -109,17 +115,47 @@ export function updateNextBtnEnableStatus(status) { |
|
|
}
|
|
|
}
|
|
|
|
|
|
export function updateNextBtnText(text) {
|
|
|
export function updateSnsCheckCodeText(text) {
|
|
|
return {
|
|
|
type: UPDATE_NEXT_BTN_TEXT,
|
|
|
type: UPDATE_SNS_CHECK_CODE_TEXT,
|
|
|
payload: text
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function updateSnsCheckCodeText(text) {
|
|
|
export function updateTipMessage(message) {
|
|
|
return {
|
|
|
type: UPDATE_SNS_CHECK_CODE_TEXT,
|
|
|
payload: text
|
|
|
type: UPDATE_TIP_MESSAGE,
|
|
|
payload: message
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function nextBtnProcessingRequest() {
|
|
|
return {
|
|
|
type: NEXT_BTN_PROCESSING_REQUEST,
|
|
|
}
|
|
|
}
|
|
|
export function nextBtnProcessingFailure() {
|
|
|
return {
|
|
|
type: NEXT_BTN_PROCESSING_FAILURE
|
|
|
}
|
|
|
}
|
|
|
export function nextBtnProcessingSuccess() {
|
|
|
return {
|
|
|
type: NEXT_BTN_PROCESSING_SUCCESS
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function setInstallmentStatusPageOriginalInfo(params) {
|
|
|
return {
|
|
|
type: SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO,
|
|
|
payload: params
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function setInstallmentStatusPageGoods(goods) {
|
|
|
return {
|
|
|
type: SET_INSTALLMENT_STATUS_PAGE_GOODS,
|
|
|
payload: goods
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -222,10 +258,67 @@ export function onPressProtocol() { |
|
|
export function onPressOpenNext() {
|
|
|
return (dispatch, getState) => {
|
|
|
let {app, installment} = getState();
|
|
|
let {nextBtnEnable} = installment.openPageInfo;
|
|
|
if (!nextBtnEnable) {
|
|
|
return;
|
|
|
let {nextBtnEnable,cellList,nextProcessing} = installment.openPageInfo;
|
|
|
let activateParams = {};
|
|
|
let newCellList = cellList;
|
|
|
// if (!nextBtnEnable) {
|
|
|
// return;
|
|
|
// }
|
|
|
ReactNative.NativeModules.YH_InstallmentHelper.gotoInstallmentStatusView('2', '您的授信未通过,在有货更多的消费,增加信用度,会大大提升审核通过率奥。');
|
|
|
return;
|
|
|
cellList.map((item, i) => {
|
|
|
if (item.get('inputKey') != 'BankIcon') {
|
|
|
activateParams[item.get('inputKey')]= item.get('text');
|
|
|
}
|
|
|
});
|
|
|
let activateService = (uid) => {
|
|
|
dispatch(nextBtnProcessingRequest());
|
|
|
console.log('----0000');
|
|
|
return new InstallmentService(app.host).checkVerifyCode(uid, activateParams.mobile, activateParams.snsCheckCode)
|
|
|
.then(json => {
|
|
|
if (json.result === '1') {
|
|
|
|
|
|
return new InstallmentService(app.host).activateService(activateParams)
|
|
|
}else {
|
|
|
newCellList.map((item, i) => {
|
|
|
if (item.inputKey == 'snsCheckCode') {
|
|
|
item.text = '';
|
|
|
}
|
|
|
cellList[i] = item;
|
|
|
});
|
|
|
dispatch(updateTipMessage(json.message))
|
|
|
dispatch(updateCellList(cellList));
|
|
|
dispatch(nextBtnProcessingFailure());
|
|
|
}
|
|
|
})
|
|
|
.then(json => {
|
|
|
dispatch(nextBtnProcessingSuccess());
|
|
|
console.log('2222222');
|
|
|
console.log(json);
|
|
|
let tipMessage = '';
|
|
|
if (json.status == '3') {
|
|
|
json.failReason = json.failReason || '姓名、身份证、银行卡不匹配';
|
|
|
}
|
|
|
ReactNative.NativeModules.YH_InstallmentHelper.gotoInstallmentStatusView(json.status, json.failReason);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
ReactNative.NativeModules.YH_CommonHelper.uid()
|
|
|
.then(uid => {
|
|
|
activateService(uid);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
ReactNative.NativeModules.YH_CommonHelper.login()
|
|
|
.then(uid => {
|
|
|
activateService(uid);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
|
|
|
});
|
|
|
});
|
|
|
|
|
|
};
|
|
|
}
|
|
|
|
...
|
...
|
@@ -247,6 +340,62 @@ export function onPressCardNoQuestion() { |
|
|
};
|
|
|
}
|
|
|
|
|
|
export function getBankInfo(cellInfo,cardNo) {
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
|
let bankInfo = (uid) => {
|
|
|
let {app, installment} = getState();
|
|
|
let {cellList,snsCheckCodeEnable} = installment.openPageInfo;
|
|
|
cellList = cellList.toJS();
|
|
|
let newCellList = cellList;
|
|
|
let nextBtnEnable = true;
|
|
|
return new InstallmentService(app.host).fentchBankInfo(cardNo,uid)
|
|
|
.then(json => {
|
|
|
let bankIconInfo = {
|
|
|
inputKey: 'BankIcon',
|
|
|
bankCode: '',
|
|
|
bankName: '',
|
|
|
bankText: '',
|
|
|
show: true,
|
|
|
};
|
|
|
if (json.bankCode) {
|
|
|
bankIconInfo.bankCode = json.bankCode;
|
|
|
bankIconInfo.bankName = json.bankName;
|
|
|
}
|
|
|
if (json.businessSupport === '1') {
|
|
|
bankIconInfo.bankCode = '';
|
|
|
bankIconInfo.bankName = '';
|
|
|
bankIconInfo.bankText = '暂不支持此银行卡';
|
|
|
}
|
|
|
|
|
|
newCellList.map((item, i) => {
|
|
|
if (item.inputKey == 'BankIcon') {
|
|
|
item = bankIconInfo;
|
|
|
}
|
|
|
cellList[i] = item;
|
|
|
});
|
|
|
dispatch(updateCellList(cellList));
|
|
|
})
|
|
|
.catch(error => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
ReactNative.NativeModules.YH_CommonHelper.uid()
|
|
|
.then(uid => {
|
|
|
bankInfo(uid);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
ReactNative.NativeModules.YH_CommonHelper.login()
|
|
|
.then(uid => {
|
|
|
bankInfo(uid);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function updateOpenPageCellInfo(cellInfo) {
|
|
|
return (dispatch, getState) => {
|
|
|
let {app, installment} = getState();
|
...
|
...
|
@@ -256,14 +405,37 @@ export function updateOpenPageCellInfo(cellInfo) { |
|
|
let cardNoValid = false;
|
|
|
let mobileValid = false;
|
|
|
let nextBtnEnable = true;
|
|
|
|
|
|
if (cellInfo.inputKey == "cardNo") {
|
|
|
let value = cellInfo.text;
|
|
|
console.log('value');
|
|
|
console.log(value);
|
|
|
let cardNo = value.replace(/\s/g, '');
|
|
|
let newCardNo = value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 ');
|
|
|
console.log('newCardNo');
|
|
|
console.log(newCardNo);
|
|
|
cellInfo.text = newCardNo;
|
|
|
if (cardNo && cardNo.length >= 16) {
|
|
|
cardNoValid = true;
|
|
|
dispatch(getBankInfo(cellInfo,value));
|
|
|
}else {
|
|
|
cardNoValid = false;
|
|
|
cellInfo.showBankIcon = false;
|
|
|
}
|
|
|
|
|
|
}else if (cellInfo.inputKey == "mobile" && cellInfo.text.length ==11) {
|
|
|
mobileValid = true;
|
|
|
}
|
|
|
|
|
|
|
|
|
newCellList.map((item, i) => {
|
|
|
if (item.inputKey == 'cardNo' && item.text.length >=13) {
|
|
|
if (item.inputKey == 'cardNo' && item.text.length >=16 && cellInfo.inputKey != 'cardNo') {
|
|
|
cardNoValid = true;
|
|
|
} else if (item.inputKey == 'mobile' && item.text.length ==11) {
|
|
|
} else if (item.inputKey == 'mobile' && item.text.length ==11 && cellInfo.inputKey != 'mobile') {
|
|
|
mobileValid = true;
|
|
|
}
|
|
|
if (item.inputKey == cellInfo.inputKey) {
|
|
|
item.text = cellInfo.text;
|
|
|
item = cellInfo;
|
|
|
}
|
|
|
if (item.text == '') {
|
|
|
nextBtnEnable = false;
|
...
|
...
|
@@ -275,6 +447,8 @@ export function updateOpenPageCellInfo(cellInfo) { |
|
|
}else {
|
|
|
snsCheckCodeEnable = false;
|
|
|
}
|
|
|
console.log('cellInfo');
|
|
|
console.log(cellInfo);
|
|
|
dispatch(updateCellList(cellList));
|
|
|
dispatch(updateSnsCheckCodeEnableStatus(snsCheckCodeEnable));
|
|
|
dispatch(updateNextBtnEnableStatus(nextBtnEnable));
|
...
|
...
|
@@ -362,3 +536,112 @@ export function onPressCheckCode() { |
|
|
|
|
|
};
|
|
|
}
|
|
|
|
|
|
export function setInstallmentStausPageParams(statusCode, failReason, uid) {
|
|
|
return (dispatch, getState) => {
|
|
|
let {app, installment} = getState();
|
|
|
let status ='';
|
|
|
let jumpUrl = '';
|
|
|
let statusInfo = {};
|
|
|
if (statusCode == '2') {//成功
|
|
|
//请求用户信用额度
|
|
|
return new InstallmentService(app.host).getQueryCreditInfo('5448919')
|
|
|
.then(json => {
|
|
|
console.log('---额度');
|
|
|
console.log(json);
|
|
|
status = 'success',
|
|
|
statusInfo = {
|
|
|
message: '可用额度',
|
|
|
reason: json.currCreditLimit,
|
|
|
btnText: '去逛逛',
|
|
|
}
|
|
|
jumpUrl = `http://m.yohobuy.com/home/installment/index?uid=${uid}?openby:yohobuy={"action":"go.instalmentlist","params":{"title":"分期专享"}}`;
|
|
|
let params = {
|
|
|
statusCode,
|
|
|
status,
|
|
|
jumpUrl,
|
|
|
statusInfo,
|
|
|
};
|
|
|
dispatch(setInstallmentStatusPageOriginalInfo(params));
|
|
|
dispatch(getInstallmentProductAndAdvertisement(1));
|
|
|
})
|
|
|
.catch(error => {
|
|
|
});
|
|
|
}else {
|
|
|
switch (statusCode) {
|
|
|
case '1':{
|
|
|
status = 'review',
|
|
|
statusInfo = {
|
|
|
message: '审核中',
|
|
|
reason: '审核结果会在5分钟内短信通知您',
|
|
|
btnText: '先去逛逛',
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case '3':{
|
|
|
status = 'error',
|
|
|
statusInfo = {
|
|
|
message: '审核未通过暂时无法授信',
|
|
|
reason: failReason,
|
|
|
btnText: '重新申请',
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case '4':{
|
|
|
status = 'cancel',
|
|
|
statusInfo = {
|
|
|
message: '账户已注销',
|
|
|
reason: '您的有货分期账户经本人确认已注销,',
|
|
|
reasonTwo: '如有疑问,请联系客服。',
|
|
|
reasonThird: '提示:已注销用户不可再开通',
|
|
|
btnText: '先去逛逛',
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case '5':{
|
|
|
status = 'error',
|
|
|
statusInfo = {
|
|
|
message: '审核未通过暂时无法授信',
|
|
|
reason: '您的授信未通过,在有货更多的消费,增加信用度,会大大提升审核通过率奥。',
|
|
|
btnText: '重新申请',
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
|
|
|
}
|
|
|
}
|
|
|
console.log('---1111');
|
|
|
|
|
|
let params = {
|
|
|
statusCode,
|
|
|
status,
|
|
|
jumpUrl,
|
|
|
statusInfo,
|
|
|
};
|
|
|
dispatch(setInstallmentStatusPageOriginalInfo(params));
|
|
|
};
|
|
|
}
|
|
|
|
|
|
export function getInstallmentProductAndAdvertisement(page) {
|
|
|
return (dispatch, getState) => {
|
|
|
let {app, installment} = getState();
|
|
|
return new InstallmentService(app.host).getSearchIntallment(page)
|
|
|
.then(json => {
|
|
|
dispatch(setInstallmentStatusPageGoods(json.product_list))
|
|
|
console.log('goods');
|
|
|
console.log(json);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
});
|
|
|
};
|
|
|
}
|
|
|
|
|
|
// onPressStatusPageBtn
|
|
|
export function onPressStatusPageBtn(page) {
|
|
|
return (dispatch, getState) => {
|
|
|
let {app, installment} = getState();
|
|
|
let {jumpUrl} = installment.installmentStausPageInfo;
|
|
|
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(jumpUrl);
|
|
|
};
|
|
|
} |
...
|
...
|
|