101 lines
3.3 KiB
JavaScript
101 lines
3.3 KiB
JavaScript
/**
|
|
* Purpose: request supports coupon.js by holding or executing the request page or API role.
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
*/
|
|
const request = require('../utils/request')
|
|
|
|
module.exports = {
|
|
/**
|
|
* Purpose: listCoupons supports coupon.js by holding or executing the list coupons 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.
|
|
*/
|
|
listCoupons(params) {
|
|
return request({
|
|
url: '/coupon/list',
|
|
params
|
|
})
|
|
},
|
|
|
|
/**
|
|
* Purpose: listAllCoupons supports coupon.js by holding or executing the list all coupons 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.
|
|
*/
|
|
listAllCoupons(shopId) {
|
|
return request({
|
|
url: '/coupon/list/all',
|
|
params: shopId ? { shopId } : undefined
|
|
})
|
|
},
|
|
|
|
/**
|
|
* Purpose: getCouponDetail supports coupon.js by holding or executing the get coupon detail 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.
|
|
*/
|
|
getCouponDetail(id) {
|
|
return request({
|
|
url: `/coupon/detail/${id}`
|
|
})
|
|
},
|
|
|
|
/**
|
|
* Purpose: createCoupon supports coupon.js by holding or executing the create coupon 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.
|
|
*/
|
|
createCoupon(data) {
|
|
return request({
|
|
url: '/coupon/create',
|
|
method: 'POST',
|
|
data
|
|
})
|
|
},
|
|
|
|
/**
|
|
* Purpose: updateCoupon supports coupon.js by holding or executing the update coupon 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.
|
|
*/
|
|
updateCoupon(id, data) {
|
|
return request({
|
|
url: `/coupon/update/${id}`,
|
|
method: 'PUT',
|
|
data
|
|
})
|
|
},
|
|
|
|
/**
|
|
* Purpose: deleteCoupon supports coupon.js by holding or executing the delete coupon 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.
|
|
*/
|
|
deleteCoupon(id) {
|
|
return request({
|
|
url: `/coupon/delete/${id}`,
|
|
method: 'DELETE'
|
|
})
|
|
},
|
|
|
|
/**
|
|
* Purpose: assignCoupon supports coupon.js by holding or executing the assign coupon 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.
|
|
*/
|
|
assignCoupon(data) {
|
|
return request({
|
|
url: '/coupon/assign',
|
|
method: 'POST',
|
|
params: data,
|
|
data: {}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* Purpose: distributeCoupon supports coupon.js by holding or executing the distribute coupon 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.
|
|
*/
|
|
distributeCoupon(data) {
|
|
return request({
|
|
url: '/coupon/distribute',
|
|
method: 'POST',
|
|
params: data,
|
|
data: {}
|
|
})
|
|
}
|
|
}
|