diff --git a/src/api/mall/product/favorite.ts b/src/api/mall/product/favorite.ts index 2e54ec78..3834eed0 100644 --- a/src/api/mall/product/favorite.ts +++ b/src/api/mall/product/favorite.ts @@ -8,21 +8,5 @@ export interface Favorite { // 获得 ProductFavorite 列表 export const getFavoritePage = (params: PageParam) => { - params.keyword = params.name return request.get({ url: '/product/favorite/page', params }) } - -// 收藏商品 Favorite -export const createFavorite = (data: Favorite) => { - return request.post({ url: '/product/favorite/create', data }) -} - -// 取消商品收藏 Favorite -export const delFavorite = (data: Favorite) => { - return request.delete({ url: '/product/favorite/delete', data }) -} - -// 是否收藏过商品 Favorite -export const exitsFavorite = (data: Favorite) => { - return request.post({ url: '/product/favorite/exits', data }) -} diff --git a/src/views/member/user/detail/UserFavoriteList.vue b/src/views/member/user/detail/UserFavoriteList.vue index 009a8b10..afab9a08 100644 --- a/src/views/member/user/detail/UserFavoriteList.vue +++ b/src/views/member/user/detail/UserFavoriteList.vue @@ -1,46 +1,4 @@ - - - { handleQuery() } -/** 取消收藏按钮操作 */ -const handleDelete = async (row: object) => { - try { - console.log(row) - // 取消的二次确认 - await message.delStarConfirm() - // 发起取消 - await FavoriteApi.delFavorite({ userId: queryParams.userId, spuId: row.spuId }) - message.success(t('common.delStarSuccess')) - row.favoriteStatus = 0 - // 刷新列表 - // await getList() - } catch {} -} - -/** 收藏按钮操作 */ -const handleAdd = async (row: object) => { - try { - const data = { userId: queryParams.userId, spuId: row.spuId } - // 发起收藏 - const result = await FavoriteApi.exitsFavorite(data) - if (result === false) { - // 发起收藏 - await FavoriteApi.createFavorite(data) - message.success(t('common.starSuccess')) - row.favoriteStatus = 1 - // 刷新列表 - // await getList() - } else { - message.warning(t('common.existStar')) - row.favoriteStatus = 1 - } - } catch {} -} - const { userId } = defineProps({ userId: { type: Number,