功能:完善门店能力与用户安全配置
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Front-end API wrapper for this module.
|
||||
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
|
||||
*/
|
||||
import request from './index'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
@@ -74,8 +78,17 @@ export interface CouponListResponse {
|
||||
size: number
|
||||
}
|
||||
|
||||
/**
|
||||
* couponApi groups all API calls for this page domain.
|
||||
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
|
||||
*/
|
||||
export const couponApi = {
|
||||
// 创建优惠券
|
||||
/**
|
||||
* `createCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param data: CreateCouponRequest caller-supplied value for `data: CreateCouponRequest`
|
||||
*/
|
||||
createCoupon: (data: CreateCouponRequest) => {
|
||||
return request({
|
||||
url: '/coupon/create',
|
||||
@@ -85,6 +98,12 @@ export const couponApi = {
|
||||
},
|
||||
|
||||
// 更新优惠券
|
||||
/**
|
||||
* `updateCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param id: IdType caller-supplied value for `id: IdType`
|
||||
* @param data: CreateCouponRequest caller-supplied value for `data: CreateCouponRequest`
|
||||
*/
|
||||
updateCoupon: (id: IdType, data: CreateCouponRequest) => {
|
||||
return request({
|
||||
url: `/coupon/update/${id}`,
|
||||
@@ -94,6 +113,11 @@ export const couponApi = {
|
||||
},
|
||||
|
||||
// 删除优惠券
|
||||
/**
|
||||
* `deleteCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param id: IdType caller-supplied value for `id: IdType`
|
||||
*/
|
||||
deleteCoupon: (id: IdType) => {
|
||||
return request({
|
||||
url: `/coupon/delete/${id}`,
|
||||
@@ -102,6 +126,11 @@ export const couponApi = {
|
||||
},
|
||||
|
||||
// 获取优惠券详情
|
||||
/**
|
||||
* `getCouponById` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param id: IdType caller-supplied value for `id: IdType`
|
||||
*/
|
||||
getCouponById: (id: IdType) => {
|
||||
return request({
|
||||
url: `/coupon/detail/${id}`,
|
||||
@@ -110,6 +139,11 @@ export const couponApi = {
|
||||
},
|
||||
|
||||
// 获取优惠券列表
|
||||
/**
|
||||
* `listCoupons` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param params: { page: number; size: number; shopId?: IdType } caller-supplied value for `params: { page: number; size: number; shopId?: IdType }`
|
||||
*/
|
||||
listCoupons: (params: { page: number; size: number; shopId?: IdType }) => {
|
||||
return request({
|
||||
url: '/coupon/list',
|
||||
@@ -119,6 +153,12 @@ export const couponApi = {
|
||||
},
|
||||
|
||||
// 为用户分配优惠券
|
||||
/**
|
||||
* `assignCouponToUser` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param userId: IdType caller-supplied value for `userId: IdType`
|
||||
* @param couponId: IdType caller-supplied value for `couponId: IdType`
|
||||
*/
|
||||
assignCouponToUser: (userId: IdType, couponId: IdType) => {
|
||||
return request({
|
||||
url: '/coupon/assign',
|
||||
@@ -137,6 +177,11 @@ export const couponApi = {
|
||||
},
|
||||
|
||||
// 使用优惠券
|
||||
/**
|
||||
* `useCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param userCouponId: IdType caller-supplied value for `userCouponId: IdType`
|
||||
*/
|
||||
useCoupon: (userCouponId: IdType) => {
|
||||
return request({
|
||||
url: '/coupon/use',
|
||||
|
||||
Reference in New Issue
Block a user