fix: 移动端店铺收藏

master
chc 2023-05-15 14:21:38 +08:00
parent ca4e458db1
commit 5e5d5b904b
2 changed files with 20 additions and 8 deletions

View File

@ -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,
});
}

View File

@ -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({