修复一些问题以及优惠券管理功能
This commit is contained in:
+28
-10
@@ -367,6 +367,15 @@ export const adminTagApi = {
|
||||
},
|
||||
listTagsByShopId: (shopId: number) => {
|
||||
return adminApi.get<any[]>('/tag/list/by-shop/' + shopId)
|
||||
},
|
||||
createTag: (data: any) => {
|
||||
return adminApi.post('/tag/create', data)
|
||||
},
|
||||
updateTag: (id: number, data: any) => {
|
||||
return adminApi.put(`/tag/update/${id}`, data)
|
||||
},
|
||||
deleteTag: (id: number) => {
|
||||
return adminApi.delete(`/tag/delete/${id}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,20 +386,29 @@ export const adminArtistApi = {
|
||||
}
|
||||
|
||||
export const adminCouponApi = {
|
||||
listAllCoupons: () => {
|
||||
return adminApi.get<any[]>('/coupon/list', { params: { page: 1, size: 100 } })
|
||||
listAllCoupons: (shopId?: number) => {
|
||||
return adminApi.get<any[]>('/coupon/list', { params: { page: 1, size: 100, shopId } })
|
||||
},
|
||||
createCoupon: (data: any) => {
|
||||
return adminApi.post('/coupon/create', data)
|
||||
createCoupon: (data: any, shopId: number) => {
|
||||
return adminApi.post('/coupon/create', data, { params: { shopId } })
|
||||
},
|
||||
updateCoupon: (id: number, data: any) => {
|
||||
return adminApi.put(`/coupon/update/${id}`, data)
|
||||
updateCoupon: (id: number, data: any, shopId: number) => {
|
||||
return adminApi.put(`/coupon/update/${id}`, data, { params: { shopId } })
|
||||
},
|
||||
deleteCoupon: (id: number) => {
|
||||
return adminApi.delete(`/coupon/delete/${id}`)
|
||||
deleteCoupon: (id: number, shopId: number) => {
|
||||
return adminApi.delete(`/coupon/delete/${id}`, { params: { shopId } })
|
||||
},
|
||||
distributeCoupon: (data: { couponId: number; userIds: number[]; quantity: number }) => {
|
||||
return adminApi.post('/coupon/distribute', data)
|
||||
distributeCoupon: (data: { couponId: number; userIds: number[]; quantity: number }, shopId: number) => {
|
||||
const params: any = {
|
||||
couponId: data.couponId,
|
||||
quantity: data.quantity,
|
||||
shopId: shopId
|
||||
};
|
||||
// 处理userIds数组,确保它能被后端正确解析
|
||||
data.userIds.forEach((userId, index) => {
|
||||
params[`userIds[${index}]`] = userId;
|
||||
});
|
||||
return adminApi.post('/coupon/distribute', null, { params })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user