From e02fa752742d320c02fac4454af8d63b4de65370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?lemon=E6=A9=AA?= <17633066053@163.com> Date: Thu, 5 Aug 2021 19:01:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=97=E9=93=BA=E9=A1=B5=E9=9D=A2=E6=9C=89?= =?UTF-8?q?=E4=BA=9Bbug=20=E5=B7=B2=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/members.js | 28 ++++++++++++++-------------- pages/mine/distribution/list.vue | 14 +------------- pages/product/shopPageMain.vue | 26 ++++++++++++-------------- 3 files changed, 27 insertions(+), 41 deletions(-) diff --git a/api/members.js b/api/members.js index 20faf55..08bba68 100644 --- a/api/members.js +++ b/api/members.js @@ -206,7 +206,7 @@ export function getGoodsCollection(params, type) { * 收藏商品 * @returns {AxiosPromise} */ -export function collectionGoods(id, type) { +export function collectionGoods(type, id) { return http.request({ url: `/member/collection/add/${type}/${id}`, method: Method.POST, @@ -230,11 +230,23 @@ export function deleteGoodsCollection(ids) { }); } +/** + * 删除店铺收藏 + * @param store_id + */ +export function deleteStoreCollection(store_id) { + return http.request({ + url: `/member/collection/delete/STORE/${store_id}`, + method: Method.DELETE, + needToken: true, + }); +} + /** * 获取商品是否被收藏 * @param good_id */ -export function getGoodsIsCollect(good_id, type) { +export function getGoodsIsCollect(type, good_id) { return http.request({ url: `/member/collection/isCollection/${type}/${good_id}`, method: Method.GET, @@ -257,18 +269,6 @@ export function collectionStore(store_id) { }); } -/** - * 删除店铺收藏 - * @param store_id - */ -export function deleteStoreCollection(store_id) { - return http.request({ - url: `members/collection/store/${store_id}`, - method: Method.DELETE, - needToken: true, - }); -} - /** * 获取当前登录的用户信息 * @returns {AxiosPromise} diff --git a/pages/mine/distribution/list.vue b/pages/mine/distribution/list.vue index 95d43b7..e95e74e 100644 --- a/pages/mine/distribution/list.vue +++ b/pages/mine/distribution/list.vue @@ -174,9 +174,7 @@ export default { onLoad(options) { this.routers = options; }, - watch: { - showFlag(val) {}, - }, + watch: {}, onShow() { this.goodsList = []; this.init(); @@ -273,12 +271,7 @@ export default { // 选择商品 handleClickGoods(val) { - uni.showLoading({ - title: "加载中", - mask: true, - }); checkedDistributionGoods({ id: val.id, checked: true }).then((res) => { - uni.hideLoading(); if (res.data.success) { uni.showToast({ title: "已添加到我的选品库", @@ -295,12 +288,7 @@ export default { }, init() { - uni.showLoading({ - title: "加载中", - }); distributionGoods(this.params).then((res) => { - uni.hideLoading(); - if (res.data.success && res.data.result.records.length >= 1) { res.data.result.records.forEach((item) => { this.$set(item, "___selected", false); diff --git a/pages/product/shopPageMain.vue b/pages/product/shopPageMain.vue index fcbf7b3..1c49f71 100644 --- a/pages/product/shopPageMain.vue +++ b/pages/product/shopPageMain.vue @@ -11,14 +11,14 @@ {{ storeInfo.goodsNum || 0 }}关注 {{ storeInfo.collectionNum || 0 }}件商品 - {{ isCollection == 'success' ? '已关注' : '+ 关注' }} + {{ isCollection ? '已关注' : '+ 关注' }} 店铺简介 - + - + @@ -68,7 +68,7 @@ import { getstoreBaseInfo } from "@/api/store.js"; import { receiveCoupons, - deleteGoodsCollection, + deleteStoreCollection, collectionGoods, getGoodsIsCollect, } from "@/api/members.js"; @@ -101,13 +101,12 @@ export default { mounted(options) { if (this.$options.filters.isLogin("auth")) { getGoodsIsCollect("STORE", this.storeId).then((res) => { - this.isCollection = res.data.message; + this.isCollection = res.data.result; }); } this.initStoreInfo(); }, methods: { - /** * 店铺信息 */ @@ -135,8 +134,7 @@ export default { } }); }, - - + /** * 跳转到商品详情 */ @@ -151,9 +149,9 @@ export default { */ whetherCollection() { if (this.isCollection) { - deleteGoodsCollection("STORE", this.storeId).then((res) => { - if (res.statusCode === 200) { - this.isCollection = "error"; + deleteStoreCollection(this.storeId).then((res) => { + if (res.data.success) { + this.isCollection = false; uni.showToast({ icon: "none", duration: 3000, @@ -163,8 +161,8 @@ export default { }); } else { collectionGoods("STORE", this.storeId).then((res) => { - if (res.statusCode === 200) { - this.isCollection = "success"; + if (res.data.success) { + this.isCollection = true; uni.showToast({ icon: "none", duration: 3000, @@ -174,7 +172,7 @@ export default { }); } }, - + /** * 获取优惠券 */