|
|
<template>
|
|
|
<top-nav v-if="isApp" :title="entity.productName" :img="firstImage | resize 300 300"></top-nav>
|
|
|
<top-nav v-if="isApp" :title="entity.product_name" :img="firstImage | resize 300 300"></top-nav>
|
|
|
<show-box :is-first="true">
|
|
|
<image-carousel :goods="entity.goodsList"></image-carousel>
|
|
|
<image-carousel :goods="entity.goods_list"></image-carousel>
|
|
|
<div class="title-box">
|
|
|
<h1 class="line-clamp-2">{{entity.productName}}</h1>
|
|
|
<i class="price" v-if="entity.marketPrice > entity.salesPrice"
|
|
|
:class="{'strike-through': entity.salesPrice > 0}">{{entity.formatMarketPrice}}</i>
|
|
|
<h1 class="line-clamp-2">{{entity.product_name}}</h1>
|
|
|
<i class="price" v-if="entity.market_price > entity.sales_price"
|
|
|
:class="{'strike-through': entity.sales_price > 0}">{{entity.format_market_price}}</i>
|
|
|
|
|
|
<i v-if="entity.salesPrice > 0"
|
|
|
:class="{price: true, highlight: entity.marketPrice > entity.salesPrice}">
|
|
|
{{entity.formatSalesPrice !== '0' ? entity.formatSalesPrice : entity.formatMarketPrice}}
|
|
|
<i v-if="entity.sales_price > 0"
|
|
|
:class="{price: true, highlight: entity.market_price > entity.sales_price}">
|
|
|
{{entity.format_sales_price !== '0' ? entity.format_sales_price : entity.format_market_price}}
|
|
|
</i>
|
|
|
</div>
|
|
|
</show-box>
|
|
|
|
|
|
<show-box class="brand" v-if="brand">
|
|
|
<img :src="brand.brandIco | resize 110 68"/>
|
|
|
<img :src="brand.brand_ico | resize 110 68"/>
|
|
|
|
|
|
<h2>{{brand.brandName}}</h2>
|
|
|
<h2>{{brand.brand_name}}</h2>
|
|
|
<div class="brand-go">
|
|
|
<span>进入店铺</span>
|
|
|
<span class="icon icon-right"></span>
|
|
|
</div>
|
|
|
<a :href="brand.brandDomain | brandUrl"></a>
|
|
|
<a :href="brand.brand_domain | brandUrl"></a>
|
|
|
</show-box>
|
|
|
|
|
|
<show-box v-if="intro.productDescBo">
|
...
|
...
|
@@ -153,7 +153,7 @@ |
|
|
<h2>商品详情</h2>
|
|
|
<i>DETAILS</i>
|
|
|
|
|
|
<p v-if="brand && brand.brandIntro" v-lazy-html="brand.brandIntro">
|
|
|
<p v-if="brand && brand.brand_intro" v-lazy-html="brand.brand_intro">
|
|
|
</p>
|
|
|
|
|
|
<p v-if="brand && intro.productIntroBo" v-lazy-html="intro.productIntroBo.productIntro">
|
...
|
...
|
@@ -169,7 +169,7 @@ |
|
|
</span>
|
|
|
</button>
|
|
|
<button class="button control-button" @click="toggleFavorite()">
|
|
|
<span v-if="entity.isCollect === 'Y' " class="icon icon-focused"></span>
|
|
|
<span v-if="entity.is_collect === 'Y' " class="icon icon-focused"></span>
|
|
|
<span v-else class="icon icon-focus"></span>
|
|
|
</button>
|
|
|
<button class="button button-solid add-to-cart"
|
...
|
...
|
@@ -413,11 +413,7 @@ |
|
|
intro: {},
|
|
|
firstImage: '',
|
|
|
brand: null,
|
|
|
entity: {
|
|
|
productPriceBo: {
|
|
|
formatMarketPrice: ''
|
|
|
}
|
|
|
},
|
|
|
entity: {},
|
|
|
showFeatureSelector: false,
|
|
|
cartCount: 0,
|
|
|
|
...
|
...
|
@@ -476,12 +472,12 @@ |
|
|
*/
|
|
|
toggleFavorite: function() {
|
|
|
$.post('/product/favorite.json', {
|
|
|
operation: this.entity.isCollect === 'Y' ? 'remove' : 'add',
|
|
|
id: this.entity.productId
|
|
|
operation: this.entity.is_collect === 'Y' ? 'remove' : 'add',
|
|
|
id: this.entity.product_id
|
|
|
}).then((result)=> {
|
|
|
if (result.code === 200) {
|
|
|
tip(this.entity.isCollect === 'Y' ? '取消收藏成功' : '收藏成功');
|
|
|
this.entity.isCollect = this.entity.isCollect === 'Y' ? 'N' : 'Y';
|
|
|
tip(this.entity.is_collect === 'Y' ? '取消收藏成功' : '收藏成功');
|
|
|
this.entity.is_collect = this.entity.is_collect === 'Y' ? 'N' : 'Y';
|
|
|
yoho.store.set('productReload', true);
|
|
|
} else if (result.code === 401) {
|
|
|
yoho.goLogin('', () => {
|
...
|
...
|
@@ -517,20 +513,21 @@ |
|
|
return;
|
|
|
}
|
|
|
this.entity = result.data;
|
|
|
this.brand = result.data.brand_info;
|
|
|
if (this.entity.storage === 0 || this.entity.status === 0) {
|
|
|
this.isSoldOut = true;
|
|
|
}
|
|
|
|
|
|
const goodsList = this.entity.goodsList || [];
|
|
|
const goodsList = this.entity.goods_list || [];
|
|
|
|
|
|
goodsList.forEach((goods)=> {
|
|
|
if (!this.firstImage && goods.colorImage) {
|
|
|
this.firstImage = goods.colorImage;
|
|
|
if (!this.firstImage && goods.color_image) {
|
|
|
this.firstImage = goods.color_image;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
share({
|
|
|
title: this.entity.productName,
|
|
|
title: this.entity.product_name,
|
|
|
link: location.href,
|
|
|
desc: '我在BLK发现了一个不错的商品,快来看看吧!',
|
|
|
imgUrl: this.firstImage.replace(/(\{width}|\{height}|\{mode})/g, function($0) {
|
...
|
...
|
@@ -548,18 +545,12 @@ |
|
|
}).then((data)=> {
|
|
|
if (data) {
|
|
|
// 读取商品详情
|
|
|
$.get(`/product/product/intro_${pid}.json`, {skn: data.productSkn}).then(intro => {
|
|
|
$.get(`/product/product/intro_${pid}.json`, {skn: data.product_skn}).then(intro => {
|
|
|
this.intro = intro;
|
|
|
if (this.intro.sizeImage) {
|
|
|
this.intro.sizeImage = this.intro.sizeImage.replace(/https?:/, '');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (data.brandInfo && data.brandInfo.brandId) {
|
|
|
$.get(`/product/product/brand_${data.brandInfo.brandId}.json`).then(brand => {
|
|
|
this.brand = brand.data && brand.data.length ? brand.data[0] : {};
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
.always(() => {
|
...
|
...
|
|