Files
yshopb2c-uniapp/api/store.js

162 lines
2.5 KiB
JavaScript
Raw Normal View History

2020-03-15 13:59:43 +08:00
import request from "@/utils/request";
/*
* 商品分类
* */
export function getCategory() {
2020-04-06 17:18:09 +08:00
return request.get("/category", {}, {
login: false
});
2020-03-15 13:59:43 +08:00
}
/*
* 商品详情
* */
2020-04-06 17:18:09 +08:00
export function getProductDetail(id, data) {
return request.get("/product/detail/" + id, data, {
login: true
});
2020-03-15 13:59:43 +08:00
}
/*
* 商品分销二维码
* */
export function getProductCode(id) {
2020-04-06 17:18:09 +08:00
return request.get("/product/code/" + id, {}, {
login: true
});
2020-03-15 13:59:43 +08:00
}
/*
* 商品列表
* */
export function getProducts(q) {
2020-04-06 17:18:09 +08:00
return request.get("/products", q, {
login: false
});
2020-03-15 13:59:43 +08:00
}
/*
* 购物车数量
* */
export function getCartNum() {
2020-04-06 17:18:09 +08:00
return request.get("/cart/count");
2020-03-15 13:59:43 +08:00
}
/*
* 添加收藏
* */
export function toCollect(id, category) {
2020-04-06 17:18:09 +08:00
return request.get("/collect/add/" + id + "/" + category);
2020-03-15 13:59:43 +08:00
}
/*
* 为你推荐
* */
export function getHostProducts(page, limit) {
2020-04-06 17:18:09 +08:00
return request.get(
"/product/hot", {
page: page,
limit: limit
}, {
login: false
}
);
2020-03-15 13:59:43 +08:00
}
/*
* 精品热门首发列表
* */
export function getGroomList(type) {
2020-04-06 17:18:09 +08:00
return request.get("/groom/list/" + type, {}, {
login: false
});
2020-03-15 13:59:43 +08:00
}
/*
* 购物车 添加
* */
export function postCartAdd(data) {
2020-04-06 17:18:09 +08:00
return request.post("/cart/add", data);
2020-03-15 13:59:43 +08:00
}
/*
* 购物车列表
* */
export function getCartList() {
2020-04-06 17:18:09 +08:00
return request.get("/cart/list");
2020-03-15 13:59:43 +08:00
}
/*
* 购物车 删除
* */
export function postCartDel(ids) {
2020-04-06 17:18:09 +08:00
return request.post("/cart/del", {
ids
});
2020-03-15 13:59:43 +08:00
}
/*
* 购物车 获取数量
* */
export function getCartCount(data) {
2020-04-06 17:18:09 +08:00
return request.get("/cart/count", data);
2020-03-15 13:59:43 +08:00
}
/*
* 购物车 修改商品数量
* */
export function changeCartNum(id, number) {
2020-04-06 17:18:09 +08:00
return request.post("/cart/num", {
id,
number
});
2020-03-15 13:59:43 +08:00
}
/**
* 搜索推荐关键字
*/
export function getSearchKeyword() {
2020-04-06 17:18:09 +08:00
return request.get("/search/keyword", {}, {
login: false
});
2020-03-15 13:59:43 +08:00
}
/**
* 产品评论列表
*/
export function getReplyList(id, q) {
2020-04-06 17:18:09 +08:00
return request.get("/reply/list/" + id, q, {
login: true
});
2020-03-15 13:59:43 +08:00
}
/**
* 产品评价数量和好评度
*/
export function getReplyConfig(id) {
2020-04-06 17:18:09 +08:00
return request.get("/reply/config/" + id, {}, {
login: true
});
2020-03-15 13:59:43 +08:00
}
/**
* 评价页面获取单个产品详情
*/
export function postOrderProduct(unique) {
2020-04-06 17:18:09 +08:00
return request.post("/order/product", {
unique
}, {
login: true
});
2020-03-15 13:59:43 +08:00
}
/**
* 提交评价页面
*/
export function postOrderComment(data) {
2020-04-06 17:18:09 +08:00
return request.post("/order/comment", data, {
login: true
});
}