修复运营后台处理自助申请通过时无法编辑商户号的问题

master
PeiYY 4 years ago
parent d06cb3afa6
commit 7562cbcfb3

@ -46,6 +46,8 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.states = stateMap.configs(); $scope.states = stateMap.configs();
$scope.countries = countryMap.configs(); $scope.countries = countryMap.configs();
$scope.params = {}; $scope.params = {};
$scope.merchantIsValid = false;
$scope.merchantCodeChecked = false;
$scope.loadPartners = function (page) { $scope.loadPartners = function (page) {
var params = angular.copy($scope.params); var params = angular.copy($scope.params);
@ -57,18 +59,25 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
}; };
$scope.linkButton = function (obj) { $scope.linkButton = function (obj) {
var partner = angular.copy(obj); var partner = angular.copy(obj);
partner.link = true; $http.get('/sys/partners/init/merchant_code').then(function (response) {
$uibModal.open({ partner.client_moniker = response.data.partner_code;
templateUrl: '/static/payment/partner/templates/partner_application_pass.html', console.log('partner.client_moniker',partner.client_moniker)
controller: 'passApplicationCtrl', console.log('partner',partner)
resolve: { $scope.merchantCodeChecked = true;
partner: partner $scope.merchantIsValid = true;
} partner.link = true;
}).result.then(function () { $uibModal.open({
commonDialog.alert({title: 'Success', content: '关联成功!', type: 'success'}); templateUrl: '/static/payment/partner/templates/partner_application_pass.html',
$state.reload(); controller: 'passApplicationCtrl',
// $state.go('partner_application.detail', {client_apply_id: obj.client_apply_id}, {reload: true}); resolve: {
}) partner: partner
}
}).result.then(function () {
commonDialog.alert({title: 'Success', content: '关联成功!', type: 'success'});
$state.reload();
// $state.go('partner_application.detail', {client_apply_id: obj.client_apply_id}, {reload: true});
})
});
}; };
$scope.loadPartners(1); $scope.loadPartners(1);
@ -177,6 +186,8 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
}]); }]);
app.controller('passApplicationCtrl', ['$scope', '$http', '$state', 'partner', function ($scope, $http, $state, partner) { app.controller('passApplicationCtrl', ['$scope', '$http', '$state', 'partner', function ($scope, $http, $state, partner) {
$scope.partner = angular.copy(partner); $scope.partner = angular.copy(partner);
$scope.merchantCodeChecked = false;
$scope.merchantIsValid = false;
$scope.submit = function (form) { $scope.submit = function (form) {
if (form.$invalid) { if (form.$invalid) {
angular.forEach(form, function (item, key) { angular.forEach(form, function (item, key) {
@ -198,6 +209,28 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
}); });
//$rootScope.partner_application = $scope.client; //$rootScope.partner_application = $scope.client;
}; };
$scope.initMerchantCode=function(){
$http.get('/sys/partners/init/merchant_code').then(function (response) {
$scope.partner.client_moniker = response.data.partner_code;
console.log('refresh',$scope.partner.client_moniker)
$scope.merchantCodeChecked = true;
$scope.merchantIsValid = true;
});
};
$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.link = function (form) { $scope.link = function (form) {
if (form.$invalid) { if (form.$invalid) {
angular.forEach(form, function (item, key) { angular.forEach(form, function (item, key) {

@ -7,13 +7,16 @@
<form name="partnerForm" novalidate> <form name="partnerForm" novalidate>
<div class="form-group" <div class="form-group"
ng-class="{'has-error':partnerForm.client_moniker.$invalid && partnerForm.client_moniker.$dirty}"> ng-class="{'has-error':partnerForm.client_moniker.$invalid && partnerForm.client_moniker.$dirty}">
<label class="control-label col-sm-6" for="short-id-input">Partner Code(4 Letters or <label class="control-label col-sm-4" for="short-id-input">* Partner Code(4 Letters or
Numbers)</label> Numbers)</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input class="form-control text-uppercase" ng-model="partner.client_moniker" <input class="form-control text-uppercase"
ng-model="partner.client_moniker"
type="text" type="text"
name="client_moniker" name="client_moniker"
id="short-id-input" required maxlength="4" ng-pattern="/^[a-zA-Z0-9]+$/"> id="short-id-input" required maxlength="4" ng-pattern="/^[a-zA-Z0-9]+$/"
ng-change="checkMerchantCodeIsValid(partner.client_moniker)">
<p class="small text-info">No further changeable!</p> <p class="small text-info">No further changeable!</p>
<div ng-messages="partnerForm.client_moniker.$error" <div ng-messages="partnerForm.client_moniker.$error"
ng-if="partnerForm.client_moniker.$dirty"> ng-if="partnerForm.client_moniker.$dirty">
@ -23,6 +26,11 @@
Numbers are allowed</p> Numbers are allowed</p>
</div> </div>
</div> </div>
<a style="display: inline-block" role="button" ng-click="initMerchantCode(partner)"><i class="fa fa-refresh" title="Refreshes the partner code"></i></a>
<span ng-if="merchantCodeChecked">
<i ng-if="merchantIsValid" class="fa fa-check-square-o check-i" aria-hidden="true" style="float: none;padding-left: 20px"></i>
<i ng-if="!merchantIsValid" class="text-danger fa fa-close" style="float: none;padding-left: 20px"></i>
</span>
</div> </div>
</form> </form>
</div> </div>

Loading…
Cancel
Save