重构项目文件夹目录
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Mini program API wrapper for this module.
|
||||
* Call guide: require this module in a page, then invoke the matching method from page event handlers or lifecycle hooks.
|
||||
*/
|
||||
const request = require('../utils/request')
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Purpose: addToCart supports cart.js by holding or executing the add to cart page or API role.
|
||||
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
addToCart(data) {
|
||||
return request({
|
||||
url: '/cart/add',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Purpose: removeFromCart supports cart.js by holding or executing the remove from cart page or API role.
|
||||
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
removeFromCart(productId) {
|
||||
return request({
|
||||
url: `/cart/remove/${productId}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Purpose: updateCartQuantity supports cart.js by holding or executing the update cart quantity page or API role.
|
||||
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
updateCartQuantity(data) {
|
||||
return request({
|
||||
url: '/cart/update',
|
||||
method: 'PUT',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Purpose: getCartList supports cart.js by holding or executing the get cart list page or API role.
|
||||
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
getCartList() {
|
||||
return request({
|
||||
url: '/cart/list'
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Purpose: clearCart supports cart.js by holding or executing the clear cart page or API role.
|
||||
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
clearCart() {
|
||||
return request({
|
||||
url: '/cart/clear',
|
||||
method: 'DELETE'
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user