StoreController.js
4.8 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
"use strict";
var storeController = angular.module('storeController',[]);
storeController.controller('storeController', [
'$state',
'$rootScope',
'$scope',
'StoreService',
function($state,$rootScope, $scope, StoreService) {
$scope.stores=[];
StoreService.storePager();
$scope.$on('store.list',function(){
$scope.stores=StoreService.stores.datas;
});
}]
);
storeController.controller('editStoreController', [
'$rootScope',
'$scope',
'StoreService',
function($rootScope, $scope, StoreService) {
$scope.imageUrl = '';
$scope.editStoreInfo={
contact:'',
contactPhone:'',
name:'',
freightRemark:'',
headImg:'',
address:''
};
StoreService.getStoreDetail(function (data) {
$scope.editStoreInfo = data.data;
$scope.imageUrl = $scope.editStoreInfo.headImg;
});
$scope.onSubmitStore=function(){
$scope.editStoreInfo.headImg=$scope.imageUrl;
StoreService.editStore($scope.editStoreInfo);
}
}]
);
storeController.controller('storeRefundAddressController', [
'$rootScope',
'$scope',
'StoreService',
function($rootScope, $scope, StoreService) {
$scope.storeId = $rootScope.$stateParams.storeId;
$scope.currentPage = 1;
$scope.numPages = 1;
$scope.pageSize = 20;
$scope.totalRecord = 0;
$scope.pages = [];
$scope.storeRefundAddressList=[];
$scope.storeRefundAddressQuery={
storeId: $scope.storeId,
storeName:'',
contact:'',
contactPhone:'',
address:'',
pageNow:1,
pageSize:20
};
StoreService.storeRefundAddressPager($scope.storeRefundAddressQuery);
$scope.$on('storeRefundAddress.list',function(){
$scope.storeRefundAddressList=StoreService.storeRefundAddressList.datas;
$scope.numPages=StoreService.storeRefundAddressList.totalPage;
$scope.totalRecord=StoreService.storeRefundAddressList.totalRecord;
});
//选当前页
$scope.onSelectPage = function(page) {
$scope.storeRefundAddressQuery.pageNow=page;
$scope.currentPage=page;
StoreService.storeRefundAddressPager($scope.storeRefundAddressQuery);
};
$scope.searchStoreRefundAddress=function(){
$scope.storeRefundAddressQuery.pageNow=1;
StoreService.storeRefundAddressPager($scope.storeRefundAddressQuery);
};
$scope.deleteStoreRefundAddress=function(id){
if(confirm("小主,确定要删除该条数据吗?")){
StoreService.deleteStoreRefundAddress(id,function() {
StoreService.storeRefundAddressPager($scope.storeRefundAddressQuery);
$scope.$on('storeRefundAddress.list',function(){
$scope.storeRefundAddressList=StoreService.storeRefundAddressList.datas;
$scope.numPages=StoreService.storeRefundAddressList.totalPage;
$scope.totalRecord=StoreService.storeRefundAddressList.totalRecord;
});
})
}
}
}]
);
storeController.controller('editStoreRefundAddressController', [
'$rootScope',
'$scope',
'StoreService',
function($rootScope, $scope, StoreService) {
$scope.stores=[];
var addressId = $rootScope.$stateParams.addressId;
$scope.editStoreRefundAddressInfo={
id:'',
supplierId:'',
contact:'',
contactPhone:'',
address:'',
refundStandardRemark:'',
addressId:addressId
};
if(addressId!==''){
StoreService.getStoreRefundAddressDetail(addressId,function (data) {
$scope.editStoreRefundAddressInfo = data.data;
});
}
function getStoreName(){
if($scope.stores&&$scope.stores.length){
var type = $scope.editStoreRefundAddressInfo.storeId;
var list = $scope.stores;
for(var i=0;i<list.length;i++){
if(list[i]['id'] == type){
$scope.storeObj = $scope.stores[i];
break;
}
if(type == '') {
$scope.storeObj = null;
break;
}
}
}
}
StoreService.listStore();
$scope.$on('store.list',function(){
$scope.stores=StoreService.stores;
getStoreName();
});
$scope.onSubmitStoreRefundAddress=function(){
StoreService.editStoreRefundAddress($scope.editStoreRefundAddressInfo);
}
}]
);