parent
6ca6628c12
commit
b164e32641
@ -0,0 +1,134 @@
|
||||
define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiSelect'], function (angular) {
|
||||
'use strict';
|
||||
var app = angular.module('simpleApplyApp', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload', 'ui.select']);
|
||||
app.config(['$stateProvider', function ($stateProvider) {
|
||||
$stateProvider.state('partner_apply.simple_application', {
|
||||
url: '/simple/applications',
|
||||
templateUrl: '/static/payment/partner/templates/simple_applications.html',
|
||||
controller: 'simpleApplicationListCtrl',
|
||||
data: {label: '商户自主申请列表'}
|
||||
}).state('partner_apply.apply_detail', {
|
||||
url: '/{client_pre_apply_id}/detail',
|
||||
templateUrl: '/static/payment/partner/templates/simple_application_detail.html',
|
||||
controller: 'simpleApplicationDetailCtrl',
|
||||
resolve: {
|
||||
client_pre_apply_id: ['$stateParams', function ($stateParams) {
|
||||
return $stateParams.client_pre_apply_id;
|
||||
}],
|
||||
index: ['$stateParams', function ($stateParams) {
|
||||
return 0;
|
||||
}]
|
||||
}
|
||||
}).state('partner_apply.handle_detail', {
|
||||
url: '/{client_pre_apply_id}/handle',
|
||||
templateUrl: '/static/payment/partner/templates/simple_application_detail.html',
|
||||
controller: 'simpleApplicationDetailCtrl',
|
||||
resolve: {
|
||||
client_pre_apply_id: ['$stateParams', function ($stateParams) {
|
||||
return $stateParams.client_pre_apply_id;
|
||||
}],
|
||||
index: ['$stateParams', function ($stateParams) {
|
||||
return 1;
|
||||
}]
|
||||
}
|
||||
})
|
||||
}]);
|
||||
app.controller('simpleApplicationListCtrl', ['$scope', '$state', '$http', '$uibModal', 'commonDialog', 'industryMap', 'stateMap','countryMap',
|
||||
function ($scope, $state, $http, $uibModal, commonDialog) {
|
||||
$scope.pagination = {};
|
||||
$scope.params = {};
|
||||
$scope.removeStatus = function () {
|
||||
if($scope.params.status){
|
||||
delete $scope.params.status;
|
||||
}
|
||||
};
|
||||
$scope.loadSimpleApplies = function (page) {
|
||||
var params = angular.copy($scope.params);
|
||||
params.page = page || $scope.pagination.page || 1;
|
||||
$http.get('/register/manage', {params: params}).then(function (resp) {
|
||||
$scope.applies = resp.data.data;
|
||||
$scope.pagination = resp.data.pagination;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.loadSimpleApplies(1);
|
||||
}]);
|
||||
|
||||
app.controller('simpleApplicationDetailCtrl', [ '$scope', '$http', '$state', '$uibModal', 'commonDialog','client_pre_apply_id','index', function ($scope, $http, $state, $uibModal, commonDialog,client_pre_apply_id,index) {
|
||||
$scope.pagination = {};
|
||||
$scope.index = index;
|
||||
$scope.params = {client_pre_apply_id:client_pre_apply_id};
|
||||
$scope.loadDetail = function () {
|
||||
$http.get('/register/manage/getOne/' + client_pre_apply_id).then(function (resp) {
|
||||
$scope.partner = resp.data;
|
||||
});
|
||||
};
|
||||
$scope.loadHandleLogs = function (page) {
|
||||
var params = angular.copy($scope.params);
|
||||
params.page = page || $scope.pagination.page || 1;
|
||||
$http.get('/register/manage/log',{params:params}).then(function (resp) {
|
||||
$scope.handleLogs = resp.data.data;
|
||||
$scope.pagination = resp.data.pagination
|
||||
});
|
||||
};
|
||||
$scope.loadDetail(1);
|
||||
$scope.loadHandleLogs();
|
||||
|
||||
$scope.addHandleLog = function () {
|
||||
$uibModal.open({
|
||||
templateUrl: '/static/payment/partner/templates/add_handle_log.html',
|
||||
controller: 'addHandleDetailCtrl',
|
||||
resolve:{
|
||||
client_pre_apply_id:function () {
|
||||
return $scope.partner.client_pre_apply_id;
|
||||
}}
|
||||
}).result.then(function () {
|
||||
$scope.loadHandleLogs(1);
|
||||
commonDialog.alert({title: 'Success', type: 'success'});
|
||||
})
|
||||
};
|
||||
|
||||
$scope.closeHandleLog = function () {
|
||||
commonDialog.confirm({title: 'Confirm', content: '确定此次处理已结束?'
|
||||
}).then(function () {
|
||||
$http.put('/register/manage/'+ client_pre_apply_id).then(function (resp) {
|
||||
commonDialog.alert({title: 'Success', type: 'Success'});
|
||||
$scope.loadHandleLogs(1);
|
||||
},function (resp) {
|
||||
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
||||
})
|
||||
})
|
||||
}
|
||||
}]);
|
||||
|
||||
app.controller('addHandleDetailCtrl', [ '$scope', '$http', '$state', 'client_pre_apply_id', 'commonDialog',function ($scope, $http, $state, client_pre_apply_id, commonDialog) {
|
||||
$scope.handleDetail = {client_pre_apply_id:client_pre_apply_id};
|
||||
$scope.addHandleLog = function () {
|
||||
$http.put('/register/manage', $scope.handleDetail).then(function (resp) {
|
||||
$scope.$close();
|
||||
},function (resp) {
|
||||
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
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;
|
||||
});
|
Loading…
Reference in new issue