wechatQrcodeCreateCtrl.js 1.52 KB
(function (angular) {
    function wechatQrcodeCreateCtrl($scope, params, $http, $uibModalInstance, $uibModal,systemService,$filter,$rootScope) {
    	$scope.typeList = [{id:'Y',name:'永久'},{id:'N',name:'临时'}];
    	$scope.wechatConfigList = [];
		$scope.init = function(){
			systemService.listWechatConfig({appType:'BIZ'},function(res){
    			if(res.returnCode == 0){
    				$scope.wechatConfigList = res.data;
    			}
    		});
		};
		$scope.init();
		
    	
        $scope.ok = function () {
    		if($scope.creatForm.$invalid){
                $scope.isInValidate = true;
                return false;
            }
    		var params = {};
    		params.wechatAppid = $scope.wechatConfig.wechatAppid;
    		params.remark = $scope.info.remark;
    		params.number = $scope.info.number;
    		params.permanent = $scope.info.permanent.id;
    		if(params.permanent == 'N'){
    			params.expireSeconds = $scope.info.expireSeconds;
    		}
    		systemService.createWechatQrcode(params,function(res){
    			if(res.returnCode == 0){
    				swal({type: 'success',title: '',text: '创建成功',showConfirmButton:false,timer: 1500},function(){
                        window.sweetAlert.close();
                        $uibModalInstance.close();
                    });
    			}else{
    				swal({type: 'error',title: '',text: res.message||'操作失败',timer: 1500},function(){window.sweetAlert.close();});
    			}
    		});
        };
    }
    angular.module('system').controller('wechatQrcodeCreateCtrl', wechatQrcodeCreateCtrl);

})(angular);