|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
angular.module('applyPartnerApp', ['ngMessages','ngFileUpload']).controller('applyPartnerCtrl', ['$scope', '$http','$interval','Upload', function ($scope, $http,$interval,Upload) {
|
|
|
|
|
var app = angular.module('applyPartnerApp', ['ngMessages','ngFileUpload','ui.bootstrap']);
|
|
|
|
|
app.controller('applyPartnerCtrl', ['$scope', '$http','$interval','Upload','$uibModal', 'commonDialog', function ($scope, $http,$interval,Upload,$uibModal,commonDialog) {
|
|
|
|
|
var countryMap = [{
|
|
|
|
|
"label": "AUS",
|
|
|
|
|
"value": "AUS"
|
|
|
|
@ -160,6 +161,7 @@ angular.module('applyPartnerApp', ['ngMessages','ngFileUpload']).controller('app
|
|
|
|
|
$scope.partner.client_pay_type = [];
|
|
|
|
|
$scope.partner.client_pay_desc = [];
|
|
|
|
|
$scope.phone_code_timer=$interval(function () {}, 1000);
|
|
|
|
|
$scope.signInfo = {};
|
|
|
|
|
|
|
|
|
|
$scope.loadRoyalpayindustry = function () {
|
|
|
|
|
$http.get('/static/data/rp_industry_apply.json').then(function (resp) {
|
|
|
|
@ -171,7 +173,6 @@ angular.module('applyPartnerApp', ['ngMessages','ngFileUpload']).controller('app
|
|
|
|
|
$scope.loadAlipayCategory = function () {
|
|
|
|
|
$http.get('/static/data/alipayMcc.json').then(function (resp) {
|
|
|
|
|
$scope.alipayMccCategory = resp.data;
|
|
|
|
|
debugger;
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
$scope.loadAlipayCategory();
|
|
|
|
@ -181,11 +182,6 @@ angular.module('applyPartnerApp', ['ngMessages','ngFileUpload']).controller('app
|
|
|
|
|
$scope.partner.alipayindustry = selectedItem.mccCode;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.onAlipayMccSelect = function (selectedItem) {
|
|
|
|
|
$scope.partner.alipay_category = selectedItem.label;
|
|
|
|
|
$scope.partner.alipayindustry = selectedItem.mccCode;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.loadCustomerChannel = function () {
|
|
|
|
|
$http.get('/static/data/rp_customer_channel.json').then(function (resp) {
|
|
|
|
|
$scope.customerchannel = resp.data;
|
|
|
|
@ -694,4 +690,298 @@ angular.module('applyPartnerApp', ['ngMessages','ngFileUpload']).controller('app
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.submitSign = function (fullName) {
|
|
|
|
|
var sign = $("#signature").jSignature('getData', 'image');
|
|
|
|
|
var signInfo = {};
|
|
|
|
|
signInfo.src = 'data:' + sign[0] + ',' + sign[1];
|
|
|
|
|
signInfo.fullName = fullName;
|
|
|
|
|
$scope.$close(signInfo);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.submitApply = function () {
|
|
|
|
|
$uibModal.open({
|
|
|
|
|
backdrop: false,
|
|
|
|
|
templateUrl: '/static/payment/partner/templates/agreement_signature_dialog.html',
|
|
|
|
|
controller: 'agreementSignDialogCtrl',
|
|
|
|
|
size: 'md'
|
|
|
|
|
}).result.then(function (result) {
|
|
|
|
|
$scope.confirmBtn = true;
|
|
|
|
|
$scope.signItBtn = false;
|
|
|
|
|
$scope.signInfo.fullName = result.fullName;
|
|
|
|
|
$scope.signInfo.src = result.src;
|
|
|
|
|
$scope.uploadSign();
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.uploadSign = function () {
|
|
|
|
|
if ($scope.signInfo.fullName == null || $scope.signInfo.fullName == "") {
|
|
|
|
|
commonDialog.alert({title: 'Submit Fail', content: 'Please confirm full name entered', type: 'error'});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ($scope.signInfo.src == null || $scope.signInfo.src == "") {
|
|
|
|
|
commonDialog.alert({title: 'Submit Fail', content: 'Please confirm signature', type: 'error'});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
document.getElementById("loading_logo").style ="";
|
|
|
|
|
$scope.white();
|
|
|
|
|
var signFile = dataURLtoFile($scope.signInfo.src, $scope.signInfo.fullName);
|
|
|
|
|
$scope.logoProgress = {value: 0};
|
|
|
|
|
Upload.upload({
|
|
|
|
|
url: '/register/clientCompliance/commit_aggregate_file'+'?username='+$scope.partner.contact_phone+'&clean_days='+$scope.partner.clean_days,
|
|
|
|
|
data: {file: signFile}
|
|
|
|
|
}).then(function (resp) {
|
|
|
|
|
$scope.contract_url= resp.data.contract_url;
|
|
|
|
|
document.getElementById('loading').style.display = "none";
|
|
|
|
|
document.getElementById('loading_logo').style.display = "none";
|
|
|
|
|
delete $scope.logoProgress;
|
|
|
|
|
$scope.changeChoose(4);
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
debugger;
|
|
|
|
|
document.getElementById('loading').style.display = "none";
|
|
|
|
|
document.getElementById('loading_logo').style.display = "none";
|
|
|
|
|
delete $scope.logoProgress;
|
|
|
|
|
commonDialog.alert({title: 'Commit Aggregate File Fail', content: resp.data.message, type: 'error'})
|
|
|
|
|
}, function (evt) {
|
|
|
|
|
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.white=function(){
|
|
|
|
|
$("#loading").css({
|
|
|
|
|
"position":"absolute", //绝对位置
|
|
|
|
|
"display":"block", //让对象成为块级元素
|
|
|
|
|
"background-color":"white", //背景白色
|
|
|
|
|
"z-index":"9999", //最上层显示
|
|
|
|
|
"opacity":"0.7" //背景透明度
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function dataURLtoFile(dataurl, filename) {//将base64转换为文件
|
|
|
|
|
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
|
|
|
|
|
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
|
|
|
|
|
while (n--) {
|
|
|
|
|
u8arr[n] = bstr.charCodeAt(n);
|
|
|
|
|
}
|
|
|
|
|
return new File([u8arr], filename, {type: mime});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
app.controller('agreementSignDialogCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) {
|
|
|
|
|
$scope.submitSign = function (fullName) {
|
|
|
|
|
var sign = $("#signature").jSignature('getData', 'image');
|
|
|
|
|
var signInfo = {};
|
|
|
|
|
signInfo.src = 'data:' + sign[0] + ',' + sign[1];
|
|
|
|
|
signInfo.fullName = fullName;
|
|
|
|
|
$scope.$close(signInfo);
|
|
|
|
|
};
|
|
|
|
|
}]);
|
|
|
|
|
app.factory('commonDialog', ['$q', '$uibModal', function ($q, $uibModal) {
|
|
|
|
|
return {
|
|
|
|
|
alert: function (cfg) {
|
|
|
|
|
var choises = [{label: 'OK', className: 'btn-default', key: '1'}];
|
|
|
|
|
var config = {
|
|
|
|
|
title: cfg.title,
|
|
|
|
|
content: cfg.content,
|
|
|
|
|
contentHtml: cfg.contentHtml,
|
|
|
|
|
backdrop: cfg.backdrop,
|
|
|
|
|
size: cfg.size,
|
|
|
|
|
choises: choises,
|
|
|
|
|
type: cfg.type
|
|
|
|
|
};
|
|
|
|
|
var defer = $q.defer();
|
|
|
|
|
showModalDialog(config).then(function () {
|
|
|
|
|
defer.resolve();
|
|
|
|
|
}, function () {
|
|
|
|
|
defer.resolve()
|
|
|
|
|
});
|
|
|
|
|
return defer.promise;
|
|
|
|
|
},
|
|
|
|
|
confirm: function (cfg) {
|
|
|
|
|
var choises = [{label: 'OK', className: 'btn-success', key: '1'},
|
|
|
|
|
{label: 'Cancel', className: 'btn-danger', key: '2', dismiss: true}];
|
|
|
|
|
var config = {
|
|
|
|
|
title: cfg.title,
|
|
|
|
|
content: cfg.content,
|
|
|
|
|
contentHtml: cfg.contentHtml,
|
|
|
|
|
json:cfg.json,
|
|
|
|
|
backdrop: cfg.backdrop,
|
|
|
|
|
size: cfg.size,
|
|
|
|
|
choises: cfg.choises || choises
|
|
|
|
|
};
|
|
|
|
|
var deferred = $q.defer();
|
|
|
|
|
showModalDialog(config).then(function (choice) {
|
|
|
|
|
if (choice.dismiss) {
|
|
|
|
|
deferred.reject();
|
|
|
|
|
} else {
|
|
|
|
|
deferred.resolve(choice.key);
|
|
|
|
|
}
|
|
|
|
|
}, function () {
|
|
|
|
|
deferred.reject();
|
|
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
},
|
|
|
|
|
inputNum: function (cfg) {
|
|
|
|
|
return $uibModal.open({
|
|
|
|
|
templateUrl: '/static/commons/templates/num_input.html',
|
|
|
|
|
size: 'sm',
|
|
|
|
|
resolve: {
|
|
|
|
|
cfg: function () {
|
|
|
|
|
return cfg;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
controller: ['$scope', 'cfg', function ($scope, cfg) {
|
|
|
|
|
$scope.title = cfg.title || 'Input Amount';
|
|
|
|
|
$scope.data = {};
|
|
|
|
|
$scope.submit = function () {
|
|
|
|
|
$scope.$close($scope.data.num);
|
|
|
|
|
};
|
|
|
|
|
}]
|
|
|
|
|
}).result;
|
|
|
|
|
},
|
|
|
|
|
inputText:function (cfg) {
|
|
|
|
|
return $uibModal.open({
|
|
|
|
|
backdrop: 'static', keyboard: false,
|
|
|
|
|
templateUrl:'/static/commons/templates/text_input.html',
|
|
|
|
|
size: cfg.size || 'sm',
|
|
|
|
|
resolve:{
|
|
|
|
|
cfg:function () {
|
|
|
|
|
return cfg;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
controller:['$scope','cfg',function ($scope, cfg) {
|
|
|
|
|
$scope.title = cfg.title || 'Input Amount';
|
|
|
|
|
$scope.data = {};
|
|
|
|
|
$scope.submit = function () {
|
|
|
|
|
$scope.$close($scope.data.text);
|
|
|
|
|
};
|
|
|
|
|
}]
|
|
|
|
|
}).result;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function showModalDialog(cfg) {
|
|
|
|
|
cfg = angular.extend({}, defaultCfg, cfg);
|
|
|
|
|
return $uibModal.open({
|
|
|
|
|
templateUrl: 'static/commons/templates/dialog.html',
|
|
|
|
|
controller: 'commonModalCtrl',
|
|
|
|
|
size: cfg.size,
|
|
|
|
|
backdrop: cfg.backdrop,
|
|
|
|
|
resolve: {
|
|
|
|
|
cfg: function () {
|
|
|
|
|
return cfg;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).result;
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|
app.controller('commonModalCtrl', ['$scope', '$timeout', 'cfg', function ($scope, $timeout, cfg) {
|
|
|
|
|
var bgClasses = {
|
|
|
|
|
success: 'bg-success',
|
|
|
|
|
error: 'bg-warning',
|
|
|
|
|
info: 'bg-info'
|
|
|
|
|
};
|
|
|
|
|
var glyIcons = {
|
|
|
|
|
success: 'glyphicon-ok-circle',
|
|
|
|
|
error: 'glyphicon-remove-circle',
|
|
|
|
|
info: 'glyphicon-info-sign'
|
|
|
|
|
};
|
|
|
|
|
$scope.title = cfg.title;
|
|
|
|
|
$scope.content = cfg.content;
|
|
|
|
|
$scope.contentHtml = cfg.contentHtml;
|
|
|
|
|
$scope.jsonData = cfg.json;
|
|
|
|
|
$scope.bgClass = bgClasses[cfg.type];
|
|
|
|
|
$scope.glyIcon = glyIcons[cfg.type];
|
|
|
|
|
$scope.choises = cfg.choises;
|
|
|
|
|
if(cfg.type=='success'){
|
|
|
|
|
$timeout(function () {
|
|
|
|
|
$scope.$dismiss();
|
|
|
|
|
},2000)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.btnClick = function (choice) {
|
|
|
|
|
$scope.$close(choice);
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|
app.directive('multiLevelSelectPopup', [function () {
|
|
|
|
|
return {
|
|
|
|
|
restrict: 'A',
|
|
|
|
|
scope: {
|
|
|
|
|
multiLevelSelectPopup: '=',
|
|
|
|
|
childrenKey: '@',
|
|
|
|
|
labelKey: '@',
|
|
|
|
|
onSelect: '&'
|
|
|
|
|
},
|
|
|
|
|
link: function (scope, element, attr) {
|
|
|
|
|
var selectBox,bg;
|
|
|
|
|
var selectGroups = [];
|
|
|
|
|
scope.labelKey = scope.labelKey || 'label';
|
|
|
|
|
scope.childrenKey = scope.childrenKey || 'children';
|
|
|
|
|
$(element).focus(function () {
|
|
|
|
|
if (selectBox) {
|
|
|
|
|
selectBox.remove();
|
|
|
|
|
}
|
|
|
|
|
selectBox = $('<div></div>').addClass('ml-select-box');
|
|
|
|
|
var offset = $(this).offset();
|
|
|
|
|
selectBox.css({
|
|
|
|
|
top: (offset.top + $(this).outerHeight() + 3) + 'px',
|
|
|
|
|
left: offset.left + 'px'
|
|
|
|
|
});
|
|
|
|
|
var container = $('<div></div>').appendTo(selectBox);
|
|
|
|
|
initSelectLevel(container, scope.multiLevelSelectPopup, 0);
|
|
|
|
|
var $body = $('body');
|
|
|
|
|
selectBox.appendTo($body);
|
|
|
|
|
bg = $('<div></div>').css({position:'fixed',top:0,left:0,right:0,bottom:0,zIndex:9998}).appendTo($body);
|
|
|
|
|
bg.click(function () {
|
|
|
|
|
selectBox.remove();
|
|
|
|
|
bg.remove();
|
|
|
|
|
selectBox = null;
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function initSelectLevel(container, list, groupIndex) {
|
|
|
|
|
if (selectGroups[groupIndex]) {
|
|
|
|
|
var groups = selectGroups.splice(groupIndex, 999);
|
|
|
|
|
angular.forEach(groups, function (group) {
|
|
|
|
|
group.remove();
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
var levelBox = $('<ul></ul>').addClass('select-group').appendTo(container);
|
|
|
|
|
selectGroups[groupIndex] = levelBox;
|
|
|
|
|
angular.forEach(list, function (item) {
|
|
|
|
|
var label = item[scope.labelKey];
|
|
|
|
|
var li = $('<li></li>').text(label).attr('title', label).appendTo(levelBox);
|
|
|
|
|
if (!item[scope.childrenKey] || !item[scope.childrenKey].length) {
|
|
|
|
|
if (angular.isFunction(scope.onSelect)) {
|
|
|
|
|
li.click(function () {
|
|
|
|
|
try {
|
|
|
|
|
scope.$apply(function () {
|
|
|
|
|
scope.onSelect({$selected: item});
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}catch(err){}
|
|
|
|
|
selectBox.remove();
|
|
|
|
|
bg.remove();
|
|
|
|
|
selectBox = null;
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
li.hover(function () {
|
|
|
|
|
levelBox.find('.active').removeClass('active');
|
|
|
|
|
li.addClass('active');
|
|
|
|
|
initSelectLevel(container, item.children, groupIndex + 1);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|