|
@@ -227,7 +227,13 @@
|
|
// 查询店铺信息
|
|
// 查询店铺信息
|
|
const res = await that.$api(`/shop/${that.id}`, 'GET');
|
|
const res = await that.$api(`/shop/${that.id}`, 'GET');
|
|
if (res.errcode == '0') that.$set(that, `info`, res.data);
|
|
if (res.errcode == '0') that.$set(that, `info`, res.data);
|
|
-
|
|
|
|
|
|
+ let arr = await that.$api(`/storeGoods/check`, `GET`, {
|
|
|
|
+ customer: that.user._id,
|
|
|
|
+ shop: that.id
|
|
|
|
+ });
|
|
|
|
+ if (arr.errcode == '0') {
|
|
|
|
+ that.$set(that, `collection`, arr.data)
|
|
|
|
+ }
|
|
// 查询店铺商品
|
|
// 查询店铺商品
|
|
that.searchShopMarket();
|
|
that.searchShopMarket();
|
|
// 查询全部商品
|
|
// 查询全部商品
|
|
@@ -339,31 +345,24 @@
|
|
// 收藏
|
|
// 收藏
|
|
async toCollect() {
|
|
async toCollect() {
|
|
const that = this;
|
|
const that = this;
|
|
- that.collection = !that.collection;
|
|
|
|
- if (that.collection == true) {
|
|
|
|
- var params = {};
|
|
|
|
- params = {
|
|
|
|
- shop: that.info.id,
|
|
|
|
- customer: that.user.id
|
|
|
|
- }
|
|
|
|
- const arr = await that.$api(`/storeShop`, 'POST', params)
|
|
|
|
- if (arr.errcode == '0') {
|
|
|
|
- const aee = await that.$api(`/storeShop/check`, 'POST', params)
|
|
|
|
- if (aee.errcode == '0') {
|
|
|
|
- console.log(aee.data);
|
|
|
|
- }
|
|
|
|
|
|
+ var params = {};
|
|
|
|
+ params = {
|
|
|
|
+ shop: that.id,
|
|
|
|
+ customer: that.user.id
|
|
|
|
+ }
|
|
|
|
+ if (that.user) {
|
|
|
|
+ let res = await that.$api(`/storeShop`, `POST`, params);
|
|
|
|
+ if (res.errcode == '0') {
|
|
|
|
+ console.log(res);
|
|
uni.showToast({
|
|
uni.showToast({
|
|
- title: `收藏成功`,
|
|
|
|
|
|
+ title: res.data.msg,
|
|
icon: 'none'
|
|
icon: 'none'
|
|
})
|
|
})
|
|
- } else {
|
|
|
|
- uni.showToast({
|
|
|
|
- title: arr.errmsg,
|
|
|
|
- })
|
|
|
|
|
|
+ that.$set(that, `collection`, res.data.result)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
- title: `取消成功`,
|
|
|
|
|
|
+ title: '无用户登录无法收藏店铺',
|
|
icon: 'none'
|
|
icon: 'none'
|
|
})
|
|
})
|
|
}
|
|
}
|