|
|
var $ = require('yoho-jquery');
|
|
|
var tip = require('../plugin/tip');
|
|
|
var yohoApp = require('../yoho-app');
|
|
|
|
|
|
var Timer = function() {
|
|
|
this.counter = 0;
|
...
|
...
|
@@ -35,7 +36,9 @@ var validateForm = function() { |
|
|
formModel.mobile &&
|
|
|
formModel.snsCheckCode &&
|
|
|
formModel.agreements === 'on') {
|
|
|
if (!applyButton.data('running')) {
|
|
|
applyButton.removeClass('disabled');
|
|
|
}
|
|
|
ret = true;
|
|
|
} else {
|
|
|
applyButton.addClass('disabled');
|
...
|
...
|
@@ -54,7 +57,7 @@ var validateForm = function() { |
|
|
|
|
|
var checkCard = require('./bind-card-check');
|
|
|
|
|
|
const clearVerifyCode = function() {
|
|
|
var clearVerifyCode = function() {
|
|
|
formModel.snsCheckCode = '';
|
|
|
$('#sns-check-code').val('');
|
|
|
};
|
...
|
...
|
@@ -162,7 +165,7 @@ $('#send-sms').click(function() { |
|
|
|
|
|
// 输入框改变时同时更新模型
|
|
|
/*
|
|
|
$('input').on('change', function() {
|
|
|
$('input').on('change', function() {
|
|
|
var name = $(this).attr('name');
|
|
|
|
|
|
if ($(this).is(':checkbox')) {
|
...
|
...
|
@@ -172,8 +175,8 @@ $('input').on('change', function() { |
|
|
}
|
|
|
|
|
|
validateForm();
|
|
|
});
|
|
|
*/
|
|
|
});
|
|
|
*/
|
|
|
|
|
|
// validateForm();
|
|
|
|
...
|
...
|
@@ -198,14 +201,17 @@ setInterval(function() { |
|
|
$('#apply-button').click(function() {
|
|
|
var ret = false;
|
|
|
var that = $(this);
|
|
|
var asyncMode = yohoApp.isiOS;
|
|
|
|
|
|
if ($(this).hasClass('disabled') || !validateForm()) {
|
|
|
return false;
|
|
|
} else {
|
|
|
$(this).addClass('disabled').text('处理中...').data('running', true);
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
method: 'get',
|
|
|
async: false,
|
|
|
async: asyncMode,
|
|
|
url: '/home/installment/starting-service/check-verify-code',
|
|
|
data: {
|
|
|
mobile: formModel.mobile,
|
...
|
...
|
@@ -217,7 +223,7 @@ $('#apply-button').click(function() { |
|
|
method: 'post',
|
|
|
url: '/home/installment/activate-service',
|
|
|
data: formModel,
|
|
|
async: false
|
|
|
async: asyncMode
|
|
|
});
|
|
|
} else {
|
|
|
clearVerifyCode();
|
...
|
...
|
@@ -226,12 +232,10 @@ $('#apply-button').click(function() { |
|
|
}).then(function(result) {
|
|
|
var params;
|
|
|
|
|
|
if (!result) {
|
|
|
// return;
|
|
|
that.removeClass('disabled').text('下一步').data('running', false);
|
|
|
|
|
|
result = {
|
|
|
code: 500
|
|
|
};
|
|
|
if (!result) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
params = {
|
...
|
...
|
@@ -242,12 +246,21 @@ $('#apply-button').click(function() { |
|
|
};
|
|
|
|
|
|
if (result.code === 200 && result.data) {
|
|
|
if (asyncMode) {
|
|
|
yohoApp.invokeMethod('go.instalmentActivated', params.params);
|
|
|
} else {
|
|
|
that.attr('href', location.pathname + '?openby:yohobuy=' + encodeURIComponent(JSON.stringify(params)));
|
|
|
}
|
|
|
|
|
|
ret = true;
|
|
|
} else if (result.code === 500) {
|
|
|
// 接口可能超时返回审核中 by 孟令阶
|
|
|
params.params.status = '1';
|
|
|
if (asyncMode) {
|
|
|
yohoApp.invokeMethod('go.instalmentActivated', params.params);
|
|
|
} else {
|
|
|
that.attr('href', location.pathname + '?openby:yohobuy=' + encodeURIComponent(JSON.stringify(params)));
|
|
|
}
|
|
|
ret = true;
|
|
|
} else {
|
|
|
tip.show(result.message);
|
...
|
...
|
@@ -268,7 +281,7 @@ $('input[maxlength]').keyup(function() { |
|
|
});
|
|
|
|
|
|
$('#agreements').click(function() {
|
|
|
const params = {
|
|
|
var params = {
|
|
|
action: 'go.instalmentProtocol',
|
|
|
params: {
|
|
|
protocolUrl: location.protocol + '//' + location.hostname + location.port + $(this).data('href')
|
...
|
...
|
|