店铺页面有些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}
*/
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}

View File

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

View File

@ -11,12 +11,12 @@
<view>{{ storeInfo.goodsNum || 0 }}关注 {{ storeInfo.collectionNum || 0 }}件商品</view>
</view>
<view class="follow" @click="whetherCollection">
<view>{{ isCollection == 'success' ? '已关注' : '+ 关注' }}</view>
<view>{{ isCollection ? '已关注' : '+ 关注' }}</view>
</view>
</view>
<view class="store-intro">
<view class="title">店铺简介</view>
<view class="text" >
<view class="text">
<view v-html="storeInfo.storeDesc"></view>
</view>
@ -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: {
/**
* 店铺信息
*/
@ -136,7 +135,6 @@ 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,