Browse Source

商城PC端商品详情轮播图处理为存在规格图片时,替换为规格图片业务

master
dy-hu 1 year ago
parent
commit
08a7fe34fe
  1. 17
      src/views/product/productDetail.vue
  2. 11
      src/views/product/productDetailSlot.vue

17
src/views/product/productDetail.vue

@ -308,7 +308,8 @@ export default {
composeList: [],
skusList: [],
priceRules: [],
composePosition: 0
composePosition: 0,
skuImages: []
}
},
filters: {
@ -543,6 +544,18 @@ export default {
}
})
})
for (const valueCode of this.skuNames[0].values) {
if (valueCode.image) {
this.skuImages.push(valueCode.image)
}
}
if (this.skuImages.length > 0) {
//
this.productDetailData.images = this.skuImages
this.productDetailData.skuImages = this.skuImages
}
}
this.setActivityOption()
// this.getProOption()
@ -807,8 +820,6 @@ export default {
},
// sku
selectSku (o, list) {
console.log('o-->', o)
console.log('list-->', list)
const temp = this.productDetailData.names
this.productNumber = 1
if (list.values.length > 1) {

11
src/views/product/productDetailSlot.vue

@ -103,7 +103,7 @@
</div>
<!-- -----------------------------------------------------规格----------------------------------------------- -->
<div class="sku" v-if="productData.names && productData.names.length > 0">
<ul v-for='it in productData.names' :key='it.nameCode'>
<ul v-for='(it,rowIndex) in productData.names' :key='it.nameCode'>
<li>
<p class="proDescribeTit">
{{it.skuName === '' ? '' : it.skuName + ':'}}
@ -111,10 +111,10 @@
<!-- 多选项值 -->
<p v-if="it.values && it.values.length > 1">
<span
v-for='kt in it.values'
v-for='(kt,colIndex) in it.values'
:key='kt.valueCode'
:class="[{'selected-item': kt.selected}]"
@click="selectSku(kt, it);"
@click="selectSku(kt, it, rowIndex, colIndex);"
>
{{kt.skuValue }}
</span>
@ -272,8 +272,11 @@ export default {
this.swiperTop.slideTo(index, 300, false)
},
//
selectSku (o, list) {
selectSku (o, list, rowIndex, colIndex) {
this.$emit('selectSku', o, list)
if (this.productData.skuImages && rowIndex === 0) {
this.thumbsClick(colIndex)
}
},
//
collect () { this.$emit('collect') },

Loading…
Cancel
Save