|
|
@ -0,0 +1,884 @@
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Created by yixian on 2016-06-29.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiSelect'], function (angular, Decimal) {
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var removeClientPayDesc = function (items, key) {
|
|
|
|
|
|
|
|
for (var i = 0; i < items.length; i++) {
|
|
|
|
|
|
|
|
var item = items[i];
|
|
|
|
|
|
|
|
if (item.indexOf(key) >= 0) {
|
|
|
|
|
|
|
|
items.splice(items.indexOf(item), 1);
|
|
|
|
|
|
|
|
i = i - 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var app = angular.module('addPartnerApp', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ui.select', 'ngFileUpload']);
|
|
|
|
|
|
|
|
app.config(['$stateProvider', function ($stateProvider) {
|
|
|
|
|
|
|
|
$stateProvider.state('newPartners', {
|
|
|
|
|
|
|
|
url: '/partners/new',
|
|
|
|
|
|
|
|
templateUrl: '/static/payment/partner/templates/add_partner.html',
|
|
|
|
|
|
|
|
controller: 'addPartnerCtrl'
|
|
|
|
|
|
|
|
}).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);
|
|
|
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
app.controller('addPartnerCtrl', ['$rootScope', '$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'businessStructuresMap', 'upayIndustryMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap', function ($rootScope, $scope, $http, $state, Upload, commonDialog, timezone, businessStructuresMap, upayIndustryMap, 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.client_type = 'cross-border';
|
|
|
|
|
|
|
|
$scope.initMerchantCode = function () {
|
|
|
|
|
|
|
|
$http.get('/sys/partners/init/merchant_code').then(function (response) {
|
|
|
|
|
|
|
|
$scope.partner.client_moniker = response.data.partner_code;
|
|
|
|
|
|
|
|
$scope.merchantCodeChecked = true;
|
|
|
|
|
|
|
|
$scope.merchantIsValid = true;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.initMerchantCode();
|
|
|
|
|
|
|
|
$scope.partner.company_phone_c = 61;
|
|
|
|
|
|
|
|
$scope.partner.contact_phone_c = 61;
|
|
|
|
|
|
|
|
$scope.partner.client_pay_type = [];
|
|
|
|
|
|
|
|
$scope.partner.client_pay_desc = [];
|
|
|
|
|
|
|
|
var resetClientPayDescByTpey = function (type) {
|
|
|
|
|
|
|
|
type = parseInt(type);
|
|
|
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
|
|
|
removeClientPayDesc($scope.partner.client_pay_desc, '10');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == 2) {
|
|
|
|
|
|
|
|
removeClientPayDesc($scope.partner.client_pay_desc, '20');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.partner.sameAsContactPerson = false;
|
|
|
|
|
|
|
|
$scope.checkboxOnclick = function (){
|
|
|
|
|
|
|
|
$scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson);
|
|
|
|
|
|
|
|
if($scope.partner.sameAsContactPerson) {
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_person = $scope.partner.contact_person;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_phone_a = $scope.partner.contact_phone_a;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_phone_c = $scope.partner.contact_phone_c;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_phone_p = $scope.partner.contact_phone_p;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_email = $scope.partner.contact_email;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_job = $scope.partner.contact_job;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_wechatid = $scope.partner.contact_wechatid;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.partner.marketingSameAsContact = false;
|
|
|
|
|
|
|
|
$scope.checkMarketingSameAsContact = function (){
|
|
|
|
|
|
|
|
$scope.partner.marketingSameAsContact = !($scope.partner.marketingSameAsContact);
|
|
|
|
|
|
|
|
if($scope.partner.marketingSameAsContact) {
|
|
|
|
|
|
|
|
$scope.partner.marketing_person = $scope.partner.contact_person;
|
|
|
|
|
|
|
|
$scope.partner.marketing_phone_a = $scope.partner.contact_phone_a;
|
|
|
|
|
|
|
|
$scope.partner.marketing_phone_c = $scope.partner.contact_phone_c;
|
|
|
|
|
|
|
|
$scope.partner.marketing_phone_p = $scope.partner.contact_phone_p;
|
|
|
|
|
|
|
|
$scope.partner.marketing_email = $scope.partner.contact_email;
|
|
|
|
|
|
|
|
$scope.partner.marketing_job = $scope.partner.contact_job;
|
|
|
|
|
|
|
|
$scope.partner.marketing_wechatid = $scope.partner.contact_wechatid;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.partner.sameAsAddress=false;
|
|
|
|
|
|
|
|
$scope.sameAddress = function (){
|
|
|
|
|
|
|
|
$scope.partner.sameAsAddress = !($scope.partner.sameAsAddress);
|
|
|
|
|
|
|
|
if($scope.partner.sameAsAddress) {
|
|
|
|
|
|
|
|
$scope.partner.registered_address = $scope.partner.address;
|
|
|
|
|
|
|
|
$scope.partner.registered_suburb = $scope.partner.suburb;
|
|
|
|
|
|
|
|
$scope.partner.registered_postcode = $scope.partner.postcode;
|
|
|
|
|
|
|
|
$scope.partner.registered_state = $scope.partner.state;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var compare = function (x, y) {
|
|
|
|
|
|
|
|
x = parseInt(x);
|
|
|
|
|
|
|
|
y = parseInt(y);
|
|
|
|
|
|
|
|
if (x < y) {
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
} else if (x > y) {
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.toggleClientPayType = function (type) {
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_type == null || $scope.partner.client_pay_type == undefined) {
|
|
|
|
|
|
|
|
$scope.partner.client_pay_type = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var $idx = $scope.partner.client_pay_type.indexOf(type);
|
|
|
|
|
|
|
|
if ($idx >= 0) {
|
|
|
|
|
|
|
|
$scope.partner.client_pay_type.splice($idx, 1);
|
|
|
|
|
|
|
|
resetClientPayDescByTpey(type);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$scope.partner.client_pay_type.push(type);
|
|
|
|
|
|
|
|
$scope.partner.client_pay_type.sort(compare);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.toggleClientPayDesc = function (type) {
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_desc == null || $scope.partner.client_pay_desc == undefined) {
|
|
|
|
|
|
|
|
$scope.partner.client_pay_desc = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var $idx = $scope.partner.client_pay_desc.indexOf(type);
|
|
|
|
|
|
|
|
if ($idx >= 0) {
|
|
|
|
|
|
|
|
if (type == '203') {
|
|
|
|
|
|
|
|
removeClientPayDesc($scope.partner.client_pay_desc, '2030')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.partner.client_pay_desc.splice($idx, 1);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$scope.partner.client_pay_desc.push(type);
|
|
|
|
|
|
|
|
$scope.partner.client_pay_desc.sort(compare);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.pagination = {};
|
|
|
|
|
|
|
|
$scope.industries = industryMap.configs();
|
|
|
|
|
|
|
|
$scope.upayIndustrys = upayIndustryMap.configs();
|
|
|
|
|
|
|
|
$scope.states = stateMap.configs();
|
|
|
|
|
|
|
|
$scope.countries = countryMap.configs();
|
|
|
|
|
|
|
|
$scope.sectors = sectorMap.configs();
|
|
|
|
|
|
|
|
$scope.business_structures = businessStructuresMap.configs();
|
|
|
|
|
|
|
|
$scope.params = {textType: 'all', org_name: 'ALL'};
|
|
|
|
|
|
|
|
$scope.merchantIsValid = false;
|
|
|
|
|
|
|
|
$scope.merchantCodeChecked = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.loadLakalaPayindustry = function () {
|
|
|
|
|
|
|
|
$http.get('/static/data/lakalapayindustry.json').then(function (resp) {
|
|
|
|
|
|
|
|
$scope.lakalapayindustry = resp.data;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.loadLakalaPayindustry();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.loadLakalaPaySettle = function () {
|
|
|
|
|
|
|
|
$http.get('/static/data/lakalapaysettle.json').then(function (resp) {
|
|
|
|
|
|
|
|
$scope.lakalapaysettle = resp.data;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.loadLakalaPaySettle();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.loadLakalaPayGoods = function () {
|
|
|
|
|
|
|
|
$http.get('/static/data/lakalapaygoods.json').then(function (resp) {
|
|
|
|
|
|
|
|
$scope.lakalapaygoods = resp.data;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.loadLakalaPayGoods();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$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.checkMerchantCodeIsValid = function (code) {
|
|
|
|
|
|
|
|
if (code.length != 4) {
|
|
|
|
|
|
|
|
$scope.merchantCodeChecked = false;
|
|
|
|
|
|
|
|
$scope.merchantIsValid = false;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$http.get('/sys/partners/init/check_code_isvalid', {params: {clientMoniker: code}}).then(function (response) {
|
|
|
|
|
|
|
|
$scope.merchantIsValid = response.data;
|
|
|
|
|
|
|
|
$scope.merchantCodeChecked = true;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$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;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_phone = '+' + $scope.partner.legal_representative_phone_c + ( $scope.partner.legal_representative_phone_a || '') + $scope.partner.legal_representative_phone_p;
|
|
|
|
|
|
|
|
$scope.partner.marketing_phone = '+' + $scope.partner.marketing_phone_c + ( $scope.partner.marketing_phone_a || '') + $scope.partner.marketing_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.legal_representative_phone.indexOf(' ') != -1) {
|
|
|
|
|
|
|
|
alert('Representative phone can not contain space character');
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($scope.partner.marketing_phone.indexOf(' ') != -1) {
|
|
|
|
|
|
|
|
alert('Marketing 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.legal_representative_email.indexOf(' ') != -1) {
|
|
|
|
|
|
|
|
alert('Representative email Phone can not contain space character');
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($scope.partner.marketing_email && $scope.partner.marketing_email.indexOf(' ') != -1) {
|
|
|
|
|
|
|
|
alert('Marketing 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.registered_suburb.indexOf(' ') != -1) {
|
|
|
|
|
|
|
|
alert('Registered 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.client_pay_type.indexOf('2') >= 0) {
|
|
|
|
|
|
|
|
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 ($scope.partner.client_pay_type.length == 0) {
|
|
|
|
|
|
|
|
alert('请选择商户支付场景')
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_desc.length == 0) {
|
|
|
|
|
|
|
|
alert('请选择商户支付方式')
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof ($scope.partner.client_pay_type) == 'string' || typeof ($scope.partner.client_pay_desc) == 'string') {
|
|
|
|
|
|
|
|
$scope.partner.client_pay_type = $scope.partner.client_pay_type.split(",");
|
|
|
|
|
|
|
|
$scope.partner.client_pay_desc = $scope.partner.client_pay_desc.split(",");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_type.indexOf('1') >= 0) {
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) {
|
|
|
|
|
|
|
|
alert("请检查线上支付场景是否已选择支付方式");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_type.indexOf('2') >= 0) {
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) {
|
|
|
|
|
|
|
|
alert("请检查线下支付场景是否已选择支付方式");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) {
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0 && $scope.partner.client_pay_desc.join(',').indexOf('20399') < 0) {
|
|
|
|
|
|
|
|
alert("请检查线下支付是否已选择收银系统类型");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.partner.client_pay_type = $scope.partner.client_pay_type.join(',');
|
|
|
|
|
|
|
|
$scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(',');
|
|
|
|
|
|
|
|
$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('partnerEditCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'partner','upayIndustryMap',
|
|
|
|
|
|
|
|
function ($scope, $http, $state, Upload, commonDialog, timezone, partner,upayIndustryMap) {
|
|
|
|
|
|
|
|
$scope.upayIndustrys = upayIndustryMap.configs();
|
|
|
|
|
|
|
|
$scope.timezones = timezone.configs();
|
|
|
|
|
|
|
|
$scope.partner = partner.data;
|
|
|
|
|
|
|
|
if (!$scope.partner.client_type) {
|
|
|
|
|
|
|
|
$scope.partner.client_type = 'cross-border';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if($scope.partner.representativeInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$scope.partner.registered_address = $scope.partner.representativeInfo.address;
|
|
|
|
|
|
|
|
$scope.partner.registered_suburb = $scope.partner.representativeInfo.suburb;
|
|
|
|
|
|
|
|
$scope.partner.registered_postcode = $scope.partner.representativeInfo.postcode;
|
|
|
|
|
|
|
|
$scope.partner.registered_state = $scope.partner.representativeInfo.state;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_person = $scope.partner.representativeInfo.representative_person;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_phone = $scope.partner.representativeInfo.phone;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_email = $scope.partner.representativeInfo.email;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_job = $scope.partner.representativeInfo.job_title;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.partner.marketing_person = $scope.partner.representativeInfo.marketing_person;
|
|
|
|
|
|
|
|
$scope.partner.marketing_phone = $scope.partner.representativeInfo.marketing_phone;
|
|
|
|
|
|
|
|
$scope.partner.marketing_email = $scope.partner.representativeInfo.marketing_email;
|
|
|
|
|
|
|
|
$scope.partner.marketing_job = $scope.partner.representativeInfo.marketing_job_title;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_wechatid = $scope.partner.representativeInfo.legal_representative_wechatid;
|
|
|
|
|
|
|
|
$scope.partner.marketing_wechatid = $scope.partner.representativeInfo.marketing_wechatid;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function hasRole() {
|
|
|
|
|
|
|
|
var rolenum;
|
|
|
|
|
|
|
|
switch (sessionStorage.getItem('role')) {
|
|
|
|
|
|
|
|
case "administrator":
|
|
|
|
|
|
|
|
rolenum = 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "bduser":
|
|
|
|
|
|
|
|
rolenum = 4;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "salesmanager":
|
|
|
|
|
|
|
|
rolenum = 8192;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "accountant":
|
|
|
|
|
|
|
|
rolenum = 8;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "sitemanager":
|
|
|
|
|
|
|
|
rolenum = 128;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "director":
|
|
|
|
|
|
|
|
rolenum = 64;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "developer":
|
|
|
|
|
|
|
|
rolenum = 256;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "compliance":
|
|
|
|
|
|
|
|
rolenum = 2;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "guest":
|
|
|
|
|
|
|
|
rolenum = 2048;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "orgmanager":
|
|
|
|
|
|
|
|
rolenum = 4096;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "riskmanager":
|
|
|
|
|
|
|
|
rolenum = 1024;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((window.currentUser.role & rolenum) >0) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
sessionStorage.removeItem('role');
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (hasRole()) {
|
|
|
|
|
|
|
|
$scope.role = sessionStorage.getItem('role');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var origin_referrer_id = angular.copy($scope.partner.referrer_id);
|
|
|
|
|
|
|
|
var resetClientPayDescByTpey = function (type) {
|
|
|
|
|
|
|
|
type = parseInt(type);
|
|
|
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
|
|
|
removeClientPayDesc($scope.partner.client_pay_desc, '10');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == 2) {
|
|
|
|
|
|
|
|
removeClientPayDesc($scope.partner.client_pay_desc, '20');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
var compare = function (x, y) {
|
|
|
|
|
|
|
|
x = parseInt(x);
|
|
|
|
|
|
|
|
y = parseInt(y);
|
|
|
|
|
|
|
|
if (x < y) {
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
} else if (x > y) {
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.toggleClientPayType = function (type) {
|
|
|
|
|
|
|
|
if (!$scope.partner.client_pay_type) {
|
|
|
|
|
|
|
|
$scope.partner.client_pay_type = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var $idx = $scope.partner.client_pay_type.indexOf(type);
|
|
|
|
|
|
|
|
if ($idx >= 0) {
|
|
|
|
|
|
|
|
$scope.partner.client_pay_type.splice($idx, 1);
|
|
|
|
|
|
|
|
resetClientPayDescByTpey(type);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$scope.partner.client_pay_type.push(type);
|
|
|
|
|
|
|
|
$scope.partner.client_pay_type.sort(compare);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.toggleClientPayDesc = function (type) {
|
|
|
|
|
|
|
|
if (!$scope.partner.client_pay_desc) {
|
|
|
|
|
|
|
|
$scope.partner.client_pay_desc = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var $idx = $scope.partner.client_pay_desc.indexOf(type);
|
|
|
|
|
|
|
|
if ($idx >= 0) {
|
|
|
|
|
|
|
|
if (type == '203') {
|
|
|
|
|
|
|
|
removeClientPayDesc($scope.partner.client_pay_desc, '2030')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.partner.client_pay_desc.splice($idx, 1);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$scope.partner.client_pay_desc.push(type);
|
|
|
|
|
|
|
|
$scope.partner.client_pay_desc.sort(compare);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.partner.sameAsContactPerson = false;
|
|
|
|
|
|
|
|
$scope.checkboxOnclick = function (){
|
|
|
|
|
|
|
|
$scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson);
|
|
|
|
|
|
|
|
if($scope.partner.sameAsContactPerson) {
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_person = $scope.partner.contact_person;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_phone = $scope.partner.contact_phone;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_email = $scope.partner.contact_email;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_job = $scope.partner.contact_job;
|
|
|
|
|
|
|
|
$scope.partner.legal_representative_wechatid = $scope.partner.contact_wechatid;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.partner.marketingSameAsContact = false;
|
|
|
|
|
|
|
|
$scope.checkMarketingSameAsContact = function (){
|
|
|
|
|
|
|
|
$scope.partner.marketingSameAsContact = !($scope.partner.marketingSameAsContact);
|
|
|
|
|
|
|
|
if($scope.partner.marketingSameAsContact) {
|
|
|
|
|
|
|
|
$scope.partner.marketing_person = $scope.partner.contact_person;
|
|
|
|
|
|
|
|
$scope.partner.marketing_phone = $scope.partner.contact_phone;
|
|
|
|
|
|
|
|
$scope.partner.marketing_email = $scope.partner.contact_email;
|
|
|
|
|
|
|
|
$scope.partner.marketing_job = $scope.partner.contact_job;
|
|
|
|
|
|
|
|
$scope.partner.marketing_wechatid = $scope.partner.contact_wechatid;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.partner.sameAsAddress=false;
|
|
|
|
|
|
|
|
$scope.sameAddress = function (){
|
|
|
|
|
|
|
|
$scope.partner.sameAsAddress=!($scope.partner.sameAsAddress);
|
|
|
|
|
|
|
|
if($scope.partner.sameAsAddress) {
|
|
|
|
|
|
|
|
$scope.partner.registered_address = $scope.partner.address;
|
|
|
|
|
|
|
|
$scope.partner.registered_suburb = $scope.partner.suburb;
|
|
|
|
|
|
|
|
$scope.partner.registered_postcode = $scope.partner.postcode;
|
|
|
|
|
|
|
|
$scope.partner.registered_state = $scope.partner.state;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$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.loadLakalaPayindustry = function () {
|
|
|
|
|
|
|
|
$http.get('/static/data/lakalapayindustry.json').then(function (resp) {
|
|
|
|
|
|
|
|
$scope.lakalapayindustry = resp.data;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.loadLakalaPayindustry();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.loadLakalaPaySettle = function () {
|
|
|
|
|
|
|
|
$http.get('/static/data/lakalapaysettle.json').then(function (resp) {
|
|
|
|
|
|
|
|
$scope.lakalapaysettle = resp.data;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.loadLakalaPaySettle();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.loadLakalaPayGoods = function () {
|
|
|
|
|
|
|
|
$http.get('/static/data/lakalapaygoods.json').then(function (resp) {
|
|
|
|
|
|
|
|
$scope.lakalapaygoods = resp.data;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.loadLakalaPayGoods();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$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.client_pay_type.indexOf('2') >= 0) {
|
|
|
|
|
|
|
|
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 ($scope.partner.client_pay_type.length == 0) {
|
|
|
|
|
|
|
|
alert('请选择商户支付场景')
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_desc.length == 0) {
|
|
|
|
|
|
|
|
alert('请选择商户支付方式')
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_type.indexOf('1') >= 0) {
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) {
|
|
|
|
|
|
|
|
alert("请检查线上支付场景是否已选择支付方式");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_type.indexOf('2') >= 0) {
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) {
|
|
|
|
|
|
|
|
alert("请检查线下支付场景是否已选择支付方式");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) {
|
|
|
|
|
|
|
|
if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0 && $scope.partner.client_pay_desc.join(',').indexOf('20399') < 0) {
|
|
|
|
|
|
|
|
alert("请检查线下支付是否已选择收银系统类型");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.partner.client_pay_type = $scope.partner.client_pay_type.join(',');
|
|
|
|
|
|
|
|
$scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(',');
|
|
|
|
|
|
|
|
$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 () {
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
return app;
|
|
|
|
|
|
|
|
});
|