Merge branch 'master' of http://git.luyuan.tk/luyuan/deming into xbx
This commit is contained in:
@@ -27,10 +27,10 @@
|
||||
<text>¥{{ goodsInfo.goods_price }}</text>
|
||||
<s>¥{{ goodsInfo.goods_marketprice }}</s>
|
||||
</view>
|
||||
<view class="collect">
|
||||
<u-icon name="star" color="#474747" size="28" v-if="1"></u-icon>
|
||||
<view class="collect" @click="switchCollect(goodsInfo.goods_collect)">
|
||||
<u-icon name="star" color="#474747" size="28" v-if="!goodsInfo.goods_collect"></u-icon>
|
||||
<u-icon name="star-fill" color="#FF7807" size="28" v-else></u-icon>
|
||||
<text>收藏</text>
|
||||
<text>{{ !goodsInfo.goods_collect ? '收藏' : '已收藏' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -228,9 +228,12 @@ export default {
|
||||
onLoad(option) {
|
||||
// this.init();
|
||||
// console.log(option);
|
||||
this.type = Number(option.type);
|
||||
// this.type = Number(option.type);
|
||||
// this.type = 1;
|
||||
this.id = option.id;
|
||||
this.setTitle();
|
||||
// 先请求普通商品详情获取商品类型再渲染页面
|
||||
this.ordinaryDetails(this.id);
|
||||
},
|
||||
onShow() {
|
||||
this.debounce = true;
|
||||
@@ -325,19 +328,15 @@ export default {
|
||||
},
|
||||
getGoodsDetails(id) {
|
||||
switch (this.type) {
|
||||
case 1:
|
||||
this.ordinaryDetails(id);
|
||||
break;
|
||||
// case 1:
|
||||
// this.ordinaryDetails(id);
|
||||
// break;
|
||||
case 2:
|
||||
this.pinTuanDetails(id);
|
||||
break;
|
||||
case 3:
|
||||
this.spikeGoodsDetails(id);
|
||||
break;
|
||||
case 4:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -354,6 +353,8 @@ export default {
|
||||
this.glist = res.data.spec_list;
|
||||
this.storeid = res.data.store.store_id
|
||||
// console.log(this.goodsInfo.mobile_body);
|
||||
this.type = res.data.view_type;
|
||||
this.getGoodsDetails(this.type);
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -512,7 +513,32 @@ export default {
|
||||
urls: arr,
|
||||
current: arr[index]
|
||||
})
|
||||
}
|
||||
},
|
||||
switchCollect(status) {
|
||||
if(status) {
|
||||
this.removeFavorite();
|
||||
} else {
|
||||
this.addFavoriteGoods();
|
||||
}
|
||||
},
|
||||
addFavoriteGoods() {
|
||||
this.$u.api.addFavoriteGoods({ fid: this.id }).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.getGoodsDetails(this.id);
|
||||
} else {
|
||||
this.$u.toast(res.message);
|
||||
}
|
||||
})
|
||||
},
|
||||
removeFavorite() {
|
||||
this.$u.api.removeFavorite({ fid: this.id, type: 'goods' }).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.getGoodsDetails(this.id);
|
||||
} else {
|
||||
this.$u.toast(res.message);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user