returns-api.js
5.03 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
/**
* 退换货API
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2016/9/05
*/
'use strict';
const api = global.yoho.API;
/**
* 获取订单退货信息
*/
const getRefundGoodsAsync = (orderCode, uid) => {
return api.get('', {
method: 'app.refund.goodsList',
order_code: orderCode,
uid: uid
}, {code: 200});
};
/**
* 获取退货详情
*/
const getRefundDetailAsync = (id, uid) => {
return api.get('', {
method: 'app.refund.detail',
id: id,
uid: uid
}, {code: 200});
};
/**
* 获取换货详情
*/
const getChangeDetailAsync = (id, uid) => {
return api.get('', {
method: 'app.change.detail',
id: id,
uid: uid
}, {code: 200});
};
/**
* 获取订单换货信息
*/
const getExchangeGoodsAsync = (orderCode, uid) => {
return api.get('', {
method: 'app.change.goodsList',
order_code: orderCode,
uid: uid
}, {code: 200});
};
/**
* 获取商品信息
*/
const getProductDataAsync = (skn) => {
return api.get('', {
method: 'app.product.data',
product_skn: skn
}, {code: 200});
};
/**
* 快递公司列表
*/
const getExpressCompanyAsync = () => {
return api.get('', {
method: 'app.express.getExpressCompany'
}, {code: 200});
};
/**
* 取消退货申请
* @param $id
* @param $uid
* @return mixed
*/
const cancelRefundAsync = (id, uid) =>{
let options = {
method: 'app.refund.cancel',
id: id,
uid: uid
};
return api.post('', options);
};
/**
* 取消换货申请
* @param $id
* @param $uid
* @return mixed
*/
const cancelChangeAsync = (id, uid) =>{
let options = {
method: 'app.change.cancel',
id: id,
uid: uid
};
return api.post('', options);
};
/**
* 设置快递
* @param $id
* @param $expressId
* @param $expressNumber
* @param $uid
* @param $expressCompany
* @param $isChange
* @return mixed
*/
const setExpressNumberAsync = (id, expressId, expressNumber, uid, expressCompany, isChange) =>{
let options = {
method: isChange ? 'app.change.setexpress' : 'app.refund.setexpress',
id: id,
express_id: expressId,
express_number: expressNumber,
uid: uid,
express_company: expressCompany
};
return api.post('', options);
};
/**
* save退货申请
* @param $orderCode
* @param $uid
* @param $goods
* @param $payment
* @return mixed
*/
const refundSubmit = (orderCode, uid, goods, payment) =>{
let options = {
method: 'app.refund.submit',
order_code: orderCode,
uid: uid,
goods: goods,
payment: payment
};
return api.post('', options);
};
/**
* save换货申请
* @param $orderCode
* @param $goods
* @param $consigneeName
* @param $areaCode
* @param $address
* @param $mobile
* @param $zipCode
* @param $deliveryType
* @param $uid
* @return mixed
*/
const exchangeSubmit = (orderCode, goods, consigneeName, areaCode, address, mobile, zipCode, deliveryType, uid) =>{
let options = {
method: 'app.change.submit',
order_code: orderCode,
uid: uid,
goods: goods,
consignee_name: consigneeName,
area_code: areaCode,
address: address,
mobile: mobile,
zip_code: zipCode,
delivery_tpye: deliveryType
};
return api.post('', options);
};
/**
* 获取换货方式
* @param $uid
* @param $areaCode
* @param $gender
* @param $yhChannel
* @return mixed
*/
const getDeliveryAsync = (areaCode, uid, gender, channel) => {
let options = {
method: 'app.change.getDelivery',
uid: uid,
area_code: areaCode,
gender: gender,
yh_channel: channel
};
return api.post('', options);
};
/**
* 发送站内信
* @param int $uid
* @param string $title
* @param int $content
* @param int $type
* @param string $verify_key
* @param int $send_uid
* @param string $call_back
* @return array
*/
const sendMessage = (uid, title, content, type, verifyKey, sendUid) =>{
let options = {
method: 'web.inbox.setSingleMessage',
uid: uid,
send_uid: sendUid || 0,
verify_key: verifyKey || '',
content: content,
title: title,
type: type || 1
};
return api.post('', options);
};
/**
* [退货结算]
* @param {[type]} uid [uid]
* @param {[type]} orderCode [订单号]
* @param {[type]} goods [商品详细]
* @return {[type]} [{}]
*/
const refundComputeAsync = (uid, orderCode, goods) => {
let options = {
method: 'app.refund.compute',
order_code: orderCode,
uid: uid,
goods: goods
};
return api.get('', options);
};
module.exports = {
getRefundGoodsAsync,
refundSubmit,
exchangeSubmit,
sendMessage,
getRefundDetailAsync,
getExchangeGoodsAsync,
getChangeDetailAsync,
getProductDataAsync,
getExpressCompanyAsync,
cancelRefundAsync,
cancelChangeAsync,
getDeliveryAsync,
setExpressNumberAsync,
refundComputeAsync
};