From 5e5d5b904b8f75b4ee44f9e460e99d64006f4575 Mon Sep 17 00:00:00 2001 From: chc <1501738723@qq.com> Date: Mon, 15 May 2023 14:21:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/members.js | 20 ++++++++++++++++---- pages/product/shopPage.vue | 8 ++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/api/members.js b/api/members.js index 46eb96b..153941a 100644 --- a/api/members.js +++ b/api/members.js @@ -236,7 +236,7 @@ export function deleteGoodsCollection(ids) { */ export function deleteStoreCollection(store_id) { return http.request({ - url: `/member/collection/delete/STORE/${store_id}`, + url: `/member/storeCollection/delete/STORE/${store_id}`, method: Method.DELETE, needToken: true, }); @@ -255,6 +255,19 @@ export function getGoodsIsCollect(type, good_id) { }); } +/** + * 获取商品是否被收藏 + * @param good_id + */ +export function getStoreIsCollect(type, store_id) { + return http.request({ + url: `/member/storeCollection/isCollection/${type}/${store_id}`, + method: Method.GET, + needToken: true, + loading: false, + }); +} + /** * 收藏店铺 * @param store_id 店铺ID @@ -262,10 +275,9 @@ export function getGoodsIsCollect(type, good_id) { */ export function collectionStore(store_id) { return http.request({ - url: "members/collection/store", - header: { "content-type": "application/x-www-form-urlencoded" }, + url: `/member/storeCollection/add/STORE/${store_id}`, method: Method.POST, - data: { store_id }, + needToken: true, }); } diff --git a/pages/product/shopPage.vue b/pages/product/shopPage.vue index 487e497..f3cc7de 100644 --- a/pages/product/shopPage.vue +++ b/pages/product/shopPage.vue @@ -181,8 +181,8 @@ import { getStoreBaseInfo, getStoreCategory } from "@/api/store.js"; import { receiveCoupons, deleteStoreCollection, - collectionGoods, - getGoodsIsCollect, + collectionStore, + getStoreIsCollect, } from "@/api/members.js"; import config from "@/config/config"; @@ -374,7 +374,7 @@ export default { }, /**是否收藏店铺 */ async enableGoodsIsCollect() { - let res = await getGoodsIsCollect("STORE", this.storeId); + let res = await getStoreIsCollect("STORE", this.storeId); if (res.data.success) { this.isCollection = res.data.result; } @@ -465,7 +465,7 @@ export default { } }); } else { - collectionGoods("STORE", this.storeId).then((res) => { + collectionStore(this.storeId).then((res) => { if (res.data.success) { this.isCollection = true; uni.showToast({ From 67177217251ae5fceae67da0560edbe9c6a657e1 Mon Sep 17 00:00:00 2001 From: chc <1501738723@qq.com> Date: Mon, 15 May 2023 14:34:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E6=94=B6=E8=97=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/members.js | 16 ++++++++++++++++ pages/mine/myCollect.vue | 5 +++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/api/members.js b/api/members.js index 153941a..e198238 100644 --- a/api/members.js +++ b/api/members.js @@ -202,6 +202,22 @@ export function getGoodsCollection(params, type) { }); } +/** + * 获取商品收藏 + * @param params + * @returns {AxiosPromise} + */ +export function getStoreCollection(params, type) { + return http.request({ + url: `/member/storeCollection/${type}`, + method: Method.GET, + needToken: true, + loading: false, + message: false, + params, + }); +} + /** * 收藏商品 * @returns {AxiosPromise} diff --git a/pages/mine/myCollect.vue b/pages/mine/myCollect.vue index 7191f68..036d676 100644 --- a/pages/mine/myCollect.vue +++ b/pages/mine/myCollect.vue @@ -64,6 +64,7 @@