init
This commit is contained in:
822
app/index/view/product/detail.phtml
Executable file
822
app/index/view/product/detail.phtml
Executable file
@@ -0,0 +1,822 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
{include file="include/head-seo" /}
|
||||
{include file="include/head" /}
|
||||
{include file="include/head-product" /}
|
||||
<script type="text/javascript" src="__PUBLIC__/web/scripts/comment.js"></script>
|
||||
<script type="text/javascript">
|
||||
var navID = "1";
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!--top-->
|
||||
<header class="header-PC header-Product">
|
||||
<div id="header" class="theme-black">
|
||||
|
||||
{include file="include/top-head2023" /}
|
||||
</div>
|
||||
</header>
|
||||
<!--top End-->
|
||||
<link rel="stylesheet" href="__PUBLIC__/web/css/tipso.min.css">
|
||||
<script type="text/javascript" src="__PUBLIC__/web/scripts/large.js"></script>
|
||||
<script src="__PUBLIC__/web/scripts/tipso.min.js"></script>
|
||||
<div class="indexbox-product cpmbox">
|
||||
<div class="swt-Container">
|
||||
<div class="product_address">
|
||||
<a href="/index" class="href_01">首页</a>
|
||||
<span class="icon-arrow arrow_address"></span><?php if($pid==''){?>
|
||||
<a href="<?php echo url_rewrite('product', ['id' => $cid['id']]); ?>" class="href_02"><?php echo $cid['name'];?></a>
|
||||
<?php }else{?>
|
||||
<a href="<?php echo url_rewrite('product', ['id' => $pid['id']]); ?>" class="href_02"><?php echo $pid['name'];?></a>
|
||||
<?php }?>
|
||||
<span class="icon-arrow arrow_address"></span> <a href="<?php echo url_rewrite('productsub', ['id' => $detail['cid']]); ?>" class="href_02"><?php echo $category['name'];?></a>
|
||||
</div>
|
||||
<!-- 产品 s -->
|
||||
<div class="cp outBox">
|
||||
<div class="cpfl">
|
||||
<?php
|
||||
$proimages = [];
|
||||
$images = [];
|
||||
if ($product_images):
|
||||
$proimages = $product_images;
|
||||
|
||||
//判断属性规则为旧版【2023-12-30前】单一颜色属性, 还是新版多属性
|
||||
if(is_array($product_attr)) {
|
||||
|
||||
$images = reset($product_images);
|
||||
$skuAttr = $images['image_color']; //获取多属性标签
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
if ($color){
|
||||
$images = $product_images[$color];
|
||||
} else {
|
||||
$images = reset($product_images);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!--preview start-->
|
||||
<div class="preview">
|
||||
<div class="smallImg">
|
||||
<div class="scrollbutton smallImgUp disabled"></div>
|
||||
<div id="imageMenu">
|
||||
<ul id="image_list">
|
||||
<?php
|
||||
$firstimage = '';
|
||||
|
||||
if(is_array($product_attr) && is_array($images['image_url'])){
|
||||
foreach($images['image_url'] as $km => $itm) {
|
||||
|
||||
if($km == 0) {
|
||||
$firstimage = $itm;
|
||||
echo '<li id="onlickImg"> <img src="'.getImage($itm).'"></li>';
|
||||
}
|
||||
else{
|
||||
echo '<li> <img src="'.getImage($itm).'"></li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(isset($images['image_url']) && is_array($images['image_url'])) {
|
||||
foreach ($images['image_url'] as $k => $img){
|
||||
if($k == 0) { $firstimage = $img;}
|
||||
|
||||
echo '<li id="onlickImg"> <img src="'.getImage($img).'"></li>';
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
foreach ($images as $k => $img){
|
||||
if($k == 0) {
|
||||
$firstimage = $img['image_url'];
|
||||
echo '<li id="onlickImg"> <img src="'.getImage($img['image_url']).'"></li>';
|
||||
}
|
||||
else{
|
||||
echo '<li> <img src="'.getImage($img['image_url']).'"></li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="scrollbutton smallImgDown"></div>
|
||||
</div><!--smallImg end-->
|
||||
<div id="vertical" class="bigImg">
|
||||
<img src="<?php echo getImage($firstimage); ?>" id="midimg"/>
|
||||
</div><!--bigImg end-->
|
||||
</div>
|
||||
<!--preview end-->
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<!-- 视频播放 s -->
|
||||
<?php if ($detail['videopath'] == "") { ?><?php } else { ?>
|
||||
<!--div class="play play1">
|
||||
<a href="javascript:;" class="pcha"><img src="__PUBLIC__/web/images/images/cha1.png"></a>
|
||||
<div class="moimg">
|
||||
<video id="pvideo" width="100%" height="auto" controls
|
||||
poster="<?php echo getImage($detail['picture']); ?>">
|
||||
<source src="<?php echo $detail['videopath']; ?>">
|
||||
您的浏览器不支持 video 标签。
|
||||
Your browser does not support HTML5 video.
|
||||
</video>
|
||||
</div>
|
||||
</div>
|
||||
<div class="plbtn"><a href="javascript:;"><img src="__PUBLIC__/web/images/images/play.png"></a>
|
||||
</div-->
|
||||
<?php } ?>
|
||||
<!-- 视频播放 e -->
|
||||
</div>
|
||||
<div class="cprh">
|
||||
<div class="cpcon">
|
||||
<p class="ctit1"><?php echo $detail['name']; ?></p>
|
||||
<p class="ctit2"><?php echo $detail['shortname']; ?></p>
|
||||
<div class="position-r" style="width:96px; margin-top:0.5vw;">
|
||||
<!-- <img src="__PUBLIC__/web/images/star_whhite.png"> -->
|
||||
<div class="star" style="width:<?php echo $detail['cpyanse']; ?>%;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 规格参数 s -->
|
||||
<div class="proTfg">
|
||||
<?php
|
||||
if ($detail['product_view']) {
|
||||
$detail_views = unserialize($detail['product_view']);
|
||||
if ($detail_views) {
|
||||
?>
|
||||
<ul class="msul swt-Table">
|
||||
<li class="Table-Row">
|
||||
<div class="ms3 Table-Cell">型号</div>
|
||||
<div class="ms2 Table-Cell"></div>
|
||||
<div class="ms4 Table-Cell"><?php echo $detail['brand_id']; ?></div>
|
||||
</li>
|
||||
<?php foreach ($detail_views as $detail_view): ?>
|
||||
|
||||
<li class="Table-Row">
|
||||
<div class="ms3 Table-Cell"><?php echo $detail_view['desc_title']; ?></div>
|
||||
<div class="ms2 Table-Cell "></div>
|
||||
<div class="ms4 Table-Cell"><?php echo $detail_view['desc_desc']; ?></div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<!-- 规格参数 e -->
|
||||
|
||||
<?php if ($proimages): ?>
|
||||
|
||||
|
||||
<?php
|
||||
//echo "<pre>*******"; print_r($attributes);
|
||||
|
||||
if(is_array($attributes) && sizeof($attributes)){
|
||||
foreach($attributes as $ka => $attrList){
|
||||
echo "<div class='hd 111'><div class ='dt attr_type'>".$ka."</div>";
|
||||
$isColor = false;
|
||||
|
||||
if(strtolower($ka) == 'color' || $ka == '颜色' || $ka == '色彩') {
|
||||
echo "<ul class='dowebok'>";
|
||||
$isColor = true;
|
||||
}
|
||||
else{
|
||||
echo "<ul class='typeColor'>";
|
||||
}
|
||||
$colorType = '';
|
||||
foreach($attrList as $kl => $attrValue){
|
||||
|
||||
$firstClass = " attr_item ".($kl ==0 ? "on" : "");
|
||||
|
||||
if($isColor){
|
||||
//判断颜色属性取值【中文文字、色值、色块图英文名称】
|
||||
$firstChar = substr($attrValue, 0, 1);
|
||||
$colorFile = 'https://cc.f2b211.com/uploads/color/' .strtolower($attrValue). '.jpg';
|
||||
|
||||
if($kl == 0){
|
||||
//判断为颜色色值RGB
|
||||
if($firstChar == '#'){
|
||||
$colorType = 1;
|
||||
}
|
||||
elseif(strlen($attrValue) ==2){
|
||||
$colorType = 2;
|
||||
}
|
||||
//判断颜色色块图片是否存在
|
||||
elseif(https_request($colorFile)){
|
||||
$colorType = 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//判断为颜色色值RGB
|
||||
if($colorType == 1){
|
||||
echo '<li class="item attr_value '.$firstClass.'" data-type="'.$ka.'" data-value="'.trim($attrValue).'"><a style="background-color: '.$attrValue.'""></a></li>';
|
||||
|
||||
}
|
||||
elseif($colorType == 2){
|
||||
if(isset($productColor[strtoupper($attrValue)])) {
|
||||
if($attrValue == 'GD'||$attrValue == 'GR'||$attrValue == 'SV'||$attrValue == 'RG'||$attrValue == 'CO'||$attrValue == 'WD'){
|
||||
echo '<li class="item attr_value tip1 '.$firstClass.'" data-type="'.$ka.'" data-value="'.trim($attrValue).'" data-feed="'.$productColor[$attrValue].'" data-tipso="'.$productColor[strtoupper($attrValue)].'"><a><img src="/uploads/color/'.$attrValue.'.jpg" alt="" style="width:20px; height: 20px; border-radius: 10px; "></a></li>';
|
||||
|
||||
}
|
||||
else{
|
||||
echo '<li class="item attr_value tip1 '.$firstClass.'" data-type="'.$ka.'" data-value="'.trim($attrValue).'" data-feed="'.$productColor[$attrValue].'" data-tipso="'.$productColor[strtoupper($attrValue)].'"><span class="co-bg '.strtoupper($attrValue).'"></span></li>';
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
echo '<li class="item attr_value tip1 '.$firstClass.'" data-type="'.$ka.'" data-value="'.trim($attrValue).'" data-feed="'.strtoupper($attrValue).'" data-tipso="'.strtoupper($attrValue).'"><span class="co-bg '.strtoupper($attrValue).'"></span></li>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//判断颜色色块图片是否存在
|
||||
elseif($colorType == 3){
|
||||
?>
|
||||
<li class="item attr_value inner tip1 <?php echo $firstClass;?>" data-tipso="<?php echo strtoupper($attrValue);?>" data-type="<?php echo trim($ka);?>" data-value="<?php echo trim($attrValue);?>">
|
||||
<a>
|
||||
<img src="<?php echo '/uploads/color/'.strtolower($attrValue);?>.jpg" alt="" style="width:20px; height: 20px; border-radius: 10px; ">
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
else{
|
||||
echo '<li class="item attr_value '.$firstClass.'" data-feed="'.strtoupper($attrValue).'" data-type="'.$ka.'" data-value="'.trim($attrValue).'"><a ><i class="text">'.strtoupper($attrValue).'</i></a></li>';
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo '<li class="item attr_value '.$firstClass.'" data-feed="'.strtoupper($attrValue).'" data-type="'.$ka.'" data-value="'.trim($attrValue).'"><a ><i class="text">'.$attrValue.'</i></a></li>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo "</ul> </div>";
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
//echo "<pre>=="; print_r($images); die;
|
||||
if($images){
|
||||
$firstKeys = array_keys($proimages);
|
||||
$firstElement = array_shift($firstKeys);
|
||||
|
||||
if(!$firstElement == 0){
|
||||
echo "<div class='hd 333'><div class ='dt'>颜色</div><ul class='dowebok'>";
|
||||
}
|
||||
|
||||
|
||||
foreach ($proimages as $k => $imgclrs):
|
||||
|
||||
if(!isset($imgclrs['product_id'])) {
|
||||
$b = $k;
|
||||
$c = $imgclrs[0]['image_color']; //背景图片色块
|
||||
$colorName = mb_substr($b,-2,2);
|
||||
|
||||
if (!$c == '') { ?>
|
||||
|
||||
<li class="item inner <?php if ($b == $color): ?> on<?php endif; ?>" >
|
||||
|
||||
<a class="attr_value" href="<?php echo url_rewrite('productdetail', ['id' => $detail['id'], 'color' => $b]); ?>">
|
||||
<img src="<?php echo $c; ?>" alt="" style="width:20px; height: 20px; border-radius: 10px; ">
|
||||
</a>
|
||||
</li>
|
||||
<?php } } ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php echo " </ul></div>";?>
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<div class="buy">
|
||||
{volist name="purchase_links" id="vo"}
|
||||
{if condition="trim($vo.link) != ''"}
|
||||
<a target="_blank"
|
||||
href="{$vo.link}"
|
||||
class="business-button buybuttonin{$key == 0 ? ' btn1-blue-detail' : ' btn1-white-detail'} "
|
||||
>
|
||||
{$vo.platform}
|
||||
</a>
|
||||
{/if}
|
||||
{/volist}
|
||||
</div>
|
||||
|
||||
<!-- <div class="buy">
|
||||
<?php if ($detail['url_tm']): ?>
|
||||
<a href="<?php echo $detail['url_tm']; ?>" target="_blank" onclick="add_click(<?php echo $detail['id'] ?>, 1, '<?php echo $detail['url_tm']; ?>')">天猫购买</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($detail['url_jd']): ?>
|
||||
<a href="<?php echo $detail['url_jd']; ?>" target="_blank" onclick="add_click(<?php echo $detail['id'] ?>, 2, '<?php echo $detail['url_jd']; ?>')">京东购买</a>
|
||||
<?php endif;?>
|
||||
</div> -->
|
||||
|
||||
<!--a onclick="toggle_colleciton()" class="m_top_20">
|
||||
<span class="house house_img01
|
||||
<?php if ($detail['is_collection']): ?>
|
||||
house_img02
|
||||
<?php endif; ?>
|
||||
"></span>
|
||||
<div class="clear"></div>
|
||||
</a-->
|
||||
</div>
|
||||
</div>
|
||||
<!-- 产品 e -->
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("a .house").click(function(){
|
||||
$(this).toggleClass("house_img02");
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="warp">
|
||||
<div class="warpa">
|
||||
<!-- 锚链接 s -->
|
||||
<ul class="cpa">
|
||||
<li><a href="#link1">产品描述</a></li>
|
||||
<?php if ($product_relateds): ?><li><a href="#link2">关联产品</a></li><?php endif; ?>
|
||||
<?php if ($product_dls): ?><li><a href="#link3">相关下载</a></li><?php endif; ?>
|
||||
<?php if ($count): ?><li><a href="#link4">评论</a></li><?php endif; ?>
|
||||
<div class="clear"></div>
|
||||
</ul>
|
||||
<!-- 锚链接 e-->
|
||||
</div>
|
||||
<div class="swt-Container">
|
||||
<!--产品详情-->
|
||||
<div class="products_des"><?php echo $detail['ld_md_content']; ?></div>
|
||||
</div>
|
||||
<!-- 关联产品 s <?php //if ($product_relateds)print_r($product_relateds); ?>-->
|
||||
<?php if ($product_relateds): ?>
|
||||
<div class="warp2 proTfg">
|
||||
<div class="swt-Container">
|
||||
<div class="gltit" id="link2">关联产品</div>
|
||||
|
||||
<div class="cpBox">
|
||||
<div class="owl-carousel">
|
||||
<?php foreach ($product_relateds as $product):; ?>
|
||||
<div class="item wow">
|
||||
<?php $img = getProductReated($product['id']); ?>
|
||||
<a href="<?php echo url_rewrite('productdetail', ['id' => $product['id']]); ?>">
|
||||
<div class="glimg img-responsive"><img src="<?php echo $product['list_bk_img']; ?>">
|
||||
<!--换成一级列表图--></div>
|
||||
<div class="gltext">
|
||||
<p class="gl1"><?php echo $product['name']; ?></p>
|
||||
<p class="gl2"> <?php echo $product['brand_id']; ?></p>
|
||||
<!-- <p class="gl2">-->
|
||||
<?php //echo $product['shortname']; ?><!--</p>-->
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</a>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<script>
|
||||
var owl = $(".cpBox .owl-carousel");
|
||||
owl.owlCarousel({
|
||||
autoplay: true,
|
||||
navigationText: ["", ""],
|
||||
responsive: {
|
||||
0: {
|
||||
items: 1,
|
||||
margin: 0
|
||||
},
|
||||
420: {
|
||||
items: 1,
|
||||
margin: 0,
|
||||
smartSpeed: 80,
|
||||
dots: false
|
||||
},
|
||||
640: {
|
||||
items: 2,
|
||||
margin: 0,
|
||||
smartSpeed: 80,
|
||||
dots: false
|
||||
},
|
||||
998: {
|
||||
items: 3,
|
||||
margin: 0,
|
||||
smartSpeed: 80,
|
||||
dots: false
|
||||
},
|
||||
},
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 相关下载 s -->
|
||||
<?php if ($product_dls) { ?>
|
||||
<div class="nybox proTfg">
|
||||
<div class="swt-Container">
|
||||
<div class="sptit" id="link3">相关下载</div>
|
||||
<?php
|
||||
if ($product_dls):
|
||||
$selectTypeArr = config("product_dltype");
|
||||
$prodls = [];
|
||||
foreach ($product_dls as $dlrow) {
|
||||
$prodls[$dlrow['dl_type']][] = $dlrow;
|
||||
}
|
||||
?>
|
||||
<?php foreach ($prodls as $type => $dlclrs): ?>
|
||||
<div class="xz">
|
||||
<p class="xztit"><?php echo isset($selectTypeArr[$type]) ? $selectTypeArr[$type] : ''; ?></p>
|
||||
<?php foreach ($dlclrs as $dl): ?>
|
||||
<p class="xz1"><a
|
||||
href="<?php echo url('index/download/prodownload', ['id' => $dl['id']]); ?>"><i></i><?php echo $dl['dl_name']; ?>
|
||||
</a></p>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<!-- 相关下载 e -->
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $category = $(".ans .anbox");
|
||||
$category.hide();
|
||||
$(".ans .antit").click(function () {
|
||||
if ($(this).next(".anbox").is(":visible")) {
|
||||
$(this).removeClass('on').next().slideUp(800);
|
||||
$(this).parent('.ans').removeClass('on');
|
||||
$(this).children("i").removeClass("ons")
|
||||
} else {
|
||||
$category.hide();
|
||||
$(".ans .antit").removeClass('on');
|
||||
$(this).children("i").addClass("ons")
|
||||
$(this).addClass('on').next().slideDown(800);
|
||||
$(this).parent('.ans').addClass('on');
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$('a[href*=#],area[href*=#]').click(function () {
|
||||
|
||||
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
|
||||
var $target = $(this.hash);
|
||||
$target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']');
|
||||
if ($target.length) {
|
||||
var targetOffset = $target.offset().top - 50;
|
||||
$('html,body').animate({
|
||||
scrollTop: targetOffset
|
||||
}, 800);
|
||||
return false; //页面锚点跳转动画 后面的800是锚点跳转的时间 800ms
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$("input").click(function () {
|
||||
$(this).siblings("div").children("span").addClass("active");
|
||||
$(this).parents("div").siblings("div").find("span").removeClass("active");
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$(window).scroll(function () {
|
||||
var arr = []
|
||||
$.each($(".proTfg"), function (k, v) {
|
||||
arr[k] = $(this).offset().top + $(this).height();
|
||||
})
|
||||
$.each(arr, function (k, v) {
|
||||
if (($(window).scrollTop() + $(".cpa li").eq(k - 1).height() + 10) < v) {
|
||||
if (!$(".cpa li").eq(k).hasClass("current")) {
|
||||
$(".cpa li").eq(k).attr("class", "current").siblings().removeClass();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="enlarge-img" style="display: none;">
|
||||
<div class="scrollbutton_01 smallImgUp disabled"></div>
|
||||
<img src="<?php echo getImage($firstimage); ?>">
|
||||
<div class="scrollbutton_01 smallImgDown"></div>
|
||||
<div class="close"><span class="icon-close"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--评论-->
|
||||
<?php if ($count): ?>
|
||||
<div class="" style="background-color:#f1f1f1; overflow: hidden;">
|
||||
|
||||
<div class="detail_title">
|
||||
<p class="de_t_n" id="link4">评论</p>
|
||||
<div class="position-r" style="width:96px; margin:auto;">
|
||||
<img src="__PUBLIC__/web/images/star_whhite.png">
|
||||
<div class="star" style="width:<?php echo $detail['cpyanse']; ?>%;"></div>
|
||||
</div>
|
||||
|
||||
<p>{$count}条评论</p>
|
||||
</div>
|
||||
|
||||
{volist name = 'list' id = 'user'}
|
||||
<!--图片放大-->
|
||||
<div class="swt-Container detail_con_a">
|
||||
<div class="lj_detail_text clearfix">
|
||||
<p><b class="Ts-black">{$user.auctionSku}</b></p>
|
||||
</div>
|
||||
<div class="lj_detail_texts clearfix">
|
||||
<p>{$user.displayUserNick} {$user.rateDate}</p>
|
||||
<p>{$user.rateContent}</p>
|
||||
</div>
|
||||
<div class="tm-m-photos">
|
||||
{if condition="$user['pics'] eq null"}
|
||||
{else/}
|
||||
<ul class="tm-m-photos-thumb">
|
||||
{volist name="user['pics']" id='vv'}
|
||||
<li data-src="{$vv}"> <img src="{$vv}"> <b class="tm-photos-arrow"></b> </li>
|
||||
{/volist}
|
||||
</ul>
|
||||
{/if}
|
||||
<div class="tm-m-photo-viewer transition1">
|
||||
<img src="img/a1.png">
|
||||
<a class="tm-m-photo-viewer-navleft" style="cursor: default;"> <i
|
||||
class="tm-m-photo-viewer-navicon arrow-right"><</i> </a>
|
||||
<a class="tm-m-photo-viewer-navright" data-spm-anchor-id="a220o.1000855.0.0" style="cursor: pointer;"> <i
|
||||
class="tm-m-photo-viewer-navicon arrow-right">></i> </a>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--详情新增样式-->
|
||||
{/volist}
|
||||
{$page}
|
||||
</div>
|
||||
<div class="alert" style="display: none">
|
||||
<div class="alert_white"></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<style>
|
||||
.cp .cprh .buy a.btn1-blue-detail:hover{
|
||||
background: #0044e2;
|
||||
color: #fff !important;
|
||||
}
|
||||
.btn1-blue-detail {
|
||||
background: #0044e2;
|
||||
color: #fff !important;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
line-height: 36px;
|
||||
text-align: center;
|
||||
width: 150px;
|
||||
height: 36px;
|
||||
border: 1px solid #009fdf!important;
|
||||
margin-right: 18px;
|
||||
}
|
||||
.cp .cprh .buy a.btn1-white-detail:hover{
|
||||
background: #fff;
|
||||
color: #0044e2!important;
|
||||
}
|
||||
.btn1-white-detail {
|
||||
background: #fff;
|
||||
color: #0044e2!important;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
line-height: 36px;
|
||||
text-align: center;
|
||||
width: 150px;
|
||||
height: 36px;
|
||||
border: 1px solid #009fdf !important;
|
||||
margin-right: 18px;
|
||||
}
|
||||
|
||||
.buybuttonin {
|
||||
border: 1px solid #0044e2 !important;
|
||||
border-radius: 32px;
|
||||
width: auto;
|
||||
padding: 0px 30px;
|
||||
height: auto;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.indexbox-product {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
padding: 40px 0 0;
|
||||
background: #f1f1f1;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script>
|
||||
$(function () {
|
||||
var obj = new commentMove('.tm-m-photos', '.tm-m-photo-viewer');
|
||||
obj.init()
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
$(function() {
|
||||
$('.tip1').tipso({
|
||||
useTitle: false
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/*图片放大效果*/
|
||||
$(".bigImg").click(function () {
|
||||
$(".enlarge-img").show();
|
||||
});
|
||||
$(".enlarge-img .close").click(function () {
|
||||
$(".enlarge-img").hide();
|
||||
});
|
||||
|
||||
$(function () {
|
||||
var attributes = JSON.parse('<?php echo json_encode($product_attr);?>');
|
||||
var pictures = JSON.parse('<?php echo json_encode($product_images);?>');
|
||||
|
||||
//多属性选择及绑定事件
|
||||
$(".hd .attr_item").click(function(){
|
||||
$(this).siblings().removeClass('on');
|
||||
$(this).toggleClass('on');
|
||||
|
||||
var attrVal = $(this).data('feed');
|
||||
if($(this).hasClass("on")){
|
||||
$(this).parents(".hd").find(".selectedAttr").text(attrVal);
|
||||
}
|
||||
else{
|
||||
|
||||
$(this).parents(".hd").find(".selectedAttr").html('');
|
||||
}
|
||||
//验证是否所有属性全部选中
|
||||
var skuCount = $('.attr_type').length;
|
||||
var activeCount = $('.hd .on').length;
|
||||
|
||||
var productAttr = skuAttrType();
|
||||
|
||||
if(activeCount == skuCount)
|
||||
{
|
||||
|
||||
//勾选属性事件: 重新加载属性图片
|
||||
pictures.forEach(function(image, key) {
|
||||
//选中的属性
|
||||
var imageColor = image.image_color;
|
||||
//console.log(imageColor);
|
||||
//console.log('===========');
|
||||
//console.log(imageColor.filter(item => productAttr.includes(item)));
|
||||
|
||||
//判断属性是否全部匹配
|
||||
var attrFlag = true;
|
||||
attributes.forEach(function(attrName, kat) {
|
||||
//console.log(imageColor[kat][attrName] + '=====+++++====' + productAttr[kat][attrName]);
|
||||
if(imageColor[kat][attrName] == productAttr[kat][attrName]){
|
||||
|
||||
}else{
|
||||
|
||||
attrFlag = false;
|
||||
return;
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
if(attrFlag){
|
||||
|
||||
var smaImagesHtml = '';
|
||||
var bigImagesHtml = '';
|
||||
var firstImage = '';
|
||||
var imageUrl = image.image_url;
|
||||
|
||||
imageUrl.forEach(function(atrVal,atrKey) {
|
||||
if(atrKey == 0) {
|
||||
$("#midimg").attr('src', atrVal);
|
||||
}
|
||||
//bigImagesHtml += '<li id="onlickImg"> <img src="' + atrVal + '"></li>';
|
||||
bigImagesHtml += '<li> <img src="' + atrVal + '"></li>';
|
||||
smaImagesHtml += '<div class="swiper-slide"><a href="javascript:void(0);"><img src="' + atrVal + '"></a></div>';
|
||||
|
||||
});
|
||||
|
||||
$("#image_list").html(bigImagesHtml);
|
||||
$("#mswiper-list").html(smaImagesHtml);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function skuAttrType(){
|
||||
// 获取规格值
|
||||
var spec = [];
|
||||
$('.hd .on').each(function()
|
||||
{
|
||||
var typeName = $(this).data('type');
|
||||
var selected = {};
|
||||
|
||||
selected[typeName] = $(this).data('value');
|
||||
|
||||
spec.push(selected);
|
||||
});
|
||||
|
||||
return JSON.parse(JSON.stringify(spec));
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<!-- bottom s -->
|
||||
{include file="include/bottom2023" /}
|
||||
<!-- bottom e -->
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script type="text/javascript">
|
||||
function add_click(content_id, type, url) {
|
||||
$.ajax({
|
||||
url: '/index/clicksum/add_click',
|
||||
data: {
|
||||
content_id: content_id,
|
||||
type: type,
|
||||
customer_id: 0,
|
||||
country_code: 'ZH',
|
||||
url:url
|
||||
},
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var curr_url = '/product/detail/<?php echo $detail['id']; ?>.html';
|
||||
var is_collection = <?php echo $detail['is_collection']; ?>;
|
||||
var flag = 1; // 限制调用收藏接口 1可用 0不可用
|
||||
function toggle_colleciton()
|
||||
{
|
||||
if (flag == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
is_collection = Number(!is_collection);
|
||||
flag = 0;
|
||||
if (is_collection)
|
||||
{
|
||||
var url = '/index/collection/add_collection';
|
||||
}
|
||||
else
|
||||
{
|
||||
var url = '/index/collection/cancel_collection';
|
||||
}
|
||||
|
||||
var coll_id = <?php echo $detail['id']; ?>;
|
||||
var data = {
|
||||
type: 1,
|
||||
coll_id: coll_id,
|
||||
curr_url: curr_url
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data : data,
|
||||
success: function(res) {
|
||||
if (res.code == -1000)
|
||||
{
|
||||
$('.alert').show();
|
||||
$('.alert_white').html('请先登录').delay(1000).fadeOut();
|
||||
setTimeout(function() {
|
||||
location.href = '/login.html?url=' + res.data.url;
|
||||
}, 800);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
flag = 1;
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user