...
|
...
|
@@ -471,41 +471,20 @@ |
|
|
* 添加收藏
|
|
|
*/
|
|
|
toggleFavorite: function() {
|
|
|
if (this.entity.isCollect === 'Y') {
|
|
|
$.post('/product/favorite.json', {
|
|
|
operation: 'remove',
|
|
|
id: this.entity.productPriceBo.productId
|
|
|
}).then((result)=> {
|
|
|
if (result.code === 200) {
|
|
|
tip('取消收藏成功');
|
|
|
this.entity.isCollect = 'N';
|
|
|
} else if (result.code === 403) {
|
|
|
// 未登陆
|
|
|
yoho.goLogin('', function() {
|
|
|
this.toggleFavorite();
|
|
|
}, function() {
|
|
|
tip('登陆失败');
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
$.post('/product/favorite.json', {
|
|
|
operation: 'add',
|
|
|
id: this.entity.productPriceBo.productId
|
|
|
}).then((result)=> {
|
|
|
if (result.code === 200) {
|
|
|
tip('收藏成功');
|
|
|
this.entity.isCollect = 'Y';
|
|
|
} else if (result.code === 403) {
|
|
|
// 未登陆
|
|
|
yoho.goLogin('', function() {
|
|
|
this.toggleFavorite();
|
|
|
}, function() {
|
|
|
tip('登陆失败');
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
$.post('/product/favorite.json', {
|
|
|
operation: this.entity.isCollect === 'Y' ? 'remove' : 'add',
|
|
|
id: this.entity.productPriceBo.productId
|
|
|
}).then((result)=> {
|
|
|
if (result.code === 200) {
|
|
|
tip(this.entity.isCollect === 'Y' ? '取消收藏成功' : '收藏成功');
|
|
|
this.entity.isCollect = this.entity.isCollect === 'Y' ? 'N' : 'Y';
|
|
|
} else if (result.code === 403) {
|
|
|
// 未登录
|
|
|
yoho.goLogin('', () => {
|
|
|
this.toggleFavorite();
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
created() {
|
...
|
...
|
|