diff --git a/src/api/mall/product/favorite.ts b/src/api/mall/product/favorite.ts
new file mode 100644
index 00000000..2e54ec78
--- /dev/null
+++ b/src/api/mall/product/favorite.ts
@@ -0,0 +1,28 @@
+import request from '@/config/axios'
+
+export interface Favorite {
+ id?: number
+ userId?: string // 用户编号
+ spuId?: number | null // 商品 SPU 编号
+}
+
+// 获得 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/hooks/web/useMessage.ts b/src/hooks/web/useMessage.ts
index ac2b552e..9bfb7a3a 100644
--- a/src/hooks/web/useMessage.ts
+++ b/src/hooks/web/useMessage.ts
@@ -90,6 +90,18 @@ export const useMessage = () => {
cancelButtonText: t('common.cancel'),
type: 'warning'
})
+ },
+ // 取消收藏窗体
+ delStarConfirm(content?: string, tip?: string) {
+ return ElMessageBox.confirm(
+ content ? content : t('common.confirmDelStar'),
+ tip ? tip : t('common.confirmTitle'),
+ {
+ confirmButtonText: t('common.ok'),
+ cancelButtonText: t('common.cancel'),
+ type: 'warning'
+ }
+ )
}
}
}
diff --git a/src/locales/en.ts b/src/locales/en.ts
index 4f4d4895..d82e616e 100644
--- a/src/locales/en.ts
+++ b/src/locales/en.ts
@@ -54,7 +54,13 @@ export default {
updateTime: 'Update Time',
copy: 'Copy',
copySuccess: 'Copy Success',
- copyError: 'Copy Error'
+ copyError: 'Copy Error',
+ confirmDelStar: 'Delete the Star?',
+ starSuccess: 'Star Success',
+ starFail: 'Star Error',
+ delStarSuccess: 'Del Star Success',
+ delStarFail: 'Del Star Error',
+ existStar: 'exist Star'
},
error: {
noPermission: `Sorry, you don't have permission to access this page.`,
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index 4f95852f..49a3f895 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -54,7 +54,13 @@ export default {
updateTime: '更新时间',
copy: '复制',
copySuccess: '复制成功',
- copyError: '复制失败'
+ copyError: '复制失败',
+ confirmDelStar: '是否取消收藏?',
+ starSuccess: '收藏成功',
+ starFail: '收藏失败',
+ delStarSuccess: '取消收藏成功',
+ delStarFail: '取消收藏失败',
+ existStar: '收藏已存在'
},
error: {
noPermission: `抱歉,您无权访问此页面。`,
diff --git a/src/views/member/user/detail/UserFavoriteList.vue b/src/views/member/user/detail/UserFavoriteList.vue
new file mode 100644
index 00000000..009a8b10
--- /dev/null
+++ b/src/views/member/user/detail/UserFavoriteList.vue
@@ -0,0 +1,195 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+
+
+
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ floatToFixed2(row.price) }}元
+
+
+
+
+
+
+
+
+
+
+
+ 收藏
+
+
+ 取消收藏
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/member/user/detail/index.vue b/src/views/member/user/detail/index.vue
index 1bac010e..6237cca6 100644
--- a/src/views/member/user/detail/index.vue
+++ b/src/views/member/user/detail/index.vue
@@ -48,7 +48,9 @@
售后管理(WIP)
- 收藏记录(WIP)
+
+
+
@@ -76,6 +78,7 @@ import UserExperienceRecordList from './UserExperienceRecordList.vue'
import UserOrderList from './UserOrderList.vue'
import UserPointList from './UserPointList.vue'
import UserSignList from './UserSignList.vue'
+import UserFavoriteList from './UserFavoriteList.vue'
import { CardTitle } from '@/components/Card/index'
import { ElMessage } from 'element-plus'