店铺页面有些bug 已处理

master
lemon橪 2021-08-05 19:01:31 +08:00
parent 4ca71d0987
commit e02fa75274
3 changed files with 27 additions and 41 deletions

View File

@ -206,7 +206,7 @@ export function getGoodsCollection(params, type) {
* 收藏商品 * 收藏商品
* @returns {AxiosPromise} * @returns {AxiosPromise}
*/ */
export function collectionGoods(id, type) { export function collectionGoods(type, id) {
return http.request({ return http.request({
url: `/member/collection/add/${type}/${id}`, url: `/member/collection/add/${type}/${id}`,
method: Method.POST, 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 * @param good_id
*/ */
export function getGoodsIsCollect(good_id, type) { export function getGoodsIsCollect(type, good_id) {
return http.request({ return http.request({
url: `/member/collection/isCollection/${type}/${good_id}`, url: `/member/collection/isCollection/${type}/${good_id}`,
method: Method.GET, 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} * @returns {AxiosPromise}

View File

@ -174,9 +174,7 @@ export default {
onLoad(options) { onLoad(options) {
this.routers = options; this.routers = options;
}, },
watch: { watch: {},
showFlag(val) {},
},
onShow() { onShow() {
this.goodsList = []; this.goodsList = [];
this.init(); this.init();
@ -273,12 +271,7 @@ export default {
// //
handleClickGoods(val) { handleClickGoods(val) {
uni.showLoading({
title: "加载中",
mask: true,
});
checkedDistributionGoods({ id: val.id, checked: true }).then((res) => { checkedDistributionGoods({ id: val.id, checked: true }).then((res) => {
uni.hideLoading();
if (res.data.success) { if (res.data.success) {
uni.showToast({ uni.showToast({
title: "已添加到我的选品库", title: "已添加到我的选品库",
@ -295,12 +288,7 @@ export default {
}, },
init() { init() {
uni.showLoading({
title: "加载中",
});
distributionGoods(this.params).then((res) => { distributionGoods(this.params).then((res) => {
uni.hideLoading();
if (res.data.success && res.data.result.records.length >= 1) { if (res.data.success && res.data.result.records.length >= 1) {
res.data.result.records.forEach((item) => { res.data.result.records.forEach((item) => {
this.$set(item, "___selected", false); this.$set(item, "___selected", false);

View File

@ -11,14 +11,14 @@
<view>{{ storeInfo.goodsNum || 0 }}关注 {{ storeInfo.collectionNum || 0 }}件商品</view> <view>{{ storeInfo.goodsNum || 0 }}关注 {{ storeInfo.collectionNum || 0 }}件商品</view>
</view> </view>
<view class="follow" @click="whetherCollection"> <view class="follow" @click="whetherCollection">
<view>{{ isCollection == 'success' ? '已关注' : '+ 关注' }}</view> <view>{{ isCollection ? '已关注' : '+ 关注' }}</view>
</view> </view>
</view> </view>
<view class="store-intro"> <view class="store-intro">
<view class="title">店铺简介</view> <view class="title">店铺简介</view>
<view class="text" > <view class="text">
<view v-html="storeInfo.storeDesc"></view> <view v-html="storeInfo.storeDesc"></view>
</view> </view>
</view> </view>
<!-- 优惠券 --> <!-- 优惠券 -->
@ -68,7 +68,7 @@
import { getstoreBaseInfo } from "@/api/store.js"; import { getstoreBaseInfo } from "@/api/store.js";
import { import {
receiveCoupons, receiveCoupons,
deleteGoodsCollection, deleteStoreCollection,
collectionGoods, collectionGoods,
getGoodsIsCollect, getGoodsIsCollect,
} from "@/api/members.js"; } from "@/api/members.js";
@ -101,13 +101,12 @@ export default {
mounted(options) { mounted(options) {
if (this.$options.filters.isLogin("auth")) { if (this.$options.filters.isLogin("auth")) {
getGoodsIsCollect("STORE", this.storeId).then((res) => { getGoodsIsCollect("STORE", this.storeId).then((res) => {
this.isCollection = res.data.message; this.isCollection = res.data.result;
}); });
} }
this.initStoreInfo(); this.initStoreInfo();
}, },
methods: { methods: {
/** /**
* 店铺信息 * 店铺信息
*/ */
@ -135,8 +134,7 @@ export default {
} }
}); });
}, },
/** /**
* 跳转到商品详情 * 跳转到商品详情
*/ */
@ -151,9 +149,9 @@ export default {
*/ */
whetherCollection() { whetherCollection() {
if (this.isCollection) { if (this.isCollection) {
deleteGoodsCollection("STORE", this.storeId).then((res) => { deleteStoreCollection(this.storeId).then((res) => {
if (res.statusCode === 200) { if (res.data.success) {
this.isCollection = "error"; this.isCollection = false;
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
duration: 3000, duration: 3000,
@ -163,8 +161,8 @@ export default {
}); });
} else { } else {
collectionGoods("STORE", this.storeId).then((res) => { collectionGoods("STORE", this.storeId).then((res) => {
if (res.statusCode === 200) { if (res.data.success) {
this.isCollection = "success"; this.isCollection = true;
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
duration: 3000, duration: 3000,
@ -174,7 +172,7 @@ export default {
}); });
} }
}, },
/** /**
* 获取优惠券 * 获取优惠券
*/ */