StoreAccountOrderCheckingController.js
9.9 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
"use strict";
var StoreAccountOrderCheckingController = angular.module('StoreAccountOrderCheckingController',['ngDialog']);
StoreAccountOrderCheckingController.controller('StoreAccountOrderCheckingController', [
'$rootScope',
'$scope',
'StoreAccountOrderCheckingService',
function($rootScope, $scope, StoreAccountOrderCheckingService) {
$scope.accounts=[];
$scope.currentPage = 1;
$scope.pageSize = 15;
$scope.numPages = 1;
$scope.totalRecord = 0;
$scope.choseAtrr=[];
$scope.pages = [];
$scope.master=false;
$scope.order=[];
$scope.accountQuery={
checkingOrderCode:'',
supplierName:'',
auditStatus:'',
settleStartDate:'',
settleEndDate:'',
pageNow:1,
pageSize:10,
};
StoreAccountOrderCheckingService.accountPagerList($scope.accountQuery);
$scope.$on('accounts.list', function(){
$scope.accounts = StoreAccountOrderCheckingService.accounts;
$scope.numPages = StoreAccountOrderCheckingService.accounts.totalPage;
$scope.totalRecord = StoreAccountOrderCheckingService.accounts.totalRecord;
});
//选当前页
$scope.onSelectPage = function(page) {
$scope.accountQuery.pageNow=page;
$scope.currentPage=page;
StoreAccountOrderCheckingService.accountPagerList($scope.accountQuery);
};
$scope.search=function(){
$scope.accountQuery.pageNow=1;
$scope.accountQuery.settleStartDate = $('#settleStartDate').val();
$scope.accountQuery.settleEndDate = $('#settleEndDate').val();
StoreAccountOrderCheckingService.accountPagerList($scope.accountQuery);
}
$scope.chk=function(orderCheckingId,check){
var id =orderCheckingId;
//选中变未选中
if(check){
var index=$scope.choseAtrr.indexOf(id);
$scope.choseAtrr.splice(index,1);
}else{
//未选中变选中
$scope.choseAtrr.push(id);
}
}
$scope.allcheck=function(c){
$scope.x=c;
$scope.choseAtrr=[];
if(!c){
angular.forEach($scope.accounts.datas,function(data){
var id =data.orderCheckingId;
$scope.choseAtrr.push(id);
})
};
}
//确认账单
$scope.verifyOrder=function(orderCheckingId){
if(orderCheckingId){
var id=orderCheckingId;
$scope.choseAtrr=[id];
}
if($scope.choseAtrr.length<=0){
alert("请先选中操作记录");
return;
}
var ids= $scope.choseAtrr.join(";");
var flag=true;
angular.forEach($scope.choseAtrr,function(id){
angular.forEach($scope.accounts.datas,function(data){
if(data.auditStatus !=3&&data.orderCheckingId==id&&flag){
alert("只能确认待确认的账单!");
flag=false;
return;
}
})
})
if(flag){
if(confirm("确定确认账单?")){
StoreAccountOrderCheckingService.verifyOrder(ids,function(){
$scope.master=false;
$scope.choseAtrr=[];
StoreAccountOrderCheckingService.accountPagerList($scope.accountQuery);
});
}
}
};
//导出对账单
$scope.exportCheckingOrder=function(orderCheckingId) {
window.open("../template/exportStoreOrderCheckingExcel/"+orderCheckingId);
};
}
]);
StoreAccountOrderCheckingController.controller('discountsProportionDetailsController', [
'$rootScope',
'$scope',
'StoreAccountOrderCheckingService',
'ngDialog',
function($rootScope, $scope, StoreAccountOrderCheckingService,ngDialog) {
$scope.discountsProportions=[];
$scope.currentPage = 1;
$scope.pageSize = 15;
$scope.numPages = 1;
$scope.totalRecord = 0;
$scope.pages = [];
$scope.master=false;
$scope.dpdQuery={
startAmount:'',
endAmount:'',
startDate:'',
endDate:'',
pageNow:1,
pageSize:10,
};
StoreAccountOrderCheckingService.discountsProportionDetailPager($scope.dpdQuery);
$scope.$on('discountsProportions.list', function(){
$scope.discountsProportions = StoreAccountOrderCheckingService.discountsProportions;
$scope.numPages = StoreAccountOrderCheckingService.discountsProportions.totalPage;
$scope.totalRecord = StoreAccountOrderCheckingService.discountsProportions.totalRecord;
});
//选当前页
$scope.onSelectPage = function(page) {
$scope.dpdQuery.pageNow=page;
$scope.currentPage=page;
StoreAccountOrderCheckingService.discountsProportionDetailPager($scope.dpdQuery);
};
$scope.search=function(){
$scope.dpdQuery.pageNow=1;
$scope.dpdQuery.startDate = $('#startDate').val();
$scope.dpdQuery.endDate = $('#endDate').val();
StoreAccountOrderCheckingService.discountsProportionDetailPager($scope.dpdQuery);
}
$scope.deleteDiscountsProportion=function(id){
if(confirm("确定要删除这条数据吗?")){
StoreAccountOrderCheckingService.deleteDiscountsProportion(id,function(){
StoreAccountOrderCheckingService.discountsProportionDetailPager($scope.dpdQuery);
$scope.$on('discountsProportions.list', function(){
$scope.discountsProportions = StoreAccountOrderCheckingService.discountsProportions;
$scope.numPages = StoreAccountOrderCheckingService.discountsProportions.totalPage;
$scope.totalRecord = StoreAccountOrderCheckingService.discountsProportions.totalRecord;
});
});
}
}
}
]);
StoreAccountOrderCheckingController.controller('editDiscountsProportionController', [
'$rootScope',
'$scope',
'StoreAccountOrderCheckingService',
'BaseService',
function($rootScope, $scope, StoreAccountOrderCheckingService,BaseService) {
var aid = $rootScope.$stateParams.id;
$scope.imageUrl = '';
$scope.editDpdInfo={
id:aid,
startAmount:0,
endAmount:0,
rate:0
};
if(aid){
StoreAccountOrderCheckingService.getDiscountsProportion(aid, function (data) {
$scope.editDpdInfo = data.data;
});
}
$scope.onSubmitDiscountsProportion=function(){
if(isNaN($scope.editDpdInfo.startAmount) || isNaN($scope.editDpdInfo.endAmount)){
BaseService.updateAlert("小主,起始金额与结束金额只能输入数字!");
}else if($scope.editDpdInfo.startAmount<0 || $scope.editDpdInfo.endAmount<0){
BaseService.updateAlert("小主,起始金额与结束金额不能小于0!");
}else if($scope.editDpdInfo.startAmount==0 && $scope.editDpdInfo.endAmount==0){
BaseService.updateAlert("小主,起始金额与结束金额不能全部为0!");
}else if(isNaN($scope.editDpdInfo.rate)){
BaseService.updateAlert("小主,优惠比例只能输入数字!");
}else if($scope.editDpdInfo.rate<0 || $scope.editDpdInfo.rate>100){
BaseService.updateAlert("小主,优惠比例不能小于0或大于100!");
}else {
StoreAccountOrderCheckingService.editDiscountsProportionDetail($scope.editDpdInfo,aid);
}
}
}]
);
StoreAccountOrderCheckingController.controller('createAccountOrderCheckingController', [
'$rootScope',
'$scope',
'StoreAccountOrderCheckingService',
'SysConfigService',
'BaseService',
'SupplierService',
'ngDialog',
function($rootScope, $scope, StoreAccountOrderCheckingService,SysConfigService,BaseService,SupplierService,ngDialog) {
$scope.period = 30;
$scope.period1 = 30;
$scope.suppliers=[];
$scope.orderChecking={
settleStartDate:'',
settleEndDate:'',
supplierId:''
};
//获取商家列表
SupplierService.listSupplier();
$scope.$on('supplier.list',function(){
$scope.suppliers=SupplierService.suppliers;
});
//获取周期
SysConfigService.loanSysConfig();
$scope.$on('sys.period', function () {
if(SysConfigService.period!=null && SysConfigService.period!=""){
$scope.period = SysConfigService.period.content+"号";
$scope.period1 = SysConfigService.period.content;
}
});
$scope.exportOrderChecking = function(){
$scope.orderChecking.settleStartDate = $('#settleStartDate').val();
$scope.orderChecking.settleEndDate = $('#settleEndDate').val();
if($("#datepickfrom").val() !=null && $("#datepickfrom").val() !=""){
if(confirm("小主,生成数据很多,请耐心等待...")) {
window.open("../accOrderCheckingController/createOrderChecking?startDate="+$scope.orderChecking.settleStartDate+
"&endDate="+ $scope.orderChecking.settleEndDate+"&supplierId="+ $scope.orderChecking.supplierId);
}
}else{
BaseService.updateAlert("请选择月份");
}
}
$scope.periodConfiguration= function(){
$scope.flag = prompt("请输入你要配置的周期(号)");
if($scope.flag !=null && $scope.flag !=""){
if(isNaN($scope.flag)){
BaseService.updateAlert("请输入数字");
return false;
}
if(Math.floor($scope.flag) != $scope.flag){
BaseService.updateAlert("请输入整数!");
return false;
}
if($scope.flag <=0){
BaseService.updateAlert("请输入大于0的整数!");
return false;
}
SysConfigService.updatePeriodConfiguration($scope.flag);
}
}
}]
);