storeListCtrl.js
2.11 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
(function (angular) {
function storeListCtrl($scope, $rootScope, $state, toaster, routeConfig, DTColumnBuilder, DTOptionsBuilder, $uibModal, $http, Utils,financeService,parentData,$uibModalInstance) {
console.log(parentData)
let query = parentData.data;
// 列表数据
$scope.staticList = []
// 月份
$scope.monthList = []
$scope.staticTime = query.time||'';
// 获取本年度所有的月份,截止到当前月
let getMonth = function(){
let o = new Date();
let y = o.getFullYear();
let m = o.getMonth()+1;
let arr = [];
for(var i=m;i>=1;i--){
let k = {
name:y + '年' + i + '月',
id:i.toString()
}
arr.push(k);
}
$scope.monthList = arr;
//$scope.staticTime = arr[0].id
}
// 关闭弹框
$scope.closeDialog = function(){
$uibModalInstance.dismiss(0);
}
// 获取时间参数
function getTimes(){
let oParams = {};
let o = $scope.staticTime;
let d = new Date();
if(o){
let s = d.getFullYear() + '-' + (o<10?'0' + o:o) + '-01 00:00:01'
let e = d.getFullYear() + '-' + (o<10?'0' + o:o) + '-31 23:59:59'
oParams.payStartDateStr = s;
oParams.payEndDateStr = e;
}
return oParams
}
// 获取统计数据
$scope.getStatic = function(){
let oParams = getTimes();
financeService.getFinanceStatic(oParams,function(res){
let obj = res.data||{};
let list = obj.countList||[]
list.map(k => {
k.name = k.shopMerchantName;
k.number = k.nums;
return k;
})
$scope.staticList = list;
})
}
// 初始化
$scope.init = function(){
getMonth();
$scope.getStatic();
}
$scope.init();
}
angular.module('finance').controller('storeListCtrl', storeListCtrl);
})(angular);