Authored by zhangxiaoru

商品

... ... @@ -56,8 +56,8 @@ const component = {
model.product(params).then(product => {
product = product.data || {};
product.formatPrice = product.formatSalesPrice !== '0' ? product.formatSalesPrice : product.formatMarketPrice;
product.isDiscount = product.marketPrice > product.salesPrice;
product.formatPrice = product.format_sales_price !== '0' ? product.format_sales_price : product.format_market_price;
product.isDiscount = product.market_price > product.sales_price;
res.render('pdetail', {
module: 'product',
... ...
<div id="app" class="product-page" data-pid="{{pid}}" data-goods-id="{{goodsId}}">
<div id="ssr">
{{#product}}
<div class="ssr show-box first-box">
<div class="image-carousel">
<div class="swipe">
<div class="swipe-items-wrap">
{{#each goodsList}}
{{#if colorImage}}
<div class="swipe-item {{#if @first}}active{{/if}}"> <img width="100%" alt="" src="{{image2 colorImage w=750 h=1000 q=80}}"></div>
{{#each goods_list}}
{{#if color_image}}
<div class="swipe-item {{#if @first}}active{{/if}}"> <img width="100%" alt="" src="{{image2 color_image w=750 h=1000 q=80}}"></div>
{{/if}}
{{/each}}
</div>
</div>
</div>
<div class="title-box">
<h1 class="line-clamp-2">{{productName}}</h1>
<h1 class="line-clamp-2">{{product_name}}</h1>
{{#if isDiscount}}
<i class="price strike-through">{{formatMarketPrice}}</i>
<i class="price strike-through">{{format_market_price}}</i>
{{/if}}
<i class="price {{#if isDiscount}}highlight{{/if}}">{{formatPrice}}</i>
</div>
</div>
{{#brandInfo}}
<div class="ssr show-box brand">
<img src="{{image2 brandIco w=110 h=68 q=80}}">
<h2>{{brandName}}</h2>
<img src="{{image2 brand_ico w=110 h=68 q=80}}">
<h2>{{brand_name}}</h2>
<div class="brand-go">
<span>进入店铺</span>
<span class="icon icon-right"></span>
</div>
<a href="/product/shop/{{brandDomain}}"></a>
<a href="/product/shop/{{brand_domain}}"></a>
</div>
{{/brandInfo}}
{{/product}}
</div>
<app/>
</div>
... ...
const yoho = require('yoho');
const $ = require('jquery');
$('.go-back-btn').click(function() {
yoho.goBack({}, function() {}, function() {});
})
const yoho = require('yoho');
const $ = require('jquery');
$('.go-back-btn').click(function() {
yoho.goBack({}, function() {}, function() {});
});
... ...
... ... @@ -18,13 +18,11 @@ yoho.ready(() => {
},
created() {
setTimeout(() => {
let ssrs = document.querySelectorAll('.ssr') || [];
let ssrs = document.getElementById('ssr');
ssrs.forEach(i => {
if (i) {
i.remove();
}
});
if (ssrs) {
ssrs.remove();
}
}, 500);
}
});
... ...