orderDetail.js
2.06 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
'use strict';
const api = global.yoho.API;
const _ = require('lodash');
const orderDetail = (params) => {
let finalResult = {};
return api.get('', _.assign({
method: 'app.SpaceOrders.detail'
}, params), {code: 200}).then((result) => {
if (params.order_code && params.uid && params.sessionKey) {
if (result.data) {
Object.assign(finalResult, {
virtual_type: result.data.virtual_type,
phoneNum: result.data.mobile,
orderStatus: result.data.status_str,
orderNum: result.data.order_code,
orderTime: result.data.create_time,
isPay: result.data.payment_status === 'Y',
relation: result.data.relate_order_code === 'Y' ? 'true' : 'false',
name: result.data.user_name,
isVirtual: false,
mobile: '15999999999',
address: result.data.address,
logisticsUrl: '#',
logisticsCompany: '顺丰',
logisticsNum: '111111',
yohoCoin: result.data.yoho_give_coin,
invoice: [{
title: '有货',
contentValue: '有货',
pdfUrl: '#'
}, {
title: '有货',
contentValue: '有货',
pdfUrl: '#'
}],
orderBalance: [{
promotion: '商品总金额',
account: '100.00'
}, {
promotion: '运费',
account: '10.00'
}],
price: result.data.amount
});
}
}
return finalResult;
});
};
module.exports = {
orderDetail
};