chao 4 years ago
parent
commit
4ee155c806

+ 13 - 5
src/main/resources/static/js/index.js

@@ -211,19 +211,27 @@ var homeData = new Vue({
             }).done(function (res) {
                 if (res.code === 0 && res.data) {
                     var priceList = res.data;
+                    $(".main_price_none").hide();
+                    $(".price_grade_club").hide();
+                    $(".price_grade_shop").hide();
+                    $(".main_price_login").show();
                     priceList.map(function(price){
                         // 用户身份 0、个人 1、协销 2、会员机构 3、供应商 4,普通机构
-                        var clubFlag = (userIdentity===2 || userIdentity===4);
-                        var shopFlag = (userIdentity===3 && shopId === price.shopId*1);
+                        // priceFlag: 0公开价格 1不公开价格 2仅对会员机构公开
                         var parent = $(".main_price_text.product_"+ price.productId);
-                        if (clubFlag || shopFlag) {
+                        var priceFlag = parent.find(".main_price_login").attr('data-id')*1;
+                        if (priceFlag === 0 || userIdentity===2 || (userIdentity===3 && shopId === price.shopId*1)) {
                             parent.find(".price_o_num").text(Number(price.originalPrice).toFixed(2));
                             parent.find(".price_num").text(Number(price.price).toFixed(2));
                             if(price.promotions && price.promotions.type*1===1 && price.promotions.mode*1===1){
                                 parent.find(".main_price_show.none").show();
                             }
-                            parent.find(".main_price_none").hide();
-                            parent.find(".main_price_login").show();
+                        } else if (userIdentity===4 && priceFlag === 2){
+                            parent.find(".main_price_show").hide();
+                            parent.find(".price_grade_club").show();
+                        } else {
+                            parent.find(".main_price_show").hide();
+                            parent.find(".price_grade_shop").show();
                         }
                     });
                 }

+ 32 - 28
src/main/resources/templates/index.html

@@ -99,103 +99,107 @@
             </div>
             <div class="section_left ">
                 <div class="section_page" th:each="floor,stat : ${floorJson.get('homePageFloor')}">
-                    <template th:if="${floor.get('floorContent')}!=null">
+                    <th:block th:if="${floor.get('floorContent')}!=null">
                         <div class="section_page_title">
                             <h1 th:text="${floor.get('title')}" th:attr="data-id=${stat.index+1}"></h1>
                             <p th:text="${floor.get('detail')}"></p>
                         </div>
-                        <template th:object="${floor.get('floorContent')}">
+                        <th:block th:object="${floor.get('floorContent')}">
                             <div th:class="*{templateType}==8? 'hotList swiper-container-floor' : ''" th:id="*{templateType}==8? 'recommendBox' : ''">
                                 <div th:class="*{templateType}==8? *{'section_page_main type_08 swiper-wrapper recommendBox-wrapper clear mfw section_'+templateType} : *{'section_page_main clear mfw section_'+templateType}">
                                     <!-- 广告图 -->
-                                    <template th:if="*{templateType}==1 or *{templateType}==2 or *{templateType}==3 or *{templateType}==4 or *{templateType}==5">
+                                    <th:block th:if="*{templateType}==1 or *{templateType}==2 or *{templateType}==3 or *{templateType}==4 or *{templateType}==5">
                                         <a th:href="*{#strings.isEmpty(adsLink1)}? 'javascript:;' : *{adsLink1}" th:attr="target=(*{#strings.isEmpty(adsLink1)} ? '_self' : '_blank')" class="page_main_item ad_01">
                                             <img v-if="isPC" th:src="*{pcAdsImage1}" alt="" class="page_main_item_adv">
                                             <img v-else th:src="*{appletsAdsImage1}" alt="" class="page_main_item_adv">
                                         </a>
-                                    </template>
-                                    <template th:if="*{templateType}==2 or *{templateType}==3 or *{templateType}==4">
+                                    </th:block>
+                                    <th:block th:if="*{templateType}==2 or *{templateType}==3 or *{templateType}==4">
                                         <a th:href="*{#strings.isEmpty(adsLink2)}? 'javascript:;' : *{adsLink2}" th:attr="target=(*{#strings.isEmpty(adsLink2)} ? '_self' : '_blank')" class="page_main_item ad_02">
                                             <img v-if="isPC" th:src="*{pcAdsImage2}" alt="" class="page_main_item_adv">
                                             <img v-else th:src="*{appletsAdsImage2}" alt="" class="page_main_item_adv">
                                         </a>
-                                    </template>
-                                    <template th:if="*{templateType}==4">
+                                    </th:block>
+                                    <th:block th:if="*{templateType}==4">
                                         <a th:href="*{#strings.isEmpty(adsLink3)}? 'javascript:;' : *{adsLink3}" th:attr="target=(*{#strings.isEmpty(adsLink3)} ? '_self' : '_blank')" class="page_main_item ad_03">
                                             <img v-if="isPC" th:src="*{pcAdsImage3}" alt="" class="page_main_item_adv">
                                             <img v-else th:src="*{appletsAdsImage3}" alt="" class="page_main_item_adv">
                                         </a>
-                                    </template>
+                                    </th:block>
                                     <!-- 商品/图片 列表 -->
-                                    <template th:each="pros : ${floor.get('floorImageList')}"  th:object="${pros}">
+                                    <th:block th:each="pros : ${floor.get('floorImageList')}"  th:object="${pros}">
                                         <a th:href="*{link}" class="page_main_item ad_04 swiper-slide" target="_blank">
                                             <img class="page_main_image" src="/img/base/placeholder.png" th:attr="data-original=*{image}" th:alt="*{name}">
                                             <div class="page_main_tag" th:if="*{listType}==2"><p th:text="*{label}"></p></div>
                                             <div class="page_main_text">
-                                                <template th:if="${pros.get('product')}!=null" th:object="${pros.get('product')}"><span class="tag" th:if="*{beautyActFlag}==1">美博会</span></template>
+                                                <th:block th:if="${pros.containsKey('product')}">
+                                                    <span class="tag" th:if="${pros.get('product').containsKey('beautyActFlag')} and ${pros.get('product').get('beautyActFlag')}==1">美博会</span>
+                                                </th:block>
                                                 <span th:text="${pros.get('name')}"></span>
                                             </div>
                                             <div class="page_main_price" th:if="*{listType}==1">
-                                                <template th:if="${pros.get('product')}!=null" th:object="${pros.get('product')}">
+                                                <th:block th:if="${pros.get('product')}!=null" th:object="${pros.get('product')}">
                                                     <!-- 商品价格 -->
                                                     <div th:attr="class=*{'main_price_text product_'+productId}, data-id=*{productId}">
                                                         <!-- 正常商品 -->
-                                                        <template th:if="*{productCategory}==1">
+                                                        <th:block th:if="*{productCategory}==1">
                                                             <div class="price_text_tag" th:if="${pros.get('product').containsKey('actStatus')}">
                                                                 <p class="listTag" th:if="*{actStatus}==1 and *{promotions}!=null">
                                                                     <template th:text="*{promotions.name}"></template>
-                                                                    <template th:if="*{promotions.type}==1 and *{promotions.mode}==1">
+                                                                    <th:block th:if="*{promotions.type}==1 and *{promotions.mode}==1">
                                                                         <!--单品优惠:优惠价-->
                                                                         <span class="price_num"></span>
-                                                                    </template>
+                                                                    </th:block>
                                                                 </p>
                                                             </div>
                                                             <div class="main_price_none">
                                                                 <em class="price_grade"><span class="bold">¥</span><i th:attr="class=*{'icon mIcon price_grade_'+priceGrade}"></i></em>
                                                             </div>
-                                                            <div class="main_price_login">
+                                                            <div class="main_price_login" th:attr="data-id=*{priceFlag}">
                                                                 <!--0公开价格 1不公开价格 2仅对会员机构公开-->
                                                                 <em th:if="*{priceFlag}==1" class="price_grade"><span>¥</span>价格未公开</em>
-                                                                <em th:if="*{priceFlag}==2" class="price_grade"><span>¥</span>会员可见</em>
-                                                                <template th:if="*{priceFlag}!=1 and *{priceFlag}!=2">
+                                                                <th:block th:unless="*{priceFlag}==1">
+                                                                    <em class="price_grade_club"><span>¥</span>会员可见</em>
                                                                     <!--机构价-->
                                                                     <div class="main_price_show">¥<span class="price_num"></span></div>
                                                                     <!--单品优惠时的划线价-->
                                                                     <div class="main_price_show none">¥<span class="price_o_num"></span></div>
-                                                                </template>
+                                                                    <!--供应商除自己的商品外,也显示价格等级-->
+                                                                    <em class="price_grade_shop"><span class="bold">¥</span><i th:attr="class=*{'icon mIcon price_grade_'+priceGrade}"></i></em>
+                                                                </th:block>
                                                             </div>
-                                                        </template>
+                                                        </th:block>
                                                         <!-- 二手商品 -->
-                                                        <template th:if="*{productCategory}!=1">
+                                                        <th:block th:if="*{productCategory}!=1">
                                                             <div class="main_price_none sec">
                                                                 <em class="price_grade"><span>¥</span>登录可见</em>
                                                             </div>
-                                                            <div class="main_price_login">
+                                                            <div class="main_price_login" data-id="0">
                                                                 <div class="price_text_tag"></div>
                                                                 <div th:if="*{detailTalkFlag}==2" class="main_price_show">¥价格祥聊</div>
                                                                 <div th:if="*{detailTalkFlag}!=2" class="main_price_show">¥<span class="price_num"></span></div>
                                                             </div>
-                                                        </template>
+                                                        </th:block>
                                                     </div>
-                                                </template>
+                                                </th:block>
                                             </div>
                                         </a>
-                                    </template>
+                                    </th:block>
                                     <!-- 广告图 -->
-                                    <template th:if="*{templateType}==6">
+                                    <th:block th:if="*{templateType}==6">
                                         <a th:href="*{#strings.isEmpty(adsLink1)}? 'javascript:;' : *{adsLink1}" th:attr="target=(*{#strings.isEmpty(adsLink1)} ? '_self' : '_blank')" class="page_main_item ad_01">
                                             <img v-if="isPC" th:src="*{pcAdsImage1}" alt="" class="page_main_item_adv">
                                             <img v-else th:src="*{appletsAdsImage1}" alt="" class="page_main_item_adv">
                                         </a>
-                                    </template>
+                                    </th:block>
                                 </div>
                                 <div th:if="*{templateType}==8" class="swiper-pagination swiper-pagination-floor mfc" th:attr="data-id=${floor.get('floorImageList').size}"></div>
                             </div>
                             <div class="section_page_more" th:attr="data-id=*{templateType}, data-size=${floor.get('floorImageList').size}">
                                 <div class="more" @click="showMoreItem($event)"> <i class="icon mIcon"></i>查看更多</div>
                             </div>
-                        </template>
-                    </template>
+                        </th:block>
+                    </th:block>
                 </div>
                 <div class="section_page">
                     <div class="section_page_title">

BIN
target/www-0.0.1-SNAPSHOT.jar