lilishop-uniapp/api/goods.js

221 lines
3.9 KiB
JavaScript
Raw Normal View History

2021-05-13 11:03:32 +08:00
/**
* 商品相关API
*/
import { http, Method } from "@/utils/request.js";
/**
* 从ES中获取相关商品品牌名称分类名称及属性
*/
export function getGoodsMessage(goodsId) {
return http.request({
2022-02-10 18:57:17 +08:00
url: `/goods/goods/get/${goodsId}`,
2021-05-13 11:03:32 +08:00
method: Method.GET,
});
}
/**
* 从ES中获取相关商品品牌名称分类名称及属性
*/
export function getGoodsRelated(params) {
return http.request({
2022-02-10 18:57:17 +08:00
url: `/goods/goods/es/related`,
2021-05-13 11:03:32 +08:00
method: Method.GET,
params,
});
}
/**
* 获取商品详情
* @param skuId 商品ID
* @returns {AxiosPromise}
*/
export function getGoods(skuId, goodsId) {
2021-05-13 11:03:32 +08:00
return http.request({
2022-02-10 18:57:17 +08:00
url: `/goods/goods/sku/${goodsId}/${skuId}`,
2021-05-13 11:03:32 +08:00
method: Method.GET,
});
}
/**
* 获取商品分销
* @param distributionId 商品分销ID
*/
export function getGoodsDistribution(distributionId) {
return http.request({
2022-02-12 15:20:48 +08:00
url: `/distribution/distribution/bindingDistribution/${distributionId}`,
method: Method.GET,
});
}
2021-05-13 11:03:32 +08:00
/**
* 获取商品列表
* @param params
* @returns {AxiosPromise}
*/
export function getGoodsList(params) {
return http.request({
2022-02-10 18:57:17 +08:00
url: "/goods/goods/es",
2021-05-13 11:03:32 +08:00
method: Method.GET,
params,
});
}
/**
* 获取上新商品列表
* @param params
* @returns {AxiosPromise}
*/
export function getGoodsListUplog(params) {
return http.request({
url: "goods/search/uplog",
method: Method.GET,
params,
});
}
/**
* 获取标签商品
* @param storeId 卖家id
* @param mark 标签 hot热卖 new新品 recommend推荐
* @param num 获取个数
*/
export function getTagGoods(storeId, mark = "hot", num = 5) {
return http.request({
url: `goods/tags/${mark}/goods`,
method: Method.GET,
loading: false,
params: {
storeId,
mark,
num,
},
});
}
/**
* 获取标签商品
*/
export function getPlateformTagGoods(tag_id) {
return http.request({
url: `goods/tags/byid/${tag_id}`,
method: Method.GET,
loading: false,
});
}
/**
* 获取首页商品分类 左侧列表
* @param parent_id
*/
export function getCategoryList(id) {
return http.request({
2022-02-10 18:57:17 +08:00
url: `/goods/category/get/${id}`,
2021-05-13 11:03:32 +08:00
method: Method.GET,
loading: false,
});
}
/**
* 获取当前会员的分销商信息 可根据分销商信息查询待提现金额以及冻结金额等信息
*/
export function distribution() {
return http.request({
2022-02-12 15:20:48 +08:00
url: `/distribution/distribution`,
2021-05-13 11:03:32 +08:00
method: Method.GET,
});
}
/**
* 申请分销商
*/
export function applyDistribution(params) {
return http.request({
2022-02-12 15:20:48 +08:00
url: `/distribution/distribution`,
2021-05-13 11:03:32 +08:00
method: Method.POST,
params,
});
}
/**
* 分销商提现
*/
export function cash(params) {
return http.request({
url: `/distribution/cash`,
method: Method.POST,
params,
});
}
/**
* 分销商提现历史
*/
export function cashLog(params) {
2021-05-13 11:03:32 +08:00
return http.request({
url: `/distribution/cash`,
method: Method.GET,
params
2021-05-13 11:03:32 +08:00
});
}
/**
* 获取分销商分页订单列表
*/
export function distributionOrderList(params) {
2021-05-13 11:03:32 +08:00
return http.request({
2022-02-12 15:20:48 +08:00
url: `/distribution/distribution/distributionOrder`,
2021-05-13 11:03:32 +08:00
method: Method.GET,
params
2021-05-13 11:03:32 +08:00
});
}
/**
* 获取分销商商品列表
*/
export function distributionGoods(params) {
return http.request({
2022-02-12 15:20:48 +08:00
url: `/distribution/goods`,
2021-05-13 11:03:32 +08:00
method: Method.GET,
params,
});
}
/**
* 选择分销商品 分销商品id
*/
export function checkedDistributionGoods(params) {
2021-05-13 11:03:32 +08:00
return http.request({
2022-02-12 15:20:48 +08:00
url: `/distribution/goods/checked/${params.id}`,
2021-05-13 11:03:32 +08:00
method: Method.GET,
params
2021-05-13 11:03:32 +08:00
});
}
/**
* 获取 小程序码
*/
export function getMpCode(params){
return http.request({
2022-02-12 15:20:48 +08:00
url:`/passport/connect/miniProgram/mp/unlimited`,
2021-05-13 11:03:32 +08:00
method:Method.GET,
params
})
}
/**
* 根据shortlink 获取页面参数
*/
export function getMpScene(id){
return http.request({
2022-02-12 15:20:48 +08:00
url:`/passport/connect/miniProgram/mp/unlimited/scene?id=${id}`,
2021-05-13 11:03:32 +08:00
method:Method.GET,
})
}