order.js
1.94 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
/**
* 订单.
* @author hgwang
* @date 2016-07-20
*/
'use strict';
const api = global.yoho.API;
// const serviceAPI = global.yoho.ServiceAPI;
const camelCase = global.yoho.camelCase;
/**
* 获取订单列表数据
* @param param
* uid uid,
* page 页数
* type 订单类型 1:全部订单,2:待付款,3:待发货,4:待收货,5:待评论/成功订单,7:失败/取消
* limit 每页大小
* app_type 0:yohobuy,1:blk
* @returns {Promise.<T>|*}
*/
exports.getOrders = (param) => {
param = Object.assign({method: 'app.SpaceOrders.get'}, param);
return api.get('978c6bad6c379086.json', param).then(camelCase);
};
/**
* 获取订单详情
* @param uid
* @param orderCode
* @returns {Promise.<T>|*}
*/
exports.getOrderDetail = (uid, orderCode) => {
return api.get('621e0b505983ac8a.json', {
method: 'app.SpaceOrders.detail',
order_code: orderCode,
uid: uid
}).then(camelCase);
};
/**
* 取消订单
* @param orderCode
* @param reasonId
* @param reason
* @returns {Promise.<T>|*}
*/
exports.cancelOrder = (orderCode, reasonId, reason) => {
return api.get('057f5f856dff8b58.json', {
method: 'app.SpaceOrders.close',
order_code: orderCode,
reason_id: reasonId,
reason: reason
}).then(result => {
return result;
});
};
/**
* 确认订单
* @param orderCode 订单号
* @returns {Promise.<T>|*}
*/
exports.confirmOrder = (orderCode) => {
return api.get('', {
method: 'app.SpaceOrders.confirm',
order_code: orderCode
}).then(result => {
return result;
});
};
/**
* 删除订单
* @param orderCode 订单号
* @param uid uid
* @returns {Promise.<T>|*}
*/
exports.deleteOrder = (orderCode, uid) => {
return api.get('', {
method: 'app.SpaceOrders.delOrderByCode',
order_code: orderCode,
uid: uid
}).then(result => {
return result;
});
};