feat: harden phase one workflows

This commit is contained in:
王鹏
2026-07-14 16:04:51 +08:00
parent 47f4a24760
commit 767534df48
103 changed files with 4849 additions and 388 deletions

View File

@@ -4,11 +4,21 @@ function listCategories() {
return request({ url: '/api/mini/product-categories' })
}
function listProducts(categoryId) {
function listProducts(categoryId, keyword) {
return request({
url: '/api/mini/products',
data: categoryId ? { categoryId } : {}
})
url: '/api/mini/products/page',
data: buildProductQuery(categoryId, keyword)
}).then((page) => page && page.records ? page.records : [])
}
function buildProductQuery(categoryId, keyword) {
const data = {
pageNo: 1,
pageSize: 20
}
if (categoryId) data.categoryId = categoryId
if (keyword) data.keyword = keyword
return data
}
function getProductDetail(id) {
@@ -26,6 +36,7 @@ function createGoodsOrder(data) {
module.exports = {
listCategories,
listProducts,
buildProductQuery,
getProductDetail,
createGoodsOrder
}