|
|
<template>
|
|
|
<div class="layout">
|
|
|
<LayoutHeader class="layout-header" :show-back="true" :title="title" ref="header">
|
|
|
<transition name="fade">
|
|
|
<img-size v-show="headThumbnailVisible" class="title-thumbnail" :src="imageList && imageList[0] && imageList[0].image_url" :width="300" :height="300"/>
|
|
|
</transition>
|
|
|
</LayoutHeader>
|
|
|
<LayoutHeader class="layout-header" :show-back="true" :title="'\u200E'"></LayoutHeader>
|
|
|
<div class="layout-context fixscroll">
|
|
|
<cube-scroll :data="imageList"
|
|
|
:scroll-events="['scroll']"
|
|
|
@scroll="handleScroll">
|
|
|
<div class="slide">
|
|
|
<cube-slide ref="slide" :data="imageList">
|
|
|
<cube-slide-item v-for="(item, index) in imageList" :key="index">
|
|
|
<a click="javascript:void 0" class="square-img-container">
|
|
|
<square-img :src="item.image_url" :width="300" :height="300" />
|
|
|
</a>
|
|
|
</cube-slide-item>
|
|
|
<template slot="dots" slot-scope="props">
|
|
|
<span class="dot" :class="{active: props.current === index}" v-for="(item, index) in props.dots">{{index + 1}}</span>
|
|
|
</template>
|
|
|
</cube-slide>
|
|
|
<div class="qiugou" v-if="isQiugouEnabled" @click="qiugou"></div>
|
|
|
</div>
|
|
|
<cube-scroll :data="imageList">
|
|
|
<div class="slide">
|
|
|
<cube-slide ref="slide" :data="imageList">
|
|
|
<cube-slide-item v-for="(item, index) in imageList" :key="index">
|
|
|
<a click="javascript:void 0" class="square-img-container">
|
|
|
<square-img :src="item.image_url" :width="300" :height="300" />
|
|
|
</a>
|
|
|
</cube-slide-item>
|
|
|
<template slot="dots" slot-scope="props">
|
|
|
<span class="dot" :class="{active: props.current === index}" v-for="(item, index) in props.dots">{{index + 1}}</span>
|
|
|
</template>
|
|
|
</cube-slide>
|
|
|
<div class="qiugou" v-if="isQiugouEnabled" @click="qiugou"></div>
|
|
|
</div>
|
|
|
|
|
|
<div class="info">
|
|
|
<div class="info-price">
|
|
|
<template v-if="productDetail.least_price >= 0"> ¥{{productDetail.least_price}}</template>
|
|
|
<template v-else> </template>
|
|
|
<div class="info">
|
|
|
<div class="info-price">
|
|
|
<template v-if="productDetail.least_price >= 0"> ¥{{productDetail.least_price}}</template>
|
|
|
<template v-else> </template>
|
|
|
</div>
|
|
|
<div class="info-name">{{productDetail.product_name}}</div>
|
|
|
</div>
|
|
|
<div class="info-name">{{productDetail.product_name}}</div>
|
|
|
</div>
|
|
|
<a class="banner" v-if="resource" :href="resource.url">
|
|
|
<img-size :src="sizeImg(resource.src)" :width="300" :height="60"/>
|
|
|
</a>
|
|
|
<div class="info">
|
|
|
<div class="info-list">
|
|
|
<div class="info-list-item" v-if="activity && activity.length !== 0" @click="showActivity">
|
|
|
<div class="info-list-name">促销</div>
|
|
|
<div class="info-list-value info-promote">
|
|
|
<span>{{activity[0].promotionTypeStr}}</span>
|
|
|
<i class="cubeic-arrow"></i>
|
|
|
<a class="banner" v-if="resource" :href="resource.url">
|
|
|
<img-size :src="sizeImg(resource.src)" :width="300" :height="60"/>
|
|
|
</a>
|
|
|
<div class="info">
|
|
|
<div class="info-list">
|
|
|
<div class="info-list-item" v-if="activity && activity.length !== 0" @click="showActivity">
|
|
|
<div class="info-list-name">促销</div>
|
|
|
<div class="info-list-value info-promote">
|
|
|
<span>{{activity[0].promotionTypeStr}}</span>
|
|
|
<i class="cubeic-arrow"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="info-list-item" v-for="(desc, index) in productDec" :key="index">
|
|
|
<div class="info-list-name">{{desc.text}}</div>
|
|
|
<div class="info-list-value">{{desc.value}}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="info-list-item" v-for="(desc, index) in productDec" :key="index">
|
|
|
<div class="info-list-name">{{desc.text}}</div>
|
|
|
<div class="info-list-value">{{desc.value}}</div>
|
|
|
</div>
|
|
|
<top-list v-if="topList && topList.length !== 0" :list="topList" @itemClick="gotoProduct" @allClick="gotoBrand" />
|
|
|
<img class="ref-img" v-lazy="prdDetailTip"/>
|
|
|
</div>
|
|
|
<top-list v-if="topList && topList.length !== 0" :list="topList" @itemClick="gotoProduct" @allClick="gotoBrand" />
|
|
|
<img class="ref-img" v-lazy="prdDetailTip"/>
|
|
|
</div>
|
|
|
|
|
|
<img class="ref-img" v-lazy="prdDetailImage" />
|
|
|
<img class="ref-img" v-lazy="prdDetailImage" />
|
|
|
|
|
|
<div class="recommend" v-if="recommend"><h2>相关推荐</h2>
|
|
|
<product-list :list="recommend" />
|
|
|
</div>
|
|
|
<div class="recommend" v-if="recommend"><h2>相关推荐</h2>
|
|
|
<product-list :list="recommend" />
|
|
|
</div>
|
|
|
</cube-scroll>
|
|
|
</div>
|
|
|
<div class="footer">
|
...
|
...
|
@@ -139,7 +133,6 @@ export default { |
|
|
return {
|
|
|
prdDetailTip,
|
|
|
prdDetailImage,
|
|
|
headThumbnailVisible: false,
|
|
|
|
|
|
showActivitySheet: false,
|
|
|
|
...
|
...
|
@@ -184,16 +177,7 @@ export default { |
|
|
return get(this.productDetail, 'product_name', '商品详情');
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
|
title: {
|
|
|
handler() {
|
|
|
this.setTitle();
|
|
|
},
|
|
|
immediate: true,
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
this.imageHideThreadhold = -window.innerWidth * 0.693;
|
|
|
if (this.isQiugouEnabled === null) {
|
|
|
this.$store.dispatch('getSysConfigQiugou');
|
|
|
}
|
...
|
...
|
@@ -205,21 +189,8 @@ export default { |
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['fetchProductInfo', 'fetchTop3', 'fetchFav', 'toggleFav', 'updateTradeInfo', 'getSelectedTradeProduct', 'payment']),
|
|
|
setTitle() {
|
|
|
if (this.productId === this.productDetail.product_id) {
|
|
|
if (this.$refs.header && this.$refs.header.setTitle) {
|
|
|
this.$refs.header.setTitle(this.title);
|
|
|
} else if (document) {
|
|
|
document.title = this.title;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
refresh() {
|
|
|
this.$refs.slide.refresh();
|
|
|
this.headThumbnailVisible = false;
|
|
|
},
|
|
|
handleScroll(e) {
|
|
|
this.headThumbnailVisible = e.y < this.imageHideThreadhold;
|
|
|
},
|
|
|
sizeImg(src, width = 360, height = 72) {
|
|
|
if (src) {
|
...
|
...
|
@@ -579,10 +550,6 @@ export default { |
|
|
}
|
|
|
}
|
|
|
|
|
|
.title-thumbnail {
|
|
|
height: 100%;
|
|
|
}
|
|
|
|
|
|
.footer {
|
|
|
display: flex;
|
|
|
text-align: center;
|
...
|
...
|
|