<script>
$(function () {
//
const goodsPriceList = {{ goodsPriceList | json_encode | raw }};
//
$('.get-price-ajax').each(function () {
//
const $price = $(this);
const $list_price = $price.parent().prev('.through');
const goodsId = $(this).data('itemId');
const goodsPrice = goodsPriceList[goodsId];
const price = goodsPrice.min_price_in_tax;
const teika = goodsPrice.gp_teika_min;
const priceText = (price === null || isNaN(price)) ? price : parseInt(price).toLocaleString();
$(this).text(priceText);
// ぽちぽちブロック 商品バナー
if( $price.hasClass('managed-contents-block-list-price') ){
$price.attr('data-price', price);
var $contentsBlock = $price.closest('.managed-contents-block');
var $listPrice = $('.managed-contents-block-retail-prices', $contentsBlock).attr('data-list-price', teika);
$('.through', $listPrice).html( $list_price.html() );
// SALEアイコン表示
if( teika && parseInt(teika, 10) !== 0 ){
var rate = parseInt(price, 10) / parseInt(teika, 10) * 100;
var percentage = Math.round(100 - rate, 0);
var svNum = Math.floor(Math.random() * Math.floor(10));
$('.managed-contents-block-sale-icon img', $contentsBlock).attr('src', 'https://img'+svNum+'.land-mark.biz/ut_img/public_images/sale/left-bottom/percent_off_'+percentage+'.png');
}
else{
$('.managed-contents-block-sale-icon', $contentsBlock).remove();
}
}
})
})
</script>