orderService.js
1.7 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
/**
* orderService.js
*@author dennis
*@createtime 2018/10/29
*@description 订单相关网络请求
*/
import BaseService from '../../libs/services/baseService'
const CREATE_PAYMENTINFO = 'ufo.order.payment'
const BUYER_GETADDRESS = 'app.address.gethidden'
const BUYER_SUBMIT = 'ufo.order.submit'
const BUYER_PREPAY = 'ufo.order.pay'
const COMPUTE_COMPENSATE = 'ufo.buyer.computeCompensate'
const PRODUCT_RECOMMEND = 'ufo.product.data.search.recommend'
export default class orderService extends BaseService {
constructor(options) {
super(options)
}
async createPaymentInfo(params, complete) {
return await this.GET(
{
...params,
method: CREATE_PAYMENTINFO,
},
{
path: '/shopping',
complete
}
)
}
async buyerGetAddress(params, complete) {
return await this.GET({
...params,
method:BUYER_GETADDRESS
},{
complete
})
}
async buyerSubmit(skup,channelNo='2919',addressId, complete) {
return await this.GET({
method: BUYER_SUBMIT,
skup,
channelNo,
addressId,
},{
path: '/shopping',
complete
})
}
async prePay( orderCode, openId, complete) {
return await this.GET({
orderCode,
openid: openId,
payment: 3,
method:BUYER_PREPAY,
debug: 'XYZ'
},{
path: '/payment',
complete
})
}
async getComputeCompensate(orderCode, complete) {
return await this.GET({
orderCode,
method:COMPUTE_COMPENSATE,
}, {
complete
})
}
async getRecommendList(product_id, complete) {
return await this.GET({
product_id,
method: PRODUCT_RECOMMEND,
},{
complete
})
}
}