|
|
|
@ -15,10 +15,23 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct
|
|
|
|
|
return $http.get('/client/partner_info');
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
}).state('basic.payment_info_edit', {
|
|
|
|
|
url: '/payment/edit',
|
|
|
|
|
templateUrl: '/static/payment/partner/templates/client_partner_edit.html',
|
|
|
|
|
controller: 'clientPaymentInfoEditCtrl'
|
|
|
|
|
}).state('basic.payment_info', {
|
|
|
|
|
url: '/payment',
|
|
|
|
|
templateUrl: '/static/payment/partner/templates/client_payment_info.html',
|
|
|
|
|
controller: 'clientPaymentInfoCtrl'
|
|
|
|
|
}).state('basic.compliance_files', {
|
|
|
|
|
url: '/{client_moniker}/compliance_files',
|
|
|
|
|
templateUrl: '/static/payment/partner/templates/client_compliance_files.html',
|
|
|
|
|
controller: 'clientComplianceFilesCtrl',
|
|
|
|
|
resolve: {
|
|
|
|
|
file: ['$http', function ($http) {
|
|
|
|
|
return $http.get('/client/partner_info/compliance/files');
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
}).state('payment_materials', {
|
|
|
|
|
url: '/payment_materials',
|
|
|
|
|
templateUrl: '/static/payment/partner/templates/client_payment_materials.html',
|
|
|
|
@ -46,15 +59,354 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct
|
|
|
|
|
controller: 'clientDeviceCtrl'
|
|
|
|
|
})
|
|
|
|
|
}]);
|
|
|
|
|
app.controller('clientPartnerDetailCtrl', ['$scope', '$http', 'partner','industryMap', function ($scope, $http, partner,industryMap) {
|
|
|
|
|
app.controller('clientPartnerDetailCtrl', ['$scope', '$http', 'partner','industryMap','businessStructuresMap', function ($scope, $http, partner,industryMap,businessStructuresMap) {
|
|
|
|
|
$scope.business_structures = businessStructuresMap.configs();
|
|
|
|
|
$scope.industries = industryMap.configs();
|
|
|
|
|
$scope.partner = partner.data;
|
|
|
|
|
//修改邮箱
|
|
|
|
|
$scope.updateEmail = function () {
|
|
|
|
|
$http.put('/client/partner_info', $scope.partner).then(
|
|
|
|
|
$http.put('/client/partner_info/compliance_audit').then(
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.commitToCompliance = function () {
|
|
|
|
|
$http.get('/client/partner_info/compliance/files').then(function (resp) {
|
|
|
|
|
$scope.complianceFiles = resp.data;
|
|
|
|
|
if( $scope.complianceFiles.client_agree_file == null || $scope.complianceFiles.client_id_file == null||$scope.complianceFiles.client_bank_file == null || $scope.complianceFiles.client_company_file == null){
|
|
|
|
|
alert("请前去完善合规资料,再进行提交");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if($scope.partner.business_structure == null ||$scope.partner.logo_url == null || $scope.partner.description == null || (($scope.partner.store_photo == null || $scope.partner.company_photo == null) && $scope.currentUser.client.company_website == null)){
|
|
|
|
|
alert("请前去完善商户资料,再进行提交");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(($scope.partner.business_structure == "Company" && $scope.partner.acn == null) || ($scope.partner.business_structure != "Company" && $scope.partner.abn == null)){
|
|
|
|
|
alert("请前去完善商户资料,再进行提交");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(!$scope.partner.mail_confirm){
|
|
|
|
|
alert("请验证邮箱后,再进行提交");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$http.post('/client/partner_info/compliance_audit').then(
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|
app.controller('clientPaymentInfoEditCtrl', ['$scope', '$http','industryMap', 'commonDialog','$state','Upload',function ($scope, $http,industryMap,commonDialog,$state,Upload) {
|
|
|
|
|
/* $scope.loadClient = function () {
|
|
|
|
|
$http.get('/client/partner_info').then(function (resp) {
|
|
|
|
|
$scope.partner = resp.data;
|
|
|
|
|
})
|
|
|
|
|
};*/
|
|
|
|
|
|
|
|
|
|
$scope.uploadLogo = function (file) {
|
|
|
|
|
if (file != null) {
|
|
|
|
|
$scope.logoProgress = {value: 0};
|
|
|
|
|
Upload.upload({
|
|
|
|
|
url: '/attachment/files',
|
|
|
|
|
data: {file: file}
|
|
|
|
|
}).then(function (resp) {
|
|
|
|
|
delete $scope.logoProgress;
|
|
|
|
|
$scope.partner.logo_id = resp.data.fileid;
|
|
|
|
|
$scope.partner.logo_url = resp.data.url;
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
delete $scope.logoProgress;
|
|
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
|
|
}, function (evt) {
|
|
|
|
|
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.uploadShopPhoto = function (file) {
|
|
|
|
|
if (file != null) {
|
|
|
|
|
$scope.shopPhotoProgress = {value: 0};
|
|
|
|
|
Upload.upload({
|
|
|
|
|
url: '/attachment/files',
|
|
|
|
|
data: {file: file}
|
|
|
|
|
}).then(function (resp) {
|
|
|
|
|
delete $scope.shopPhotoProgress;
|
|
|
|
|
$scope.partner.company_photo = resp.data.url;
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
delete $scope.shopPhotoProgress;
|
|
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
|
|
}, function (evt) {
|
|
|
|
|
$scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.uploadStorePhoto = function (file) {
|
|
|
|
|
if (file != null) {
|
|
|
|
|
$scope.storePhotoProgress = {value: 0};
|
|
|
|
|
Upload.upload({
|
|
|
|
|
url: '/attachment/files',
|
|
|
|
|
data: {file: file}
|
|
|
|
|
}).then(function (resp) {
|
|
|
|
|
delete $scope.storePhotoProgress;
|
|
|
|
|
$scope.partner.store_photo = resp.data.url;
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
delete $scope.storePhotoProgress;
|
|
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
|
|
}, function (evt) {
|
|
|
|
|
$scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.updatePartner = function (form) {
|
|
|
|
|
if (form.$invalid) {
|
|
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
|
|
if (key.indexOf('$') < 0) {
|
|
|
|
|
item.$dirty = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!$scope.partner.logo_url) {
|
|
|
|
|
alert("Logo is necessary!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if($scope.partner.partner_type == 'photo'){
|
|
|
|
|
if (!$scope.partner.company_photo) {
|
|
|
|
|
alert('Shop Photo1 is necessary');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!$scope.partner.store_photo) {
|
|
|
|
|
alert('Shop Photo2 is necessary');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var content = '';
|
|
|
|
|
$http.put('/client/partner_info/update/partnerInfo', $scope.partner).then(function () {
|
|
|
|
|
if (content != '') {
|
|
|
|
|
commonDialog.alert({
|
|
|
|
|
title: 'Warning',
|
|
|
|
|
content: content,
|
|
|
|
|
type: 'error'
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
commonDialog.alert({
|
|
|
|
|
title: 'Success',
|
|
|
|
|
content: 'Update partner information successfully',
|
|
|
|
|
type: 'success'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
$state.go('basic', {clientMoniker: $scope.partner.client_moniker}, {reload: true});
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
}]);
|
|
|
|
|
app.controller('clientComplianceFilesCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', 'Upload', 'file', function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) {
|
|
|
|
|
|
|
|
|
|
$scope.file = file.data || {};
|
|
|
|
|
//audit files
|
|
|
|
|
$scope.uploadBankFile = function (file) {
|
|
|
|
|
if (file != null) {
|
|
|
|
|
if (file.size > 3 * 1024 * 1024) {
|
|
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
|
|
} else {
|
|
|
|
|
$scope.bankFileProgress = {value: 0};
|
|
|
|
|
Upload.upload({
|
|
|
|
|
url: '/attachment/files',
|
|
|
|
|
data: {file: file}
|
|
|
|
|
}).then(function (resp) {
|
|
|
|
|
delete $scope.bankFileProgress;
|
|
|
|
|
$scope.file.file_bank_info = resp.data.url;
|
|
|
|
|
$scope.updateFile();
|
|
|
|
|
if ($scope.file.file_bank_info.endsWith('pdf')) {
|
|
|
|
|
$scope.bankIsImage = false;
|
|
|
|
|
} else {
|
|
|
|
|
$scope.bankIsImage = true;
|
|
|
|
|
}
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
delete $scope.bankFileProgress;
|
|
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
|
|
}, function (evt) {
|
|
|
|
|
$scope.bankFileProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
$scope.agreeIsImage = true;
|
|
|
|
|
if ($scope.file.file_agreement_info && $scope.file.file_agreement_info.endsWith('pdf')) {
|
|
|
|
|
$scope.agreeIsImage = false;
|
|
|
|
|
}
|
|
|
|
|
$scope.bankIsImage = true;
|
|
|
|
|
if ($scope.file.file_bank_info && $scope.file.file_bank_info.endsWith('pdf')) {
|
|
|
|
|
$scope.bankIsImage = false;
|
|
|
|
|
}
|
|
|
|
|
$scope.companyIsImage = true;
|
|
|
|
|
if ($scope.file.file_company_info && $scope.file.file_company_info.endsWith('pdf')) {
|
|
|
|
|
$scope.companyIsImage = false;
|
|
|
|
|
}
|
|
|
|
|
$scope.applyIsImage = true;
|
|
|
|
|
if ($scope.file.file_apply_info && $scope.file.file_apply_info.endsWith('pdf')) {
|
|
|
|
|
$scope.applyIsImage = false;
|
|
|
|
|
}
|
|
|
|
|
$scope.idIsImage = true;
|
|
|
|
|
if ($scope.file.file_id_info && $scope.file.file_id_info.endsWith('pdf')) {
|
|
|
|
|
$scope.idIsImage = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.uploadCompanyFile = function (file) {
|
|
|
|
|
if (file != null) {
|
|
|
|
|
if (file.size > 3 * 1024 * 1024) {
|
|
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
|
|
} else {
|
|
|
|
|
$scope.companyFileProgress = {value: 0};
|
|
|
|
|
Upload.upload({
|
|
|
|
|
url: '/attachment/files',
|
|
|
|
|
data: {file: file}
|
|
|
|
|
}).then(function (resp) {
|
|
|
|
|
delete $scope.companyFileProgress;
|
|
|
|
|
$scope.file.file_company_info = resp.data.url;
|
|
|
|
|
$scope.updateFile();
|
|
|
|
|
if ($scope.file.file_company_info.endsWith('pdf')) {
|
|
|
|
|
$scope.companyIsImage = false;
|
|
|
|
|
} else {
|
|
|
|
|
$scope.companyIsImage = true;
|
|
|
|
|
}
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
delete $scope.companyFileProgress;
|
|
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
|
|
}, function (evt) {
|
|
|
|
|
$scope.companyFileProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
//上传ID信息
|
|
|
|
|
$scope.uploadIDFile = function (file) {
|
|
|
|
|
if (file != null) {
|
|
|
|
|
if (file.size > 3 * 1024 * 1024) {
|
|
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
|
|
} else {
|
|
|
|
|
$scope.idFileProgress = {value: 0};
|
|
|
|
|
Upload.upload({
|
|
|
|
|
url: '/attachment/files',
|
|
|
|
|
data: {file: file}
|
|
|
|
|
}).then(function (resp) {
|
|
|
|
|
delete $scope.idFileProgress;
|
|
|
|
|
$scope.file.file_id_info = resp.data.url;
|
|
|
|
|
$scope.updateFile();
|
|
|
|
|
if ($scope.file.file_id_info.endsWith('pdf')) {
|
|
|
|
|
$scope.idIsImage = false;
|
|
|
|
|
} else {
|
|
|
|
|
$scope.idIsImage = true;
|
|
|
|
|
}
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
delete $scope.idFileProgress;
|
|
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
|
|
}, function (evt) {
|
|
|
|
|
$scope.idFileProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//上传协议文件
|
|
|
|
|
$scope.uploadAgreementFile = function (file) {
|
|
|
|
|
if (file != null) {
|
|
|
|
|
if (file.size > 10 * 1024 * 1024) {
|
|
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过5MB,请压缩后重试', type: 'error'})
|
|
|
|
|
} else {
|
|
|
|
|
$scope.agreementFileProgress = {value: 0};
|
|
|
|
|
Upload.upload({
|
|
|
|
|
url: '/attachment/files',
|
|
|
|
|
data: {file: file}
|
|
|
|
|
}).then(function (resp) {
|
|
|
|
|
delete $scope.agreementFileProgress;
|
|
|
|
|
$scope.file.file_agreement_info = resp.data.url;
|
|
|
|
|
$scope.updateFile();
|
|
|
|
|
if ($scope.file.file_agreement_info.endsWith('pdf')) {
|
|
|
|
|
$scope.agreeIsImage = false;
|
|
|
|
|
} else {
|
|
|
|
|
$scope.agreeIsImage = true;
|
|
|
|
|
}
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
delete $scope.agreementFileProgress;
|
|
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
|
|
}, function (evt) {
|
|
|
|
|
$scope.agreementFileProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//上传申请表
|
|
|
|
|
$scope.uploadApplyFile = function (file) {
|
|
|
|
|
if (file != null) {
|
|
|
|
|
if (file.size > 3 * 1024 * 1024) {
|
|
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
|
|
} else {
|
|
|
|
|
$scope.applyFileProgress = {value: 0};
|
|
|
|
|
Upload.upload({
|
|
|
|
|
url: '/attachment/files',
|
|
|
|
|
data: {file: file}
|
|
|
|
|
}).then(function (resp) {
|
|
|
|
|
delete $scope.applyFileProgress;
|
|
|
|
|
$scope.file.file_apply_info = resp.data.url;
|
|
|
|
|
$scope.updateFile();
|
|
|
|
|
if ($scope.file.file_apply_info.endsWith('pdf')) {
|
|
|
|
|
$scope.applyIsImage = false;
|
|
|
|
|
} else {
|
|
|
|
|
$scope.applyIsImage = true;
|
|
|
|
|
}
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
delete $scope.applyFileProgress;
|
|
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
|
|
}, function (evt) {
|
|
|
|
|
$scope.applyFileProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* $scope.downloadAsZip = function () {
|
|
|
|
|
var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/complianceAsZIP';
|
|
|
|
|
return url;
|
|
|
|
|
};
|
|
|
|
|
*/
|
|
|
|
|
$scope.updateFile = function () {
|
|
|
|
|
$http.put('/client/partner_info/update/file', $scope.file).then(function () {
|
|
|
|
|
commonDialog.alert({
|
|
|
|
|
title: 'Success',
|
|
|
|
|
content: 'Upload Successful',
|
|
|
|
|
type: 'success'
|
|
|
|
|
});
|
|
|
|
|
$state.reload();
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function commitError() {
|
|
|
|
|
commonDialog.alert({
|
|
|
|
|
title: 'Error',
|
|
|
|
|
content: 'Missing file',
|
|
|
|
|
type: 'error'
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
$scope.commitPartner = function () {
|
|
|
|
|
if ($scope.file) {
|
|
|
|
|
if ($scope.file.file_bank_info != null && $scope.file.file_company_info != null && $scope.file.file_id_info != null && $scope.file_apply_info != null) {
|
|
|
|
|
$http.put('/client/partner_info/compliance_audit').then(function (resp) {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
commitError();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
commitError();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
app.controller('clientPaymentInfoCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) {
|
|
|
|
|
$scope.paymentInfo = $scope.partner;
|
|
|
|
|
$scope.old_customer_surcharge_rate = angular.copy($scope.partner.customer_surcharge_rate);
|
|
|
|
|