order.js
1.16 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
const api = global.yoho.API;
const camelCase = global.yoho.camelCase;
const _getUserOrder = () => {
return api.get('', {
method: 'app.SpaceOrders.get',
uid: '10931021',
type: 1,
page: 1,
limit: 10
}).then(result => {
const orderList = result && result.data && result.data.order_list || [];
return camelCase(orderList);
});
};
const getOrderData = () => {
return _getUserOrder().then(result => {
const fakeData = {
title: '我的订单',
tabs: [
{
text: '全部订单',
isActive: true,
type: 'all'
},
{
text: '待付款',
type: 'paying'
},
{
text: '待发货',
type: 'delivering'
}
],
showSearch: true
};
const order = Object.assign(fakeData, {
orderList: result
});
return {
order: order
};
});
};
module.exports = {
getOrderData: getOrderData
};