add point redemption
This commit is contained in:
+66
-2
@@ -7,11 +7,20 @@ import type {
|
||||
PointLedger,
|
||||
PointLedgerPage,
|
||||
PointRule,
|
||||
GroovyScript
|
||||
GroovyScript,
|
||||
PointRedeemSku,
|
||||
PointRedeemSkuPage,
|
||||
PointRedemption,
|
||||
PointRedemptionCreateRequest,
|
||||
PointRedemptionPage,
|
||||
PointRedemptionReturn,
|
||||
PointRedemptionReturnRequest
|
||||
} from "@/types/Point";
|
||||
import { getCurrentStoreId, withCurrentStoreId, withCurrentStorePage } from "@/utils/store";
|
||||
|
||||
const BASE_URI = "/gao/customer/point";
|
||||
const REDEEM_SKU_URI = "/gao/point/redeem-sku";
|
||||
const REDEMPTION_URI = "/gao/point/redemption";
|
||||
|
||||
type ListOptions = {
|
||||
allStores?: boolean;
|
||||
@@ -118,6 +127,50 @@ async function ruleRemove(id: string): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
async function redeemSkuList(page: PointRedeemSkuPage): Promise<PageResult<PointRedeemSku>> {
|
||||
return await axios.post(`${REDEEM_SKU_URI}/list`, { ...page, storeId: page.storeId || getCurrentStoreId() });
|
||||
}
|
||||
|
||||
async function redeemSkuDetail(id: string, storeId?: string): Promise<PointRedeemSku> {
|
||||
return await axios.post(`${REDEEM_SKU_URI}/detail`, undefined, { params: { id, storeId: storeId || getCurrentStoreId() || undefined } });
|
||||
}
|
||||
|
||||
async function redeemSkuCreate(item: PointRedeemSku): Promise<PointRedeemSku> {
|
||||
return await axios.post(`${REDEEM_SKU_URI}/create`, withCurrentStoreId(item));
|
||||
}
|
||||
|
||||
async function redeemSkuUpdate(item: PointRedeemSku): Promise<PointRedeemSku> {
|
||||
return await axios.post(`${REDEEM_SKU_URI}/update`, item);
|
||||
}
|
||||
|
||||
async function redeemSkuDisable(id: string): Promise<void> {
|
||||
await axios.post(`${REDEEM_SKU_URI}/disable`, undefined, { params: { id, storeId: getCurrentStoreId() || undefined } });
|
||||
}
|
||||
|
||||
async function redeemSkuRemove(id: string): Promise<void> {
|
||||
await axios.post(`${REDEEM_SKU_URI}/delete`, undefined, { params: { id, storeId: getCurrentStoreId() || undefined } });
|
||||
}
|
||||
|
||||
async function redemptionList(page: PointRedemptionPage): Promise<PageResult<PointRedemption>> {
|
||||
return await axios.post(`${REDEMPTION_URI}/list`, { ...page, storeId: page.storeId || getCurrentStoreId() });
|
||||
}
|
||||
|
||||
async function redemptionDetail(id: string, storeId?: string): Promise<PointRedemption> {
|
||||
return await axios.post(`${REDEMPTION_URI}/detail`, undefined, { params: { id, storeId: storeId || getCurrentStoreId() || undefined } });
|
||||
}
|
||||
|
||||
async function redemptionCreate(request: PointRedemptionCreateRequest): Promise<PointRedemption> {
|
||||
return await axios.post(`${REDEMPTION_URI}/create`, withCurrentStoreId(request));
|
||||
}
|
||||
|
||||
async function redemptionReturn(request: PointRedemptionReturnRequest): Promise<PointRedemption> {
|
||||
return await axios.post(`${REDEMPTION_URI}/return`, request);
|
||||
}
|
||||
|
||||
async function redemptionReturnList(redemptionId: string): Promise<PointRedemptionReturn[]> {
|
||||
return await axios.post(`${REDEMPTION_URI}/return/list`, undefined, { params: { redemptionId, storeId: getCurrentStoreId() || undefined } });
|
||||
}
|
||||
|
||||
export default {
|
||||
list,
|
||||
detailByCustomerId,
|
||||
@@ -130,5 +183,16 @@ export default {
|
||||
ruleCreate,
|
||||
ruleUpdate,
|
||||
ruleSort,
|
||||
ruleRemove
|
||||
ruleRemove,
|
||||
redeemSkuList,
|
||||
redeemSkuDetail,
|
||||
redeemSkuCreate,
|
||||
redeemSkuUpdate,
|
||||
redeemSkuDisable,
|
||||
redeemSkuRemove,
|
||||
redemptionList,
|
||||
redemptionDetail,
|
||||
redemptionCreate,
|
||||
redemptionReturn,
|
||||
redemptionReturnList
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user