orders-api.js
903 Bytes
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
var $ = require('yoho-jquery');
var __cacheReason;
require('../../common/promise');
exports.getExpress = function(orderId, type, time) {
return $.get('/home/orders/express', {
orderId: orderId,
payType: type,
time: time
});
};
exports.refund = function(orderId, reasonId, reason) {
return $.get('/home/orders/refund', {
orderId: orderId,
reasonId: reasonId,
reason: reason
});
};
exports.refundReason = function() {
return (function() {
if (__cacheReason) {
return $.resolve(__cacheReason);
}
return $.get('/home/orders/refundreason').then(function(result) {
if (result.code !== 200) {
return $.reject();
}
return (__cacheReason = result);
});
}()).then(function(result) {
return {refundReason: result.data};
});
};