OrderService.js
3.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
"use strict";
var OrderService = angular.module('OrderService',[]);
OrderService.service("OrderService", [
'$rootScope',
'BaseService',
function ($rootScope,BaseService) {
var _service = {
orders:[],
orderDetailBean:[],
orderPagerList:function(queryParam){
BaseService.request({
url:BaseService.url.orderPager_url,
method:'post',
mark:true,
data:queryParam,
fn:function(response) {
if(response.code == 0) {
_service.orders = response.data;
$rootScope.$broadcast('orders.list');
}
}
});
},
orderErrorPagerList:function(queryParam){
BaseService.request({
url:BaseService.url.orderErroePager_url,
method:'post',
mark:true,
data:queryParam,
fn:function(response) {
if(response.code == 0) {
_service.orders = response.data;
$rootScope.$broadcast('orders.error');
}
}
});
},
orderDetail:function(orderCode){
BaseService.request({
url:BaseService.url.orderDetail_url+orderCode,
method:'POST',
mark:true,
fn:function(response) {
if(response.code == 0) {
_service.orderDetailBean = response.data;
$rootScope.$broadcast('orders.detail');
}
}
});
},
getOrderDetailById:function(memberId, orderId){
BaseService.request({
url:BaseService.url.getOrderDetail_url+"?memberId="+memberId+"&orderId="+orderId,
method:'GET',
mark:true,
fn:function(response) {
if(response.code == 0) {
_service.orderDetailBean = response.data;
$rootScope.$broadcast('order.detail');
}
}
});
},
verifyOrder:function(ids,callback){
BaseService.request({
url:BaseService.url.verify_order_url,
method:'POST',
data:{"ids":ids},
fn:function(response){
if(response.code == 0){
callback();
}else{
BaseService.updateAlert(response.message,response.code);
}
}
});
},
statusList:function(orderType){
BaseService.request({
url:BaseService.url.order_status_url+"/"+orderType,
method:'post',
mark:true,
fn:function(response) {
if(response.code == 0) {
_service.orderStatusList = response.data;
$rootScope.$broadcast('orders.orderStatusList');
}
}
});
},
modifyExpress:function(code,code2,expressName,orderCode,orderStatus){
BaseService.request({
url:BaseService.url.order_modify_url,
method:'post',
mark:true,
data:{"expressCode":code,"expressCode2":code2,"orderCode":orderCode,'orderStatus':orderStatus,'expressName':expressName},
fn:function(response) {
if(response.code==0){
window.location.reload();
}
BaseService.updateAlert(response.message,response.code)
}
});
},
refundOrderHandle:function(orderCode, orderStatus) {
BaseService.request({
url:BaseService.url.refund_order_handle_url,
method:'post',
mark:true,
data:{"orderCode":orderCode,"orderStatus":orderStatus},
fn:function(response) {
BaseService.updateAlert(response.message,response.code)
}
});
},
updateOrderGoods:function(editOrder1Info,orderCode) {
BaseService.request({
url:BaseService.url.update_order_goods_url+orderCode,
method:'post',
mark:true,
data:editOrder1Info,
fn:function(response) {
BaseService.updateAlert(response.message,response.code)
}
});
},
addOrderGoods:function(editOrder1Info,orderCode,callback){
BaseService.request({
url:BaseService.url.add_order_goods_url+orderCode,
method:'post',
mark:true,
data:editOrder1Info,
fn:function(data) {
BaseService.updateAlert(data.message,data.code);
if(callback) {
callback.call(this, data);
}
}
});
}
};
return _service;
}]);