Files
JayuCloud/WeChatProgram/api/cart.js
T

64 lines
2.0 KiB
JavaScript
Raw Normal View History

/**
* 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.
*/
2026-04-01 15:18:35 +08:00
const request = require('../utils/request')
module.exports = {
2026-05-23 18:45:41 +08:00
/**
* 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.
*/
2026-04-01 15:18:35 +08:00
addToCart(data) {
return request({
url: '/cart/add',
method: 'POST',
data
})
},
2026-05-23 18:45:41 +08:00
/**
* 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.
*/
2026-04-01 15:18:35 +08:00
removeFromCart(productId) {
return request({
url: `/cart/remove/${productId}`,
method: 'DELETE'
})
},
2026-05-23 18:45:41 +08:00
/**
* 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.
*/
2026-04-01 15:18:35 +08:00
updateCartQuantity(data) {
return request({
url: '/cart/update',
method: 'PUT',
data
})
},
2026-05-23 18:45:41 +08:00
/**
* 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.
*/
2026-04-01 15:18:35 +08:00
getCartList() {
return request({
url: '/cart/list'
})
},
2026-05-23 18:45:41 +08:00
/**
* 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.
*/
2026-04-01 15:18:35 +08:00
clearCart() {
return request({
url: '/cart/clear',
method: 'DELETE'
})
}
}