|
|
@@ -1,6 +1,6 @@
|
|
|
-define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'service/Make', 'service/Fa', 'service/Account', 'service/Alert', 'ui.router', 'ui.bootstrap' , 'file-upload', 'ngSanitize'], function() {
|
|
|
+define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'service/Make', 'service/Fa', 'service/Account', 'service/Alert', 'service/CheckTel', 'ui.router', 'ui.bootstrap', 'file-upload', 'ngSanitize'], function() {
|
|
|
'use strict';
|
|
|
- var app = angular.module('myApp', [ 'toaster', 'angularCharts', 'ngTable', 'ui.router', 'common.services', 'PurcServices', 'MakeServices', 'FaServices', 'AccountServices', 'AlertServices', 'ui.bootstrap', 'angularFileUpload', 'ngSanitize']);
|
|
|
+ var app = angular.module('myApp', [ 'toaster', 'angularCharts', 'ngTable', 'ui.router', 'common.services', 'PurcServices', 'MakeServices', 'FaServices', 'AccountServices', 'AlertServices', 'ui.bootstrap', 'angularFileUpload', 'ngSanitize', 'CheckTelModule']);
|
|
|
app.init = function() {
|
|
|
angular.bootstrap(document, [ 'myApp' ]);
|
|
|
};
|
|
|
@@ -470,9 +470,35 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
$scope.routeState = routeState || 'home';
|
|
|
});
|
|
|
}]);
|
|
|
- app.controller('AuthCtrl', ['$scope', '$window', 'AuthenticationService', 'toaster', 'BaseService', function($scope, $window, AuthenticationService, toaster, BaseService) {
|
|
|
+ app.controller('AuthCtrl', ['$scope', '$window', 'AuthenticationService', 'toaster', 'BaseService', '$modal', function($scope, $window, AuthenticationService, toaster, BaseService, $modal) {
|
|
|
$scope.isAuthed = AuthenticationService.isAuthed(); //AuthenticationService模块在common/下
|
|
|
- $scope.userInfo = {};
|
|
|
+
|
|
|
+ //手机号码格式验证
|
|
|
+ var checkTel = function(data){
|
|
|
+ var userTel = data.userTel;
|
|
|
+ $scope.checkResult = false;
|
|
|
+ var telephone = /^1[3|4|5|7|8]\d{9}$/;
|
|
|
+ if(!(telephone).test(userTel)){
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: 'static/tpl/index/account/checkTel.html',
|
|
|
+ controller: 'CheckTelCtrl',
|
|
|
+ backdrop: 'static',
|
|
|
+ keyboard: false,
|
|
|
+ resolve: {
|
|
|
+ user: function(){
|
|
|
+ return data;
|
|
|
+ },
|
|
|
+ }
|
|
|
+ });
|
|
|
+ modalInstance.result.then(function(){
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ $scope.checkResult = true;
|
|
|
+ }
|
|
|
+ };
|
|
|
AuthenticationService.getAuthentication().success(function(data) {
|
|
|
if(data.enterprises) {
|
|
|
data.enterprise = data.enterprises[data.enterprises.length - 1];
|
|
|
@@ -491,8 +517,11 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
if (data == null || !data.userUU) {
|
|
|
$scope.isAuthed = false;
|
|
|
$window.location.href = BaseService.getRootPath() + "/signin";
|
|
|
+ } else {
|
|
|
+ //跳转到手机号码验证
|
|
|
+ checkTel($scope.userInfo);
|
|
|
}
|
|
|
- });
|
|
|
+ });
|
|
|
$scope.logout = function() {
|
|
|
AuthenticationService.logout().success(function() {
|
|
|
$window.location.href = BaseService.getRootPath() + "/signin";
|
|
|
@@ -2841,7 +2870,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
$scope.last = function (){
|
|
|
$scope.barData = getPage($scope.barData.next,5);
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
/**
|
|
|
* 更新外箱号
|
|
|
*/
|
|
|
@@ -3985,7 +4014,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
$scope.ifShow = true;
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
if($stateParams.id){
|
|
|
loadData();
|
|
|
@@ -4106,15 +4135,20 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
$scope.condition.dateTo = '';
|
|
|
$scope.condition.venduuorname = '';
|
|
|
$scope.condition.factory = '';
|
|
|
+ $scope.condition.prodTitle = '';
|
|
|
+ $scope.condition.prodSpec = '';
|
|
|
|
|
|
$scope.searchOrder = function(check) {
|
|
|
angular.forEach($scope.data, function(item) {
|
|
|
$scope.checkboxes.checked = false;
|
|
|
item.$selected = false;
|
|
|
});
|
|
|
+ console.log($scope.data);
|
|
|
$scope.totalMoney = 0;
|
|
|
$scope.condition.uuorname = $scope.suuorname;
|
|
|
$scope.condition.factory = $scope.factory
|
|
|
+ $scope.condition.prodTitle = $scope.prodTitle;
|
|
|
+ $scope.condition.prodSpec = $scope.prodSpec;
|
|
|
$scope.condition.dateFrom = ($scope.sdateFrom || 0);
|
|
|
$scope.thisdatato = ($scope.sdateTo || 0);
|
|
|
if($scope.thisdatato != 0) {
|
|
|
@@ -4543,7 +4577,6 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
toaster.pop('error', '失败', reponse.data);
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
$scope.updatePassword = function(){
|
|
|
var modalInstance = $modal.open({
|
|
|
animation: true,
|
|
|
@@ -4570,7 +4603,8 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
});
|
|
|
|
|
|
modalInstance.result.then(function(){
|
|
|
-
|
|
|
+ $scope.userTelSuccess = false;
|
|
|
+ $scope.userTelError = false;
|
|
|
}, function(){
|
|
|
|
|
|
});
|
|
|
@@ -4614,7 +4648,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
$scope.newUserForm.newUserTel.$setValidity('available', true);
|
|
|
$scope.userTelSuccess = true;
|
|
|
$scope.userTelError = false;
|
|
|
- } else {
|
|
|
+ }else{
|
|
|
$scope.newUserForm.newUserTel.$setValidity('available', false);
|
|
|
$scope.userTelError = true;
|
|
|
$scope.userTelSuccess = false;
|
|
|
@@ -4758,6 +4792,89 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
};
|
|
|
}]);
|
|
|
|
|
|
+ // 登录手机号码验证
|
|
|
+ app.controller('CheckTelCtrl', ['$scope', '$modalInstance', 'user', 'AccountUser', 'AuthenticationService', 'SendCheckMsg', 'SessionService', '$timeout', function($scope, $modalInstance, user, AccountUser, AuthenticationService, SendCheckMsg, SessionService, $timeout){
|
|
|
+ $scope.user = user;
|
|
|
+ $scope.cancel = function(){
|
|
|
+ $modalInstance.close();
|
|
|
+ }
|
|
|
+ /*$scope.loading = false;
|
|
|
+ $scope.btnState = false;
|
|
|
+ $scope.clicks = 0;
|
|
|
+ var storage = window.localStorage;
|
|
|
+ //手机验证码定时器
|
|
|
+ $scope.msgInfoError = false;
|
|
|
+ var setBtnTimeDown = function(value) {
|
|
|
+ if(value > 0) {
|
|
|
+ $scope.btnState = true;
|
|
|
+ $timeout(function() {
|
|
|
+ $scope.$apply(function(){
|
|
|
+ storage.setItem("btnTimes", $scope.btnTimes);
|
|
|
+ $scope.btnTimes --;
|
|
|
+ value --;
|
|
|
+ setBtnTimeDown (value);
|
|
|
+ });
|
|
|
+ }, 500);
|
|
|
+ }else{
|
|
|
+ $scope.btnState = false;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ if(storage.btnTimes > 1){
|
|
|
+ $scope.btnTimes = storage.btnTimes;
|
|
|
+ setBtnTimeDown(storage.btnTimes)
|
|
|
+ }else{
|
|
|
+ storage.removeItem("btnTimes");
|
|
|
+ }
|
|
|
+ $scope.updateTel = function(phoneCode, userTel, uu){
|
|
|
+ $scope.loading = true;
|
|
|
+ $scope.msgInfoError = false;
|
|
|
+ $scope.result = false;
|
|
|
+ //更新联系方式
|
|
|
+ AccountUser.updateWithCode({code: phoneCode, tel : userTel, uu: uu},{}, function(data){
|
|
|
+ $scope.loading = false;
|
|
|
+ $scope.msgInfoError2 = false;
|
|
|
+ $scope.result = true;
|
|
|
+ AuthenticationService.getAuthentication().success(function(data) {
|
|
|
+ $timeout(function(){
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ window.location.reload();
|
|
|
+ }, 1000);
|
|
|
+ }).error(function(response) {
|
|
|
+
|
|
|
+ });
|
|
|
+ }, function(response){
|
|
|
+ $scope.loading = false;
|
|
|
+ $scope.msgInfoError2 = response;
|
|
|
+ });
|
|
|
+ };
|
|
|
+ //获取验证码
|
|
|
+ $scope.getPhoneCode = function(userTel){
|
|
|
+ var timeInfo = 10;
|
|
|
+ $scope.clicks ++;
|
|
|
+ $scope.timeInfo = timeInfo;
|
|
|
+ if($scope.clicks >= 5){
|
|
|
+ $scope.errorloading = true;
|
|
|
+ $scope.msgInfoSuccess = false;
|
|
|
+ $scope.msgInfoError = false;
|
|
|
+ }else{
|
|
|
+ $scope.loading = true;
|
|
|
+ SendCheckMsg.sendMsgInfos({userTel: userTel},function(data){
|
|
|
+ $scope.loading = false;
|
|
|
+ $scope.msgInfoSuccess = data.success;
|
|
|
+ $scope.sendMsg = data;
|
|
|
+ $scope.btnTimes = 60;
|
|
|
+ setBtnTimeDown($scope.btnTimes);
|
|
|
+ $scope.msgInfoError = false;
|
|
|
+ },function(response){
|
|
|
+ console.log(response);
|
|
|
+ $scope.loading = false;
|
|
|
+ $scope.msgInfoError = false;
|
|
|
+ $scope.sendCheckMsg = false;
|
|
|
+ $scope.msgInfoSuccess = true;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }; */
|
|
|
+ }]);
|
|
|
app.controller('RemoveVendorCtrl', ['$scope', '$modalInstance', 'user', 'AccountUser', 'toaster', function($scope, $modalInstance, user, AccountUser, toaster){
|
|
|
$scope.checkboxes = {
|
|
|
checked : false
|
|
|
@@ -5911,6 +6028,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
app.controller('CustServeCtrl', ['$scope', 'Vendor', function($scope, Vendor){
|
|
|
Vendor.getServe(function(datas){
|
|
|
$scope.vendors = datas;
|
|
|
+ console.log($scope.Vender);
|
|
|
// 自动跳转
|
|
|
if(datas && datas.length == 1)
|
|
|
$scope.redirect(datas[0]);
|