Authored by 郭成尧

店铺收藏联调

... ... @@ -59,7 +59,10 @@ module.exports = {
shopId: req.body.shopId,
favId: req.body.favId,
uid: req.user.uid,
type: 'shop'
// uid: '8050882',
type: 'shop',
isFav: req.body.isFav
}).then(result => {
res.json(result);
});
... ...
... ... @@ -108,14 +108,14 @@ module.exports = {
uid: params.uid,
type: params.type
};
if (params.isFav) {
if (params.isFav === 'true') {
Object.assign(finalParams, {
method: 'app.favorite.add'
method: 'app.favorite.cancel'
});
} else {
Object.assign(finalParams, {
method: 'app.favorite.cancel'
method: 'app.favorite.add'
});
}
return api.get('', finalParams);
... ...
... ... @@ -31,13 +31,16 @@ const getShopData = params => {
/* 是 BLK 的店铺 */
Object.assign(finalResult, {
isBlkShop: true
isBlkShop: true,
shopId: result[0].data.shop_id
});
return api.all([
shopApi.getShopInfoData({
shopId: result[0].data.shop_id,
uid: params.uid
// uid: '8050882'
})
]).then(subResult => {
if (subResult[0].code === 200) {
... ... @@ -46,7 +49,8 @@ const getShopData = params => {
Object.assign(finalResult, {
brandLogo: subResult[0].data.shop_logo,
brandName: subResult[0].data.shop_name,
brandIntro: subResult[0].data.shop_intro
brandIntro: subResult[0].data.shop_intro,
isFav: subResult[0].data.is_favorite === 'Y'
});
/* TODO shop_template_type 待接口确认 */
... ...
... ... @@ -71,7 +71,9 @@
this.shareData = {
title: result.brandName,
link: '/brand-share?domain=' + this.domain,
img: result.brandBg
img: result.brandBg,
shopId: result.shopId,
isFav: result.isFav
};
} else {
this.shopInfo.showBrandInfo = false;
... ...
... ... @@ -15,7 +15,7 @@
width: 100%;
height: 468px;
color: #fff;
background-color: #000;
background-color: #ccc;
position: relative;
.brand-bottom {
... ...
... ... @@ -2,9 +2,10 @@
<div class="top-box clearfix">
<span class="icon back" @click="goBack()">&#xe606;</span>
<div class="right">
<span class="icon" v-bind:class="{'favorite': shareData.isFav}" @click="collectShop()">&#xe609;</span>
<span class="icon share" @click="goShare()">&#xe60e;</span>
<span class="icon filter" @click="showFilter()">&#xe60b;</span>
<span v-if="shareData.isFav" class="icon" @click="collectShop()">&#xe60d;</span>
<span v-else class="icon" @click="collectShop()">&#xe60c;</span>
<span class="icon" @click="goShare()">&#xe60e;</span>
<span class="icon" @click="showFilter()">&#xe60b;</span>
</div>
</div>
</template>
... ... @@ -38,10 +39,6 @@
height: 60px;
margin: 0 5px;
}
.favorite {
color: #000;
}
}
}
</style>
... ... @@ -75,13 +72,12 @@
};
$.post({
url: '/collect-shop',
url: '/product/collect-shop',
data: data
}).done(result => {
tip(result.message);
if (result.code === 200) {
this.shareData.isFav = this.shareData.isFav !== true;
} else {
tip('网络错误');
this.shareData.isFav = !this.shareData.isFav;
}
}).fail(() => {
tip('网络错误');
... ...