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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
| /**
| * 交♂易相关API
| */
|
| import { http, Method } from "@/utils/request.js";
|
| /**
| * 获取购物车列表
| * @param show_type 要显示的类型 all:全部 checked:已选中的
| */
| export function getCarts() {
| return http.request({
| url: `/trade/carts/all`,
| method: Method.GET,
| needToken: true,
| loading: false,
| });
| }
|
| /**
| * 获取购物车总数
| * @param show_type 要显示的类型 all:全部 checked:已选中的
| */
| export function getCartNum() {
| return http.request({
| url: `/trade/carts/count`,
| method: Method.GET,
| needToken: true,
| loading: false,
| });
| }
|
| /**
| * 获取购物车可用优惠券数量
| * @param way 购物车购买:CART/立即购买:BUY_NOW/拼团购买:PINTUAN / 积分购买:POINT
| */
| export function getCartCouponNum(way) {
| return http.request({
| url: `/trade/carts/coupon/num?way=${way}`,
| method: Method.GET,
| needToken: true,
| loading: false,
| });
| }
|
| /**
| * 添加货品到购物车
| * @param skuId 产品ID
| * @param num 产品的购买数量
| * @param cartType 购物车类型,默认加入购物车
| */
| export function addToCart(data) {
| return http.request({
| url: "/trade/carts",
| method: Method.POST,
| needToken: true,
| header: { "content-type": "application/x-www-form-urlencoded" },
| data,
| });
| }
|
|
|
| /**
| * 更新购物车商品数量
| * @param skuId
| * @param num
| */
| export function updateSkuNum(skuId, num = 1) {
| return http.request({
| url: `/trade/carts/sku/num/${skuId}`,
| method: Method.POST,
| header: { "content-type": "application/x-www-form-urlencoded" },
| needToken: true,
| data: { num },
| });
| }
|
| /**
| * 更新购物车货品选中状态
| * @param skuId
| * @param checked
| */
| export function updateSkuChecked(skuId, checked) {
| return http.request({
| url: `/trade/carts/sku/checked/${skuId}`,
| method: Method.POST,
| needToken: true,
| header: { "content-type": "application/x-www-form-urlencoded" },
| data: { checked },
| });
| }
|
| /**
| * 删除多个货品项
| * @param skuIds
| */
| export function deleteSkuItem(skuIds) {
| return http.request({
| url: `/trade/carts/sku/remove?skuIds=${skuIds}`,
| method: Method.DELETE,
| needToken: true,
| });
| }
|
|
| /**
| * 设置全部货品为选中或不选中
| * @param checked
| */
| export function checkAll(checked) {
| return http.request({
| url: "/trade/carts/sku/checked",
| method: Method.POST,
| needToken: true,
| params: { checked },
| });
| }
|
| /**
| * 设置店铺内全部货品选中状态
| * @param storeId
| * @param checked
| */
| export function checkStore(storeId, checked) {
| return http.request({
| url: `/trade/carts/store/${storeId}`,
| method: Method.POST,
| needToken: true,
| header: { "content-type": "application/x-www-form-urlencoded" },
| data: { checked },
| });
| }
|
| /**
| * 获取结算参数
| */
| export function getCheckoutParams(way) {
| return http.request({
| url: "/trade/carts/checked?way=" + way,
| method: Method.GET,
| needToken: true,
| });
| }
|
| /**
| * 设置收货地址ID
| * @param addressId
| */
| export function setAddressId(addressId,way) {
| return http.request({
| url: `/trade/carts/shippingAddress?shippingAddressId=${addressId}&way=${way}`,
| method: Method.GET,
| needToken: true,
|
| });
| }
| /**
| * 设置收货地址ID
| * @param addressId
| */
| export function setStoreAddressId(storeAddressId,way) {
| return http.request({
| url: `/trade/carts/storeAddress?storeAddressId=${storeAddressId}&way=${way}`,
| method: Method.GET,
| needToken: true,
|
| });
| }
|
|
| /**
| * 创建交易
| */
| export function createTrade(params) {
| return http.request({
| url: "/trade/carts/create/trade",
| method: Method.POST,
| needToken: true,
| message: false,
| data:params,
| });
| }
|
|
| /**
| * 根据交易编号或订单编号查询收银台数据
| * @param params
| */
| export function getCashierData(params) {
| return http.request({
| url: "payment/cashier/tradeDetail",
| method: Method.GET,
| needToken: true,
| params,
| });
| }
|
|
| /**
| * 发起支付
| * @param paymentMethod
| * @param paymentClient
| * @param params
| * @returns {*|*}
| */
| export function initiatePay(paymentMethod, paymentClient, params) {
| return http.request({
| url: `payment/cashier/pay/${paymentMethod}/${paymentClient}`,
| method: Method.GET,
| needToken: true,
| params,
| });
| }
|
|
| /**
| * 查询物流
| * @param orderSn
|
| */
| export function getExpress(orderSn) {
| return http.request({
| url: `/order/order/getTraces/${orderSn}`,
| method: Method.POST,
| needToken: true,
|
| });
| }
|
|
| /**
| * 获取当前会员的对于当前商品可使用的优惠券列表
| */
| export function getMemberCanUse(data) {
| return http.request({
| url: `/promotion/coupon/canUse`,
| method: Method.GET,
| params: data,
| });
| }
|
|
|
| /**
| * 获取当前会员的优惠券列表
| */
| export function getMemberCouponList(data) {
| return http.request({
| url: `/promotion/coupon/getCoupons`,
| method: Method.GET,
| params: data,
| });
| }
|
| /**
| * 使用优惠券
|
| */
| export function useCoupon(params) {
| return http.request({
| url: `/trade/carts/select/coupon`,
| method: Method.GET,
| needToken: true,
| params: params,
| });
| }
|
|
| /**
| * 更换参与活动
| * @param params
| */
| export function changeActivity(params) {
| return http.request({
| url: "trade/promotion",
| method: Method.POST,
| needToken: true,
| data: params,
|
| header: { "content-type": "application/x-www-form-urlencoded" },
| });
| }
|
| /**
| * 根据交易单号查询订单列表
| * @param trade_sn
| */
| export function reBuy(sn) {
| return http.request({
| url: `trade/carts/rebuy/${sn}`,
| method: Method.POST,
| needToken: true,
| });
| }
|
|
| /**
| * 获取全部配送方式
| */
| export function shippingMethodList(params) {
| return http.request({
| url: `/trade/carts/shippingMethodList`,
| method: Method.GET,
| needToken: true,
| params: params,
| });
| }
|
| /**
| * 提交配送方式
| * @param params
| */
| export function setShipMethod(params) {
| return http.request({
| url: "/trade/carts/shippingMethod",
| method: Method.PUT,
| needToken: true,
| params,
| });
| }
|
| // 查看包裹列表
| export function getPackage(orderSn) {
| return http.request({
| url: `/order/order/getPackage/${orderSn}`,
| method: Method.GET,
| needToken: true,
| });
| }
|
|