From f4ddeaa5c5884a8a0f40bebd3239c2c10539d8c4 Mon Sep 17 00:00:00 2001 From: 17600048398 <277692624@qq.com> Date: Thu, 9 Mar 2023 18:16:10 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buyer/src/api/member.js | 45 +++++++++++++++++-- buyer/src/pages/GoodsDetail.vue | 12 ++--- buyer/src/pages/Merchant.vue | 6 +-- .../src/pages/home/memberCenter/Favorites.vue | 30 ++++++++++--- manager/src/views/member/list/index.vue | 5 ++- manager/src/views/seller/shop/shopDetail.vue | 12 ++++- seller/src/api/logistics.js | 2 +- 7 files changed, 90 insertions(+), 22 deletions(-) diff --git a/buyer/src/api/member.js b/buyer/src/api/member.js index 301b7414..eeb7de21 100644 --- a/buyer/src/api/member.js +++ b/buyer/src/api/member.js @@ -59,7 +59,7 @@ export function withdrawalApply (params) { }); } -// 收藏商品、店铺 +// 收藏商品 export function collectGoods (type, id) { return request({ url: `/buyer/member/collection/add/${type}/${id}`, @@ -68,7 +68,16 @@ export function collectGoods (type, id) { }); } -// 取消 收藏商品、店铺 +// 收藏店铺 +export function collectStore (type, id) { + return request({ + url: `/buyer/member/storeCollection/add/${type}/${id}`, + method: Method.POST, + needToken: true + }); +} + +// 取消 收藏商品 export function cancelCollect (type, id) { return request({ url: `/buyer/member/collection/delete/${type}/${id}`, @@ -77,7 +86,16 @@ export function cancelCollect (type, id) { }); } -// 查看是否收藏 +// 取消 收藏店铺 +export function cancelStoreCollect (type, id) { + return request({ + url: `/buyer/member/storeCollection/delete/${type}/${id}`, + method: Method.DELETE, + needToken: true + }); +} + +// 查看是否收藏商品 export function isCollection (type, goodsId) { return request({ url: `/buyer/member/collection/isCollection/${type}/${goodsId}`, @@ -86,7 +104,16 @@ export function isCollection (type, goodsId) { }); } -// 会员收藏列表 +// 查看是否收藏店铺 +export function isStoreCollection (type, goodsId) { + return request({ + url: `/buyer/member/storeCollection/isCollection/${type}/${goodsId}`, + method: Method.GET, + needToken: true + }); +} + +// 会员收藏商品列表 export function collectList (params) { return request({ url: `/buyer/member/collection/${params.type}`, @@ -96,6 +123,16 @@ export function collectList (params) { }); } +// 会员收藏店铺列表 +export function storeCollectList (params) { + return request({ + url: `/buyer/member/storeCollection/${params.type}`, + method: Method.GET, + needToken: true, + params + }); +} + // 单个商品评价 export function goodsComment (params) { return request({ diff --git a/buyer/src/pages/GoodsDetail.vue b/buyer/src/pages/GoodsDetail.vue index 14870db6..63a421f0 100644 --- a/buyer/src/pages/GoodsDetail.vue +++ b/buyer/src/pages/GoodsDetail.vue @@ -44,9 +44,9 @@ import ShowGoods from "@/components/goodsDetail/ShowGoods"; import ShowGoodsDetail from "@/components/goodsDetail/ShowGoodsDetail"; import { goodsSkuDetail } from "@/api/goods"; import { - cancelCollect, - collectGoods, - isCollection, + cancelStoreCollect, + collectStore, + isStoreCollection, getGoodsDistribution, } from "@/api/member"; import { getDetailById } from "@/api/shopentry"; @@ -121,7 +121,7 @@ export default { this.$set(this, "goodsMsg", res.result); // 判断是否收藏 if (this.Cookies.getItem("userInfo")) { - isCollection("STORE", this.goodsMsg.data.storeId).then((res) => { + isStoreCollection("STORE", this.goodsMsg.data.storeId).then((res) => { if (res.success && res.result) { this.storeCollected = true; } @@ -159,13 +159,13 @@ export default { async collect () { // 收藏店铺 if (this.storeCollected) { - let cancel = await cancelCollect("STORE", this.goodsMsg.data.storeId); + let cancel = await cancelStoreCollect("STORE", this.goodsMsg.data.storeId); if (cancel.success) { this.$Message.success("已取消收藏"); this.storeCollected = false; } } else { - let collect = await collectGoods("STORE", this.goodsMsg.data.storeId); + let collect = await collectStore("STORE", this.goodsMsg.data.storeId); if (collect.code === 200) { this.storeCollected = true; this.$Message.success("收藏店铺成功,可以前往个人中心我的收藏查看"); diff --git a/buyer/src/pages/Merchant.vue b/buyer/src/pages/Merchant.vue index 3cf82442..773d8ac8 100644 --- a/buyer/src/pages/Merchant.vue +++ b/buyer/src/pages/Merchant.vue @@ -108,7 +108,7 @@