商品详情规则选择的bug
parent
4599b02a41
commit
ef5941de00
|
@ -219,7 +219,7 @@
|
||||||
|
|
||||||
<!-- 商品规格 商品详情,以及默认参与活动的id-->
|
<!-- 商品规格 商品详情,以及默认参与活动的id-->
|
||||||
<popupGoods :addr="delivery" ref="popupGoods" @changed="changedGoods" @closeBuy="closePopupBuy" @queryCart="cartCount()" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" :id="productId"
|
<popupGoods :addr="delivery" ref="popupGoods" @changed="changedGoods" @closeBuy="closePopupBuy" @queryCart="cartCount()" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" :id="productId"
|
||||||
v-if="goodsDetail.id " :pointDetail="pointDetail" @handleClickSku="init" :buyMask="buyMask" />
|
v-if="goodsDetail.id " :pointDetail="pointDetail" @handleClickSku="selectSku" :buyMask="buyMask" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</div>
|
</div>
|
||||||
|
@ -499,11 +499,15 @@ export default {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
selectSku (idObj) {
|
||||||
|
console.log(idObj)
|
||||||
|
this.init(idObj.skuId,idObj.goodsId)
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 初始化信息
|
* 初始化信息
|
||||||
*/
|
*/
|
||||||
async init(id, goodsId, distributionId) {
|
async init(id, goodsId, distributionId) {
|
||||||
|
console.log(id, goodsId)
|
||||||
this.isGroup = false; //初始化拼团
|
this.isGroup = false; //初始化拼团
|
||||||
this.productId = id; // skuId
|
this.productId = id; // skuId
|
||||||
// 这里请求获取到页面数据 解析数据
|
// 这里请求获取到页面数据 解析数据
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
<view class="goods-skus-view" :key="specIndex" v-for="(spec, specIndex) in formatList">
|
<view class="goods-skus-view" :key="specIndex" v-for="(spec, specIndex) in formatList">
|
||||||
<view class="skus-view-list">
|
<view class="skus-view-list">
|
||||||
<view class="view-class-title">{{ spec.name }}</view>
|
<view class="view-class-title">{{ spec.name }}</view>
|
||||||
<view :class="{ active: spec_val.id == currentSelceted[specIndex] }" class="skus-view-item" v-for="(spec_val, spec_index) in spec.values" :key="spec_index"
|
<view :class="{ active: spec_val.value == currentSelceted[specIndex] }" class="skus-view-item" v-for="(spec_val, spec_index) in spec.values" :key="spec_index"
|
||||||
@click="handleClickSpec(spec, specIndex, spec_val)">{{ spec_val.value }}</view>
|
@click="handleClickSpec(spec, specIndex, spec_val)">{{ spec_val.value }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -145,12 +145,12 @@ export default {
|
||||||
|
|
||||||
/**点击规格 */
|
/**点击规格 */
|
||||||
handleClickSpec(val, index, specValue) {
|
handleClickSpec(val, index, specValue) {
|
||||||
this.$set(this.currentSelceted, index, specValue.id);
|
this.$set(this.currentSelceted, index, specValue.value);
|
||||||
let selectedSkuId = this.goodsSpec.find((i) => {
|
let selectedSkuId = this.goodsSpec.find((i) => {
|
||||||
let matched = true;
|
let matched = true;
|
||||||
let specValues = i.specValues.filter((j) => j.specName !== "images");
|
let specValues = i.specValues.filter((j) => j.specName !== "images");
|
||||||
for (let n = 0; n < specValues.length; n++) {
|
for (let n = 0; n < specValues.length; n++) {
|
||||||
if (specValues[n].specValueId !== this.currentSelceted[n]) {
|
if (specValues[n].specValue !== this.currentSelceted[n]) {
|
||||||
matched = false;
|
matched = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,6 @@ export default {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.selectSkuList = {
|
this.selectSkuList = {
|
||||||
spec: {
|
spec: {
|
||||||
specName: val.name,
|
specName: val.name,
|
||||||
|
@ -169,7 +168,7 @@ export default {
|
||||||
};
|
};
|
||||||
this.selectName = specValue.value;
|
this.selectName = specValue.value;
|
||||||
|
|
||||||
this.$emit("handleClickSku", selectedSkuId.skuId, this.goodsDetail.id);
|
this.$emit("handleClickSku", {skuId: selectedSkuId.skuId, goodsId: this.goodsDetail.goodsId});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,10 +230,8 @@ export default {
|
||||||
let arr = [{}];
|
let arr = [{}];
|
||||||
list.forEach((item, index) => {
|
list.forEach((item, index) => {
|
||||||
item.specValues.forEach((spec, specIndex) => {
|
item.specValues.forEach((spec, specIndex) => {
|
||||||
let id = spec.specNameId;
|
|
||||||
let name = spec.specName;
|
let name = spec.specName;
|
||||||
let values = {
|
let values = {
|
||||||
id: spec.specValueId,
|
|
||||||
value: spec.specValue,
|
value: spec.specValue,
|
||||||
quantity: item.quantity,
|
quantity: item.quantity,
|
||||||
};
|
};
|
||||||
|
@ -246,7 +243,7 @@ export default {
|
||||||
if (
|
if (
|
||||||
arrItem.name == name &&
|
arrItem.name == name &&
|
||||||
arrItem.values &&
|
arrItem.values &&
|
||||||
!arrItem.values.find((i) => i.id === values.id)
|
!arrItem.values.find((i) => i.value === values.value)
|
||||||
) {
|
) {
|
||||||
arrItem.values.push(values);
|
arrItem.values.push(values);
|
||||||
}
|
}
|
||||||
|
@ -256,7 +253,6 @@ export default {
|
||||||
});
|
});
|
||||||
if (!keys.includes(name)) {
|
if (!keys.includes(name)) {
|
||||||
arr.push({
|
arr.push({
|
||||||
id: id,
|
|
||||||
name: name,
|
name: name,
|
||||||
values: [values],
|
values: [values],
|
||||||
});
|
});
|
||||||
|
@ -273,7 +269,7 @@ export default {
|
||||||
item.specValues
|
item.specValues
|
||||||
.filter((i) => i.specName !== "images")
|
.filter((i) => i.specName !== "images")
|
||||||
.forEach((value, _index) => {
|
.forEach((value, _index) => {
|
||||||
this.currentSelceted[_index] = value.specValueId;
|
this.currentSelceted[_index] = value.specValue;
|
||||||
|
|
||||||
this.selectName = value.specValue;
|
this.selectName = value.specValue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue