Browse Source

代码优化

喻文俊 3 years ago
parent
commit
23bdc07aa8

+ 5 - 0
src/main/resources/static/js/user-center/member/memberPage.js

@@ -92,6 +92,11 @@ var memberPage = new Vue({
         this.getSvipProductList();
     },
     methods: {
+        // 是否显示vip标签价格
+        showVipPriceTag: function(product){
+            return (product.priceFlag !== 1 && product.svipProductFlag === 1 && ((GLOBAL_USER_IDENTITY === 4 && GLOBAL_VIP_FLAG === 1) || GLOBAL_USER_IDENTITY === 2));
+        },
+
         // 初始化会员中心
         initCenter: function () {
             var _self = this;

+ 6 - 2
src/main/resources/static/js/user-center/member/memberProduct.js

@@ -42,6 +42,10 @@ var memberProduct = new Vue({
         });
     },
     methods: {
+        // 是否显示vip标签价格
+        showVipPriceTag: function(product){
+            return (product.priceFlag !== 1 && product.svipProductFlag === 1 && ((GLOBAL_USER_IDENTITY === 4 && GLOBAL_VIP_FLAG === 1) || GLOBAL_USER_IDENTITY === 2));
+        },
         // 获取商品列表
         getSvipProductList() {
             var _self = this;
@@ -86,11 +90,11 @@ var memberProduct = new Vue({
                 if (priceFlag === 1) {
                     return '¥价格未公开'
                 }
-                if (priceFlag === 2 && GLOBAL_USER_IDENTITY !== 2) {
+                if ((priceFlag === 2 && GLOBAL_USER_IDENTITY === 4) && GLOBAL_VIP_FLAG !== 1) {
                     return '¥会员可见'
                 }
                 // 价格可见
-                if ((priceFlag === 0 && userIdentity !== 3) || (GLOBAL_USER_IDENTITY === 2) || (userIdentity === 3 && GLOBAL_SHOP_ID === shopID)) {
+                if ((priceFlag === 0 && userIdentity !== 3) || (GLOBAL_USER_IDENTITY === 2) || (userIdentity === 3 && GLOBAL_SHOP_ID === shopID) || GLOBAL_VIP_FLAG === 1) {
                     if (promotions || (svipProductFlag === 1 && GLOBAL_VIP_FLAG === 1)) {
                         return '<del>¥' + originalPrice + '</del>'
                     }

+ 3 - 3
src/main/resources/templates/product/detail.html

@@ -88,7 +88,7 @@
                             <em v-else>¥<i th:attr="class=${'icon mIcon i'+product.priceGrade}"></i></em>
                             <!--SVIP会员标签-->
                             <div class="svip-tag" v-if="priceObj.svipProductFlag == 1">
-                                <div class="svip-icon" :class="{ btr:showVipPriceTag(priceObj) }">SVIP</div>
+                                <div class="svip-icon">SVIP</div>
                                 <!-- !价格未公开 && ((个人机构 + SVIP) || 资质机构 ) 可查看价格 -->
                                 <div class="svip-price" v-if="showVipPriceTag(priceObj)">
                                     <span v-html="priceObj.svipPriceTag"></span>
@@ -238,7 +238,7 @@
                 <div v-if="!isPC" class="wechatH5 btnBox"><img src="/img/base/wechat.h5.png" style="padding: 2.7vw 0">
                 </div>
                 <template v-if="GLOBAL_USER_ID && GLOBAL_USER_ID>0">
-                    <div class="btnBox" v-if="priceObj.priceFlag==2 && priceObj.userIdentity==4">
+                    <div class="btnBox" v-if="priceObj.priceFlag==2 && priceObj.userIdentity==4 && GLOBAL_VIP_FLAG !== 1">
                         <a class="upgrade" href="/user/setting/upgrade.html"
                            onclick="_czc.push(['_trackEvent','商品详情','点击','升级查看价格','','Um_Event_ProductUpgrade'])">升级会员查看价格</a>
                     </div>
@@ -513,7 +513,7 @@
 <!-- 引入底部 -->
 <template th:replace="components/footer"></template>
 <template th:replace="components/foot-link"></template>
-<script src="https://cdn.bootcdn.net/ajax/libs/moment.js/2.29.1/moment-2.29.min.js"></script>
+<script src="/lib/datapicker/moment-2.29.min.js"></script>
 <script charset="utf-8" type="text/javascript" src="/lib/magnifier.js"></script>
 <script charset="utf-8" type="text/javascript" src="/lib/viewer.min.js"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/product.service.js(v=${version})}"></script>

+ 4 - 4
src/main/resources/templates/user-center/member/member-product.html

@@ -21,11 +21,11 @@
                 <img src="/img/base/placeholder.png" :data-original="product.image"/>
                 <div class="goods-title cm-text-ellipsis-2" v-html="product.name"></div>
                 <div class="goods-tag">
-                    <span class="tag styl1" v-if="true">优惠券</span>
-                    <div class="svip-tag">
-                        <div class="svip-icon " :class="{ btr: product.priceFlag != 1 && product.userIdentity === 2 }">SVIP</div>
+                    <span class="tag styl1" v-if="product.couponsLogo">优惠券</span>
+                    <div class="svip-tag" v-if="product.svipProductFlag === 1">
+                        <div class="svip-icon ">SVIP</div>
                         <!-- 公开价格 && (个人机构 || 资质机构) && 开通SVIP 可查看价格-->
-                        <template v-if="GLOBAL_USER_IDENTITY === 2 || (product.priceFlag === 0 && GLOBAL_USER_IDENTITY === 4) || (GLOBAL_USER_IDENTITY === 3 && product.shopID==GLOBAL_SHOP_ID) || GLOBAL_VIP_FLAG === 1">
+                        <template v-if="showVipPriceTag(product)">
                             <div class="svip-price">
                                 <span v-html="product.svipPriceTag"></span>
                             </div>

+ 3 - 3
src/main/resources/templates/user-center/member/member.html

@@ -103,11 +103,11 @@
                                 <img src="/img/base/placeholder.png" :data-original="product.image"/>
                                 <div class="goods-title cm-text-ellipsis-2" v-html="product.name"></div>
                                 <div class="goods-tag">
-                                    <span class="tag styl1" v-if="true">优惠券</span>
-                                    <div class="svip-tag">
+                                    <span class="tag styl1" v-if="product.couponsLogo">优惠券</span>
+                                    <div class="svip-tag" v-if="product.svipProductFlag === 1">
                                         <div class="svip-icon ">SVIP</div>
                                         <!-- 公开价格 && (个人机构 || 资质机构) && 开通SVIP 可查看价格-->
-                                        <template v-if="GLOBAL_USER_IDENTITY === 2 || (product.priceFlag === 0 && GLOBAL_USER_IDENTITY === 4) || (GLOBAL_USER_IDENTITY === 3 && product.shopID==GLOBAL_SHOP_ID) || GLOBAL_VIP_FLAG === 1">
+                                        <template v-if="showVipPriceTag(product)">
                                             <div class="svip-price">
                                                 <span v-html="product.svipPriceTag"></span>
                                             </div>