|
@@ -16,6 +16,7 @@ Router({
|
|
|
brand: {},
|
|
|
specificationList: [],
|
|
|
productList: [],
|
|
|
+ goodsNums:0,
|
|
|
relatedGoods: [],
|
|
|
cartGoodsCount: 0,
|
|
|
userHasCollect: 0,
|
|
@@ -27,6 +28,7 @@ Router({
|
|
|
hasCollectImage: "https://4d-tjw.oss-cn-shenzhen.aliyuncs.com/wxmall/images/icon_collect_checked.png",
|
|
|
collectBackImage: "https://4d-tjw.oss-cn-shenzhen.aliyuncs.com/wxmall/images/icon_collect.png",
|
|
|
collected:'',
|
|
|
+ skuActiveItem:[],
|
|
|
isfromBrand:false
|
|
|
},
|
|
|
|
|
@@ -34,6 +36,10 @@ Router({
|
|
|
let that = this;
|
|
|
util.request(api.GoodsDetail, { id: that.data.id }).then(function (res) {
|
|
|
if (res.errno === 0) {
|
|
|
+ let goodsNums = 0
|
|
|
+ res.data.productList.forEach(item=>{
|
|
|
+ goodsNums+=item.goods_number
|
|
|
+ })
|
|
|
that.setData({
|
|
|
goods: res.data.info,
|
|
|
gallery: res.data.gallery,
|
|
@@ -43,7 +49,8 @@ Router({
|
|
|
brand: res.data.brand,
|
|
|
specificationList: res.data.specificationList,
|
|
|
productList: res.data.productList,
|
|
|
- userHasCollect: res.data.userHasCollect
|
|
|
+ userHasCollect: res.data.userHasCollect,
|
|
|
+ goodsNums:goodsNums
|
|
|
});
|
|
|
//设置默认值
|
|
|
that.setDefSpecInfo(that.data.specificationList);
|
|
@@ -108,6 +115,8 @@ Router({
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
this.setData({
|
|
|
'specificationList': _specificationList,
|
|
|
'goods.list_pic_url': picUrl,
|
|
@@ -134,11 +143,24 @@ Router({
|
|
|
_checkedObj.valueId = _specificationList[i].valueList[j].id;
|
|
|
_checkedObj.valueText = _specificationList[i].valueList[j].value;
|
|
|
}
|
|
|
+ else{
|
|
|
+ this.setData({
|
|
|
+ skuActiveItem : []
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
checkedValues.push(_checkedObj);
|
|
|
}
|
|
|
|
|
|
- console.log(checkedValues)
|
|
|
+ let goods_specification_ids = ''
|
|
|
+ checkedValues.forEach(item=>{
|
|
|
+ goods_specification_ids+=('_'+item.valueId)
|
|
|
+ })
|
|
|
+ let productItem = this.data.productList.find(item=>item.goods_specification_ids===goods_specification_ids) || []
|
|
|
+ console.log(productItem)
|
|
|
+ this.setData({
|
|
|
+ skuActiveItem : productItem
|
|
|
+ })
|
|
|
return checkedValues;
|
|
|
|
|
|
},
|