orderService.js
2.99 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/**
* 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'
const CREATE_OFFLINE_PAYMENTINFO = 'ufo.order.offlinePayment';
const STORE_BUYER_SUBMIT = 'ufo.order.offlineSubmit'
const ORDER_SELECT_COUPON = 'ufo.order.selectCoupon'
const ORDER_COMPUTE = 'ufo.order.compute'
const ORDER_OFFLINE_COMPUTE = 'ufo.order.offlineCompute'
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 createOfflinePayment(params, complete) {
return await this.GET({
...params,
method: CREATE_OFFLINE_PAYMENTINFO
}, {
path: '/shopping',
complete
})
}
async buyerGetAddress(params, complete) {
return await this.GET({
...params,
method: BUYER_GETADDRESS
}, {
complete
})
}
async buyerSubmit({ skup, channelNo = '2919', addressId, couponCode, complete, promotionId, extra = {}} ) {
return await this.GET(Object.assign({
method: BUYER_SUBMIT,
skup,
channelNo,
addressId,
promotionId,
coupon_code: couponCode || '',
app_version: '1'
}, extra), {
path: '/shopping',
complete
})
}
async storeBuyerSubmit(params,complete){
return await this.GET({
method: STORE_BUYER_SUBMIT,
...params
}, {
path: '/shopping',
complete
})
}
async prePay(orderCode, openId, complete) {
return await this.GET({
orderCode,
openid: openId,
payment: 3,
method: BUYER_PREPAY,
}, {
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
})
}
async orderSelectCoupon(skup, complete) {
return await this.GET({
skup,
method: ORDER_SELECT_COUPON,
}, {
path: '/shopping',
complete
})
}
async orderOfflineCompute(params, complete) {
return await this.GET({
...params,
method: ORDER_OFFLINE_COMPUTE,
}, {
path: '/shopping',
complete
})
}
async orderCompute(params, complete) {
return await this.GET({
...params,
method: ORDER_COMPUTE,
}, {
path: '/shopping',
complete
})
}
}