setSms.js
1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(function (angular) {
function setSms($scope,aiNicheService,DTOptionsBuilder, $uibModal,$uibModalInstance,$sce,SweetAlertX) {
$scope.cnotifySwitch='';
$scope.cnotifySwitch = 2;
$scope.collisionPhone = '';
function getCurrentUserInfo() {
aiNicheService.getCurrentUserMerchantConfig(function(response) {
if(response.data) {
$scope.cnotifySwitch = response.data.cnotifySwitch;
$scope.collisionPhone = response.data.collisionPhone;
}
});
}
getCurrentUserInfo();
//保存
$scope.ok = function () {
if($scope.smsSetForm.$valid) {
var obj = {
collisionPhone:$scope.collisionPhone,
cnotifySwitch:$scope.cnotifySwitch
};
aiNicheService.saveOrUpdateConfig(obj, function(result){
if (result.returnCode == '0') {
SweetAlertX.alert('', '设置成功', 'success');
$uibModalInstance.close(result);
} else {
SweetAlertX.alert(result.message || '', '设置失败', 'error');
}
});
}else{
$scope.smsSetForm.submitted = true;
}
};
//关闭
$scope.cancel = function () {
// $uibModalInstance.dismiss('cancel');
/*关闭后返回true给前一页面*/
$uibModalInstance.close();
};
}
angular.module('AIniche').controller('setSms', setSms);
})(angular);