Commit b567d582 authored by 慕轻风's avatar 慕轻风

wnf

parent 3d6ca2e5
...@@ -53,14 +53,21 @@ Component({ ...@@ -53,14 +53,21 @@ Component({
* 收藏商品 * 收藏商品
*/ */
async goToCollectGoods(e) { async goToCollectGoods(e) {
const { itemId, collected } = e.target.dataset.item let { itemId, collected } = e.target.dataset.item
const { taskType } = this.props.task const { taskType } = this.props.task
if(collected) { if(collected) {
commonToast('您已收藏过该商品了') commonToast('您已收藏过该商品了')
return; return;
} }
//判断是否活动外已收藏商品
let isCollected = await checkGoodsCollectedStatus(+itemId)
if(isCollected) {
this.props.onCompleteTask(taskType, itemId)
return;
}
let result = await collectGoods(+itemId) let result = await collectGoods(+itemId)
if(result) { if(result) {
this.props.onCompleteTask(taskType, itemId) this.props.onCompleteTask(taskType, itemId)
} }
......
...@@ -56,7 +56,7 @@ Page({ ...@@ -56,7 +56,7 @@ Page({
const { success, data } = await API.getCollectGoodsList({ activityId, itemIds }).catch(res => { const { success, data } = await API.getCollectGoodsList({ activityId, itemIds }).catch(res => {
res && commonToast(res) res && commonToast(res)
}) || {} }) || {}
if(!success || success) { if(success) {
this.setData({ goodsList: data || [] }) this.setData({ goodsList: data || [] })
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment