|
|
/**
|
|
|
* Created by yixian on 2016-06-29.
|
|
|
*/
|
|
|
define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiSelect'], function (angular, Decimal) {
|
|
|
'use strict';
|
|
|
var clean_days_map = [
|
|
|
{
|
|
|
"label": "T+1",
|
|
|
"value": "1"
|
|
|
},
|
|
|
{
|
|
|
"label": "T+2",
|
|
|
"value": "2"
|
|
|
},
|
|
|
{
|
|
|
"label": "T+3",
|
|
|
"value": "3"
|
|
|
}];
|
|
|
var bd_city_map = [
|
|
|
{
|
|
|
"label": "Sydney",
|
|
|
"value": "Sydney"
|
|
|
},
|
|
|
{
|
|
|
"label": "Melbourne",
|
|
|
"value": "Melbourne"
|
|
|
}];
|
|
|
var partnerRoles = [
|
|
|
{code: 1, label: 'Admin'},
|
|
|
{code: 2, label: 'Manager'},
|
|
|
{code: 3, label: 'Cashier'}
|
|
|
];
|
|
|
var wxMerchantIndustries = [
|
|
|
{
|
|
|
"label": "鞋包服饰|Shoes&Garments",
|
|
|
"value": "343"
|
|
|
},
|
|
|
{
|
|
|
"label": "机票行业|Air Ticket",
|
|
|
"value": "493"
|
|
|
},
|
|
|
{
|
|
|
"label": "文具/办公用品|Stationery/office supplies",
|
|
|
"value": "492"
|
|
|
},
|
|
|
{
|
|
|
"label": "酒店行业|Hotel Industry",
|
|
|
"value": "491"
|
|
|
},
|
|
|
{
|
|
|
"label": "教育行业|Education Industry",
|
|
|
"value": "490"
|
|
|
},
|
|
|
{
|
|
|
"label": "国际物流|Logistics",
|
|
|
"value": "489"
|
|
|
},
|
|
|
{
|
|
|
"label": "数码电器|Digital appliance",
|
|
|
"value": "488"
|
|
|
},
|
|
|
{
|
|
|
"label": "母婴|Maternal and infant",
|
|
|
"value": "487"
|
|
|
},
|
|
|
{
|
|
|
"label": "化妆品|Cosmetics",
|
|
|
"value": "486"
|
|
|
},
|
|
|
{
|
|
|
"label": "食品|Food",
|
|
|
"value": "485"
|
|
|
},
|
|
|
{
|
|
|
"label": "综合商城|Comprehensive mall",
|
|
|
"value": "484"
|
|
|
},
|
|
|
{
|
|
|
"label": "其它货物贸易行业|Other trade industry",
|
|
|
"value": "494"
|
|
|
}
|
|
|
];
|
|
|
var app = angular.module('partnerManageApp', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ui.select', 'ngFileUpload']);
|
|
|
app.config(['$stateProvider', function ($stateProvider) {
|
|
|
$stateProvider.state('partners', {
|
|
|
url: '/partners',
|
|
|
templateUrl: '/static/payment/partner/templates/partners.html',
|
|
|
controller: 'partnerListCtrl',
|
|
|
data: {label: '商户列表'}
|
|
|
}).state('newPartners', {
|
|
|
url: '/partners/new',
|
|
|
templateUrl: '/static/payment/partner/templates/add_partner.html',
|
|
|
controller: 'addPartnerCtrl'
|
|
|
}).state('businessCompliance', {
|
|
|
url: '/partners/compliance',
|
|
|
templateUrl: '/static/payment/partner/templates/partner_compliance.html',
|
|
|
controller: 'compliancePartnerCtrl'
|
|
|
}).state('partners.detail', {
|
|
|
url: '/{clientMoniker}/detail',
|
|
|
templateUrl: '/static/payment/partner/templates/partner_detail.html',
|
|
|
controller: 'partnerDetailCtrl',
|
|
|
resolve: {
|
|
|
partner: ['$http', '$stateParams', function ($http, $stateParams) {
|
|
|
return $http.get('/sys/partners/' + $stateParams.clientMoniker);
|
|
|
}]
|
|
|
}
|
|
|
}).state('partners.edit', {
|
|
|
url: '/{clientMoniker}/edit',
|
|
|
templateUrl: '/static/payment/partner/templates/partner_edit.html',
|
|
|
controller: 'partnerEditCtrl',
|
|
|
resolve: {
|
|
|
partner: ['$http', '$stateParams', function ($http, $stateParams) {
|
|
|
return $http.get('/sys/partners/' + $stateParams.clientMoniker);
|
|
|
}]
|
|
|
}
|
|
|
}).state('partners.detail.payment_info', {
|
|
|
url: '/payment',
|
|
|
templateUrl: '/static/payment/partner/templates/partner_payment_info.html',
|
|
|
controller: 'partnerPaymentInfoCtrl'
|
|
|
}).state('partners.detail.payment_info_invalid', {
|
|
|
url: '/payment_invalid',
|
|
|
templateUrl: '/static/payment/partner/templates/partner_payment_info_invalid.html',
|
|
|
controller: 'partnerPaymentInfoCtrl'
|
|
|
}).state('partners.detail.subpartners', {
|
|
|
url: '/sub_partners',
|
|
|
templateUrl: '/static/payment/partner/templates/sub_partners.html',
|
|
|
controller: 'partnerSubCtrl'
|
|
|
}).state('partners.detail.accounts', {
|
|
|
url: '/accounts',
|
|
|
templateUrl: '/static/payment/partner/templates/partner_accounts.html',
|
|
|
controller: 'partnerAccountsCtrl'
|
|
|
}).state('partners.detail.paylogs', {
|
|
|
url: '/pay_logs',
|
|
|
templateUrl: '/static/payment/partner/templates/partner_pay_logs.html',
|
|
|
controller: 'partnerPayLogCtrl'
|
|
|
}).state('partners.detail.rates', {
|
|
|
url: '/rates',
|
|
|
templateUrl: '/static/payment/partner/templates/partner_bankaccounts.html',
|
|
|
controller: 'partnerRatesCtrl'
|
|
|
}).state('partners.detail.plugins', {
|
|
|
url: '/plugins',
|
|
|
templateUrl: '/static/payment/partner/templates/partner_plugins.html',
|
|
|
controller: 'partnerPluginsCtrl'
|
|
|
}).state('partners.detail.devices', {
|
|
|
url: '/devices',
|
|
|
templateUrl: '/static/payment/partner/templates/partner_devices.html',
|
|
|
controller: 'partnerDeviceCtrl'
|
|
|
}).state('partners.detail.files', {
|
|
|
url: '/files',
|
|
|
templateUrl: '/static/payment/partner/templates/partner_auth_files.html',
|
|
|
controller: 'partnerAuthFileCtrl',
|
|
|
resolve: {
|
|
|
file: ['$http', '$stateParams', function ($http, $stateParams) {
|
|
|
return $http.get('/sys/partners/' + $stateParams.clientMoniker + '/file');
|
|
|
}]
|
|
|
}
|
|
|
}).state('partners.detail.settlement', {
|
|
|
url: '/settlement',
|
|
|
templateUrl: '/static/payment/partner/templates/partner_settlement.html',
|
|
|
controller: 'partnerSettlementCtrl',
|
|
|
resolve: {
|
|
|
clientMoniker: ['$stateParams', function ($stateParams) {
|
|
|
return $stateParams.clientMoniker;
|
|
|
}]
|
|
|
}
|
|
|
}).state('partners.detail.product', {
|
|
|
url: '/partner_product',
|
|
|
templateUrl: 'static/payment/product/templates/product.html',
|
|
|
controller: 'productCtrl'
|
|
|
}).state('partners.detail.sub_merchant_applicaitons', {
|
|
|
url: '/sub_merchant_applicaitons',
|
|
|
templateUrl: 'static/payment/partner/templates/sub_merchant_id_apply.html',
|
|
|
controller: 'subMerchantIdApplicaitonsCtrl'
|
|
|
}).state('partners.detail.permission_client', {
|
|
|
url: '/permission_client',
|
|
|
templateUrl: 'static/payment/partner/templates/partner_permission.html',
|
|
|
controller: 'permissionClientCtrl'
|
|
|
});
|
|
|
}]);
|
|
|
app.controller('partnerListCtrl', ['$scope', '$sce', '$http', '$filter', '$uibModal', 'businessStructuresMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap',
|
|
|
function ($scope, $sce, $http, $filter, $uibModal, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) {
|
|
|
|
|
|
$scope.analysisClients = function () {
|
|
|
$http.get('/sys/partners/analysis').then(function (resp) {
|
|
|
$scope.analysis = resp.data;
|
|
|
})
|
|
|
};
|
|
|
if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) {
|
|
|
$scope.analysisClients();
|
|
|
}
|
|
|
$scope.pagination = {};
|
|
|
$scope.industries = industryMap.configs();
|
|
|
$scope.states = stateMap.configs();
|
|
|
$scope.countries = countryMap.configs();
|
|
|
$scope.sectors = sectorMap.configs();
|
|
|
$scope.business_structures = businessStructuresMap.configs();
|
|
|
$scope.clean_days = angular.copy(clean_days_map);
|
|
|
$scope.bd_citys = angular.copy(bd_city_map);
|
|
|
$scope.params = {textType: 'all', org_name: 'ALL'};
|
|
|
|
|
|
$scope.loadPartners = function (page) {
|
|
|
var params = angular.copy($scope.params);
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
$http.get('/sys/partners', {params: params}).then(function (resp) {
|
|
|
$scope.partners = resp.data.data;
|
|
|
$scope.pagination = resp.data.pagination;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/*$scope.loadLocations = function () {
|
|
|
var params = angular.copy($scope.params);
|
|
|
$http.get('/sys/partners/merchant/list_locations', {params: params}).then(function (resp) {
|
|
|
$scope.locations = resp.data;
|
|
|
window.merchant_maps.initMap($scope.locations);
|
|
|
});
|
|
|
};*/
|
|
|
$scope.today = new Date();
|
|
|
|
|
|
$scope.listBDUsers = function () {
|
|
|
$http.get('/sys/manager_accounts/roles/bd_user').then(function (resp) {
|
|
|
$scope.bdUserSource = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.listBDUsers();
|
|
|
|
|
|
if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) {
|
|
|
$scope.showOrg = 'Organization';
|
|
|
$http.get('/sys/orgs/list_all_Org', {params: {}}).then(function (resp) {
|
|
|
$scope.orgs = resp.data;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$scope.loadOrgs = function () {
|
|
|
var params = angular.copy($scope.params);
|
|
|
$http.get('/sys/orgs/orgChild', {params: params}).then(function (resp) {
|
|
|
$scope.orgs_child = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadOrgs();
|
|
|
|
|
|
|
|
|
/* $scope.onOrgsSelect = function (selectedItem) {
|
|
|
$scope.params.org_id = selectedItem.org_id;
|
|
|
$scope.params.org_name = selectedItem.label;
|
|
|
$scope.loadPartners();
|
|
|
};
|
|
|
*/
|
|
|
/* $scope.chooseOrg = function (org) {
|
|
|
if (org == 'all') {
|
|
|
delete $scope.params.org_id;
|
|
|
$scope.showOrg = 'All'
|
|
|
} else {
|
|
|
$scope.params.org_id = org.org_id;
|
|
|
$scope.showOrg = org.name;
|
|
|
}
|
|
|
$scope.loadPartners(1);
|
|
|
};*/
|
|
|
|
|
|
$scope.loadPartners(1);
|
|
|
|
|
|
|
|
|
$scope.openClientBoard = function (client) {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/analysis/templates/partner_card.html',
|
|
|
controller: 'partnerCardCtrl',
|
|
|
resolve: {
|
|
|
clientMoniker: function () {
|
|
|
return client.client_moniker
|
|
|
}
|
|
|
},
|
|
|
size: 'lg'
|
|
|
})
|
|
|
|
|
|
};
|
|
|
/*$scope.toogleMapSelect = function () {
|
|
|
$scope.mapFrame = 'all_locations.html';
|
|
|
$scope.loadLocations();
|
|
|
}
|
|
|
$scope.toogleMerchantSelect = function () {
|
|
|
$scope.mapFrame = null;
|
|
|
}
|
|
|
$scope.toogleMerchantSelect();*/
|
|
|
}]);
|
|
|
app.controller('compliancePartnerCtrl', ['$scope', '$sce', '$http', '$filter', '$uibModal', 'businessStructuresMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap',
|
|
|
function ($scope, $sce, $http, $filter, $uibModal, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) {
|
|
|
|
|
|
$scope.analysisClients = function () {
|
|
|
$http.get('/sys/partners/analysis').then(function (resp) {
|
|
|
$scope.analysis = resp.data;
|
|
|
})
|
|
|
};
|
|
|
if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) {
|
|
|
$scope.analysisClients();
|
|
|
}
|
|
|
$scope.pagination = {};
|
|
|
$scope.industries = industryMap.configs();
|
|
|
$scope.states = stateMap.configs();
|
|
|
$scope.countries = countryMap.configs();
|
|
|
$scope.sectors = sectorMap.configs();
|
|
|
$scope.business_structures = businessStructuresMap.configs();
|
|
|
$scope.clean_days = angular.copy(clean_days_map);
|
|
|
$scope.bd_citys = angular.copy(bd_city_map);
|
|
|
$scope.params = {textType: 'all', org_name: 'ALL'};
|
|
|
|
|
|
$scope.loadPartners = function (page) {
|
|
|
var params = angular.copy($scope.params);
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
$http.get('/sys/partners/compliance', {params: params}).then(function (resp) {
|
|
|
$scope.partners = resp.data.data;
|
|
|
$scope.pagination = resp.data.pagination;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
$scope.today = new Date();
|
|
|
|
|
|
$scope.listBDUsers = function () {
|
|
|
$http.get('/sys/manager_accounts/roles/bd_user').then(function (resp) {
|
|
|
$scope.bdUserSource = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.listBDUsers();
|
|
|
|
|
|
if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) {
|
|
|
$scope.showOrg = 'Organization';
|
|
|
$http.get('/sys/orgs/list_all_Org', {params: {}}).then(function (resp) {
|
|
|
$scope.orgs = resp.data;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$scope.loadOrgs = function () {
|
|
|
var params = angular.copy($scope.params);
|
|
|
$http.get('/sys/orgs/orgChild', {params: params}).then(function (resp) {
|
|
|
$scope.orgs_child = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadOrgs();
|
|
|
|
|
|
$scope.loadPartners(1);
|
|
|
|
|
|
|
|
|
$scope.openClientBoard = function (client) {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/analysis/templates/partner_card.html',
|
|
|
controller: 'partnerCardCtrl',
|
|
|
resolve: {
|
|
|
clientMoniker: function () {
|
|
|
return client.client_moniker
|
|
|
}
|
|
|
},
|
|
|
size: 'lg'
|
|
|
})
|
|
|
|
|
|
};
|
|
|
}]);
|
|
|
app.controller('addPartnerCtrl', ['$rootScope', '$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone','businessStructuresMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap', function ($rootScope, $scope, $http, $state, Upload, commonDialog, timezone, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) {
|
|
|
if ($scope.partner_application) {
|
|
|
$scope.partner = angular.copy($scope.partner_application);
|
|
|
delete $rootScope.partner_application;
|
|
|
} else {
|
|
|
$scope.partner = {timezone: 'Australia/Melbourne'};
|
|
|
}
|
|
|
$scope.partner.company_phone_c = 61;
|
|
|
$scope.partner.contact_phone_c = 61;
|
|
|
|
|
|
|
|
|
$scope.pagination = {};
|
|
|
$scope.industries = industryMap.configs();
|
|
|
$scope.states = stateMap.configs();
|
|
|
$scope.countries = countryMap.configs();
|
|
|
$scope.sectors = sectorMap.configs();
|
|
|
$scope.business_structures = businessStructuresMap.configs();
|
|
|
$scope.clean_days = angular.copy(clean_days_map);
|
|
|
$scope.bd_citys = angular.copy(bd_city_map);
|
|
|
$scope.params = {textType: 'all', org_name: 'ALL'};
|
|
|
|
|
|
function remove(arr, val) {
|
|
|
if (angular.isArray(arr)) {
|
|
|
for (var i = arr.length; i--;) {
|
|
|
if (arr[i].value == val) {
|
|
|
arr.splice(i, 1);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return arr;
|
|
|
}
|
|
|
|
|
|
var industries = angular.copy($scope.industries);
|
|
|
$scope.industries = remove(industries, 331);
|
|
|
|
|
|
$scope.listReferrers = function () {
|
|
|
$http.get('/sys/orgs/referrer').then(function (resp) {
|
|
|
$scope.referrers = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.listReferrers();
|
|
|
|
|
|
$scope.loadAlipayCategory = function () {
|
|
|
$http.get('/static/data/alipayMcc.json').then(function (resp) {
|
|
|
$scope.alipayMccCategory = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadAlipayCategory();
|
|
|
$scope.loadJDindustry = function () {
|
|
|
$http.get('/static/data/jdindustry.json').then(function (resp) {
|
|
|
$scope.jdindustry = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadJDindustry();
|
|
|
|
|
|
$scope.loadRoyalpayindustry = function () {
|
|
|
$http.get('/static/data/royalpayindustry.json').then(function (resp) {
|
|
|
$scope.royalpayindustry = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadRoyalpayindustry();
|
|
|
|
|
|
$scope.loadHfindustry = function () {
|
|
|
$http.get('/static/data/hfindustry.json').then(function (resp) {
|
|
|
$scope.hfindustry = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadHfindustry();
|
|
|
|
|
|
$scope.onAlipayMccSelect = function (selectedItem) {
|
|
|
$scope.partner.alipay_category = selectedItem.label;
|
|
|
$scope.partner.alipayindustry = selectedItem.mccCode;
|
|
|
};
|
|
|
|
|
|
$scope.onRoyalPayIndustrySelect = function (selectedItem) {
|
|
|
$scope.partner.royalpay_label = selectedItem.label;
|
|
|
$scope.partner.royalpayindustry = selectedItem.mccCode;
|
|
|
};
|
|
|
|
|
|
$scope.onHfIndustrySelect = function (selectedItem) {
|
|
|
$scope.partner.hf_label = selectedItem.label;
|
|
|
$scope.partner.hfindustry = selectedItem.mccCode;
|
|
|
};
|
|
|
|
|
|
// $scope.t2city_map = angular.copy(t2city_map);
|
|
|
|
|
|
$scope.timezones = timezone.configs();
|
|
|
$scope.save = function (form) {
|
|
|
if (form.$invalid) {
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
if (key.indexOf('$') < 0) {
|
|
|
item.$dirty = true;
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($scope.partner.company_name.indexOf("Migration") != -1) {
|
|
|
alert("Company Name包含敏感词汇,请检查后重新提交!");
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.company_phone_a && ('' + $scope.partner.company_phone_a != '')) {
|
|
|
if ($scope.partner.company_phone_a.indexOf('0') == 0) {
|
|
|
alert("Please remove the first character '0' of area code");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
if ($scope.partner.contact_phone && ('' + $scope.partner.contact_phone != '')) {
|
|
|
if ($scope.partner.contact_phone.indexOf('0') == 0) {
|
|
|
alert("Please remove the first character '0' of area code");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
$scope.partner.company_phone = '+' + $scope.partner.company_phone_c + ($scope.partner.company_phone_a || '') + $scope.partner.company_phone_p;
|
|
|
$scope.partner.contact_phone = '+' + $scope.partner.contact_phone_c + ($scope.partner.contact_phone_a || '') + $scope.partner.contact_phone_p;
|
|
|
|
|
|
if ($scope.partner.company_phone.indexOf(' ') != -1) {
|
|
|
alert('Company Phone can not contain space character');
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.contact_phone.indexOf(' ') != -1) {
|
|
|
alert('Contact Phone can not contain space character');
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.contact_email.indexOf(' ') != -1) {
|
|
|
alert('Contact email Phone can not contain space character');
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.suburb.indexOf(' ') != -1) {
|
|
|
alert('suburb can not contain two and more continuous space characters');
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.acn && $scope.partner.business_structure == 'Company') {
|
|
|
if ($scope.partner.acn.length != 9) {
|
|
|
alert('Acn is not valid');
|
|
|
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;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if ($scope.partner.referrer_id) {
|
|
|
$scope.referrers.forEach(function (e) {
|
|
|
if ($scope.partner.referrer_id == e.org_id) {
|
|
|
$scope.partner.referrer_name = e.name;
|
|
|
return;
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
// if(!window.frames['merchant_detail'].merchant_location){
|
|
|
// alert("Please Locate Merchant's Location");
|
|
|
// return;
|
|
|
// }
|
|
|
$http.post('/sys/partners', $scope.partner).then(function (resp) {
|
|
|
commonDialog.alert({title: 'Success', content: 'Register new partner successfully', type: 'success'});
|
|
|
$scope.updateMerchantLocation();
|
|
|
// $scope.loadPartners();
|
|
|
$state.go('partners.detail', {clientMoniker: resp.data.client_moniker})
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
});
|
|
|
};
|
|
|
$scope.uploadLogo = function (file) {
|
|
|
if (file != null) {
|
|
|
if (file.size > 1 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$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) {
|
|
|
if (file.size > 2 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$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) {
|
|
|
if (file.size > 2 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$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.updateMerchantLocation = function () {
|
|
|
var params = window.frames['merchant_detail'].merchant_location;
|
|
|
if (params) {
|
|
|
$http.put('/sys/partners/modify/' + $scope.partner.client_moniker + '/location', params).then(function () {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}]);
|
|
|
app.controller('partnerDetailCtrl', ['$scope', '$http', '$state', '$uibModal', '$rootScope', 'Upload', 'commonDialog', 'partner', '$sce', function ($scope, $http, $state, $uibModal, $rootScope, Upload, commonDialog, partner, $sce) {
|
|
|
$scope.init = {wechat_compliance: false, local_merchant: false};
|
|
|
$scope.partner = partner.data;
|
|
|
$scope.isComplianceOfCompanyName = false;
|
|
|
$scope.isComplianceOfShortName = false;
|
|
|
$scope.isComplianceOfBusinessStructure = false;
|
|
|
var website = partner.data.company_website;
|
|
|
if (website!=null){
|
|
|
if (website.indexOf('http')!=0){
|
|
|
$scope.partner.company_website= 'http://'+angular.copy(website);
|
|
|
}
|
|
|
}
|
|
|
$scope.decideCompliance = function (name) {
|
|
|
var keywords = ['education','financial' ,'train','immigrant','invest',
|
|
|
'律师咨询','会计事务所', '移民', '留学','娱乐','金融','地产','投资'];
|
|
|
for(var i = 0; i < keywords.length; i++){
|
|
|
if (name.indexOf(keywords[i]) != -1) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
};
|
|
|
if (partner.data.company_name != null) {
|
|
|
$scope.isComplianceOfCompanyName = $scope.decideCompliance(partner.data.company_name);
|
|
|
}
|
|
|
if (partner.data.short_name != null) {
|
|
|
$scope.isComplianceOfShortName = $scope.decideCompliance(partner.data.short_name);
|
|
|
}
|
|
|
if (partner.data.business_structure != null) {
|
|
|
$scope.isComplianceOfBusinessStructure = $scope.decideCompliance(partner.data.business_structure);
|
|
|
}
|
|
|
$scope.showDBUsers = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/bd_user').then(function (resp) {
|
|
|
$scope.partner.client_bds = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.showDBUsers();
|
|
|
$scope.showFile = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/file').then(function (resp) {
|
|
|
$scope.fileManager = resp.data;
|
|
|
});
|
|
|
};
|
|
|
$scope.showFile();
|
|
|
$scope.passClient = function () {
|
|
|
if(!$scope.partner.wechat_institution_merchant_id){
|
|
|
commonDialog.alert({title: 'info', content: 'HF Institution Merchant Id not Refresh', type: 'info'});
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.enable_hf) {
|
|
|
if($scope.partner.hfindustry == null){
|
|
|
alert("已开启HF支付通道,HF行业不可为空!");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
if (!$rootScope.complianceCheck) {
|
|
|
alert("please check first");
|
|
|
return;
|
|
|
}
|
|
|
if (!$rootScope.complianceCheck.authFile) {
|
|
|
alert("Compliance Files not checked");
|
|
|
return;
|
|
|
}
|
|
|
if (!$rootScope.complianceCheck.clientInfo) {
|
|
|
alert("Partner Detail not checked");
|
|
|
return;
|
|
|
}
|
|
|
if (!$rootScope.complianceCheck.bankAccount) {
|
|
|
alert("Bank Account not checked");
|
|
|
return;
|
|
|
}
|
|
|
var title = 'Audit Partner';
|
|
|
var content = 'Are you sure to mark partner ' + $scope.partner.company_name + ' audited?';
|
|
|
var choises = '';
|
|
|
var contentHtml = '';
|
|
|
if ($scope.isComplianceOfCompanyName || $scope.isComplianceOfShortName
|
|
|
|| $scope.isComplianceOfBusinessStructure) {
|
|
|
var info = [];
|
|
|
if ($scope.isComplianceOfCompanyName) {
|
|
|
info.push('Company Name');
|
|
|
}
|
|
|
if ($scope.isComplianceOfShortName) {
|
|
|
info.push('Short Name');
|
|
|
}
|
|
|
if ($scope.isComplianceOfBusinessStructure) {
|
|
|
info.push('Business Structure');
|
|
|
}
|
|
|
title = 'Warning';
|
|
|
contentHtml = $sce.trustAsHtml('本次提交的商户[' + $scope.partner.company_name + '],<span style="color: red">'+ info.toString() +'</span>存在微信渠道不合规信息');
|
|
|
choises = [{label: '取消', className: 'btn-danger', key: '2', dismiss: true},
|
|
|
{label: '确认提交', className: 'btn-success', key: '1'}];
|
|
|
content = '';
|
|
|
}
|
|
|
commonDialog.confirm({
|
|
|
title: title,
|
|
|
content: content,
|
|
|
choises: choises,
|
|
|
contentHtml: contentHtml
|
|
|
}).then(function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit', {pass: 1}).then(function () {
|
|
|
if ($scope.partner.approve_result == 2 && ($scope.partner.source == 1 || $scope.partner.source == 2)) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Comply Passed!',
|
|
|
type: 'success'
|
|
|
});
|
|
|
} else {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Comply Passed! Email will send to contact email address soon.',
|
|
|
type: 'success'
|
|
|
});
|
|
|
}
|
|
|
delete $rootScope.complianceCheck;
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
$scope.pass2GreenChannel = function () {
|
|
|
if(!$scope.partner.wechat_institution_merchant_id){
|
|
|
commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'});
|
|
|
return;
|
|
|
}
|
|
|
commonDialog.confirm({
|
|
|
title: 'Green Channel Audit Partner',
|
|
|
content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' green channel audited ?'
|
|
|
}).then(function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/aduit/green_channel').then(function () {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Comply Passed! Email will send to contact email address soon.',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.showBg = false;
|
|
|
$scope.exportPDF = function () {
|
|
|
$scope.showBg = true;
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/agreepdf').then(function () {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Agreement File Generate Succeed! Please notify BD!',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$scope.showBg = false;
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
$scope.showBg = false;
|
|
|
$state.reload();
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
});
|
|
|
|
|
|
};
|
|
|
$scope.exportAgreegatePDF = function () {
|
|
|
$scope.showBg = true;
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/aggregate/agreepdf').then(function () {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Agreement File Generate Succeed! Please notify BD!',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$scope.showBg = false;
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
$scope.showBg = false;
|
|
|
$state.reload();
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
});
|
|
|
|
|
|
};
|
|
|
$scope.Export = function () {
|
|
|
var url = '/dev/' + $scope.partner.client_moniker +'/export/aggregate/agreepdf' ;
|
|
|
return url;
|
|
|
}
|
|
|
$scope.uploadAgreeFile = function (file) {
|
|
|
if (file != null) {
|
|
|
if (file.size > 2 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
Upload.upload({
|
|
|
url: '/attachment/files',
|
|
|
data: {file: file}
|
|
|
}).then(function (resp) {
|
|
|
$scope.agree_file_import = resp.data.url;
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/import/agreepdf', {source_agree_file: $scope.agree_file_import}).then(function () {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Succeed Imported! Please notify BD',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
$scope.notifyBD = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/notify/completeAgree').then(function () {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Notify BD Successed!.',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'});
|
|
|
});
|
|
|
};
|
|
|
|
|
|
$scope.downTempPdf = function () {
|
|
|
var url = '/sys/partners/' + $scope.partner.client_moniker + '/temp/export/pdf';
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
$scope.refuse = function () {
|
|
|
commonDialog.inputText({title: 'refuse cause'}).then(function (text) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/refuse', {refuse_remark: text}).then(function () {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Audit application has been refused.',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.deleteClient = function () {
|
|
|
commonDialog.confirm({
|
|
|
title: 'Delete Partner',
|
|
|
content: 'Are you sure to delete ' + $scope.partner.company_name + '?'
|
|
|
}).then(function () {
|
|
|
$http.delete('/sys/partners/' + $scope.partner.client_moniker).then(function () {
|
|
|
$state.go('^');
|
|
|
commonDialog.alert({title: 'Delete', content: 'Partner Already Disabled', type: 'error'});
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.revertClient = function () {
|
|
|
commonDialog.confirm({
|
|
|
title: 'Revert Partner',
|
|
|
content: 'Are you sure to Revert ' + $scope.partner.company_name + '?'
|
|
|
}).then(function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/revert').then(function () {
|
|
|
$state.go('^');
|
|
|
commonDialog.alert({title: 'Revert', content: 'Partner Already Revert', type: 'success'});
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.commitToCompliance = function () {
|
|
|
commonDialog.confirm({
|
|
|
title: 'Commit to Compliance',
|
|
|
content: 'Are you sure to commit ' + $scope.partner.company_name + ' to compliance?',
|
|
|
choises: [
|
|
|
{label: 'Submit', className: 'btn-success', key: 1},
|
|
|
{label: 'Cancel', className: 'btn-warning', key: 0, dismiss: true}
|
|
|
]
|
|
|
}).then(function (choice) {
|
|
|
if (choice == 1) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/to_compliance', {}).then(function () {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Commit to Compliance successfully',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
};
|
|
|
$scope.apply2makeAgreeFile = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/make_agree_file').then(function () {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success!',
|
|
|
content: '已提交制作合同!',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
}
|
|
|
);
|
|
|
};
|
|
|
|
|
|
$scope.commit2GreenChannel = function () {
|
|
|
commonDialog.confirm({
|
|
|
title: 'Audit Partner',
|
|
|
content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' Green Channel?'
|
|
|
}).then(function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/compliance/green_channel').then(function () {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Commit to Green Channel successfully',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.markAuditEmail = function () {
|
|
|
commonDialog.confirm({
|
|
|
title: 'Warning',
|
|
|
content: 'Make sure you have send the email to client.'
|
|
|
}).then(function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/email_sending_status').then(function () {
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.resendApproveEmail = function () {
|
|
|
commonDialog.confirm({
|
|
|
title: 'Warning',
|
|
|
content: 'This operation will reset the password of admin user. Are you sure this email is correct ? Or you may update this information first.'
|
|
|
}).then(function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/send_email').then(function () {
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.editBDUser = function () {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/bd_user_choose_dialog.html',
|
|
|
controller: 'partnerChooseBDUserDialogCtrl',
|
|
|
resolve: {
|
|
|
bdUsers: ['$http', function ($http) {
|
|
|
return $http.get('/sys/manager_accounts/roles/bd_user');
|
|
|
}],
|
|
|
partner: function () {
|
|
|
return $scope.partner;
|
|
|
},
|
|
|
type: function () {
|
|
|
return 'edit';
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$state.reload();
|
|
|
})
|
|
|
};
|
|
|
$scope.bindBDUser = function () {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/bd_user_choose_dialog.html',
|
|
|
controller: 'partnerChooseBDUserDialogCtrl',
|
|
|
resolve: {
|
|
|
bdUsers: ['$http', function ($http) {
|
|
|
return $http.get('/sys/manager_accounts/roles/bd_user');
|
|
|
}],
|
|
|
partner: function () {
|
|
|
return $scope.partner;
|
|
|
},
|
|
|
type: function () {
|
|
|
return 'add';
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$state.reload();
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.configMasterMerchant = function () {
|
|
|
commonDialog.inputText({title: 'Input Master Merchant Code'}).then(function (text) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/master_configuration', {master_merchant: text}).then(function () {
|
|
|
commonDialog.alert({title: 'Success', content: "Master Merchant Code:" + text, type: 'success'});
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Config Master Merchant Failed',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
});
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.getMerchantLocation = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/location').then(function (resp) {
|
|
|
$scope.merchant_location = resp.data;
|
|
|
});
|
|
|
};
|
|
|
$scope.getMerchantLocation();
|
|
|
|
|
|
|
|
|
$scope.complianceCheck = function () {
|
|
|
if (!$rootScope.complianceCheck) {
|
|
|
$rootScope.complianceCheck = {};
|
|
|
}
|
|
|
$rootScope.complianceCheck.client_id = $scope.partner.client_id;
|
|
|
$rootScope.complianceCheck.clientInfo = true;
|
|
|
};
|
|
|
$scope.complianceChangeCheck = function () {
|
|
|
if ($rootScope.complianceCheck) {
|
|
|
if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) {
|
|
|
delete $rootScope.complianceCheck;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
$scope.complianceChangeCheck();
|
|
|
|
|
|
$scope.changeWechatCompliance = function () {
|
|
|
if (!$scope.partner) {
|
|
|
return;
|
|
|
}
|
|
|
if(!$state.is('partners.detail')){
|
|
|
$scope.init.wechat_compliance = false;
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.wechat_compliance) {
|
|
|
$scope.init.wechat_compliance = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_compliance_permission', {allow: $scope.partner.wechat_compliance}).then(function () {
|
|
|
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'failed to change wechat_compliance permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.changeLocalMerchant = function () {
|
|
|
if (!$scope.partner) {
|
|
|
return;
|
|
|
}
|
|
|
if(!$state.is('partners.detail')){
|
|
|
$scope.init.local_merchant = false;
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.local_merchant) {
|
|
|
$scope.init.local_merchant = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/local_merchant_permission', {allow: $scope.partner.local_merchant}).then(function () {
|
|
|
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'failed to change local_merchant permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.removeSub = function () {
|
|
|
$http.delete('/sys/partners/unsub/' + $scope.partner.client_moniker).then(function (resp) {
|
|
|
$state.reload();
|
|
|
});
|
|
|
};
|
|
|
$scope.addSub = function () {
|
|
|
$http.put('/sys/partners/unsub/' + $scope.partner.client_moniker).then(function (resp) {
|
|
|
$state.reload();
|
|
|
});
|
|
|
};
|
|
|
}]);
|
|
|
app.controller('partnerEditCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'partner',
|
|
|
function ($scope, $http, $state, Upload, commonDialog, timezone, partner) {
|
|
|
$scope.timezones = timezone.configs();
|
|
|
$scope.partner = partner.data;
|
|
|
var origin_referrer_id = angular.copy($scope.partner.referrer_id);
|
|
|
$scope.partner.partner_type = $scope.partner.website ? 'website' : 'photo';
|
|
|
|
|
|
$scope.listReferrers = function () {
|
|
|
$http.get('/sys/orgs/referrer').then(function (resp) {
|
|
|
$scope.referrers = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.listReferrers();
|
|
|
|
|
|
$scope.loadAlipayCategory = function () {
|
|
|
$http.get('/static/data/alipayMcc.json').then(function (resp) {
|
|
|
$scope.alipayMccCategory = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadAlipayCategory();
|
|
|
$scope.loadJDindustry = function () {
|
|
|
$http.get('/static/data/jdindustry.json').then(function (resp) {
|
|
|
$scope.jdindustry = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadJDindustry();
|
|
|
|
|
|
$scope.loadRoyalpayindustry = function () {
|
|
|
$http.get('/static/data/royalpayindustry.json').then(function (resp) {
|
|
|
$scope.royalpayindustry = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadRoyalpayindustry();
|
|
|
|
|
|
$scope.loadHfindustry = function () {
|
|
|
$http.get('/static/data/hfindustry.json').then(function (resp) {
|
|
|
$scope.hfindustry = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadHfindustry();
|
|
|
|
|
|
$scope.onAlipayMccSelect = function (selectedItem) {
|
|
|
$scope.partner.alipay_category = selectedItem.label;
|
|
|
$scope.partner.alipayindustry = selectedItem.mccCode;
|
|
|
};
|
|
|
$scope.onRoyalPayIndustrySelect = function (selectedItem) {
|
|
|
$scope.partner.royalpay_label = selectedItem.label;
|
|
|
$scope.partner.royalpayindustry = selectedItem.mccCode;
|
|
|
};
|
|
|
$scope.onHfIndustrySelect = function (selectedItem) {
|
|
|
$scope.partner.hf_label = selectedItem.label;
|
|
|
$scope.partner.hfindustry = selectedItem.mccCode;
|
|
|
};
|
|
|
|
|
|
|
|
|
$scope.updatePartner = function (form) {
|
|
|
if (form.$invalid) {
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
if (key.indexOf('$') < 0) {
|
|
|
item.$dirty = true;
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($scope.partner.company_name.indexOf("Migration") != -1) {
|
|
|
alert("Company Name包含敏感词汇,请检查后重新提交!");
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.company_phone.indexOf(' ') != -1) {
|
|
|
alert('Company Phone can not contain space character');
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.contact_email.indexOf(' ') != -1) {
|
|
|
alert('Contact email Phone can not contain space character');
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.suburb.indexOf(' ') != -1) {
|
|
|
alert('suburb can not contain two and more continuous space characters');
|
|
|
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;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if ($scope.partner.acn && $scope.partner.business_structure == 'Company') {
|
|
|
if ($scope.partner.acn.length != 9) {
|
|
|
alert('Acn is not valid');
|
|
|
}
|
|
|
}
|
|
|
if ($scope.partner.referrer_id) {
|
|
|
$scope.referrers.forEach(function (e) {
|
|
|
if ($scope.partner.referrer_id == e.org_id) {
|
|
|
$scope.partner.referrer_name = e.name;
|
|
|
return;
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
var content = '';
|
|
|
if (!origin_referrer_id && $scope.partner.referrer_id) {
|
|
|
content = 'Update partner info successfully,But You Had add new Referrer,Please Change the BD Commission Proportion!';
|
|
|
}
|
|
|
// if(!window.frames['merchant_detail'].merchant_location){
|
|
|
// alert("Please Locate Merchant Location!");
|
|
|
// return;
|
|
|
// }
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker, $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'
|
|
|
});
|
|
|
}
|
|
|
$scope.updateMerchantLocation();
|
|
|
$scope.loadPartners();
|
|
|
$state.go('^.detail', {clientMoniker: $scope.partner.client_moniker}, {reload: true});
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
};
|
|
|
$scope.uploadLogo = function (file) {
|
|
|
if (file != null) {
|
|
|
if (file.size > 1 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$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) {
|
|
|
if (file.size > 2 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$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) {
|
|
|
if (file.size > 2 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$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.getMerchantLocation = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/location').then(function (resp) {
|
|
|
$scope.merchant_location = resp.data;
|
|
|
});
|
|
|
};
|
|
|
$scope.getMerchantLocation();
|
|
|
|
|
|
$scope.updateMerchantLocation = function () {
|
|
|
var params = window.frames['merchant_detail'].merchant_location;
|
|
|
if (params) {
|
|
|
$http.put('/sys/partners/modify/' + $scope.partner.client_moniker + '/location', params).then(function () {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}]);
|
|
|
app.controller('partnerPaymentInfoCtrl', ['$scope', '$http', '$state', 'commonDialog','$uibModal', '$sce', function ($scope, $http, $state, commonDialog,$uibModal, $sce) {
|
|
|
$scope.copyHfLink = function() {
|
|
|
var e=document.getElementById("cpbt");
|
|
|
e.select();
|
|
|
var successful = document.execCommand("Copy");
|
|
|
if (successful) {
|
|
|
commonDialog.alert({title: 'Success', content: '已复制到剪切板!', type: 'success'});
|
|
|
}else {
|
|
|
commonDialog.alert({title: 'Error', content: '您的浏览器不支持!', type: 'error'});
|
|
|
}
|
|
|
};
|
|
|
$scope.copyYeepayLink = function() {
|
|
|
var e=document.getElementById("cpyeepay");
|
|
|
e.select();
|
|
|
var successful = document.execCommand("Copy");
|
|
|
if (successful) {
|
|
|
commonDialog.alert({title: 'Success', content: '已复制到剪切板!', type: 'success'});
|
|
|
}else {
|
|
|
commonDialog.alert({title: 'Error', content: '您的浏览器不支持!', type: 'error'});
|
|
|
}
|
|
|
};
|
|
|
$scope.copyCBBankPayLink = function() {
|
|
|
var e=document.getElementById("cpcbbankpay");
|
|
|
e.select();
|
|
|
var successful = document.execCommand("Copy");
|
|
|
if (successful) {
|
|
|
commonDialog.alert({title: 'Success', content: '已复制到剪切板!', type: 'success'});
|
|
|
}else {
|
|
|
commonDialog.alert({title: 'Error', content: '您的浏览器不支持!', type: 'error'});
|
|
|
}
|
|
|
};
|
|
|
$scope.loadPartnerPaymentInfo = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) {
|
|
|
$scope.paymentInfo = resp.data;
|
|
|
$scope.ctrl.editSubMerchant = false;
|
|
|
$scope.ctrl.editAliSubMerchant = false;
|
|
|
$scope.ctrl.editMaxOrderAmount = false;
|
|
|
$scope.ctrl.editOrderExpiryConfig = false;
|
|
|
})
|
|
|
};
|
|
|
$scope.qrConfig = {currency: 'AUD'};
|
|
|
$scope.reloadQRCode = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/qrcode', {params: $scope.qrConfig}).then(function (resp) {
|
|
|
$scope.qrcode = resp.data;
|
|
|
console.log($scope.qrcode.url)
|
|
|
});
|
|
|
};
|
|
|
$scope.reloadQRCode();
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
|
|
|
$scope.showSubMerchantLogs = function () {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/client_sub_merchant_id_log.html',
|
|
|
controller: 'clientSubMerchantIdLogCtrl',
|
|
|
size: 'lg',
|
|
|
resolve: {
|
|
|
logs: ['$http', function ($http) {
|
|
|
return $http.get('/sys/partners/'+$scope.partner.client_moniker+'/get_sub_merchant_id_logs');
|
|
|
}]
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$scope.loadSubClients();
|
|
|
});
|
|
|
};
|
|
|
|
|
|
$scope.saveMaxOrderAmount = function (limit) {
|
|
|
if (limit != null && isNaN(limit)) {
|
|
|
commonDialog.alert({title: 'Error', content: 'Your input is not a number!', type: 'error'});
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/max_order_amount', {limit: limit}).then(function (resp) {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.saveCustomerSurchargeRate = function (cofig) {
|
|
|
if (cofig != null && isNaN(cofig)) {
|
|
|
commonDialog.alert({title: 'Error', content: 'Your input is not a number!', type: 'error'});
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.paymentInfo.rate_value) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Error',
|
|
|
content: 'The merchant has not pass approval process',
|
|
|
type: 'error'
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
if (cofig > 2.5 || cofig < parseFloat(Decimal.add($scope.paymentInfo.rate_value, 0.1).toFixed(2))) {
|
|
|
commonDialog.alert({title: 'Error', content: 'Not in the valid range', type: 'error'});
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/customer_surcharge_rate', {customer_surcharge_rate: cofig}).then(function (resp) {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
$scope.ctrl.editCustomerSurchargeRate = false;
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.saveOrderExpiryConfig = function (config) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/order_expiry_config', {order_expiry_config: config}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
};
|
|
|
|
|
|
|
|
|
$scope.updateClientQRCodePaySurCharge = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.qrcode_surcharge) {
|
|
|
$scope.init.qrcode_surcharge = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/qrcode_surcharge', {qrcode_surcharge: $scope.paymentInfo.qrcode_surcharge}).then(function (resp) {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function () {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
};
|
|
|
$scope.updateClientApiSurCharge = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.api_surcharge) {
|
|
|
$scope.init.api_surcharge = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/api_surcharge', {api_surcharge: $scope.paymentInfo.api_surcharge}).then(function (resp) {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function () {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
};
|
|
|
$scope.updateClientRetailPaySurCharge = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.retail_surcharge) {
|
|
|
$scope.init.retail_surcharge = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/retail_surcharge', {retail_surcharge: $scope.paymentInfo.retail_surcharge}).then(function (resp) {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function () {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
};
|
|
|
$scope.ctrl = {};
|
|
|
$scope.saveSubMerchantId = function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: $scope.paymentInfo.sub_merchant_id}).then(function (resp) {
|
|
|
$scope.refreshInstitutionAfterSaveMerchantId();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
};
|
|
|
|
|
|
$scope.refreshInstitutionAfterSaveMerchantId = function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', {wechat_institution_merchant_id: $scope.paymentInfo.wechat_institution_merchant_id}).then(function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Modify Wechat Sub Merchant ID And Refresh Wechat Institution Merchant Id successfully',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
};
|
|
|
|
|
|
$scope.refreshWechatInstitutionMerchantId = function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', {wechat_institution_merchant_id: $scope.paymentInfo.wechat_institution_merchant_id}).then(function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Refresh Wechat Institution Merchant Id successfully',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
};
|
|
|
$scope.saveAliSubMerchantId = function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/ali_sub_merchant_id', {ali_sub_merchant_id: $scope.paymentInfo.ali_sub_merchant_id}).then(function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Modify Ali Sub Merchant ID successfully',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
};
|
|
|
$scope.submitAlipaySubId = function () {
|
|
|
commonDialog.confirm({
|
|
|
title: 'Warning',
|
|
|
content: '是否使用该商户的现有信息进件?'
|
|
|
}).then(function () {
|
|
|
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms').then(function () {
|
|
|
commonDialog.alert({title: 'Success', content: 'Alipay进件成功', type: 'success'});
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.refreshCredential = function () {
|
|
|
commonDialog.confirm({
|
|
|
title: 'Warning',
|
|
|
content: 'Refresh Credential will expire the current one, which will cause the current payment service disabled. Are you sure going on?'
|
|
|
}).then(function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/credential_code').then(function () {
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.init = {jsapi: false, gateway: false, offline: false, refund: false,common_sub_merchant_id:false, channel: {},gateway_alipay_online:false,hf_Link:false,enable_hf_email_notice:false,enable_yeepay_link:false,enable_yeepay_email_notice:false};
|
|
|
$scope.switchCommonSubMerchantId = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.common_sub_merchant_id) {
|
|
|
$scope.init.common_sub_merchant_id = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/common_sub_merchant_id', {allow: $scope.paymentInfo.common_sub_merchant_id}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Failed to change common_sub_merchant_id permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
var info = [];
|
|
|
$scope.decideCompliance = function (name) {
|
|
|
var keywords = ['education','financial' ,'train','immigrant','invest',
|
|
|
'律师咨询','会计事务所', '移民', '留学','娱乐','金融','地产','投资'];
|
|
|
for(var i = 0; i < keywords.length; i++){
|
|
|
if (name.indexOf(keywords[i]) != -1) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
};
|
|
|
$scope.getComplianceInfo = function () {
|
|
|
if ($scope.paymentInfo.company_name != null) {
|
|
|
if($scope.decideCompliance($scope.paymentInfo.company_name)) {
|
|
|
info.push('Company Name');
|
|
|
}
|
|
|
}
|
|
|
if ($scope.paymentInfo.short_name != null) {
|
|
|
if($scope.decideCompliance($scope.paymentInfo.short_name)) {
|
|
|
info.push('Short Name');
|
|
|
}
|
|
|
}
|
|
|
if ($scope.paymentInfo.business_structure != null) {
|
|
|
if($scope.decideCompliance($scope.paymentInfo.business_structure)) {
|
|
|
info.push('Business Structure');
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
$scope.toggleChannel = function (channel) {
|
|
|
if (!channel) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.channel[channel]) {
|
|
|
$scope.init.channel[channel] = true;
|
|
|
return;
|
|
|
}
|
|
|
$scope.getComplianceInfo();
|
|
|
if ($scope.paymentInfo['enable_wechat'] && channel == 'wechat'
|
|
|
&& $scope.paymentInfo.open_status == 5 && info.length > 0) {
|
|
|
commonDialog.confirm({
|
|
|
title: "Warning",
|
|
|
contentHtml: $sce.trustAsHtml('本次提交的商户[' + $scope.partner.company_name + '],<span style="color: red">'+ info.toString() +'</span>存在微信渠道不合规信息')
|
|
|
}).then(function () {
|
|
|
$scope.saveChannel(channel);
|
|
|
})
|
|
|
} else {
|
|
|
$scope.saveChannel(channel);
|
|
|
}
|
|
|
info = [];
|
|
|
};
|
|
|
$scope.saveChannel = function (channel) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/channels/' + channel + '/permission', {allow: $scope.paymentInfo['enable_' + channel]}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Failed to change ' + channel + ' channel permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
$scope.toggleHfLink = function (channel) {
|
|
|
if (!channel) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.hf_Link) {
|
|
|
$scope.init.hf_Link = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/hf', {allow: $scope.paymentInfo.enable_link}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Failed to change enable_link permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
});
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.toggleGatewayLink = function (channel) {
|
|
|
if (!channel) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
var channelLink = 'enable_'+channel+'_link';
|
|
|
if (!$scope.init[channelLink]) {
|
|
|
$scope.init[channelLink] = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/'+channel, {allow: $scope.paymentInfo[channelLink]}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Failed to change '+channelLink+' permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
});
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.toggleCBBankPayLink = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/cb_bankpay', {allow: $scope.paymentInfo.enable_cb_bankpay_link}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Failed to change cb_bankpay permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
});
|
|
|
})
|
|
|
};
|
|
|
$scope.cb_bankpay = [];
|
|
|
$scope.cbChannelConfig = function () {
|
|
|
$http.get('/sysconfig/payment/config').then(function (resp) {
|
|
|
resp.data.forEach(function (channel) {
|
|
|
if (channel.type === 1) {
|
|
|
$scope.cb_bankpay.push(channel);
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.cbChannelConfig();
|
|
|
$scope.updateCBBankPayConfig = function (key, channel) {
|
|
|
var content = "";
|
|
|
if (channel == null) {
|
|
|
content = "你确定要将支付通道跟随系统"
|
|
|
} else {
|
|
|
content = '你确定要将支付通道更改为:' + channel
|
|
|
}
|
|
|
commonDialog.confirm({
|
|
|
title: 'Confirm',
|
|
|
content: content
|
|
|
}).then(function () {
|
|
|
$http.put('/sys/partners/'+ $scope.partner.client_moniker + '/cb_bankpay/'+ key +'/channel_id', {channel_id: channel}).then(function (resp) {
|
|
|
commonDialog.alert({type: 'success', title: 'Success', content: '修改成功'});
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message});
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
});
|
|
|
})
|
|
|
};
|
|
|
$scope.toggleGatewayEmailNotice = function (channel) {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
var channelNotice = 'enable_'+channel+'_email_notice';
|
|
|
if (!$scope.init[channelNotice]) {
|
|
|
$scope.init[channelNotice] = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/'+channel+'/email_notice', {allow: $scope.paymentInfo[channelNotice]}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Failed to change '+channelNotice+' permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
});
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.toggleHfEmailNotice = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.enable_hf_email_notice) {
|
|
|
$scope.init.enable_hf_email_notice = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/hf/email_notice', {allow: $scope.paymentInfo.enable_hf_email_notice}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Failed to change enable_hf_email_notice permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
});
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.toggleJsApi = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.jsapi) {
|
|
|
$scope.init.jsapi = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/jsapi_permission', {allow: $scope.paymentInfo.enable_jsapi}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Failed to change JSApi permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.toggleGateway = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.gateway) {
|
|
|
$scope.init.gateway = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/gateway_permission', {allow: $scope.paymentInfo.enable_gateway}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'failed to change Gateway permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.toggleGatewayUpgrade = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.gateway_upgrade) {
|
|
|
$scope.init.gateway_upgrade = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/gateway_upgrade', {gateway_upgrade: $scope.paymentInfo.gateway_upgrade}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'failed to change Gateway Upgrade status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.toggleGatewayAlipayOnline = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.gateway_alipay_online) {
|
|
|
$scope.init.gateway_alipay_online = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/gateway_alipay_online', {gateway_alipay_online: $scope.paymentInfo.gateway_alipay_online}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'failed to change Gateway Alipay Online status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.toggleRefund = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.enable_refund) {
|
|
|
$scope.init.enable_refund = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/refund_permission', {allow: $scope.paymentInfo.enable_refund}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'failed to change Refund permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.togglePreRefund = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.enable_pre_refund) {
|
|
|
$scope.init.enable_pre_refund = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/pre_refund_permission', {allow: $scope.paymentInfo.enable_pre_refund}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'failed to change Refund permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.toggleOffline = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.offline) {
|
|
|
$scope.init.offline = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/offline_permission', {allow: $scope.paymentInfo.enable_retail}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'failed to change Offline permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.changePaymentPage = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_page_version', {paypad_version: $scope.paymentInfo.paypad_version}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'failed to change Payment Page Version',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
|
|
|
// 更改支付成功页
|
|
|
$scope.changePaySuccessPage = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/paysuccess_version', {paysuccess_version: $scope.paymentInfo.paysuccess_version}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'failed to change Payment Success Page Version',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.toggleRequireCustInfo = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.require_custinfo) {
|
|
|
$scope.init.require_custinfo = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/requireCustinfo', {allow: $scope.paymentInfo.require_custinfo}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'failed to change require customer Info permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.toggleRequireRemark = function () {
|
|
|
if (!$scope.paymentInfo) {
|
|
|
return;
|
|
|
}
|
|
|
if (!$scope.init.require_remark) {
|
|
|
$scope.init.require_remark = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/requireRemark', {allow: $scope.paymentInfo.require_remark}).then(function () {
|
|
|
$scope.loadPartnerPaymentInfo();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'failed to change require remark permission status',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
|
|
|
}]);
|
|
|
app.controller('clientSubMerchantIdLogCtrl', ['$scope', '$http', 'logs', function ($scope, $http, logs) {
|
|
|
$scope.logs = logs.data;
|
|
|
}]);
|
|
|
app.controller('partnerSubCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) {
|
|
|
$scope.newSubClient = function () {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/add_sub_partner_dialog.html',
|
|
|
controller: 'partnerNewSubPartnerDialogCtrl',
|
|
|
size: 'lg',
|
|
|
resolve: {
|
|
|
clientMoniker: function () {
|
|
|
return $scope.partner.client_moniker;
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$scope.loadSubClients();
|
|
|
});
|
|
|
};
|
|
|
|
|
|
$scope.loadSubClients = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients').then(function (resp) {
|
|
|
$scope.subPartners = resp.data;
|
|
|
});
|
|
|
};
|
|
|
$scope.loadSubClients();
|
|
|
|
|
|
}]);
|
|
|
app.controller('partnerRatesCtrl', ['$scope', '$rootScope', '$http', '$uibModal', 'commonDialog','$sce', function ($scope, $rootScope, $http, $uibModal, commonDialog,$sce) {
|
|
|
$scope.bankCtrl = {edit: true, rate_name: 'Wechat'};
|
|
|
$scope.init = {skip_clearing:false,tax_in_surcharge:false,customer_tax_free:false};
|
|
|
$scope.getBankAccount = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/bank_account').then(function (resp) {
|
|
|
$scope.bankaccount = resp.data;
|
|
|
$scope.bankCtrl.edit = false;
|
|
|
});
|
|
|
};
|
|
|
$scope.getBankAccount();
|
|
|
$scope.getRates = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/rates').then(function (resp) {
|
|
|
$scope.rates = resp.data;
|
|
|
angular.forEach($scope.rates, function (rate) {
|
|
|
rate.active_time = new Date(rate.active_time.substr(0, 10).replace(/-/g, '/'));
|
|
|
rate.expiry_time = new Date(rate.expiry_time.substr(0, 10).replace(/-/g, '/'));
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
|
|
|
$scope.skipClearing = function (skipClearing) {
|
|
|
if (!$scope.init.skip_clearing) {
|
|
|
$scope.init.skip_clearing = true;
|
|
|
return;
|
|
|
}
|
|
|
if (!skipClearing) {
|
|
|
commonDialog.confirm({
|
|
|
title: 'Warning',
|
|
|
content: 'This operation will switch skip clearing status. Are you sure?'
|
|
|
}).then(function () {
|
|
|
commonDialog.inputText({title: '请输入关闭跳过清算的原因'}).then(function (text) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/skip_clearing', {
|
|
|
skip_clearing: skipClearing,
|
|
|
remark: text
|
|
|
}).then(function (resp) {
|
|
|
$scope.getBankAccount();
|
|
|
});
|
|
|
});
|
|
|
})
|
|
|
}else{
|
|
|
commonDialog.confirm({
|
|
|
title: 'Warning',
|
|
|
content: 'This operation will switch skip clearing status. Are you sure?',
|
|
|
// contentHtml: $sce.trustAsHtml('This operation will switch skip clearing status. Are you sure?<input ng-model="remark"></input>')
|
|
|
}).then(function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/skip_clearing', {skip_clearing: skipClearing}).then(function (resp) {
|
|
|
$scope.getBankAccount();
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
};
|
|
|
$scope.taxInSurcharge = function (taxInSurcharge) {
|
|
|
if (!$scope.init.tax_in_surcharge) {
|
|
|
$scope.init.tax_in_surcharge = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/tax_in_surcharge', {tax_in_surcharge: taxInSurcharge}).then(function (resp) {
|
|
|
$scope.getBankAccount();
|
|
|
})
|
|
|
};
|
|
|
$scope.customerTaxFree = function (customerTaxFree) {
|
|
|
if (!$scope.init.customer_tax_free) {
|
|
|
$scope.init.customer_tax_free = true;
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/customer_tax_free', {customer_tax_free: customerTaxFree}).then(function (resp) {
|
|
|
$scope.getBankAccount();
|
|
|
})
|
|
|
};
|
|
|
$scope.settleHours = [{value: undefined, label: 'Default(24:00, GMT+10)'}];
|
|
|
for (var h = 24; h > 0; h--) {
|
|
|
$scope.settleHours.push({value: h, label: ('00' + h).substr(-2) + ':00, ' + $scope.partner.timezone});
|
|
|
}
|
|
|
$scope.settleHourConfig = function () {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/settle_hour', {hour: $scope.partner.settle_hour || null}).then(function () {
|
|
|
commonDialog.alert({type: 'success', title: 'OK', content: 'Settle Hour configured'})
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message})
|
|
|
});
|
|
|
};
|
|
|
$scope.getBankInfo = function (bsb_no) {
|
|
|
if (bsb_no != null && bsb_no != "") {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/bank_account/bank_info/' + bsb_no).then(function (resp) {
|
|
|
$scope.bankInfo = resp.data;
|
|
|
$scope.bankaccount.bank = $scope.bankInfo.bank;
|
|
|
$scope.bankaccount.city = $scope.bankInfo.city;
|
|
|
$scope.bankaccount.address = $scope.bankInfo.address;
|
|
|
$scope.bankaccount.system = $scope.bankInfo.system;
|
|
|
$scope.bankaccount.postcode = $scope.bankInfo.postcode;
|
|
|
$scope.bankaccount.state = $scope.bankInfo.state;
|
|
|
$scope.bankaccount.branch = $scope.bankInfo.branch;
|
|
|
|
|
|
});
|
|
|
} else {
|
|
|
commonDialog.alert({title: 'Error', content: "请先填写BSB No", type: 'error'})
|
|
|
}
|
|
|
|
|
|
};
|
|
|
$scope.getRates();
|
|
|
$scope.saveBankAccount = function () {
|
|
|
if(isNaN($scope.bankaccount.account_no)){
|
|
|
alert("Account No应输入数字!");
|
|
|
return;
|
|
|
};
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/bank_account', $scope.bankaccount).then(function () {
|
|
|
$scope.getBankAccount();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
})
|
|
|
};
|
|
|
$scope.newRate = function () {
|
|
|
var name = $scope.bankCtrl.rate_name;
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/partner_new_rate.html',
|
|
|
controller: 'newRateDialogCtrl',
|
|
|
resolve: {
|
|
|
rate: function () {
|
|
|
return {rate_name: name, clean_days: 3};
|
|
|
},
|
|
|
sys_common_rate: function () {
|
|
|
return $http.get('/sys/partners/sys_rates');
|
|
|
},
|
|
|
clientMoniker: function () {
|
|
|
return $scope.partner.client_moniker;
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$scope.getRates();
|
|
|
});
|
|
|
};
|
|
|
$scope.editRate = function (rate) {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/rate_config_dialog.html',
|
|
|
controller: 'rateConfigDialogCtrl',
|
|
|
resolve: {
|
|
|
rate: function () {
|
|
|
return rate
|
|
|
},
|
|
|
clientMoniker: function () {
|
|
|
return $scope.partner.client_moniker;
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$scope.getRates();
|
|
|
});
|
|
|
};
|
|
|
$scope.complianceCheck = function () {
|
|
|
if (!$rootScope.complianceCheck) {
|
|
|
$rootScope.complianceCheck = {};
|
|
|
}
|
|
|
$rootScope.complianceCheck.client_id = $scope.partner.client_id;
|
|
|
$rootScope.complianceCheck.bankAccount = true;
|
|
|
|
|
|
};
|
|
|
$scope.complianceChangeCheck = function () {
|
|
|
if ($rootScope.complianceCheck) {
|
|
|
if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) {
|
|
|
delete $rootScope.complianceCheck;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
$scope.complianceChangeCheck();
|
|
|
}]);
|
|
|
app.controller('newRateDialogCtrl', ['$scope', '$http', 'rate', 'sys_common_rate', 'clientMoniker', function ($scope, $http, rate, sys_common_rate, clientMoniker) {
|
|
|
$scope.rate = angular.copy(rate);
|
|
|
$scope.sysRateConfig = angular.copy(sys_common_rate.data);
|
|
|
$scope.ctrl = {sending: false};
|
|
|
$scope.saveRate = function (form) {
|
|
|
if (form.$invalid) {
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
if (key.indexOf('$') < 0) {
|
|
|
item.$dirty = true;
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
$scope.errmsg = null;
|
|
|
$scope.ctrl.sending = true;
|
|
|
$http.post('/sys/partners/' + clientMoniker + '/rates', $scope.rate).then(function () {
|
|
|
$scope.ctrl.sending = false;
|
|
|
$scope.$close();
|
|
|
}, function (resp) {
|
|
|
$scope.ctrl.sending = false;
|
|
|
$scope.errmsg = resp.data.message;
|
|
|
})
|
|
|
}
|
|
|
$scope.changeDays = function () {
|
|
|
if ($scope.rate.clean_days) {
|
|
|
switch ($scope.rate.clean_days) {
|
|
|
case '1': {
|
|
|
$scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t1.Wechat);
|
|
|
$scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t1.Alipay);
|
|
|
$scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t1.AlipayOnline);
|
|
|
$scope.rate.bestpay_rate_value = parseFloat($scope.sysRateConfig.t1.Bestpay);
|
|
|
$scope.rate.jd_rate_value = parseFloat($scope.sysRateConfig.t1.JDpay);
|
|
|
$scope.rate.hf_rate_value = parseFloat($scope.sysRateConfig.t1.HFpay);
|
|
|
$scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t1.Rpay);
|
|
|
$scope.rate.yeepay_rate_value = parseFloat($scope.sysRateConfig.t1.Yeepay);
|
|
|
$scope.rate.cb_bankpay_rate_value = parseFloat($scope.sysRateConfig.t1.CB_Bankpay);
|
|
|
$scope.rate.transaction_fee = 0;
|
|
|
break;
|
|
|
}
|
|
|
case '2': {
|
|
|
$scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t2.Wechat);
|
|
|
$scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t2.Alipay);
|
|
|
$scope.rate.bestpay_rate_value = parseFloat($scope.sysRateConfig.t2.Bestpay);
|
|
|
$scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t2.AlipayOnline);
|
|
|
$scope.rate.jd_rate_value = parseFloat($scope.sysRateConfig.t2.JDpay);
|
|
|
$scope.rate.hf_rate_value = parseFloat($scope.sysRateConfig.t2.HFpay);
|
|
|
$scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t2.Rpay);
|
|
|
$scope.rate.yeepay_rate_value = parseFloat($scope.sysRateConfig.t2.Yeepay);
|
|
|
$scope.rate.cb_bankpay_rate_value = parseFloat($scope.sysRateConfig.t2.CB_Bankpay);
|
|
|
$scope.rate.transaction_fee = 0;
|
|
|
break;
|
|
|
}
|
|
|
case '3': {
|
|
|
$scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t3.Wechat);
|
|
|
$scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t3.Alipay);
|
|
|
$scope.rate.bestpay_rate_value = parseFloat($scope.sysRateConfig.t3.Bestpay);
|
|
|
$scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t3.AlipayOnline);
|
|
|
$scope.rate.jd_rate_value = parseFloat($scope.sysRateConfig.t3.JDpay);
|
|
|
$scope.rate.hf_rate_value = parseFloat($scope.sysRateConfig.t3.HFpay);
|
|
|
$scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t3.Rpay);
|
|
|
$scope.rate.yeepay_rate_value = parseFloat($scope.sysRateConfig.t3.Yeepay);
|
|
|
$scope.rate.cb_bankpay_rate_value = parseFloat($scope.sysRateConfig.t3.CB_Bankpay);
|
|
|
$scope.rate.transaction_fee = 0;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
}]);
|
|
|
app.controller('partnerAccountsCtrl', ['$scope', '$http', '$uibModal', 'commonDialog', function ($scope, $http, $uibModal, commonDialog) {
|
|
|
$scope.partnerRoles = partnerRoles;
|
|
|
$scope.loadPartnerAccounts = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/accounts').then(function (resp) {
|
|
|
$scope.accounts = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadPartnerAccounts();
|
|
|
$scope.addAccount = function () {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/add_partner_account_dialog.html',
|
|
|
controller: 'partnerAddAccountDialogCtrl',
|
|
|
backdrop: false,
|
|
|
resolve: {
|
|
|
partner: function () {
|
|
|
return $scope.partner;
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$scope.loadPartnerAccounts();
|
|
|
})
|
|
|
};
|
|
|
$scope.updateAccountRole = function (account) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/accounts/' + account.account_id + '/role', {role: account.role}).then(function () {
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
})
|
|
|
};
|
|
|
$scope.resetPwd = function (account) {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/partner_account_reset_pwd_dialog.html',
|
|
|
controller: 'partnerResetPwdDialogCtrl',
|
|
|
backdrop: false,
|
|
|
size: 'sm',
|
|
|
resolve: {
|
|
|
partner: function () {
|
|
|
return $scope.partner;
|
|
|
},
|
|
|
account: function () {
|
|
|
return account;
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
commonDialog.alert({title: 'Success!', content: 'Password Changed Successfully', type: 'success'})
|
|
|
})
|
|
|
};
|
|
|
$scope.disableAccount = function (account) {
|
|
|
commonDialog.confirm({
|
|
|
title: 'Confirm Operation',
|
|
|
content: 'Are you sure to disable account ' + account.display_name + ' ?'
|
|
|
}).then(function () {
|
|
|
$http.delete('/sys/partners/' + $scope.partner.client_moniker + '/accounts/' + account.account_id).then(function () {
|
|
|
$scope.loadPartnerAccounts();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Fail!', content: resp.data.message, type: 'error'})
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
}]);
|
|
|
app.controller('partnerAddAccountDialogCtrl', ['$scope', '$http', 'partner', function ($scope, $http, partner) {
|
|
|
$scope.account = {role: 1};
|
|
|
$scope.partnerRoles = partnerRoles;
|
|
|
$scope.saveAccount = function (form) {
|
|
|
if (form.$invalid) {
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
if (key.indexOf('$') < 0) {
|
|
|
item.$dirty = true;
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.account.pwd && $scope.account.pwd.length < 8) {
|
|
|
$scope.errmsg = 'Password length must more than 8 !';
|
|
|
return;
|
|
|
}
|
|
|
var regex = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/;
|
|
|
if ($scope.account.pwd && !regex.test($scope.account.pwd)) {
|
|
|
$scope.errmsg = 'The password needs to consist of 8-16 digits and letters !';
|
|
|
return;
|
|
|
}
|
|
|
$scope.errmsg = null;
|
|
|
$http.post('/sys/partners/' + partner.client_moniker + '/accounts', $scope.account).then(function () {
|
|
|
$scope.$close();
|
|
|
}, function (resp) {
|
|
|
$scope.errmsg = resp.data.message;
|
|
|
})
|
|
|
}
|
|
|
}]);
|
|
|
app.controller('partnerResetPwdDialogCtrl', ['$scope', '$http', 'partner', 'account', function ($scope, $http, partner, account) {
|
|
|
$scope.updatePwd = function () {
|
|
|
$scope.errmsg = null;
|
|
|
if ($scope.reset.pwd && $scope.reset.pwd.length < 8) {
|
|
|
$scope.errmsg = 'Password length must more than 8 !';
|
|
|
return;
|
|
|
}
|
|
|
var regex = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/;
|
|
|
if ($scope.reset.pwd && !regex.test($scope.reset.pwd)) {
|
|
|
$scope.errmsg = 'The password needs to consist of 8-16 digits and letters !';
|
|
|
return;
|
|
|
}
|
|
|
$http.put('/sys/partners/' + partner.client_moniker + '/accounts/' + account.account_id + '/pwd', {pwd: $scope.reset.pwd}).then(function () {
|
|
|
$scope.$close();
|
|
|
}, function (resp) {
|
|
|
$scope.errmsg = resp.data.message;
|
|
|
})
|
|
|
}
|
|
|
}]);
|
|
|
app.controller('partnerNewSubPartnerDialogCtrl', ['$rootScope', '$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone',
|
|
|
'clientMoniker', 'industryMap', 'businessStructuresMap', 'stateMap', 'countryMap',
|
|
|
function ($rootScope, $scope, $http, $state, Upload, commonDialog, timezone, clientMoniker, industryMap, businessStructuresMap, stateMap, countryMap) {
|
|
|
if ($scope.partner_application) {
|
|
|
$scope.partner = angular.copy($scope.partner_application);
|
|
|
delete $rootScope.partner_application;
|
|
|
} else {
|
|
|
$scope.partner = {timezone: 'Australia/Melbourne'};
|
|
|
}
|
|
|
$scope.partner.company_phone_c = 61;
|
|
|
$scope.partner.contact_phone_c = 61;
|
|
|
$scope.business_structures = businessStructuresMap.configs();
|
|
|
$scope.industries = industryMap.configs();
|
|
|
|
|
|
$scope.listReferrers = function () {
|
|
|
$http.get('/sys/orgs/referrer').then(function (resp) {
|
|
|
$scope.referrers = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.listReferrers();
|
|
|
|
|
|
$scope.alipayMccCategory = {};
|
|
|
$scope.loadAlipayCategory = function () {
|
|
|
$http.get('/static/data/alipayMcc.json').then(function (resp) {
|
|
|
$scope.alipayMccCategory = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadAlipayCategory();
|
|
|
|
|
|
|
|
|
$scope.loadJDindustry = function () {
|
|
|
$http.get('/static/data/jdindustry.json').then(function (resp) {
|
|
|
$scope.jdindustry = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadJDindustry();
|
|
|
|
|
|
$scope.loadRoyalpayindustry = function () {
|
|
|
$http.get('/static/data/royalpayindustry.json').then(function (resp) {
|
|
|
$scope.royalpayindustry = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadRoyalpayindustry();
|
|
|
|
|
|
$scope.loadHfindustry = function () {
|
|
|
$http.get('/static/data/hfindustry.json').then(function (resp) {
|
|
|
$scope.hfindustry = resp.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.loadHfindustry();
|
|
|
|
|
|
|
|
|
$scope.onAlipayMccSelect = function (selectedItem) {
|
|
|
$scope.partner.alipay_category = selectedItem.label;
|
|
|
$scope.partner.alipayindustry = selectedItem.mccCode;
|
|
|
};
|
|
|
$scope.onRoyalPayIndustrySelect = function (selectedItem) {
|
|
|
$scope.partner.royalpay_label = selectedItem.label;
|
|
|
$scope.partner.royalpayindustry = selectedItem.mccCode;
|
|
|
};
|
|
|
|
|
|
$scope.onHfIndustrySelect = function (selectedItem) {
|
|
|
$scope.partner.hf_label = selectedItem.label;
|
|
|
$scope.partner.hfindustry = selectedItem.mccCode;
|
|
|
};
|
|
|
|
|
|
// $scope.t2city_map = angular.copy(t2city_map);
|
|
|
|
|
|
$scope.timezones = timezone.configs();
|
|
|
$scope.states = stateMap.configs();
|
|
|
$scope.countries = countryMap.configs();
|
|
|
$scope.saveSubPartner = function (form) {
|
|
|
if (form.$invalid) {
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
if (key.indexOf('$') < 0) {
|
|
|
item.$dirty = true;
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
$scope.errmsg = null;
|
|
|
if ($scope.partner.company_name.indexOf("Migration") != -1) {
|
|
|
alert("Company Name包含敏感词汇,请检查后重新提交!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($scope.partner.company_phone_a && ('' + $scope.partner.company_phone_a != '')) {
|
|
|
if ($scope.partner.company_phone_a.indexOf('0') == 0) {
|
|
|
alert("Please remove the first character '0' of area code");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
if ($scope.partner.contact_phone && ('' + $scope.partner.contact_phone != '')) {
|
|
|
if ($scope.partner.contact_phone.indexOf('0') == 0) {
|
|
|
alert("Please remove the first character '0' of area code");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
$scope.partner.company_phone = '+' + $scope.partner.company_phone_c + ($scope.partner.company_phone_a || '') + $scope.partner.company_phone_p;
|
|
|
$scope.partner.contact_phone = '+' + $scope.partner.contact_phone_c + ($scope.partner.contact_phone_a || '') + $scope.partner.contact_phone_p;
|
|
|
|
|
|
if ($scope.partner.company_phone.indexOf(' ') != -1) {
|
|
|
alert('Company Phone can not contain space character');
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.contact_phone.indexOf(' ') != -1) {
|
|
|
alert('Contact Phone can not contain space character');
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.contact_email.indexOf(' ') != -1) {
|
|
|
alert('Contact email Phone can not contain space character');
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.suburb.indexOf(' ') != -1) {
|
|
|
alert('suburb can not contain two and more continuous space characters');
|
|
|
return;
|
|
|
}
|
|
|
if ($scope.partner.acn && $scope.partner.business_structure == 'Company') {
|
|
|
if ($scope.partner.acn.length != 9) {
|
|
|
alert('Acn is not valid');
|
|
|
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;
|
|
|
}
|
|
|
}
|
|
|
// if(!window.frames['merchant_detail'].merchant_location){
|
|
|
// alert("Please Locate Merchant Location!");
|
|
|
// return;
|
|
|
// }
|
|
|
$http.post('/sys/partners/' + clientMoniker + '/sub_clients', $scope.partner).then(function () {
|
|
|
$scope.updateMerchantLocation();
|
|
|
$scope.$close();
|
|
|
}, function (resp) {
|
|
|
$scope.errmsg = resp.data.message;
|
|
|
})
|
|
|
}
|
|
|
$scope.uploadLogo = function (file) {
|
|
|
if (file != null) {
|
|
|
if (file.size > 1 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$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) {
|
|
|
if (file.size > 2 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$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) {
|
|
|
if (file.size > 2 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$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.updateMerchantLocation = function () {
|
|
|
var params = window.frames['merchant_detail'].merchant_location;
|
|
|
if (params) {
|
|
|
$http.put('/sys/partners/modify/' + $scope.partner.client_moniker + '/location', params).then(function () {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}]);
|
|
|
app.controller('partnerPayLogCtrl', ['$scope', '$http', '$filter', 'refunder', 'orderService', function ($scope, $http, $filter, refunder, orderService) {
|
|
|
$scope.params = {status: 'PAID', channel: 'ALL', textType: 'all', datefrom: new Date(), dateto: new Date()};
|
|
|
$scope.pagination = {};
|
|
|
$scope.isAll = true;
|
|
|
$scope.clients = [$scope.partner];
|
|
|
|
|
|
$scope.today = new Date();
|
|
|
$scope.chooseToday = function () {
|
|
|
$scope.params.datefrom = $scope.params.dateto = new Date();
|
|
|
$scope.loadTradeLogs(1);
|
|
|
};
|
|
|
$scope.chooseYesterday = function () {
|
|
|
var yesterday = new Date();
|
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
|
$scope.params.datefrom = $scope.params.dateto = yesterday;
|
|
|
$scope.loadTradeLogs(1);
|
|
|
};
|
|
|
$scope.chooseLast7Days = function () {
|
|
|
$scope.params.dateto = new Date();
|
|
|
var day = new Date();
|
|
|
day.setDate(day.getDate() - 7);
|
|
|
$scope.params.datefrom = day;
|
|
|
$scope.loadTradeLogs(1);
|
|
|
};
|
|
|
$scope.thisMonth = function () {
|
|
|
$scope.params.dateto = new Date();
|
|
|
var monthBegin = new Date();
|
|
|
monthBegin.setDate(1);
|
|
|
$scope.params.datefrom = monthBegin;
|
|
|
$scope.loadTradeLogs(1);
|
|
|
};
|
|
|
$scope.lastMonth = function () {
|
|
|
var monthFinish = new Date();
|
|
|
monthFinish.setDate(0);
|
|
|
$scope.params.dateto = monthFinish;
|
|
|
var monthBegin = new Date();
|
|
|
monthBegin.setDate(0);
|
|
|
monthBegin.setDate(1);
|
|
|
$scope.params.datefrom = monthBegin;
|
|
|
$scope.loadTradeLogs(1);
|
|
|
};
|
|
|
$scope.loadTradeLogs = function (page) {
|
|
|
var params = angular.copy($scope.params);
|
|
|
if (params.datefrom) {
|
|
|
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
|
|
|
}
|
|
|
if (params.dateto) {
|
|
|
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
|
|
|
}
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/trade_logs', {params: params}).then(function (resp) {
|
|
|
$scope.tradeLogs = resp.data.data;
|
|
|
$scope.pagination = resp.data.pagination;
|
|
|
$scope.analysis = resp.data.analysis;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
$scope.gatewaySelected = function (arr) {
|
|
|
return $scope.params.gateway != null && $scope.params.gateway.filter(function (gateway) {
|
|
|
return arr.indexOf(gateway) >= 0
|
|
|
}).length > 0
|
|
|
};
|
|
|
|
|
|
$scope.showRefundLog = function (orderId) {
|
|
|
refunder.refunded(orderId);
|
|
|
};
|
|
|
$scope.newRefund = function (orderId) {
|
|
|
refunder.refund(orderId).then(function () {
|
|
|
$scope.loadTradeLogs();
|
|
|
});
|
|
|
};
|
|
|
$scope.showTradeDetail = function (order) {
|
|
|
orderService.managerOrderDetail(order)
|
|
|
};
|
|
|
$scope.$on('order_refunded', function () {
|
|
|
$scope.loadTradeLogs();
|
|
|
});
|
|
|
$scope.chooseClient = function (clientId) {
|
|
|
if (clientId == 'all') {
|
|
|
$scope.params.client_ids = angular.copy($scope.clientIds);
|
|
|
$scope.isAll = true;
|
|
|
$scope.chooseClientId = '';
|
|
|
} else {
|
|
|
$scope.chooseClientId = clientId;
|
|
|
$scope.params.client_ids = [clientId];
|
|
|
$scope.isAll = false;
|
|
|
}
|
|
|
$scope.loadTradeLogs();
|
|
|
};
|
|
|
if ($scope.partner.has_children) {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients').then(function (resp) {
|
|
|
var clientList = resp.data;
|
|
|
clientList.forEach(function (client) {
|
|
|
$scope.clients.push(client);
|
|
|
});
|
|
|
$scope.clientIds = [];
|
|
|
$scope.clients.forEach(function (client) {
|
|
|
$scope.clientIds.push(client.client_id);
|
|
|
});
|
|
|
$scope.params.client_ids = angular.copy($scope.clientIds);
|
|
|
//console.log($rootScope.currentUser.client.clientList);
|
|
|
$scope.loadTradeLogs(1);
|
|
|
})
|
|
|
} else {
|
|
|
$scope.loadTradeLogs(1);
|
|
|
}
|
|
|
}]);
|
|
|
app.controller('partnerPluginsCtrl', ['$scope', '$uibModal', function ($scope, $uibModal) {
|
|
|
$scope.configRedpack = function () {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/redpack_config.html',
|
|
|
controller: 'partnerRedpackConfigDialogCtrl',
|
|
|
size: 'lg',
|
|
|
resolve: {
|
|
|
partner: function () {
|
|
|
return $scope.partner;
|
|
|
},
|
|
|
config: ['$http', function ($http) {
|
|
|
return $http.get('/sys/redpack/partners/' + $scope.partner.client_moniker);
|
|
|
}]
|
|
|
}
|
|
|
})
|
|
|
};
|
|
|
$scope.redpackLogs = function () {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/redpack_logs.html',
|
|
|
controller: 'partnerRedpackLogDialogCtrl',
|
|
|
size: 'lg',
|
|
|
resolve: {
|
|
|
partner: function () {
|
|
|
return $scope.partner;
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
}]);
|
|
|
app.controller('partnerDeviceCtrl', ['$scope', '$http', 'orderService', 'commonDialog', 'refunder', function ($scope, $http, orderService, commonDialog, refunder) {
|
|
|
$scope.pagination = {};
|
|
|
$scope.listDevices = function (page) {
|
|
|
var params = angular.copy($scope.devsearch) || {};
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/devices', {params: params}).then(function (resp) {
|
|
|
$scope.pagination = resp.data.pagination;
|
|
|
$scope.devices = resp.data.data;
|
|
|
})
|
|
|
};
|
|
|
$scope.listDevices(1);
|
|
|
$scope.showDeviceOrders = function (dev) {
|
|
|
$scope.params.dev_id = dev.dev_id;
|
|
|
$scope.listOrders(1);
|
|
|
};
|
|
|
$scope.modifyRemark = function (dev) {
|
|
|
commonDialog.inputText({title: 'Input New Remark of device'}).then(function (text) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/devices/' + dev.dev_id, {remark: text}).then(function () {
|
|
|
$scope.listDevices();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Update remark failed', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
})
|
|
|
};
|
|
|
$scope.disableDevice = function (dev) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/devices/' + dev.dev_id + '/enable', {enable: false}).then(function () {
|
|
|
$scope.listDevices()
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Failed to disable device', content: resp.data.message, type: 'error'});
|
|
|
});
|
|
|
};
|
|
|
$scope.enableDevice = function (dev) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/devices/' + dev.dev_id + '/enable', {enable: true}).then(function () {
|
|
|
$scope.listDevices()
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Failed to enable device', content: resp.data.message, type: 'error'});
|
|
|
});
|
|
|
};
|
|
|
$scope.orderPagination = {};
|
|
|
$scope.today = new Date();
|
|
|
$scope.chooseToday = function () {
|
|
|
$scope.params.datefrom = $scope.params.dateto = new Date();
|
|
|
$scope.loadTradeLogs(1);
|
|
|
};
|
|
|
$scope.chooseYesterday = function () {
|
|
|
var yesterday = new Date();
|
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
|
$scope.params.datefrom = $scope.params.dateto = yesterday;
|
|
|
$scope.loadTradeLogs(1);
|
|
|
};
|
|
|
$scope.chooseLast7Days = function () {
|
|
|
$scope.params.dateto = new Date();
|
|
|
var day = new Date();
|
|
|
day.setDate(day.getDate() - 7);
|
|
|
$scope.params.datefrom = day;
|
|
|
$scope.loadTradeLogs(1);
|
|
|
};
|
|
|
$scope.thisMonth = function () {
|
|
|
$scope.params.dateto = new Date();
|
|
|
var monthBegin = new Date();
|
|
|
monthBegin.setDate(1);
|
|
|
$scope.params.datefrom = monthBegin;
|
|
|
$scope.loadTradeLogs(1);
|
|
|
};
|
|
|
$scope.lastMonth = function () {
|
|
|
var monthFinish = new Date();
|
|
|
monthFinish.setDate(0);
|
|
|
$scope.params.dateto = monthFinish;
|
|
|
var monthBegin = new Date();
|
|
|
monthBegin.setDate(0);
|
|
|
monthBegin.setDate(1);
|
|
|
$scope.params.datefrom = monthBegin;
|
|
|
$scope.loadTradeLogs(1);
|
|
|
};
|
|
|
$scope.listOrders = function (page) {
|
|
|
var params = angular.copy($scope.params) || {};
|
|
|
if (params.datefrom) {
|
|
|
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
|
|
|
}
|
|
|
if (params.dateto) {
|
|
|
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
|
|
|
}
|
|
|
params.gateway = [0, 1];
|
|
|
params.page = page || $scope.orderPagination.page || 1;
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/trade_logs', {params: params}).then(function (resp) {
|
|
|
$scope.orders = resp.data.data;
|
|
|
$scope.orderPagination = resp.data.pagination;
|
|
|
$scope.analysis = resp.data.analysis;
|
|
|
});
|
|
|
};
|
|
|
$scope.listOrders(1);
|
|
|
$scope.orderDetail = function (order) {
|
|
|
orderService.managerOrderDetail(order)
|
|
|
};
|
|
|
$scope.refundOrder = function (order) {
|
|
|
refunder.refunded(order.order_id)
|
|
|
};
|
|
|
}]);
|
|
|
app.controller('partnerRedpackConfigDialogCtrl', ['$scope', '$http', 'partner', 'config', function ($scope, $http, partner, config) {
|
|
|
$scope.config = config.data;
|
|
|
if (!Object.keys($scope.config).length) {
|
|
|
$scope.config = {min_payment: 0, min_amount: 1, max_amount: 1, daily_limit: 1, enabled: false};
|
|
|
}
|
|
|
$scope.saveRedpackConfig = function (form) {
|
|
|
$scope.errmsg = null;
|
|
|
if (form.$invalid) {
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
if (key.indexOf('$') < 0) {
|
|
|
item.$dirty = true;
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
var config = angular.copy($scope.config);
|
|
|
$http.put('/sys/redpack/partners/' + partner.client_moniker, config).then(function () {
|
|
|
$scope.$close();
|
|
|
}, function (resp) {
|
|
|
$scope.errmsg = resp.data.message;
|
|
|
})
|
|
|
};
|
|
|
}]);
|
|
|
app.controller('rateConfigDialogCtrl', ['$scope', '$http', 'rate', 'clientMoniker', function ($scope, $http, rate, clientMoniker) {
|
|
|
$scope.rate = angular.copy(rate);
|
|
|
$scope.ctrl = {sending: false};
|
|
|
$scope.saveRate = function () {
|
|
|
$scope.errmsg = null;
|
|
|
$scope.ctrl.sending = true;
|
|
|
if ($scope.rate.client_rate_id) {
|
|
|
$http.put('/sys/partners/' + clientMoniker + '/rates/' + $scope.rate.client_rate_id, $scope.rate).then(function () {
|
|
|
$scope.ctrl.sending = false;
|
|
|
$scope.$close();
|
|
|
}, function (resp) {
|
|
|
$scope.ctrl.sending = false;
|
|
|
$scope.errmsg = resp.data.message;
|
|
|
})
|
|
|
} else {
|
|
|
$http.post('/sys/partners/' + clientMoniker + '/rates', $scope.rate).then(function () {
|
|
|
$scope.ctrl.sending = false;
|
|
|
$scope.$close();
|
|
|
}, function (resp) {
|
|
|
$scope.ctrl.sending = false;
|
|
|
$scope.errmsg = resp.data.message;
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
}]);
|
|
|
app.controller('partnerChooseBDUserDialogCtrl', ['$scope', '$http', '$filter', 'partner', 'bdUsers', 'type', function ($scope, $http, $filter, partner, bdUsers, type) {
|
|
|
$scope.bdUsers = bdUsers.data;
|
|
|
$scope.data = {};
|
|
|
$scope.params = {};
|
|
|
|
|
|
$scope.chooseOrg = {};
|
|
|
$scope.chooseOrg.org_name = null;
|
|
|
if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) {
|
|
|
/* $scope.showOrg = 'Organization';*/
|
|
|
$http.get('/sys/orgs', {params: {}}).then(function (resp) {
|
|
|
$scope.orgs = resp.data;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$scope.loadOrgs = function () {
|
|
|
var params = angular.copy($scope.params);
|
|
|
$http.get('/sys/orgs/orgChild', {params: params}).then(function (resp) {
|
|
|
$scope.orgs_child = resp.data;
|
|
|
})
|
|
|
};
|
|
|
|
|
|
/* $scope.chooseOrgFun = function (org) {
|
|
|
if (org == 'all') {
|
|
|
$scope.chooseOrg.org_name = null;
|
|
|
$scope.showOrg = 'All'
|
|
|
} else {
|
|
|
$scope.chooseOrg.org_name = org.name;
|
|
|
$scope.showOrg = org.name;
|
|
|
$scope.params.org_id = org.org_id;
|
|
|
$scope.loadOrgs();
|
|
|
}
|
|
|
};*/
|
|
|
|
|
|
function initBD() {
|
|
|
$http.get('/sys/partners/' + partner.client_moniker + '/bd_user/current').then(function (resp) {
|
|
|
var choooseBD = resp.data;
|
|
|
choooseBD.forEach(function (e) {
|
|
|
$scope.bdUsers.forEach(function (m) {
|
|
|
if (m.manager_id == e.bd_id) {
|
|
|
m.choose = true;
|
|
|
m.proportion = e.proportion;
|
|
|
/* $scope.chooseOrgFun({org_id: m.org_id, name: m.org_name});*/
|
|
|
if (($scope.currentUser.role & parseInt('1000000000000', 2)) > 0) {
|
|
|
$scope.params.org_ids = m.org_id;
|
|
|
$scope.params.org_id = m.org_id;
|
|
|
$scope.loadOrgs();
|
|
|
} else {
|
|
|
$scope.params.org_id = m.org_id;
|
|
|
$scope.loadOrgs();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
$scope.data.start_date = new Date(choooseBD[0].start_date);
|
|
|
})
|
|
|
}
|
|
|
|
|
|
if (type == 'edit') {
|
|
|
initBD();
|
|
|
}
|
|
|
|
|
|
$scope.saveBD = function () {
|
|
|
$scope.data.users = [];
|
|
|
$scope.bdUsers.forEach(function (e) {
|
|
|
if (e.choose) {
|
|
|
$scope.data.users.push(e);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if ($scope.data.users.length == 0) {
|
|
|
$scope.errmsg = "请选择至少一位BD";
|
|
|
}
|
|
|
else if ($scope.data.start_date == undefined) {
|
|
|
$scope.errmsg = "执行开始日期不能为空";
|
|
|
}
|
|
|
else {
|
|
|
var isValid = true;
|
|
|
var total = 0;
|
|
|
$scope.data.users.forEach(function (e) {
|
|
|
if (e.proportion == undefined) {
|
|
|
$scope.errmsg = "绩效比例不能为空";
|
|
|
isValid = false;
|
|
|
return;
|
|
|
} else if (e.proportion < 0.01 || e.proportion > 1) {
|
|
|
$scope.errmsg = "绩效比例无效";
|
|
|
isValid = false;
|
|
|
return;
|
|
|
}
|
|
|
total += e.proportion;
|
|
|
if (total > 1) {
|
|
|
$scope.errmsg = "总比例不能超过1";
|
|
|
isValid = false;
|
|
|
return;
|
|
|
}
|
|
|
});
|
|
|
// if (total != 1) {
|
|
|
// $scope.errmsg = "Total proportion must be 1";
|
|
|
// isValid = false;
|
|
|
// return;
|
|
|
// }
|
|
|
if (isValid) {
|
|
|
$scope.errmsg = null;
|
|
|
$scope.data.type = type;
|
|
|
var chooseUsers = angular.copy($scope.data);
|
|
|
chooseUsers.start_date = $scope.data.start_date;
|
|
|
if (chooseUsers.start_date) {
|
|
|
chooseUsers.start_date = $filter('date')(chooseUsers.start_date, 'yyyyMMdd');
|
|
|
}
|
|
|
$http.put('/sys/partners/' + partner.client_moniker + '/bd_user', $scope.data).then(function () {
|
|
|
$scope.$close();
|
|
|
}, function (resp) {
|
|
|
$scope.errmsg = resp.data.message;
|
|
|
})
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}]);
|
|
|
app.controller('partnerRedpackLogDialogCtrl', ['$scope', '$http', 'partner', function ($scope, $http, partner) {
|
|
|
$scope.pagination = {};
|
|
|
$scope.queryParams = {};
|
|
|
$scope.listRedpackLogs = function (page) {
|
|
|
var params = angular.copy($scope.queryParams);
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
$http.get('/sys/redpack/partners/' + partner.client_moniker + '/logs', {params: params}).then(function (resp) {
|
|
|
$scope.logs = resp.data.data;
|
|
|
$scope.pagination = resp.data.pagination;
|
|
|
})
|
|
|
};
|
|
|
$scope.listRedpackLogs(1);
|
|
|
}]);
|
|
|
app.controller('partnerAuthFileCtrl', ['$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('/sys/partners/' + $scope.partner.client_moniker + '/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) {
|
|
|
$scope.file.authStatus = 1;
|
|
|
$scope.updateFile();
|
|
|
} else {
|
|
|
commitError();
|
|
|
}
|
|
|
} else {
|
|
|
commitError();
|
|
|
}
|
|
|
};
|
|
|
$scope.complianceCheck = function () {
|
|
|
if (!$rootScope.complianceCheck) {
|
|
|
$rootScope.complianceCheck = {};
|
|
|
}
|
|
|
$rootScope.complianceCheck.client_id = $scope.partner.client_id;
|
|
|
$rootScope.complianceCheck.authFile = true;
|
|
|
};
|
|
|
$scope.complianceChangeCheck = function () {
|
|
|
if ($rootScope.complianceCheck) {
|
|
|
if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) {
|
|
|
delete $rootScope.complianceCheck;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
$scope.complianceChangeCheck();
|
|
|
|
|
|
}]);
|
|
|
app.controller('partnerSettlementCtrl', ['$scope', '$uibModal', '$http', 'clientMoniker', '$filter', function ($scope, $uibModal, $http, clientMoniker, $filter) {
|
|
|
$scope.params = {};
|
|
|
$scope.pagination = {};
|
|
|
$scope.today = new Date();
|
|
|
|
|
|
$scope.chooseToday = function () {
|
|
|
$scope.params.datefrom = $scope.params.dateto = new Date();
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
};
|
|
|
$scope.chooseYesterday = function () {
|
|
|
var yesterday = new Date();
|
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
|
$scope.params.datefrom = $scope.params.dateto = yesterday;
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
};
|
|
|
$scope.chooseLast7Days = function () {
|
|
|
$scope.params.dateto = new Date();
|
|
|
var day = new Date();
|
|
|
day.setDate(day.getDate() - 7);
|
|
|
$scope.params.datefrom = day;
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
};
|
|
|
$scope.thisMonth = function () {
|
|
|
$scope.params.dateto = new Date();
|
|
|
var monthBegin = new Date();
|
|
|
monthBegin.setDate(1);
|
|
|
$scope.params.datefrom = monthBegin;
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
};
|
|
|
$scope.lastMonth = function () {
|
|
|
var monthFinish = new Date();
|
|
|
monthFinish.setDate(0);
|
|
|
$scope.params.dateto = monthFinish;
|
|
|
var monthBegin = new Date();
|
|
|
monthBegin.setDate(0);
|
|
|
monthBegin.setDate(1);
|
|
|
$scope.params.datefrom = monthBegin;
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
};
|
|
|
$scope.loadSettlementLogs = function (page) {
|
|
|
var params = angular.copy($scope.params);
|
|
|
if (params.datefrom) {
|
|
|
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
|
|
|
}
|
|
|
if (params.dateto) {
|
|
|
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
|
|
|
}
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
params.limit = 10;
|
|
|
$http.get('/sys/partners/' + clientMoniker + '/lists_settlements', {params: params}).then(function (resp) {
|
|
|
$scope.settlementLogs = resp.data.data;
|
|
|
$scope.padding = resp.data.padding;
|
|
|
$scope.pagination = resp.data.pagination;
|
|
|
});
|
|
|
};
|
|
|
$scope.getClearingTransactions = function (client_id, detail_id) {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/analysis/templates/settlement_transactions.html',
|
|
|
controller: 'managerSettlementDetailCtrl',
|
|
|
resolve: {
|
|
|
detail: ['$http', '$stateParams', function ($http) {
|
|
|
return $http.get('/analysis/partner_card/' + client_id + '/settlement_logs/' + detail_id);
|
|
|
}],
|
|
|
detail_id:detail_id
|
|
|
},
|
|
|
size: 'lg'
|
|
|
});
|
|
|
};
|
|
|
$scope.chooseLast7Days();
|
|
|
}]);
|
|
|
app.controller('managerSettlementDetailCtrl', ['$scope', 'detail','detail_id','$http', function ($scope, detail,detail_id,$http) {
|
|
|
$scope.ctrl = {channel: null};
|
|
|
$scope.show = true;
|
|
|
$scope.report = detail.data;
|
|
|
$scope.report.total_charge = Decimal.add($scope.report.total_charge,$scope.report.tax_amount).toFixed(2);
|
|
|
angular.forEach($scope.report.channels,function (e) {
|
|
|
e.total_charge = Decimal.add(e.tax_amount,e.total_charge).toFixed(2);
|
|
|
});
|
|
|
|
|
|
$scope.channelAndDayOfAnalysis = function () {
|
|
|
$http.get('/analysis/partner_card/settlement_logs/' + detail_id+'/analysis/'+$scope.ctrl.channel).then(function (resp) {
|
|
|
$scope.channelAndDayMap = resp.data;
|
|
|
$scope.index = 0;
|
|
|
})
|
|
|
};
|
|
|
$scope.channelAndDayOfAnalysis(1);
|
|
|
}]);
|
|
|
app.controller('productCtrl', ['$scope', '$http', '$uibModal', 'commonDialog', '$state', 'Upload', 'industryMap', function ($scope, $http, $uibModal, commonDialog, $state, Upload, industryMap) {
|
|
|
$scope.importShow = 0;
|
|
|
$scope.pagination = {};
|
|
|
$scope.params = {text_type: 'all', search_text: null};
|
|
|
$scope.industries = industryMap.configs();
|
|
|
$scope.loadProducts = function (page) {
|
|
|
var params = angular.copy($scope.params);
|
|
|
if ($scope.params.industry == null || angular.equals({}, $scope.params.industry)) {
|
|
|
params.industry = '';
|
|
|
} else {
|
|
|
params.industry = $scope.params.industry.value;
|
|
|
}
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
$http.get('/client/product/' + $scope.partner.client_moniker + '/list', {params: params}).then(function (resp) {
|
|
|
$scope.products = resp.data.data;
|
|
|
$scope.pagination = resp.data.pagination;
|
|
|
});
|
|
|
};
|
|
|
/*$scope.importExcel = function (file) {
|
|
|
if (file != null) {
|
|
|
Upload.upload({
|
|
|
url: '/attachment/files',
|
|
|
data: {file: file}
|
|
|
}).then(function (resp) {
|
|
|
$scope.agree_file_import = resp.data.url;
|
|
|
$http.put('/client/product/'+$scope.partner.client_moniker+'/importExcel', {source_agree_file: $scope.agree_file_import}).then(function () {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Succeed Imported',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
})
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
})
|
|
|
}
|
|
|
}*/
|
|
|
$scope.deleteProduct = function (product) {
|
|
|
$scope.product = angular.copy(product);
|
|
|
commonDialog.confirm({
|
|
|
title: 'Confirm',
|
|
|
content: 'This operation will delete the product, Are you sure?'
|
|
|
}).then(function () {
|
|
|
$http.post('/sys/product/' + product.commodity_id + '/delete').then(function () {
|
|
|
alert("Success!");
|
|
|
$state.reload();
|
|
|
});
|
|
|
})
|
|
|
};
|
|
|
$scope.addProduct = function () {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/product/templates/add_product.html',
|
|
|
controller: 'AddProductDialogCtrl',
|
|
|
resolve: {
|
|
|
product: function () {
|
|
|
return {};
|
|
|
},
|
|
|
partner: function () {
|
|
|
return $scope.partner;
|
|
|
},
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$scope.loadProducts(1);
|
|
|
})
|
|
|
};
|
|
|
$scope.editProduct = function (product) {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/product/templates/add_product.html',
|
|
|
controller: 'AddProductDialogCtrl',
|
|
|
resolve: {
|
|
|
product: function () {
|
|
|
return product;
|
|
|
},
|
|
|
partner: function () {
|
|
|
return $scope.partner;
|
|
|
},
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$scope.loadProducts(1);
|
|
|
})
|
|
|
};
|
|
|
$scope.loadProducts(1);
|
|
|
}]);
|
|
|
app.controller('AddProductDialogCtrl', ['$scope', '$http', '$uibModal', 'product', 'partner', '$state', 'industryMap', function ($scope, $http, $uibModal, product, partner, $state, industryMap) {
|
|
|
$scope.product = angular.copy(product);
|
|
|
$scope.product.partner = true;
|
|
|
$scope.partner = angular.copy(partner);
|
|
|
$scope.industries = industryMap.configs();
|
|
|
|
|
|
if (($scope.product.commodity_id)) {
|
|
|
$scope.edit_or_add = "Edit";
|
|
|
} else {
|
|
|
$scope.edit_or_add = "Add";
|
|
|
$scope.product.industry = $scope.partner.industry;
|
|
|
}
|
|
|
$scope.save = function () {
|
|
|
if ($scope.product.commodity_id) {
|
|
|
$http.put('/client/product/', $scope.product).then(function (resp) {
|
|
|
alert("Success");
|
|
|
$scope.$close();
|
|
|
$state.reload();
|
|
|
});
|
|
|
} else {
|
|
|
$http.post('/client/product/' + $scope.partner.client_moniker, $scope.product).then(function (resp) {
|
|
|
alert("Success");
|
|
|
$scope.$close();
|
|
|
$state.reload();
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}]);
|
|
|
app.controller('subMerchantIdApplicaitonsCtrl', ['$scope', '$http', '$uibModal', '$state', 'commonDialog', function ($scope, $http, $uibModal, $state, commonDialog) {
|
|
|
$scope.loadSubMerchantInfos = function () {
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_sub_applices', {params: {}}).then(function (resp) {
|
|
|
$scope.subMerchantInfos = resp.data;
|
|
|
});
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_rpay_sub_applices', {params: {}}).then(function (resp) {
|
|
|
$scope.subRpayMerchantInfos = resp.data;
|
|
|
});
|
|
|
|
|
|
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_yeepay_sub_applices', {params: {}}).then(function (resp) {
|
|
|
$scope.subYeepayMerchantInfos = resp.data;
|
|
|
});
|
|
|
};
|
|
|
$scope.useSubMerchantId = function (sub_merchant_id) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: sub_merchant_id}).then(function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Modify Wechat Sub Merchant ID successfully',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
}
|
|
|
$scope.useRpaySubMerchantId = function (sub_merchant_id) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/rpay_payment_config', {rpay_enterprise_id: sub_merchant_id}).then(function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Modify Rpay+ Sub Merchant ID successfully',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
}
|
|
|
$scope.useYeepaySubMerchantId = function (sub_merchant_id) {
|
|
|
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/yeepay_payment_config', {yeepay_sub_merchant_id: sub_merchant_id}).then(function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Modify Yeepay Sub Merchant ID successfully',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
}
|
|
|
$scope.applyWxSubMerchantId = function () {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/apply_wx_sub_merchant_id.html',
|
|
|
controller: 'applyWxSubMerchantIdCtrl',
|
|
|
resolve: {
|
|
|
subMerchantInfo: function () {
|
|
|
return $scope.partner;
|
|
|
},
|
|
|
merchantIds: ['$http', '$stateParams', function ($http) {
|
|
|
return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids');
|
|
|
}]
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$scope.loadSubMerchantInfos();
|
|
|
})
|
|
|
};
|
|
|
$scope.applyRpaySubMerchantId = function () {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/apply_rpay_sub_merchant_id.html',
|
|
|
controller: 'applyRpaySubMerchantIdCtrl',
|
|
|
resolve: {
|
|
|
subMerchantInfo: function () {
|
|
|
return $scope.partner;
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$scope.loadSubMerchantInfos();
|
|
|
})
|
|
|
};
|
|
|
$scope.applyYeepaySubMerchantId = function () {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/apply_yeepay_sub_merchant_id.html',
|
|
|
controller: 'applyYeepaySubMerchantIdCtrl',
|
|
|
resolve: {
|
|
|
subMerchantInfo: function () {
|
|
|
return $scope.partner;
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$scope.loadSubMerchantInfos();
|
|
|
})
|
|
|
};
|
|
|
$scope.updateYeepaySubMerchantId = function (sub_merchant_id) {
|
|
|
$uibModal.open({
|
|
|
templateUrl: '/static/payment/partner/templates/update_yeepay_sub_merchant_id.html',
|
|
|
controller: 'updateYeepaySubMerchantIdCtrl',
|
|
|
resolve: {
|
|
|
subMerchantInfo: function () {
|
|
|
return $scope.partner;
|
|
|
},
|
|
|
subMerchantId: function () {
|
|
|
return sub_merchant_id;
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function () {
|
|
|
$scope.loadSubMerchantInfos();
|
|
|
})
|
|
|
};
|
|
|
$scope.loadSubMerchantInfos();
|
|
|
}]);
|
|
|
app.controller('applyWxSubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', '$filter', 'merchantIds', 'commonDialog', function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, merchantIds, commonDialog) {
|
|
|
$scope.wxIndustries = angular.copy(wxMerchantIndustries);
|
|
|
$scope.subMerchantInfo = angular.copy(subMerchantInfo);
|
|
|
$scope.merchantIds = merchantIds.data;
|
|
|
$scope.subMerchantInfo.industry = $filter('wxindustries')($scope.subMerchantInfo.industry);
|
|
|
$scope.saveAppliy = function (form) {
|
|
|
$scope.errmsg = null;
|
|
|
if (form.$invalid) {
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
if (key.indexOf('$') < 0) {
|
|
|
item.$dirty = true;
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
$http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/sub_apply', $scope.subMerchantInfo).then(function (resp) {
|
|
|
$scope.apply_sub_merchant_id = resp.data;
|
|
|
$scope.$close();
|
|
|
if (subMerchantInfo.sub_merchant_id != null) {
|
|
|
commonDialog.confirm({title: 'Confirm', content: '已申请成功,是否确认使用'}).then(function () {
|
|
|
$http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', {sub_merchant_id: $scope.apply_sub_merchant_id}).then(function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Modify Wechat Sub Merchant ID successfully',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
})
|
|
|
} else {
|
|
|
$http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', {sub_merchant_id: $scope.apply_sub_merchant_id}).then(function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Apply Success And Modify Wechat Sub Merchant ID successfully',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
}
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
})
|
|
|
}
|
|
|
}]);
|
|
|
|
|
|
app.controller('applyRpaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', 'businessStructuresMap','$filter', 'commonDialog','timezone', function ($scope, $http, $uibModal, $state, subMerchantInfo, businessStructuresMap,$filter, commonDialog,timezone) {
|
|
|
$scope.subMerchantInfo = angular.copy(subMerchantInfo);
|
|
|
$scope.business_structures = businessStructuresMap.configs();
|
|
|
$scope.timezone = timezone.configs();
|
|
|
|
|
|
|
|
|
$scope.saveRpayAppliy = function (form) {
|
|
|
var merchantInfo = {};
|
|
|
$scope.errmsg = null;
|
|
|
if (form.$invalid) {
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
if (key.indexOf('$') < 0) {
|
|
|
item.$dirty = true;
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
if(item !=null) {
|
|
|
if(item.$name !=null) {
|
|
|
merchantInfo[key] = item.$modelValue;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/registRpaySubMerchantId', merchantInfo).then(function (resp) {
|
|
|
$scope.apply_sub_merchant_id = resp.data;
|
|
|
$scope.$close();
|
|
|
if (subMerchantInfo.sub_merchant_id != null) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Modify Rpay+ Sub Merchant ID successfully',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Error',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
}]);
|
|
|
|
|
|
app.controller('applyYeepaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state','subMerchantInfo','yeepayIndustryMap','yeepayBusinessContentMap','$filter', 'commonDialog','Upload', function ($scope, $http, $uibModal, $state,subMerchantInfo,yeepayIndustryMap,yeepayBusinessContentMap,$filter, commonDialog,Upload) {
|
|
|
$scope.yeepay_industries = yeepayIndustryMap.configs();
|
|
|
$scope.yeepay_business_contents = yeepayBusinessContentMap.configs();
|
|
|
$scope.subMerchantInfo = angular.copy(subMerchantInfo);
|
|
|
var vouchers={};
|
|
|
|
|
|
$scope.directors={};
|
|
|
$scope.executives={};
|
|
|
$scope.industry = '';
|
|
|
$scope.business_content = '';
|
|
|
var merchantInfo = {};
|
|
|
|
|
|
var merchantId = '';
|
|
|
|
|
|
|
|
|
// $scope.uploadLegalIDcardFront = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.legalIDcardFrontProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.legalIDcardFrontProgress;
|
|
|
// $scope.legalIDcardFront = resp.data.path;
|
|
|
// vouchers['legalIDcardFront'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.legalIDcardFrontProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.legalIDcardFrontProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
//
|
|
|
// $scope.uploadLegalIDcardBack = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.legalIDcardBackProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.legalIDcardBackProgress;
|
|
|
// $scope.legalIDcardBack = resp.data.path;
|
|
|
// vouchers['legalIDcardBack'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.legalIDcardBackProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.legalIDcardBackProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
|
|
|
$scope.uploadBusinessLicence = function (file) {
|
|
|
if (file != null) {
|
|
|
if (file.size > 3 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$scope.businessLicenceProgress = {value: 0};
|
|
|
Upload.upload({
|
|
|
url: '/attachment/yeepayFiles',
|
|
|
data: {file: file}
|
|
|
}).then(function (resp) {
|
|
|
delete $scope.businessLicenceProgress;
|
|
|
$scope.businessLicence = resp.data.path;
|
|
|
merchantInfo['business_licence'] = resp.data.path;
|
|
|
merchantId = resp.data.merchantId;
|
|
|
commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
}, function (resp) {
|
|
|
delete $scope.businessLicenceProgress;
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
}, function (evt) {
|
|
|
$scope.businessLicenceProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
// $scope.uploadTaxLevel = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.taxLevelProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.taxLevelProgress;
|
|
|
// $scope.taxLevel = resp.data.path;
|
|
|
// vouchers['taxLevel'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.taxLevelProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.taxLevelProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
|
|
|
// $scope.uploadBankAccountOpen = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.bankAccountOpenProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.bankAccountOpenProgress;
|
|
|
// $scope.bankAccountOpen = resp.data.path;
|
|
|
// vouchers['bankAccountOpen'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.bankAccountOpenProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.bankAccountOpenProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
|
|
|
// $scope.uploadOrgCode = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.orgCodeProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.orgCodeProgress;
|
|
|
// $scope.orgCode = resp.data.path;
|
|
|
// vouchers['orgCode'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.orgCodeProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.orgCodeProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
//
|
|
|
// $scope.uploadNonStanProtocol = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.nonStanProtocolProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.nonStanProtocolProgress;
|
|
|
// $scope.nonStanProtocol = resp.data.path;
|
|
|
// vouchers['nonStanProtocol'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.nonStanProtocolProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.nonStanProtocolProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
//
|
|
|
// $scope.uploadZipPath = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.zipPathProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.zipPathProgress;
|
|
|
// $scope.zipPath = resp.data.path;
|
|
|
// vouchers['zipPath'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.zipPathProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.zipPathProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
|
|
|
$scope.uploadDirectorPassport = function (file) {
|
|
|
if (file != null) {
|
|
|
if (file.size > 3 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$scope.directorPassportProgress = {value: 0};
|
|
|
Upload.upload({
|
|
|
url: '/attachment/yeepayFiles',
|
|
|
data: {file: file}
|
|
|
}).then(function (resp) {
|
|
|
delete $scope.directorPassportProgress;
|
|
|
$scope.directorPassport = resp.data.path;
|
|
|
$scope.directors.filePath = resp.data.path;
|
|
|
merchantId = resp.data.merchantId;
|
|
|
commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
}, function (resp) {
|
|
|
delete $scope.directorPassportProgress;
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
}, function (evt) {
|
|
|
$scope.directorPassportProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
$scope.uploadExecutivePassport = function (file) {
|
|
|
if (file != null) {
|
|
|
if (file.size > 3 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$scope.executivePassportProgress = {value: 0};
|
|
|
Upload.upload({
|
|
|
url: '/attachment/yeepayFiles',
|
|
|
data: {file: file}
|
|
|
}).then(function (resp) {
|
|
|
delete $scope.executivePassportProgress;
|
|
|
$scope.executivePassport = resp.data.path;
|
|
|
$scope.executives.filePath = resp.data.path;
|
|
|
merchantId = resp.data.merchantId;
|
|
|
commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
}, function (resp) {
|
|
|
delete $scope.executivePassportProgress;
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
}, function (evt) {
|
|
|
$scope.executivePassportProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
$scope.saveYeepayApply = function (form) {
|
|
|
$scope.errmsg = null;
|
|
|
if (form.$invalid) {
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
if (key.indexOf('$') < 0) {
|
|
|
item.$dirty = true;
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
// angular.forEach(form, function (item, key) {
|
|
|
// if(item !=null) {
|
|
|
// if(item.$name !=null) {
|
|
|
// merchantInfo[key] = item.$modelValue;
|
|
|
// }
|
|
|
// }
|
|
|
// });
|
|
|
merchantInfo['company_website'] = $scope.subMerchantInfo.company_website;
|
|
|
merchantInfo['abn'] = $scope.subMerchantInfo.abn;
|
|
|
merchantInfo['executives'] = $scope.executives;
|
|
|
merchantInfo['directors'] = $scope.directors;
|
|
|
merchantInfo['business_content'] = $scope.business_content;
|
|
|
merchantInfo['industry'] = $scope.industry;
|
|
|
merchantInfo['merchantId'] = merchantId;
|
|
|
$http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/registYeepaySubMerchantId', merchantInfo).then(function (resp) {
|
|
|
$scope.apply_sub_merchant_id = resp.data;
|
|
|
$scope.$close();
|
|
|
if (subMerchantInfo.yeepay_sub_merchant_id != null) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Modify Yeepay Sub Merchant ID successfully',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Error',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
}]);
|
|
|
|
|
|
app.controller('updateYeepaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state','subMerchantInfo','yeepayIndustryMap','yeepayBusinessContentMap','$filter', 'commonDialog','Upload','subMerchantId', function ($scope, $http, $uibModal, $state,subMerchantInfo,yeepayIndustryMap,yeepayBusinessContentMap,$filter, commonDialog,Upload,subMerchantId) {
|
|
|
$scope.yeepay_industries = yeepayIndustryMap.configs();
|
|
|
$scope.yeepay_business_contents = yeepayBusinessContentMap.configs();
|
|
|
$scope.subMerchantInfo = angular.copy(subMerchantInfo);
|
|
|
var vouchers={};
|
|
|
|
|
|
$scope.directors={};
|
|
|
$scope.executives={};
|
|
|
$scope.industry = '';
|
|
|
$scope.business_content = '';
|
|
|
var merchantInfo = {};
|
|
|
|
|
|
var merchantId = '';
|
|
|
|
|
|
|
|
|
// $scope.uploadLegalIDcardFront = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.legalIDcardFrontProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.legalIDcardFrontProgress;
|
|
|
// $scope.legalIDcardFront = resp.data.path;
|
|
|
// vouchers['legalIDcardFront'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.legalIDcardFrontProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.legalIDcardFrontProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
//
|
|
|
// $scope.uploadLegalIDcardBack = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.legalIDcardBackProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.legalIDcardBackProgress;
|
|
|
// $scope.legalIDcardBack = resp.data.path;
|
|
|
// vouchers['legalIDcardBack'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.legalIDcardBackProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.legalIDcardBackProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
|
|
|
$scope.uploadBusinessLicence = function (file) {
|
|
|
if (file != null) {
|
|
|
if (file.size > 3 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$scope.businessLicenceProgress = {value: 0};
|
|
|
Upload.upload({
|
|
|
url: '/attachment/yeepayFiles',
|
|
|
data: {file: file}
|
|
|
}).then(function (resp) {
|
|
|
delete $scope.businessLicenceProgress;
|
|
|
$scope.businessLicence = resp.data.path;
|
|
|
merchantInfo['business_licence'] = resp.data.path;
|
|
|
merchantId = resp.data.merchantId;
|
|
|
commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
}, function (resp) {
|
|
|
delete $scope.businessLicenceProgress;
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
}, function (evt) {
|
|
|
$scope.businessLicenceProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
// $scope.uploadTaxLevel = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.taxLevelProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.taxLevelProgress;
|
|
|
// $scope.taxLevel = resp.data.path;
|
|
|
// vouchers['taxLevel'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.taxLevelProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.taxLevelProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
|
|
|
// $scope.uploadBankAccountOpen = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.bankAccountOpenProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.bankAccountOpenProgress;
|
|
|
// $scope.bankAccountOpen = resp.data.path;
|
|
|
// vouchers['bankAccountOpen'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.bankAccountOpenProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.bankAccountOpenProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
|
|
|
// $scope.uploadOrgCode = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.orgCodeProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.orgCodeProgress;
|
|
|
// $scope.orgCode = resp.data.path;
|
|
|
// vouchers['orgCode'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.orgCodeProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.orgCodeProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
//
|
|
|
// $scope.uploadNonStanProtocol = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.nonStanProtocolProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.nonStanProtocolProgress;
|
|
|
// $scope.nonStanProtocol = resp.data.path;
|
|
|
// vouchers['nonStanProtocol'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.nonStanProtocolProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.nonStanProtocolProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
//
|
|
|
// $scope.uploadZipPath = function (file) {
|
|
|
// if (file != null) {
|
|
|
// if (file.size > 3 * 1024 * 1024) {
|
|
|
// commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
// } else {
|
|
|
// $scope.zipPathProgress = {value: 0};
|
|
|
// Upload.upload({
|
|
|
// url: '/attachment/yeepayFiles',
|
|
|
// data: {file: file}
|
|
|
// }).then(function (resp) {
|
|
|
// delete $scope.zipPathProgress;
|
|
|
// $scope.zipPath = resp.data.path;
|
|
|
// vouchers['zipPath'] = resp.data.path;
|
|
|
// merchantId = resp.data.merchantId;
|
|
|
// commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
// }, function (resp) {
|
|
|
// delete $scope.zipPathProgress;
|
|
|
// commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
// }, function (evt) {
|
|
|
// $scope.zipPathProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
|
|
|
$scope.uploadDirectorPassport = function (file) {
|
|
|
if (file != null) {
|
|
|
if (file.size > 3 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$scope.directorPassportProgress = {value: 0};
|
|
|
Upload.upload({
|
|
|
url: '/attachment/yeepayFiles',
|
|
|
data: {file: file}
|
|
|
}).then(function (resp) {
|
|
|
delete $scope.directorPassportProgress;
|
|
|
$scope.directorPassport = resp.data.path;
|
|
|
$scope.directors.filePath = resp.data.path;
|
|
|
merchantId = resp.data.merchantId;
|
|
|
commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
}, function (resp) {
|
|
|
delete $scope.directorPassportProgress;
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
}, function (evt) {
|
|
|
$scope.directorPassportProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
$scope.uploadExecutivePassport = function (file) {
|
|
|
if (file != null) {
|
|
|
if (file.size > 3 * 1024 * 1024) {
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
} else {
|
|
|
$scope.executivePassportProgress = {value: 0};
|
|
|
Upload.upload({
|
|
|
url: '/attachment/yeepayFiles',
|
|
|
data: {file: file}
|
|
|
}).then(function (resp) {
|
|
|
delete $scope.executivePassportProgress;
|
|
|
$scope.executivePassport = resp.data.path;
|
|
|
$scope.executives.filePath = resp.data.path;
|
|
|
merchantId = resp.data.merchantId;
|
|
|
commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'})
|
|
|
}, function (resp) {
|
|
|
delete $scope.executivePassportProgress;
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
}, function (evt) {
|
|
|
$scope.executivePassportProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
$scope.updateYeepayApply = function (form) {
|
|
|
$scope.errmsg = null;
|
|
|
if (form.$invalid) {
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
if (key.indexOf('$') < 0) {
|
|
|
item.$dirty = true;
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
// angular.forEach(form, function (item, key) {
|
|
|
// if(item !=null) {
|
|
|
// if(item.$name !=null) {
|
|
|
// merchantInfo[key] = item.$modelValue;
|
|
|
// }
|
|
|
// }
|
|
|
// });
|
|
|
merchantInfo['company_website'] = $scope.subMerchantInfo.company_website;
|
|
|
merchantInfo['abn'] = $scope.subMerchantInfo.abn;
|
|
|
merchantInfo['executives'] = $scope.executives;
|
|
|
merchantInfo['subMerchantId'] = angular.copy(subMerchantId);
|
|
|
merchantInfo['directors'] = $scope.directors;
|
|
|
merchantInfo['business_content'] = $scope.business_content;
|
|
|
merchantInfo['industry'] = $scope.industry;
|
|
|
merchantInfo['merchantId'] = merchantId;
|
|
|
$http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/updateYeepaySubMerchantId', merchantInfo).then(function (resp) {
|
|
|
$scope.apply_sub_merchant_id = resp.data;
|
|
|
$scope.$close();
|
|
|
if (subMerchantInfo.yeepay_sub_merchant_id != null) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Success',
|
|
|
content: 'Update Successfully,Please Wait For Review!',
|
|
|
type: 'success'
|
|
|
});
|
|
|
$state.reload();
|
|
|
}
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({
|
|
|
title: 'Error',
|
|
|
content: resp.data.message,
|
|
|
type: 'error'
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
}]);
|
|
|
|
|
|
|
|
|
app.controller('permissionClientCtrl', ['$scope', '$http', '$uibModal', '$state', '$filter', 'commonDialog', function ($scope, $http, $uibModal, $state, $filter, commonDialog) {
|
|
|
$scope.clientPermission = {client_moniker:$scope.partner.client_moniker};
|
|
|
$scope.loadPermissionList = function () {
|
|
|
var params = angular.copy($scope.clientPermission);
|
|
|
$http.get('/sys/permission/list',{params:params}).then(function (resp) {
|
|
|
$scope.permissionList = resp.data;
|
|
|
}, function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
});
|
|
|
};
|
|
|
$scope.loadPermissionList(1);
|
|
|
$scope.switchValid = function (permission) {
|
|
|
$scope.clientPermission.isValid = permission.is_valid;
|
|
|
var params = angular.copy($scope.clientPermission);
|
|
|
$http.post('/sys/permission/'+permission.id,params).then(function (resp) {
|
|
|
},function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
})
|
|
|
};
|
|
|
|
|
|
$scope.init = function () {
|
|
|
var params = {client_moniker:$scope.partner.client_moniker};
|
|
|
$http.post('/sys/permission/init',params).then(function (resp) {
|
|
|
},function (resp) {
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
|
})
|
|
|
};
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.filter('bdOrg', function () {
|
|
|
return function (bdUsers, org_id) {
|
|
|
if (org_id) {
|
|
|
var bdUserByOrg = {};
|
|
|
var count = 0;
|
|
|
angular.forEach(bdUsers, function (bdUser) {
|
|
|
if (bdUser.org_id == org_id) {
|
|
|
bdUserByOrg[count] = bdUser;
|
|
|
count++;
|
|
|
}
|
|
|
});
|
|
|
return bdUserByOrg;
|
|
|
}
|
|
|
return bdUsers;
|
|
|
}
|
|
|
});
|
|
|
app.filter('wxMerchants', function () {
|
|
|
return function (values) {
|
|
|
var industry = '';
|
|
|
angular.forEach(wxMerchantIndustries, function (wxMerchant) {
|
|
|
if (wxMerchant.value == values) {
|
|
|
industry = wxMerchant.label;
|
|
|
}
|
|
|
});
|
|
|
return industry;
|
|
|
}
|
|
|
});
|
|
|
app.filter('yeepayIndustry', function () {
|
|
|
return function (value) {
|
|
|
switch (value + '') {
|
|
|
case 'ehk100000':
|
|
|
return '货物贸易';
|
|
|
case 'ehk200000':
|
|
|
return '旅游';
|
|
|
case 'ehk300000':
|
|
|
return '文化教育';
|
|
|
case 'ehk400000':
|
|
|
return '服务贸易';
|
|
|
case 'ehk500000':
|
|
|
return '物流';
|
|
|
case 'ehk600000':
|
|
|
return '数字娱乐';
|
|
|
case 'ehk700000':
|
|
|
return '金融保险';
|
|
|
case 'ehk999999':
|
|
|
return '其他';
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
app.filter('yeepayBusinessContent', function () {
|
|
|
return function (value) {
|
|
|
switch (value + '') {
|
|
|
case 'SERVICETRADE':
|
|
|
return '服务贸易';
|
|
|
case 'GOODSTRADE':
|
|
|
return '货物贸易';
|
|
|
case 'OVERSEASTUDY':
|
|
|
return '留学';
|
|
|
case 'HOTELTICKET':
|
|
|
return '酒店机票';
|
|
|
case 'INTTRANSPORT':
|
|
|
return '国际运输';
|
|
|
case 'TOURSERVICE':
|
|
|
return '旅游服务';
|
|
|
case 'INSURANCE':
|
|
|
return '保险';
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
app.filter('bdOrgSelect', function () {
|
|
|
return function (bdUsers, params) {
|
|
|
var org_id;
|
|
|
org_id = params.org_ids || params.org_id || currentUser.org_id;
|
|
|
if (org_id) {
|
|
|
var bdUserByOrg = {};
|
|
|
var count = 0;
|
|
|
angular.forEach(bdUsers, function (bdUser) {
|
|
|
if (params.org_ids) {
|
|
|
if (bdUser.org_id == org_id) {
|
|
|
bdUserByOrg[count] = bdUser;
|
|
|
count++;
|
|
|
}
|
|
|
} else {
|
|
|
if (bdUser.org_id == org_id || bdUser.parent_org_id == org_id) {
|
|
|
bdUserByOrg[count] = bdUser;
|
|
|
count++;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
});
|
|
|
return bdUserByOrg;
|
|
|
}
|
|
|
return bdUsers;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
app.filter('wxindustries', function () {
|
|
|
return function (value) {
|
|
|
switch (value + '') {
|
|
|
case '327':
|
|
|
return '343';
|
|
|
case '339':
|
|
|
return '493';
|
|
|
case '337':
|
|
|
return '492';
|
|
|
case '328':
|
|
|
return '491';
|
|
|
case '362':
|
|
|
case '361':
|
|
|
case '363':
|
|
|
case '329':
|
|
|
return '490';
|
|
|
case '330':
|
|
|
return '489';
|
|
|
case '332':
|
|
|
return '487';
|
|
|
case '334':
|
|
|
return '486';
|
|
|
case '335':
|
|
|
return '485';
|
|
|
case '336':
|
|
|
return '484';
|
|
|
case '338':
|
|
|
case '358':
|
|
|
return '494'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
app.filter('choose_merchant_id', function () {
|
|
|
return function (value) {
|
|
|
switch (value + '') {
|
|
|
case '1307485301':
|
|
|
return '1307485301(Tunnel Show1)';
|
|
|
case '1431999902':
|
|
|
return '1431999902(Tunnel Show2)';
|
|
|
case '1487387142':
|
|
|
return '1487387142(NAP)';
|
|
|
case '':
|
|
|
return ''
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
app.filter('cut', function () {
|
|
|
return function (value, wordwise, max, tail) {
|
|
|
if (!value) return '';
|
|
|
|
|
|
max = parseInt(max, 10);
|
|
|
if (!max) return value;
|
|
|
if (value.length <= max) return value;
|
|
|
|
|
|
value = value.substr(0, max);
|
|
|
if (wordwise) {
|
|
|
var lastspace = value.lastIndexOf(' ');
|
|
|
if (lastspace != -1) {
|
|
|
value = value.substr(0, lastspace);
|
|
|
}
|
|
|
}
|
|
|
return value + (tail || ' …');
|
|
|
};
|
|
|
});
|
|
|
return app;
|
|
|
});
|