index.js
1.01 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
let apiUrl = {
brand: '/platform/getSellerBrandInfo',
sort: '/platform/getSellerSortInfo',
color: '/platform/querySellerProductColors',
size: '/platform/querySortSize'
};
const request = require('axios');
function getBrand(shopId) {
return request.get(apiUrl.brand, {
params: {
shopsId:shopId
}
}).then((result) => result.data)
}
function getSort(shopId, brandId, level , sortId) {
let opts = {
shopsId: shopId,
brandId: brandId,
level: level
};
if (sortId) {
Object.assign(opts, {sortId});
}
return request.get(apiUrl.sort, {
params: opts
}).then((result) => result.data);
}
function getColor() {
return request.get(apiUrl.color).then((result) => result.data)
}
function getSize(smallSortId) {
return request.get(apiUrl.size, {
params: {
sortId: smallSortId
}
}).then(result => result.data)
}
export default {
getBrand,
getSort,
getColor,
getSize
}