cmc-web/packages/api/system/coupon.js

68 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

2024-08-20 12:11:31 +00:00
/**
* Created by HaijunZhang on 2019/7/23.
*/
import { request } from '@cmp/cmp-element'
import { wrapperParams } from 'utils'
const baseUrl = '/cos/v1/promotions'
export function getPromotions(params) {
return request.get(baseUrl, {
params
})
}
export function getPromotionsDetail(id) {
return request.get(`${baseUrl}/${id}`)
}
export function createPromotions(params) {
return request.post(baseUrl, wrapperParams(params))
}
export function modifyPromotions(params) {
return request.put(`${baseUrl}/${params.id}`, wrapperParams(params))
}
export function removePromotions(id) {
return request.delete(`${baseUrl}/${id}`)
}
export function assignPromotionsTenant(id, params) {
return request.post(`${baseUrl}/${id}/coupons`, wrapperParams(params))
}
export function conditionPromotions(params) {
return request.get(baseUrl, { params })
}
export function patchPromotions(action, id) {
return request.patch(`${baseUrl}/${id}`, {
action: action
})
}
export function getHistoryPromotions(params, id) {
return request.get(`/cos/v1/promotions/${id}/auditrecords`, {
params: params
})
}
const couponsUrl = '/cos/v1/coupons'
export function getCoupons(params) {
return request.get(couponsUrl, {
params
})
}
export function getCouponsDetail(id) {
return request.get(`${couponsUrl}/${id}`)
}
export function createCoupons(params) {
return request.post(couponsUrl, wrapperParams(params))
}
export function modifyCoupons(params) {
return request.put(`${couponsUrl}/${params.id}`, wrapperParams(params))
}
export function removeCoupons(id) {
return request.delete(`${couponsUrl}/${id}`)
}
export function conditionCoupons(params) {
return request.get(couponsUrl, { params })
}