<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="https://www.thymeleaf.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="https://www.thymeleaf.org ">
<head>
    <title th:text="'采美365网-'+${product.name}">采美365网-商品详情</title>
    <template th:replace="components/head-link"></template>
    <link th:href="@{/css/product/detail.h5.css(v=${version})}" media="screen and (max-width:768px)" rel="stylesheet" type="text/css">
    <link th:href="@{/css/product/detail.pc.css(v=${version})}" media="screen and (min-width:768px)" rel="stylesheet" type="text/css">
</head>
<body>
<!-- 引用头部 -->
<template th:replace="components/header"></template>

<!-- 商品详情 -->
<div id="productDetail">
    <input type="hidden" th:value="${productId}" id="productId">
    <input type="hidden" th:value="${product?.stock}" id="productStock">
    <div class="wrap">
        <div class="productBox clear">
            <div class="imageBox" id="imgShown">
                <div v-if="isPC" class="bigImage">
                    <img :src="images[0]">
                    <span class="mask"></span>
                </div>
                <div id="swiperImage" class="smallImage swiper-container">
                    <ul class="swiper-wrapper clear">
                        <li class="swiper-slide mfc" v-for="img in images">
                            <img :src="img">
                        </li>
                    </ul>
                    <div class="swiper-pagination mfc"></div>
                </div>
                <div v-if="isPC" class="zoomImage">
                    <div class="zoom">
                        <img :src="images[0]">
                    </div>
                </div>
            </div>
            <div class="detailBox" th:object="${product}">
                <div class="crumbs">
                    <span>所属分类：</span>
                    <a th:href="@{'/product/list.html?category=' + *{bigTypeId} + '-0-0'}" th:text="*{bigTypeText}"></a>
                    <span>&gt;</span>
                    <a th:href="@{'/product/list.html?category=' + *{bigTypeId} + '-' + *{smallTypeId} + '-0'}" th:text="*{smallTypeText}"></a>
                    <span>&gt;</span>
                    <a th:href="@{'/product/list.html?category=' + *{bigTypeId} + '-' + *{smallTypeId} + '-' + *{tinyTypeId}}" th:text="*{tinyTypeText}"></a>
                </div>
                <h1 class="title" th:text="*{name}">商品名称</h1>
                <p class="tags">
                    <span th:each="tag: *{tagList}" th:text="${tag}"></span>
                </p>
                <div class="detail">
                    <div class="row"><span class="l">采美价</span><i>：</i>
                        <template v-if="GLOBAL_USER_ID && GLOBAL_USER_ID>0">
                            <!--用户身份 0、个人 1、协销 2、会员机构 3、供应商 4,普通机构-->
                            <em v-if="priceObj.priceFlag==1">￥价格未公开</em>
                            <em v-else-if="priceObj.priceFlag==2 && priceObj.userIdentity!=2">￥会员可见</em>
                            <template v-else-if="priceObj.priceFlag==0 || priceObj.userIdentity==2 || (priceObj.userIdentity==3 && priceObj.supplierId==GLOBAL_SHOP_ID)">
                                <em class="p" v-text="'￥'+parseFloat(priceObj.price).toFixed(2)"></em>
                            </template>
                            <em v-else>￥<i :class="'icon mIcon i'+priceObj.priceGrade"></i></em>
                        </template>
                        <em v-else>￥<i :class="'icon mIcon i'+priceObj.priceGrade"></i></em>
                    </div>
                    <template v-if="priceObj.priceFlag!=2 && priceObj.userIdentity!=2">
                        <div class="row"> <span class="l">市场价</span><i>：</i>
                             <em class="pricedeail" :class="priceObj.actStatus==1?'original-price':''">￥{{priceObj.costPrice}}</em>
                        </div>
                    </template>
                    <div class="row" v-if="priceObj.actStatus==1||priceObj.ladderPriceFlag==1" ><span class="l">促销</span><i>：</i>
                        <template v-if="GLOBAL_USER_ID && GLOBAL_USER_ID>0">
                            <!-- 阶梯价 -->
                            <div v-if="priceObj.ladderPriceFlag==1" class="priceTag">
                                <i class="tag icon mIcon" @click="toggleThisLadder($event)">阶梯价格</i>
                                <div class="ladder mFixed">
                                    <span>
                                        <em class="t"><i>价格</i><i>起订量</i></em>
                                        <em v-for="l in ladderList">
                                            <i class="p">¥{{toFloat(l.buyPrice)}}</i>
                                            <i>{{l.numRange}}</i>
                                        </em>
                                        <em @click="hideThisLadder($event)" class="close">了解</em>
                                    </span>
                                </div>
                            </div>
                            <!-- 促销活动 -->
                            <div v-if="priceObj.actStatus==1 && promotions" class="priceTag">
                                <i v-if="promotions.type==1 && promotions.mode==1" @click="toggleThisLadder($event)" class="tag icon mIcon" v-text="promotions.name+'：¥'+toFloat(promotions.touchPrice)"></i>
                                <i v-else class="tag icon mIcon" @click="toggleThisLadder($event)" v-text="promotions?promotions.name:''"></i>
                                <div class="promotion mFixed">
                                    <div>
                                        <p class="t">
                                            <em v-if="promotions.type==1 && promotions.mode==1">{{promotions.name+'：¥'+toFloat(promotions.touchPrice)}}</em>
                                            <em v-if="promotions.mode==2">{{promotions.name+'，满 ¥'+toFloat(promotions.touchPrice)+' 减 ¥'+toFloat(promotions.reducedPrice)}}</em>
                                            <em v-if="promotions.mode==3">{{promotions.name+'，满 ¥'+toFloat(promotions.touchPrice)+' 赠送商品'}}</em>
                                        </p>
                                        <p>促销时间：<em v-if="promotions.status==1">不限时</em><em v-else>{{promotions.beginTime.substr(0,10)+' ~ '+promotions.endTime.substr(0,10)}}</em></p>
                                        <p v-if="promotions.type==2" class="r"><a class="more" :href="'/product/promotions.html?id='+promotions.id">更多凑单商品>>></a></p>
                                        <template v-if="promotions.mode==3">
                                            <p>赠品：</p>
                                            <p>
                                                <span v-for="g in promotions.giftList" class="p">
                                                    <img :src="g.image">
                                                    <span v-text="g.name"></span>
                                                    <span v-text="'× '+g.number"></span>
                                                </span>
                                            </p>
                                        </template>
                                        <p class="r"><a class="close" @click="hideThisLadder($event)" href="JavaScript:void(0);">了解</a></p>
                                    </div>
                                </div>
                            </div>
                        </template>
                        <!-- 登录 -->
                        <template v-else>
                            <div v-if="priceObj.ladderPriceFlag==1 || priceObj.actStatus==1" class="priceTag">
                                <i v-if="priceObj.ladderPriceFlag==1" class="tag icon mIcon" @click="toggleThisLadder($event)">阶梯价格</i>
                                <i v-if="priceObj.actStatus==1" class="tag icon mIcon" @click="toggleThisLadder($event)" v-text="promotions?promotions.name:''"></i>
                                <div class="promotion mFixed">
                                    <div>
                                        <p v-if="priceObj.ladderPriceFlag==1"><em @click="toLogin">登录</em>，享受阶梯价格优惠</p>
                                        <p v-if="priceObj.actStatus==1"><em @click="toLogin">登录</em>，参与促销活动</p>
                                        <p class="r"><a class="close" @click="hideThisLadder($event)" href="JavaScript:void(0);">了解</a></p>
                                    </div>
                                </div>
                            </div>
                        </template>
                    </div>
                    <div class="row"><span class="l">品牌</span><i>：</i><em th:text="*{brandName}"></em></div>
                    <div class="row"><span class="l">包装规格</span><i>：</i><em th:text="*{unit}"></em></div>
                    <div class="row"><span class="l">商品编码</span><i>：</i><em th:text="*{productCode}"></em></div>
                    <div class="row"><span class="l">库存</span><i>：</i><em th:text="*{stock}"></em></div>
                    <div class="row"><span class="l">起批量</span><i>：</i><em th:text="*{minBuyNumber}"></em></div>
                    <div class="row"><span class="l">采购量</span><i>：</i>
                        <span class="number">
                            <em class="sub" @click="numberSub()">-</em>
                            <input type="number" :value="number" v-model="number" maxlength='6' @change="numberChange()">
                            <em class="add" @click="numberAdd()">+</em>
                        </span>
                        <input type="hidden" th:value="*{step}">
                    </div>
                    <hr>
                    <div class="row"><span class="l">服务</span><i>：</i>
                        <em class="ser icon mIcon">无忧退货</em>
                        <em class="ser icon mIcon">快速退款</em>
                        <em class="ser icon mIcon">正品保证</em>
                    </div>
                </div>
               <template v-if="GLOBAL_USER_ID && GLOBAL_USER_ID>0">
                   <div  class="btnBox" v-if="priceObj.priceFlag==2 && userIdentity!=2">
                      <a class="upgrade" href="/upgrade.html">升级会员查看价格</a>
                   </div>
                    <div class="btnBox" v-else-if="priceObj.priceFlag==0">
                        <a href="javascript:void(0);" class="cart icon" @click='addShopCart()'>加入购物车</a>
                        <a href="javascript:void(0);" class="buy" @click="buyNowSubmit()">立即购买</a>
                    </div>
                </template>
                <template v-else>
                    <a href="javascript:void(0);" class="member-detail" @click="toLogin">登录查看价格</a>
                </template>
            </div>
        </div>
        <div class="recommendBox" v-if="recommends.length>0">
            <div class="hd">相关推荐</div>
            <div id="productRecommend" class="swiper-container">
                <ul class="swiper-wrapper" v-cloak>
                    <li class="swiper-slide mfc" v-for="p in recommends">
                        <div class="item">
                            <a class="image" :href="'/product-'+p.id+'.html'" target="_blank">
                                <img :src="p.image" :alt="p.name">
                                <span v-html="p.name"></span>
                            </a>
                        </div>
                    </li>
                    <!--<li class="swiper-slide  defaulImg" v-for="(item,index) in recommendIndex">
                       <div class="item">
                            <a href="javascript:0" class="image">
                                <img src="/img/base/placeholder.png" alt="">
                            </a>
                     </div>
                    </li>-->
                </ul>
                <div class="swiper-pagination mfc"><span v-if="isPC" v-for="i in recommendPage"></span></div>
            </div>
        </div>
    </div>
    <div class="wrap clear">
        <div v-if="!isPC" class="mShopBox">
            <a th:href="@{'/shop/home.html?sid=' + ${product.shopId}}">
                <span class="name"><em th:text="${product.shopTitle}"></em><i class="mIcon shop"></i></span>
                <span>经营范围：<em th:text="${product.businessScope}"></em></span>
                <span>所在地区：<em th:text="${product.shopAddress}"></em></span>
                <span>满意度：<em><i th:each="i:${#numbers.sequence(1,5)}" class="mIcon heart"></i></em></span>
            </a>
        </div>
        <div class="productInfo">
            <div class="tabTit">
                <span class="on">产品介绍</span>
                <span>相关参数</span>
                <span>服务项目</span>
                <span>评价</span>
            </div>
            <div class="tabCon">
                <div class="item">
                    <div th:utext="${product.detailInfo}"></div>
                    <div th:utext="${product.orderInfo}"></div>
                </div>
                <div class="item">
                    <table>
                        <tr v-for="pa in parameters">
                            <td v-text="pa.name"></td>
                            <td v-text="pa.content"></td>
                        </tr>
                    </table>
                </div>
                <div class="item">
                    <div class="item" th:utext="${product.serviceInfo}"></div>
                </div>
                <div class="item">
                <div style="text-align: left;margin: 10px 0">
                        <span>商品评分：</span>
                        <i th:each="i:${#numbers.sequence(1,5)}" class="icon comment"></i>
                        <span class="comment-right">评价（）</span>
                    </div>
                    <div class="pingjia">
                        <input type="text" class="commtext"   placeholder="对已购商品进行评论！"/>
                        <button>评价</button>
                    </div>
                    <p class="comment">该商品暂无评价!</p>
                </div>
            </div>
        </div>
        <div v-if="isPC" class="rgt">
            <div class="shopBox">
                <div class="hd">供应商信息</div>
                <div class="bd">
                    <div class="name"><span th:text="${product.shopTitle}"></span><i class="icon shop"></i></div>
                    <div class="tit">经营范围：</div>
                    <div class="con" th:text="${product.businessScope}"></div>
                    <div class="tit">所在地区：</div>
                    <div class="con" th:text="${product.shopAddress}"></div>
                    <div class="tit">满意度：<i th:each="i:${#numbers.sequence(1,5)}" class="icon heart"></i></div>
                    <a th:href="@{'/shop/home.html?sid=' + ${product.shopId}}" class="btn">查看主页</a>
                </div>
            </div>
            <div class="contact">
                <div class="hd">联系方式</div>
                <div class="bd">
                    <div>采美客服（转接供应商）</div>
                    <div>电话：</div>
                    <div>0755-22907771</div>
                    <div>153-3885-1365</div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 引入底部 -->
<template th:replace="components/footer"></template>
<template th:replace="components/foot-link"></template>
<script charset="utf-8" type="text/javascript" src="/lib/magnifier.js"></script>
<script charset="utf-8" type="text/javascript" th:src="@{/js/product/detail.js(v=${version})}"></script>
</body>
</html>
