|
|
@ -94,7 +94,7 @@ |
|
|
|
<view class="sku-image-box"> |
|
|
|
<!--规格图片遍历处理最大只显示4个--> |
|
|
|
<block v-for="(skuImgItem,skuImgIndex) in productData.names[0].values" :key="skuImgIndex"> |
|
|
|
<image class="sku-image" :class="{'sku-image-select' : skuImgItem.valueCode === selectedSku.valueCodes}" @click="handleClickSku(productData.names[0].nameCode, skuImgItem.valueCode)" |
|
|
|
<image class="sku-image" :class="{'sku-image-select' : skuImgItem.valueCode === selectedAttr[productData.names[0].nameCode]}" @click="handleClickSku(productData.names[0].nameCode, skuImgItem.valueCode)" |
|
|
|
:src="skuImgItem.image ? skuImgItem.image: defaultImageUrl" @error="onImageError"/> |
|
|
|
</block> |
|
|
|
|
|
|
@ -472,7 +472,8 @@ export default { |
|
|
|
productIds: '', |
|
|
|
} |
|
|
|
}, |
|
|
|
defaultImageUrl: 'http://36.138.125.206:8081/ceres-local-file/image/sku_default.png' |
|
|
|
defaultImageUrl: 'http://36.138.125.206:8081/ceres-local-file/image/sku_default.png', |
|
|
|
selectedAttr: {}, |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
@ -763,11 +764,13 @@ export default { |
|
|
|
this.$nextTick(async () => { |
|
|
|
if (this.paramSkuId) { |
|
|
|
this.$refs.skuSelect.handleSelectBySkuId(this.paramSkuId) |
|
|
|
this.selectedAttr = this.$refs.skuSelect.selectedAttr |
|
|
|
} else { |
|
|
|
// 默认选中第0个 |
|
|
|
for (const skuRowItem of this.productData.names) { |
|
|
|
this.$refs.skuSelect.handleClickSkuItem(skuRowItem.nameCode, skuRowItem.values[0].valueCode) |
|
|
|
} |
|
|
|
this.selectedAttr = this.$refs.skuSelect.selectedAttr |
|
|
|
} |
|
|
|
//如果是拼团,设置拼团id |
|
|
|
if (this.productData.activityType === 1) { |
|
|
@ -831,6 +834,7 @@ export default { |
|
|
|
|
|
|
|
handleClickSku(nameCode, valueCode) { |
|
|
|
this.$refs.skuSelect.handleClickSkuItem(nameCode,valueCode) |
|
|
|
this.selectedAttr = this.$refs.skuSelect.selectedAttr |
|
|
|
}, |
|
|
|
|
|
|
|
onImageError(e) { |
|
|
|